refactor stubs

This commit is contained in:
CismonX 2019-11-04 16:19:23 +08:00
parent 272f30689c
commit 69e98ca96b
6 changed files with 56 additions and 46 deletions

View File

@ -13,6 +13,15 @@ interface DenseResizableVector extends DenseVector, ResizableVector
{
// Initialization
/**
* Construct the vector to have user specified size and fill with specified pattern.
*
* @param int $n_elem[optional]
* @param int $fill[optional]
* @return static
*/
static function init($n_elem, $fill);
/**
* Set all the elements of an object to one, optionally first changing the size to specified dimensions.
*

View File

@ -9,6 +9,24 @@ namespace Arma\Internal;
*/
interface ResizableVector extends Resizable, Vector
{
/**
* Create the vector from a textual description.
*
* Elements should be separated by spaces.
*
* @param string $text
* @return static
*/
static function fromString($text);
/**
* Create the vector from a PHP array.
*
* @param array $arr
* @return static
*/
static function fromArray($arr);
/**
* Recreate the object according to given size specifications, while preserving the elements
* as well as the layout of the elements.

View File

@ -22,7 +22,7 @@ interface SparseResizableMatrix extends SparseMatrix, ResizableMatrix
* @param int $n_cols[optional]
* @param int $fill[optional]
* @param double $density[optional]
* @return Mat
* @return static
*/
static function init($n_rows, $n_cols, $fill, $density);

View File

@ -9,5 +9,33 @@ namespace Arma\Internal;
*/
interface SparseResizableVector extends SparseVector, ResizableVector
{
/**
* Construct the vector to have user specified size and fill with specified pattern.
*
* $density should be specified when filling the vector with random values.
*
* @param int $n_elem[optional]
* @param int $fill[optional]
* @param double $density[optional]
* @return static
*/
static function init($n_elem, $fill, $density);
/// Subview
/**
* {@inheritdoc}
*
* @param int $idx
* @return SpMapVal
*/
function __invoke($idx);
/**
* {@inheritdoc}
*
* @param int $idx
* @return SpMapVal
*/
function at($idx);
}

View File

@ -6,21 +6,5 @@ use Arma\SpMapVal;
interface SparseVector extends Sparse, Vector
{
/// Subview
/**
* {@inheritdoc}
*
* @param int $idx
* @return SpMapVal
*/
function __invoke($idx);
/**
* {@inheritdoc}
*
* @param int $idx
* @return SpMapVal
*/
function at($idx);
}

View File

@ -9,35 +9,6 @@ namespace Arma\Internal;
*/
interface Vector
{
// Constructors
/**
* Construct the vector to have user specified size and fill with specified pattern.
*
* @param int $n_elem[optional]
* @param int $fill[optional]
* @return static
*/
static function init($n_elem, $fill);
/**
* Create the vector from a textual description.
*
* Elements should be separated by spaces.
*
* @param string $text
* @return static
*/
static function fromString($text);
/**
* Create the vector from a PHP array.
*
* @param array $arr
* @return static
*/
static function fromArray($arr);
// Vector subview
/**