Update stubs.
This commit is contained in:
parent
a144c3fa45
commit
ca03543b4d
|
@ -9,7 +9,35 @@ namespace Arma;
|
|||
*/
|
||||
abstract class Col implements Internal\DenseResizableVector
|
||||
{
|
||||
/**
|
||||
* At the given row index, insert given number of empty rows and optionally specify
|
||||
* whether to initialize new elements to zero, or insert a copy of specified object
|
||||
* (whose column size is the same as the recipient object),
|
||||
*
|
||||
* @param int $row_idx
|
||||
* @param Internal\Dense|int $rows
|
||||
* @param bool $set_to_zero[optional]
|
||||
* @return void
|
||||
*/
|
||||
function insertRows($row_idx, $rows, $set_to_zero = true) {}
|
||||
|
||||
/**
|
||||
* Remove the specified range of rows from the column vector.
|
||||
*
|
||||
* @param int $first_row
|
||||
* @param int $last_row
|
||||
* @return void
|
||||
*/
|
||||
function shedRows($first_row, $last_row) {}
|
||||
|
||||
/**
|
||||
* Swap the contents of specified rows.
|
||||
*
|
||||
* @param int $row_1
|
||||
* @param int $row_2
|
||||
* @return void
|
||||
*/
|
||||
function swapRows($row_1, $row_2) {}
|
||||
}
|
||||
|
||||
class_alias(Col::class, 'Arma\\Vec');
|
||||
|
|
66
stubs/FileType.php
Normal file
66
stubs/FileType.php
Normal file
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
namespace Arma;
|
||||
|
||||
abstract class FileType
|
||||
{
|
||||
/**
|
||||
* Attempt to automatically detect the file type as one of the formats described below.
|
||||
*
|
||||
* Used by load() only.
|
||||
*/
|
||||
const AUTO_DETECT = 0;
|
||||
|
||||
/**
|
||||
* Numerical data stored in machine dependent binary format, with a simple header to speed up loading.
|
||||
* The header indicates the type and size of matrix.
|
||||
*/
|
||||
const ARMA_BINARY = 1;
|
||||
|
||||
/**
|
||||
* Numerical data stored in human readable text format, with a simple header to speed up loading.
|
||||
* The header indicates the type and size of matrix.
|
||||
*/
|
||||
const ARMA_ASCII = 2;
|
||||
|
||||
/**
|
||||
* Numerical data stored in machine dependent raw binary format, without a header. Matrices are
|
||||
* loaded to have one column.
|
||||
*
|
||||
* The reshape() function can be used to alter the size of the loaded matrix without losing data.
|
||||
*/
|
||||
const RAW_BINARY = 3;
|
||||
|
||||
/**
|
||||
* Numerical data stored in raw ASCII format, without a header. The numbers are separated by whitespace.
|
||||
* The number of columns must be the same in each row.
|
||||
*
|
||||
* Complex numbers are stored in standard C++ notation, which is a tuple surrounded by brackets.
|
||||
*/
|
||||
const RAW_ASCII = 4;
|
||||
|
||||
/**
|
||||
* Numerical data stored in comma separated value (CSV) text format, without a header.
|
||||
*
|
||||
* Applicable to dense matrices only.
|
||||
*/
|
||||
const CSV_ASCII = 5;
|
||||
|
||||
/**
|
||||
* Numerical data stored as a text file in coordinate list format, without a header.
|
||||
* Only non-zero values are stored.
|
||||
*
|
||||
* Applicable only to sparse matrices.
|
||||
*/
|
||||
const COORD_ASCII = 6;
|
||||
|
||||
/**
|
||||
* Image data stored in Portable Gray Map (PGM) format.
|
||||
*
|
||||
* Applicable to dense matrices only.
|
||||
*
|
||||
* Each element is copied and converted to an 8 bit representation. As such the matrix should have values
|
||||
* in the [0,255] interval, otherwise the resulting image may not display correctly.
|
||||
*/
|
||||
const PGM_ASCII = 7;
|
||||
}
|
|
@ -9,5 +9,33 @@ namespace Arma;
|
|||
*/
|
||||
abstract class Row implements Internal\DenseResizableVector
|
||||
{
|
||||
/**
|
||||
* At the given column index, insert given number of empty columns and optionally specify
|
||||
* whether to initialize new elements to zero, or insert a copy of specified object
|
||||
* (whose row size is the same as the recipient object),
|
||||
*
|
||||
* @param int $col_idx
|
||||
* @param Internal\Dense|int $cols
|
||||
* @param bool $set_to_zero[optional]
|
||||
* @return void
|
||||
*/
|
||||
function insertCols($col_idx, $cols, $set_to_zero = true) {}
|
||||
|
||||
/**
|
||||
* Remove the specified range of columns from the row vector.
|
||||
*
|
||||
* @param int $first_col
|
||||
* @param int $last_col
|
||||
* @return void
|
||||
*/
|
||||
function shedCols($first_col, $last_col) {}
|
||||
|
||||
/**
|
||||
* Swap the contents of specified columns.
|
||||
*
|
||||
* @param int $col_1
|
||||
* @param int $col_2
|
||||
* @return void
|
||||
*/
|
||||
function swapCols($col_1, $col_2) {}
|
||||
}
|
||||
|
|
26
stubs/SortDirection.php
Normal file
26
stubs/SortDirection.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace Arma;
|
||||
|
||||
abstract class SortDirection
|
||||
{
|
||||
/**
|
||||
* Elements are ascending, consecutive elements can be equal.
|
||||
*/
|
||||
const ASCEND = 0;
|
||||
|
||||
/**
|
||||
* Elements are descending, consecutive elements can be equal.
|
||||
*/
|
||||
const DESCEND = 1;
|
||||
|
||||
/**
|
||||
* Elements are strictly ascending, consecutive elements cannot be equal.
|
||||
*/
|
||||
const STRICT_ASCEND = 2;
|
||||
|
||||
/**
|
||||
* Elements are strictly descending, consecutive elements cannot be equal.
|
||||
*/
|
||||
const STRICT_DESCEND = 3;
|
||||
}
|
|
@ -4,5 +4,21 @@ namespace Arma;
|
|||
|
||||
abstract class SpCol implements Internal\SparseResizableVector
|
||||
{
|
||||
/**
|
||||
* Remove the specified range of rows from the column vector.
|
||||
*
|
||||
* @param int $first_row
|
||||
* @param int $last_row
|
||||
* @return void
|
||||
*/
|
||||
function shedRows($first_row, $last_row) {}
|
||||
|
||||
/**
|
||||
* Swap the contents of specified rows.
|
||||
*
|
||||
* @param int $row_1
|
||||
* @param int $row_2
|
||||
* @return void
|
||||
*/
|
||||
function swapRows($row_1, $row_2) {}
|
||||
}
|
||||
|
|
|
@ -4,5 +4,21 @@ namespace Arma;
|
|||
|
||||
abstract class SpRow implements Internal\SparseResizableVector
|
||||
{
|
||||
/**
|
||||
* Remove the specified range of columns from the row vector.
|
||||
*
|
||||
* @param int $first_col
|
||||
* @param int $last_col
|
||||
* @return void
|
||||
*/
|
||||
function shedCols($first_col, $last_col) {}
|
||||
|
||||
/**
|
||||
* Swap the contents of specified columns.
|
||||
*
|
||||
* @param int $col_1
|
||||
* @param int $col_2
|
||||
* @return void
|
||||
*/
|
||||
function swapCols($col_1, $col_2) {}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ interface Base
|
|||
*
|
||||
* Transformation is done column-by-column, and for SpMat only non-zero elements will be transformed.
|
||||
*
|
||||
* @param callable $callback ($old_value) => $new_value
|
||||
* @param callable $callback (Scalar) => $new_value
|
||||
* @return void
|
||||
*/
|
||||
function transform($callback);
|
||||
|
@ -89,8 +89,82 @@ interface Base
|
|||
*
|
||||
* Processing is done column-by-column, and for SpMat only non-zero elements will be passed to callback.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @param callable $action (Scalar) -> void
|
||||
* @return void
|
||||
*/
|
||||
function forEach($callback);
|
||||
function forEach($action);
|
||||
|
||||
/**
|
||||
* Returns the minimum value within this object.
|
||||
*
|
||||
* @return number|\Arma\Complex
|
||||
*/
|
||||
function min();
|
||||
|
||||
/**
|
||||
* Returns the maximum value within this object.
|
||||
*
|
||||
* @return number|\Arma\Complex
|
||||
*/
|
||||
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();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* Print the contents of the object to a stream.
|
||||
*
|
||||
* @param resource $stream[optional]
|
||||
* @return mixed
|
||||
*/
|
||||
function print($stream = STDOUT);
|
||||
|
||||
/**
|
||||
* Similar to the print() member function, with the difference that no formatting of the output is done.
|
||||
*
|
||||
* @param resource $stream[optional]
|
||||
* @return mixed
|
||||
*/
|
||||
function rawPrint($stream = STDOUT);
|
||||
}
|
||||
|
|
|
@ -113,4 +113,31 @@ interface DenseMatrix extends Dense, Matrix
|
|||
* @return \Arma\DiagView
|
||||
*/
|
||||
function diag($k = 0);
|
||||
}
|
||||
|
||||
// Iteration
|
||||
|
||||
/**
|
||||
* Apply a callback function to each row of the matrix.
|
||||
*
|
||||
* @param callable $action (\Arma\SvRow) -> void
|
||||
* @return void
|
||||
*/
|
||||
function eachRow($action);
|
||||
|
||||
/**
|
||||
* Apply a callback function to each column of the matrix.
|
||||
*
|
||||
* @param callable $action (\Arma\SvCol) -> void
|
||||
* @return void
|
||||
*/
|
||||
function eachCol($action);
|
||||
|
||||
// Transform
|
||||
|
||||
/**
|
||||
* Returns an inverse of the matrix.
|
||||
*
|
||||
* @return DenseMatrix
|
||||
*/
|
||||
function i();
|
||||
}
|
||||
|
|
|
@ -36,4 +36,53 @@ interface DenseResizableMatrix extends DenseMatrix, ResizableMatrix
|
|||
* @return void
|
||||
*/
|
||||
function randn($n_rows, $n_cols);
|
||||
|
||||
// Insertion
|
||||
|
||||
/**
|
||||
* At the given row index, insert given number of empty rows and optionally specify
|
||||
* whether to initialize new elements to zero, or insert a copy of specified object
|
||||
* (whose column size is the same as the recipient object),
|
||||
*
|
||||
* @param int $row_idx
|
||||
* @param Dense|int $rows
|
||||
* @param bool $set_to_zero[optional]
|
||||
* @return void
|
||||
*/
|
||||
function insertRows($row_idx, $rows, $set_to_zero = true);
|
||||
|
||||
/**
|
||||
* At the given column index, insert given number of empty columns and optionally specify
|
||||
* whether to initialize new elements to zero, or insert a copy of specified object
|
||||
* (whose row size is the same as the recipient object),
|
||||
*
|
||||
* @param int $col_idx
|
||||
* @param Dense|int $cols
|
||||
* @param bool $set_to_zero[optional]
|
||||
* @return void
|
||||
*/
|
||||
function insertCols($col_idx, $cols, $set_to_zero = true);
|
||||
|
||||
// Swap
|
||||
|
||||
/**
|
||||
* Swap contents with another matrix.
|
||||
*
|
||||
* @param DenseResizableMatrix $other
|
||||
* @return void
|
||||
*/
|
||||
function swap($other);
|
||||
|
||||
// Characteristics
|
||||
|
||||
/**
|
||||
* Check whether the matrix is sorted in each column (dim == 0) or each row (dim == 1).
|
||||
*
|
||||
* For matrices with complex numbers, order is checked via absolute values.
|
||||
*
|
||||
* @param int $sort_direction[optional]
|
||||
* @param int $dim[optional]
|
||||
* @return bool
|
||||
*/
|
||||
function isSorted($sort_direction = \Arma\SortDirection::ASCEND, $dim = 0);
|
||||
}
|
||||
|
|
|
@ -33,4 +33,26 @@ interface DenseResizableVector extends DenseVector, ResizableVector
|
|||
* @return void
|
||||
*/
|
||||
function randn($n_elem);
|
||||
|
||||
// Swap
|
||||
|
||||
/**
|
||||
* Swap contents with another vector.
|
||||
*
|
||||
* @param DenseResizableVector $other
|
||||
* @return void
|
||||
*/
|
||||
function swap($other);
|
||||
|
||||
// Characteristics
|
||||
|
||||
/**
|
||||
* Check whether the vector is sorted.
|
||||
*
|
||||
* For vectors with complex numbers, order is checked via absolute values.
|
||||
*
|
||||
* @param int $sort_direction[optional]
|
||||
* @return bool
|
||||
*/
|
||||
function isSorted($sort_direction = \Arma\SortDirection::ASCEND);
|
||||
}
|
||||
|
|
|
@ -67,6 +67,23 @@ interface Matrix
|
|||
*/
|
||||
function isHermitian();
|
||||
|
||||
/**
|
||||
* Check whether the matrix is symmetric/hermitian positive definite within the tolerance given by $tol.
|
||||
*
|
||||
* @param number $tol[optional]
|
||||
* @return bool
|
||||
*/
|
||||
function isSympd($tol);
|
||||
|
||||
/**
|
||||
* Check whether the given location is currently valid.
|
||||
*
|
||||
* @param int $row
|
||||
* @param int $col[optional]
|
||||
* @return bool
|
||||
*/
|
||||
function inRange($row, $col);
|
||||
|
||||
// Subview
|
||||
|
||||
/**
|
||||
|
@ -178,4 +195,36 @@ interface Matrix
|
|||
* @return Subview
|
||||
*/
|
||||
function diag($k = 0);
|
||||
|
||||
// Swap
|
||||
|
||||
/**
|
||||
* Swap the contents of specified rows.
|
||||
*
|
||||
* @param int $row_1
|
||||
* @param int $row_2
|
||||
* @return void
|
||||
*/
|
||||
function swapRows($row_1, $row_2);
|
||||
|
||||
/**
|
||||
* Swap the contents of specified columns.
|
||||
*
|
||||
* @param int $col_1
|
||||
* @param int $col_2
|
||||
* @return void
|
||||
*/
|
||||
function swapCols($col_1, $col_2);
|
||||
|
||||
// Transform
|
||||
|
||||
/**
|
||||
* Returns a transposed copy of the matrix.
|
||||
*
|
||||
* For complex matrices, $conj indicates whether the conjugate of the elements is taken during the transpose.
|
||||
*
|
||||
* @param bool $conj[optional]
|
||||
* @return Matrix
|
||||
*/
|
||||
function t($conj = true);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@ namespace Arma\Internal;
|
|||
*/
|
||||
interface Resizable
|
||||
{
|
||||
// Set size
|
||||
|
||||
/**
|
||||
* Set the size to be the same as the given object.
|
||||
*
|
||||
|
@ -25,4 +27,48 @@ interface Resizable
|
|||
* @return void
|
||||
*/
|
||||
function reset();
|
||||
|
||||
// Assignment
|
||||
|
||||
/**
|
||||
* Set the real part of the object.
|
||||
*
|
||||
* Given object must have the same size as the recipient object.
|
||||
*
|
||||
* @param static $other
|
||||
* @return void
|
||||
*/
|
||||
function setReal($other);
|
||||
|
||||
/**
|
||||
* Set the imaginary part of the object.
|
||||
*
|
||||
* Given object must have the same size as the recipient object.
|
||||
*
|
||||
* @param static $other
|
||||
* @return void
|
||||
*/
|
||||
function setImag($other);
|
||||
|
||||
// Saving
|
||||
|
||||
/**
|
||||
* Store data in a file or stream (the stream must be opened in binary mode).
|
||||
*
|
||||
* @param resource|string $dest
|
||||
* @param int $file_type[optional]
|
||||
* @return bool
|
||||
*/
|
||||
function save($dest, $file_type = \Arma\FileType::ARMA_BINARY);
|
||||
|
||||
/**
|
||||
* Retrieve data from a file or stream (the stream must be opened in binary mode).
|
||||
*
|
||||
* On failure, the object is reset so that it has no elements.
|
||||
*
|
||||
* @param resource|string $from
|
||||
* @param int $file_type[optional]
|
||||
* @return bool
|
||||
*/
|
||||
function load($from, $file_type = \Arma\FileType::AUTO_DETECT);
|
||||
}
|
||||
|
|
|
@ -58,4 +58,40 @@ interface ResizableMatrix extends Resizable, Matrix
|
|||
* @return void
|
||||
*/
|
||||
function eye($n_rows, $n_cols);
|
||||
|
||||
// Reduction
|
||||
|
||||
/**
|
||||
* Remove the specified row from the matrix.
|
||||
*
|
||||
* @param int $row_idx
|
||||
* @return void
|
||||
*/
|
||||
function shredRow($row_idx);
|
||||
|
||||
/**
|
||||
* Remove the specified column from the matrix.
|
||||
*
|
||||
* @param int $col_idx
|
||||
* @return void
|
||||
*/
|
||||
function shredCol($col_idx);
|
||||
|
||||
/**
|
||||
* Remove the specified range of rows from the matrix.
|
||||
*
|
||||
* @param int $first_row
|
||||
* @param int $last_row
|
||||
* @return void
|
||||
*/
|
||||
function shedRows($first_row, $last_row);
|
||||
|
||||
/**
|
||||
* Remove the specified range of columns from the matrix.
|
||||
*
|
||||
* @param int $first_col
|
||||
* @param int $last_col
|
||||
* @return void
|
||||
*/
|
||||
function shedCols($first_col, $last_col);
|
||||
}
|
||||
|
|
|
@ -74,4 +74,26 @@ interface Vector
|
|||
* @return Subview
|
||||
*/
|
||||
function tail($n_elem);
|
||||
|
||||
// Transform
|
||||
|
||||
/**
|
||||
* Returns a transposed copy of the vector.
|
||||
*
|
||||
* For complex vectors, $conj indicates whether the conjugate of the elements is taken during the transpose.
|
||||
*
|
||||
* @param bool $conj[optional]
|
||||
* @return Vector
|
||||
*/
|
||||
function t($conj = true);
|
||||
|
||||
// Characteristics
|
||||
|
||||
/**
|
||||
* Check whether the given index is currently valid.
|
||||
*
|
||||
* @param int $idx
|
||||
* @return bool
|
||||
*/
|
||||
function inRange($idx);
|
||||
}
|
||||
|
|
Reference in New Issue
Block a user