2019-02-21 10:49:25 +00:00
|
|
|
<?php
|
|
|
|
|
2019-02-25 13:56:43 +00:00
|
|
|
namespace Arma\Internal;
|
2019-02-21 10:49:25 +00:00
|
|
|
|
2019-02-24 03:39:51 +00:00
|
|
|
/**
|
2019-03-12 10:14:12 +00:00
|
|
|
* Interface for vectors (Col, Row, SpCol and SpRow).
|
2019-02-24 03:39:51 +00:00
|
|
|
*
|
|
|
|
* @package Arma\Internal
|
|
|
|
*/
|
2019-03-08 14:15:02 +00:00
|
|
|
interface Vector
|
2019-02-21 10:49:25 +00:00
|
|
|
{
|
2019-03-12 10:14:12 +00:00
|
|
|
// Constructors
|
|
|
|
|
2019-02-22 01:54:21 +00:00
|
|
|
/**
|
|
|
|
* Construct the vector to have user specified size and fill with specified pattern.
|
|
|
|
*
|
2019-03-12 10:14:12 +00:00
|
|
|
* @param int $n_elem[optional]
|
2019-02-22 01:54:21 +00:00
|
|
|
* @param int $fill[optional]
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
static function init($n_elem, $fill);
|
2019-02-21 10:49:25 +00:00
|
|
|
|
2019-02-22 01:54:21 +00:00
|
|
|
/**
|
|
|
|
* Create the vector from a textual description.
|
|
|
|
*
|
|
|
|
* Elements should be separated by spaces.
|
|
|
|
*
|
|
|
|
* @param string $text
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
static function fromString($text);
|
|
|
|
|
2019-03-18 14:49:42 +00:00
|
|
|
// Vector subview
|
2019-03-12 10:14:12 +00:00
|
|
|
|
2019-02-24 03:39:51 +00:00
|
|
|
/**
|
2019-03-18 14:49:42 +00:00
|
|
|
* Read/write access to the n-th element.
|
2019-02-24 03:39:51 +00:00
|
|
|
*
|
2019-03-18 14:49:42 +00:00
|
|
|
* @param int $idx
|
2019-03-23 16:24:34 +00:00
|
|
|
* @return Scalar
|
2019-02-24 03:39:51 +00:00
|
|
|
*/
|
2019-03-18 14:49:42 +00:00
|
|
|
function at($idx);
|
2019-03-10 15:23:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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);
|
2019-03-21 10:49:11 +00:00
|
|
|
|
|
|
|
// 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);
|
2019-02-22 01:54:21 +00:00
|
|
|
}
|