update stubs

This commit is contained in:
CismonX 2019-03-07 23:19:47 +08:00
parent dec6a7d141
commit 3bb9123b3a
21 changed files with 317 additions and 78 deletions

View File

@ -7,7 +7,7 @@ namespace Arma;
*
* @package Arma
*/
interface Colvec extends Internal\VecBase
interface Colvec extends Internal\Dense, Internal\VecBase
{
}

8
stubs/DiagView.php Normal file
View File

@ -0,0 +1,8 @@
<?php
namespace Arma;
interface DiagView extends Internal\DiagBase
{
}

View File

@ -73,4 +73,73 @@ interface Mat extends Internal\Dense, Internal\MatBase
* @return void
*/
function randn($n_rows, $n_cols);
/**
* @inheritdoc
*
* @param int $first_col
* @param int $last_col
* @return SubviewMat
*/
function cols($first_col, $last_col);
/**
* @inheritdoc
*
* @param int $first_row
* @param int $last_row
* @return SubviewMat
*/
function rows($first_row, $last_row);
/**
* @inheritdoc
*
* @param int $first_row
* @param int $first_col
* @param int $last_row
* @param int $last_col
* @return SubviewMat
*/
function submat($first_row, $first_col, $last_row, $last_col);
/**
* @inheritdoc
*
* @param $number_of_cols
* @return SubviewMat
*/
function head_cols($number_of_cols);
/**
* @inheritdoc
*
* @param int $number_of_rows
* @return SubviewMat
*/
function head_rows($number_of_rows);
/**
* @inheritdoc
*
* @param int $number_of_cols
* @return SubviewMat
*/
function tail_cols($number_of_cols);
/**
* @inheritdoc
*
* @param int $number_of_rows
* @return SubviewMat
*/
function tail_rows($number_of_rows);
/**
* @inheritdoc
*
* @param int $k
* @return DiagView
*/
function diag($k = 0);
}

View File

@ -7,7 +7,7 @@ namespace Arma;
*
* @package Arma
*/
interface Rowvec extends Internal\VecBase
interface Rowvec extends Internal\Dense, Internal\VecBase
{
}

8
stubs/SpDiagView.php Normal file
View File

@ -0,0 +1,8 @@
<?php
namespace Arma;
interface SpDiagView extends Internal\DiagBase
{
}

View File

@ -7,13 +7,13 @@ namespace Arma;
*
* @package Arma
*/
interface SpMat extends Internal\MatBase
interface SpMat extends Internal\Sparse, Internal\MatBase
{
/**
* Read/write access to a certain column of the sparse matrix.
*
* @param int $col_number
* @return static (subview)
* @return SpSubviewMat
*/
function col($col_number);
@ -21,7 +21,15 @@ interface SpMat extends Internal\MatBase
* Read/write access to a certain row of the sparse matrix.
*
* @param int $row_number
* @return static (subview)
* @return SpSubviewMat
*/
function row($row_number);
/**
* @inheritdoc
*
* @param int $k
* @return SpDiagView
*/
function diag($k = 0);
}

8
stubs/SpSubviewMat.php Normal file
View File

@ -0,0 +1,8 @@
<?php
namespace Arma;
interface SpSubviewMat extends SpMat, Internal\Subview
{
}

8
stubs/SpSubviewVal.php Normal file
View File

@ -0,0 +1,8 @@
<?php
namespace Arma;
interface SpSubviewVal extends Internal\Subview, Internal\Scalar
{
}

8
stubs/SubviewCol.php Normal file
View File

@ -0,0 +1,8 @@
<?php
namespace Arma;
interface SubviewCol extends Colvec, Internal\Subview
{
}

8
stubs/SubviewMat.php Normal file
View File

@ -0,0 +1,8 @@
<?php
namespace Arma;
interface SubviewMat extends Mat, Internal\Subview
{
}

8
stubs/SubviewRow.php Normal file
View File

@ -0,0 +1,8 @@
<?php
namespace Arma;
interface SubviewRow extends Rowvec, Internal\Subview
{
}

8
stubs/SubviewVal.php Normal file
View File

@ -0,0 +1,8 @@
<?php
namespace Arma;
interface SubviewVal extends Internal\Subview, Internal\Scalar
{
}

View File

@ -36,9 +36,9 @@ interface Common
*
* @param int $i
* @param int $j[optional]
* @return mixed
* @return Subview
*/
function &__invoke($i, $j);
function __invoke($i, $j);
/**
* If $j is not specified, access the n-th element. Otherwise, access the element stored at the i-th row
@ -48,9 +48,9 @@ interface Common
*
* @param int $i
* @param int $j[optional]
* @return mixed
* @return Subview
*/
function &at($i, $j);
function at($i, $j);
/**
* Addition of two objects.
@ -138,68 +138,4 @@ interface Common
* @return void
*/
function reset();
/**
* Check whether the object is a subview.
*
* @return bool
*/
function isSubview();
/**
* Read/write access to certain columns of the object.
*
* @param int $first_col
* @param int $last_col
* @return static (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 static (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 static (subview)
*/
function submat($first_row, $first_col, $last_row, $last_col);
/**
* Read/write access to an object subview of first specified columns.
*
* @param $number_of_cols
* @return static (subview)
*/
function head_cols($number_of_cols);
/**
* Read/write access to an object subview of first specified rows.
*
* @param int $number_of_rows
* @return static (subview)
*/
function head_rows($number_of_rows);
/**
* @param int $number_of_cols
* @return static (subview)
*/
function tail_cols($number_of_cols);
/**
* @param int $number_of_rows
* @return static (subview)
*/
function tail_rows($number_of_rows);
}

View File

@ -9,6 +9,24 @@ namespace Arma\Internal;
*/
interface Dense extends Common
{
/**
* @inheritdoc
*
* @param int $i
* @param int $j[optional]
* @return \Arma\SubviewVal
*/
function at($i, $j);
/**
* @inheritdoc
*
* @param int $i
* @param int $j[optional]
* @return \Arma\SubviewVal
*/
function __invoke($i, $j);
/**
* Element-wise division of an object by another object or a scalar.
*
@ -91,7 +109,7 @@ interface Dense extends Common
* Read/write access to a certain column of the object.
*
* @param int $col_number
* @return \Arma\Colvec (subview)
* @return \Arma\SubviewCol
*/
function col($col_number);
@ -99,7 +117,7 @@ interface Dense extends Common
* Read/write access to a certain row of the object.
*
* @param int $row_number
* @return \Arma\Rowvec (subview)
* @return \Arma\SubviewCol
*/
function row($row_number);
}

View File

@ -0,0 +1,48 @@
<?php
namespace Arma\Internal;
interface DiagBase extends Common
{
/**
* Sets the elements to a specified value. The type of value must match the type of elements used by
* the container object.
*
*
* @param number|\Arma\Complex $value
* @return void
*/
function fill($value);
/**
* Set the elements of an object to zero.
*
* @return void
*/
function zeros();
/**
* Set all the elements of an object to one.
*
* @return void
*/
function ones();
/**
* Set all the elements to random values.
*
* Uses a uniform distribution in the [0,1] interval.
*
* @return void
*/
function randu();
/**
* Set all the elements to random values.
*
* Uses a normal/Gaussian distribution with zero mean and unit variance.
*
* @return void
*/
function randn();
}

View File

@ -7,7 +7,7 @@ namespace Arma\Internal;
*
* @package Arma\Internal
*/
interface MatBase extends Common
interface MatBase extends Splittable
{
/**
* Set the elements of an object to zero, optionally first changing the size to specified dimensions.
@ -66,7 +66,7 @@ interface MatBase extends Common
* For k < 0, the k-th sub-diagonal is accessed (bottom-left corner).
*
* @param int $k
* @return \Arma\Colvec
* @return Subview
*/
function diag($k = 0);

13
stubs/internal/Scalar.php Normal file
View File

@ -0,0 +1,13 @@
<?php
namespace Arma\Internal;
interface Scalar
{
/**
* Return a copy of the representing scalar value of this object.
*
* @return number|\Arma\Complex
*/
function val();
}

View File

@ -0,0 +1,8 @@
<?php
namespace Arma\Internal;
interface Sparse extends Common
{
}

View File

@ -0,0 +1,67 @@
<?php
namespace Arma\Internal;
interface Splittable
{
/**
* 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 $number_of_cols
* @return Subview
*/
function head_cols($number_of_cols);
/**
* Read/write access to an object subview of first specified rows.
*
* @param int $number_of_rows
* @return Subview
*/
function head_rows($number_of_rows);
/**
* Read/write access to an object subview of last specified columns.
*
* @param int $number_of_cols
* @return Subview
*/
function tail_cols($number_of_cols);
/**
* Read/write access to an object subview of last specified rows.
*
* @param int $number_of_rows
* @return Subview
*/
function tail_rows($number_of_rows);
}

View File

@ -0,0 +1,8 @@
<?php
namespace Arma\Internal;
interface Subview
{
}

View File

@ -7,7 +7,7 @@ namespace Arma\Internal;
*
* @package Arma\Internal
*/
interface VecBase extends Dense
interface VecBase extends Splittable
{
/**
* Construct the vector to have user specified size and fill with specified pattern.