This repository has been archived on 2020-06-07. You can view files and clone it, but cannot push or open issues or pull requests.
php-armadillo/stubs/internal/Base.php

195 lines
4.1 KiB
PHP
Raw Normal View History

2019-02-07 11:39:47 +00:00
<?php
namespace Arma\Internal;
2019-04-04 08:07:37 +00:00
use Arma\Complex;
2019-05-25 18:20:02 +00:00
use Countable;
2019-04-04 08:07:37 +00:00
2019-02-15 05:44:52 +00:00
/**
2019-02-23 02:07:23 +00:00
* Interface for all container objects.
2019-02-15 05:44:52 +00:00
*
* @package Arma\Internal
*/
2019-05-25 18:20:02 +00:00
interface Base extends Countable
2019-02-07 11:39:47 +00:00
{
2019-02-14 11:11:36 +00:00
/**
* Get number of elements.
*
* @return int
*/
2019-02-07 11:39:47 +00:00
function nElem();
2019-02-14 11:11:36 +00:00
2019-02-23 02:07:23 +00:00
/**
* Addition of two objects.
*
2019-08-18 12:38:18 +00:00
* @param static|number|Complex $other
2019-02-23 02:07:23 +00:00
* @return static
*/
function add($other);
/**
* Subtraction of two objects.
*
2019-08-18 12:38:18 +00:00
* @param static|number|Complex $other
2019-02-23 02:07:23 +00:00
* @return static
*/
function sub($other);
/**
* Negation of the object.
*
* @return static
*/
function neg();
/**
* Matrix multiplication of two objects.
*
2019-08-18 12:38:18 +00:00
* @param static|number|Complex $other
2019-02-23 02:07:23 +00:00
* @return static
*/
function mul($other);
/**
* Element-wise multiplication of two objects.
*
* @param static $other
* @return static
*/
function dotMul($other);
2019-03-08 14:15:02 +00:00
/**
* Element-wise division of an object by another object or a scalar.
*
2019-08-18 12:38:18 +00:00
* @param static|number|Complex $other
2019-03-08 14:15:02 +00:00
* @return static
*/
function div($other);
2019-02-24 09:01:11 +00:00
/**
* For all elements equal to $old_value, set them to $new_value.
*
* For SpMat, replacement is not done when $old_value == 0.
*
2019-04-04 08:07:37 +00:00
* @param number|Complex $old_value
* @param number|Complex $new_value
2019-02-24 09:01:11 +00:00
* @return void
*/
function replace($old_value, $new_value);
/**
* Transform each element using a callback function.
*
* Transformation is done column-by-column, and for SpMat only non-zero elements will be transformed.
*
* @param callable $transform (number|Complex) => $new_value
2019-02-24 09:01:11 +00:00
* @return void
*/
function transform($transform);
2019-02-24 09:01:11 +00:00
/**
* For each element, pass its reference to a callback function.
*
* Processing is done column-by-column, and for SpMat only non-zero elements will be passed to callback.
*
2019-03-21 10:49:11 +00:00
* @param callable $action (Scalar) -> void
2019-02-24 09:01:11 +00:00
* @return void
*/
2019-03-21 10:49:11 +00:00
function forEach($action);
/**
* Returns the minimum value within this object.
*
2019-04-04 08:07:37 +00:00
* @return number|Complex
2019-03-21 10:49:11 +00:00
*/
function min();
/**
* Returns the maximum value within this object.
*
2019-04-04 08:07:37 +00:00
* @return number|Complex
2019-03-21 10:49:11 +00:00
*/
function max();
/**
* Return the linear index of the minimum value within this object.
*
* For objects with complex numbers, absolute values are used for comparison.
*
* @return int
*/
function indexMin();
/**
* Return the linear index of the maximum value within this object.
*
* @return int
*/
function indexMax();
/**
* Checks whether the object contains no elements.
*
* @return bool
*/
function isEmpty();
/**
* Checks whether all elements of the object are finite.
*
* @return bool
*/
function isFinite();
2020-03-21 15:51:13 +00:00
/**
* Checks whether all elements of the object are zero (value <= tolerance).
*
* For objects with complex numbers, real and imaginary part are checked separately.
*
* @param number $tol[optional]
* @return bool
*/
function isZero($tol);
2019-03-21 10:49:11 +00:00
/**
* Checks whether at least one of the elements of the object is ±infinity.
*
* @return bool
*/
function hasInf();
/**
* Checks whether at least one of the elements of the object is NaN.
*
* @return bool
*/
function hasNan();
/**
2019-07-12 17:50:16 +00:00
* Print the contents of the object to a stream resource.
*
* Feature\STREAM_RES must be true if $stream is specified.
2019-03-21 10:49:11 +00:00
*
* @param resource $stream[optional]
2019-05-30 14:02:11 +00:00
* @return void
2019-03-21 10:49:11 +00:00
*/
function print($stream = STDOUT);
/**
* Similar to the print() member function, with the difference that no formatting of the output is done.
2019-07-12 17:50:16 +00:00
*
* Feature\STREAM_RES must be true if $stream is specified.
2019-03-21 10:49:11 +00:00
*
* @param resource $stream[optional]
2019-05-30 14:02:11 +00:00
* @return void
2019-03-21 10:49:11 +00:00
*/
function rawPrint($stream = STDOUT);
/**
* Returns a string of all elements in this object.
*
* @return string
*/
function __toString();
2019-02-07 11:39:47 +00:00
}