update stubs

This commit is contained in:
CismonX 2019-03-10 23:23:11 +08:00
parent 512746d6b2
commit a2636f1f5f
27 changed files with 279 additions and 155 deletions

View File

@ -2,7 +2,7 @@
namespace Arma;
class CxDCol implements Col
class CxDCol implements Col, Internal\ResizableVector
{
/**
* Construct a complex column vector out of two non-complex column vectors.

View File

@ -2,7 +2,7 @@
namespace Arma;
class CxDMat implements Mat
class CxDMat implements Mat, Internal\ResizableMatrix
{
/**
* Construct a complex matrix out of two non-complex matrices.

View File

@ -2,7 +2,7 @@
namespace Arma;
class CxDRow implements Row
class CxDRow implements Row, Internal\ResizableVector
{
/**
* Construct a complex row vector out of two non-complex row vectors.

8
stubs/impl/CxDSvCol.php Normal file
View File

@ -0,0 +1,8 @@
<?php
namespace Arma;
class CxDSvCol implements SvCol
{
}

8
stubs/impl/CxDSvRow.php Normal file
View File

@ -0,0 +1,8 @@
<?php
namespace Arma;
class CxDSvRow implements SvRow
{
}

View File

@ -2,7 +2,7 @@
namespace Arma;
class DCol implements Col
class DCol implements Col, Internal\ResizableVector
{
}

View File

@ -2,7 +2,7 @@
namespace Arma;
class DMat implements Mat
class DMat implements Mat, Internal\ResizableMatrix
{
}

View File

@ -2,7 +2,7 @@
namespace Arma;
class DRow implements Row
class DRow implements Row, Internal\ResizableVector
{
}

8
stubs/impl/DSvCol.php Normal file
View File

@ -0,0 +1,8 @@
<?php
namespace Arma;
class DSvCol implements SvCol
{
}

8
stubs/impl/DSvRow.php Normal file
View File

@ -0,0 +1,8 @@
<?php
namespace Arma;
class DSvRow implements SvRow
{
}

View File

@ -2,7 +2,7 @@
namespace Arma;
class ICol implements Col
class ICol implements Col, Internal\ResizableVector
{
}

View File

@ -2,7 +2,7 @@
namespace Arma;
class IMat implements Mat
class IMat implements Mat, Internal\ResizableMatrix
{
}

View File

@ -2,7 +2,7 @@
namespace Arma;
class IRow implements Row
class IRow implements Row, Internal\ResizableVector
{
}

8
stubs/impl/ISvCol.php Normal file
View File

@ -0,0 +1,8 @@
<?php
namespace Arma;
class ISvCol implements SvCol
{
}

8
stubs/impl/ISvRow.php Normal file
View File

@ -0,0 +1,8 @@
<?php
namespace Arma;
class ISvRow implements SvRow
{
}

View File

@ -2,7 +2,7 @@
namespace Arma;
class SpCxDMat implements SpMat
class SpCxDMat implements SpMat, Internal\ResizableMatrix
{
/**
* Construct a complex sparse matrix out of two non-complex sparse matrices.

View File

@ -2,7 +2,7 @@
namespace Arma;
class SpDMat implements SpMat
class SpDMat implements SpMat, Internal\ResizableMatrix
{
}

View File

@ -2,7 +2,7 @@
namespace Arma;
class SpIMat implements SpMat
class SpIMat implements SpMat, Internal\ResizableMatrix
{
}

View File

@ -99,16 +99,6 @@ interface Common
*/
function div($other);
/**
* Set the size to be the same as the given object.
*
* The given object must be of the same root type as the calling object.
*
* @param static $other
* @return void
*/
function copySize($other);
/**
* For all elements equal to $old_value, set them to $new_value.
*
@ -139,11 +129,4 @@ interface Common
* @return void
*/
function forEach($callback);
/**
* Reset the size to zero. The object will have no elements.
*
* @return void
*/
function reset();
}

View File

@ -7,7 +7,7 @@ namespace Arma\Internal;
*
* @package Arma\Internal
*/
interface Dense extends Splittable
interface Dense extends Common
{
/**
* @inheritdoc

View File

@ -28,47 +28,7 @@ interface Matrix
*/
function eye($n_rows, $n_cols);
/**
* Recreate the object according to given size specifications, with the elements taken from the
* previous version of the object in a column-wise manner.
*
* The elements in the generated object are placed column-wise.
*
* @param $n_rows[optional]
* @param $n_cols[optional]
* @return void
*/
function reshape($n_rows, $n_cols);
/**
* Recreate the object according to given size specifications, while preserving the elements
* as well as the layout of the elements.
*
* @param $n_rows[optional]
* @param $n_cols[optional]
* @return void
*/
function resize($n_rows, $n_cols);
/**
* Change the size of an object, without explicitly preserving data and without initialising the elements.
*
* @param $n_rows[optional]
* @param $n_cols[optional]
* @return void
*/
function setSize($n_rows, $n_cols);
/**
* Read/write access to a diagonal in a matrix.
*
* For k=0 the main diagonal is accessed. For k > 0, the k-th super-diagonal is accessed (top-right corner).
* For k < 0, the k-th sub-diagonal is accessed (bottom-left corner).
*
* @param int $k
* @return Subview
*/
function diag($k = 0);
// Matrix characteristics
/**
* Check whether the matrix has exactly one column or one row.
@ -111,4 +71,94 @@ interface Matrix
* @return bool
*/
function isHermitian();
// Matrix subview
/**
* Read/write access to a certain column of the object.
*
* @param int $col_number
* @return Subview
*/
function col($col_number);
/**
* Read/write access to a certain row of the object.
*
* @param int $row_number
* @return Subview
*/
function row($row_number);
/**
* Read/write access to certain columns of the object.
*
* @param int $first_col
* @param int $last_col
* @return Subview
*/
function cols($first_col, $last_col);
/**
* Read/write access to certain rows of the object.
*
* @param int $first_row
* @param int $last_row
* @return Subview
*/
function rows($first_row, $last_row);
/**
* Read/write access to a matrix subview.
*
* @param int $first_row
* @param int $first_col
* @param int $last_row
* @param int $last_col
* @return Subview
*/
function submat($first_row, $first_col, $last_row, $last_col);
/**
* Read/write access to a matrix subview of first specified columns.
*
* @param $n_cols
* @return Subview
*/
function head_cols($n_cols);
/**
* Read/write access to a matrix subview of first specified rows.
*
* @param int $n_rows
* @return Subview
*/
function head_rows($n_rows);
/**
* Read/write access to a matrix subview of last specified columns.
*
* @param int $n_cols
* @return Subview
*/
function tail_cols($n_cols);
/**
* Read/write access to a matrix subview of last specified rows.
*
* @param int $n_rows
* @return Subview
*/
function tail_rows($n_rows);
/**
* Read/write access to a diagonal in a matrix.
*
* For k=0 the main diagonal is accessed. For k > 0, the k-th super-diagonal is accessed (top-right corner).
* For k < 0, the k-th sub-diagonal is accessed (bottom-left corner).
*
* @param int $k
* @return Subview
*/
function diag($k = 0);
}

View File

@ -0,0 +1,23 @@
<?php
namespace Arma\Internal;
interface Resizable
{
/**
* Set the size to be the same as the given object.
*
* The given object must be of the same root type as the calling object.
*
* @param static $other
* @return void
*/
function copySize($other);
/**
* Reset the size to zero. The object will have no elements.
*
* @return void
*/
function reset();
}

View File

@ -0,0 +1,37 @@
<?php
namespace Arma\Internal;
interface ResizableMatrix extends Resizable
{
/**
* Recreate the object according to given size specifications, with the elements taken from the
* previous version of the object in a column-wise manner.
*
* The elements in the generated object are placed column-wise.
*
* @param int $n_rows
* @param int $n_cols
* @return void
*/
function reshape($n_rows, $n_cols);
/**
* Recreate the object according to given size specifications, while preserving the elements
* as well as the layout of the elements.
*
* @param int $n_rows
* @param int $n_cols
* @return void
*/
function resize($n_rows, $n_cols);
/**
* Change the size of an object, without explicitly preserving data and without initialising the elements.
*
* @param int $n_rows
* @param int $n_cols
* @return void
*/
function setSize($n_rows, $n_cols);
}

View File

@ -0,0 +1,23 @@
<?php
namespace Arma\Internal;
interface ResizableVector extends Resizable
{
/**
* Recreate the object according to given size specifications, while preserving the elements
* as well as the layout of the elements.
*
* @param int $n_elem
* @return void
*/
function resize($n_elem);
/**
* Change the size of an object, without explicitly preserving data and without initialising the elements.
*
* @param int $n_elem
* @return void
*/
function setSize($n_elem);
}

View File

@ -2,7 +2,23 @@
namespace Arma\Internal;
interface Sparse extends Splittable
interface Sparse extends Common
{
/**
* @inheritdoc
*
* @param int $i
* @param int $j[optional]
* @return \Arma\SpSvVal
*/
function at($i, $j);
/**
* @inheritdoc
*
* @param int $i
* @param int $j[optional]
* @return \Arma\SpSvVal
*/
function __invoke($i, $j);
}

View File

@ -1,83 +0,0 @@
<?php
namespace Arma\Internal;
interface Splittable extends Common
{
/**
* Read/write access to a certain column of the object.
*
* @param int $col_number
* @return Subview
*/
function col($col_number);
/**
* Read/write access to a certain row of the object.
*
* @param int $row_number
* @return Subview
*/
function row($row_number);
/**
* Read/write access to certain columns of the object.
*
* @param int $first_col
* @param int $last_col
* @return Subview
*/
function cols($first_col, $last_col);
/**
* Read/write access to certain rows of the object.
*
* @param int $first_row
* @param int $last_row
* @return Subview
*/
function rows($first_row, $last_row);
/**
* Read/write access to an object subview.
*
* @param int $first_row
* @param int $first_col
* @param int $last_row
* @param int $last_col
* @return Subview
*/
function submat($first_row, $first_col, $last_row, $last_col);
/**
* Read/write access to an object subview of first specified columns.
*
* @param $n_cols
* @return Subview
*/
function head_cols($n_cols);
/**
* Read/write access to an object subview of first specified rows.
*
* @param int $n_rows
* @return Subview
*/
function head_rows($n_rows);
/**
* Read/write access to an object subview of last specified columns.
*
* @param int $n_cols
* @return Subview
*/
function tail_cols($n_cols);
/**
* Read/write access to an object subview of last specified rows.
*
* @param int $n_rows
* @return Subview
*/
function tail_rows($n_rows);
}

View File

@ -63,4 +63,31 @@ interface Vector
* @return void
*/
function randn($n_elem);
// Vector subview
/**
* Read/write access to a vector subview.
*
* @param int $first_idx
* @param int $last_idx
* @return Subview
*/
function subvec($first_idx, $last_idx);
/**
* Read/write access to first specified elements of a vector.
*
* @param int $n_elem
* @return Subview
*/
function head($n_elem);
/**
* Read/write access to last specified elements of a vector.
*
* @param int $n_elem
* @return Subview
*/
function tail($n_elem);
}