This repository has been archived on 2020-06-07. You can view files and clone it, but cannot push or open issues or pull requests.
php-armadillo/stubs/internal/Vector.php
2019-07-08 00:57:25 +08:00

98 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);
/**
* Create the vector from a PHP array.
*
* @param array $arr
* @return static
*/
static function fromArray($arr);
// 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);
}