100 lines
2.0 KiB
PHP
100 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace Arma\Internal;
|
|
|
|
/**
|
|
* Interface for vectors (Col, Row, SpCol and SpRow).
|
|
*
|
|
* @package 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);
|
|
|
|
// Vector subview
|
|
|
|
/**
|
|
* Read/write access to the n-th element.
|
|
*
|
|
* @param int $idx
|
|
* @return Scalar
|
|
*/
|
|
function __invoke($idx);
|
|
|
|
/**
|
|
* Read/write access to the n-th element.
|
|
*
|
|
* Without a bounds check. Not recommended for use unless your code has been thoroughly debugged.
|
|
*
|
|
* @param int $idx
|
|
* @return Scalar
|
|
*/
|
|
function at($idx);
|
|
|
|
/**
|
|
* 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);
|
|
|
|
// 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);
|
|
}
|