2018-11-09 13:56:34 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Arma;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface for a dense matrix.
|
|
|
|
*
|
|
|
|
* @package Arma
|
|
|
|
*/
|
2019-03-08 14:15:02 +00:00
|
|
|
interface Mat extends Internal\Dense, Internal\Matrix
|
2018-11-09 13:56:34 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Construct the matrix to have user specified dimensions and fill with specified pattern.
|
|
|
|
*
|
2019-02-22 01:54:21 +00:00
|
|
|
* @param int $n_rows
|
|
|
|
* @param int $n_cols
|
2018-11-09 13:56:34 +00:00
|
|
|
* @param int $fill[optional]
|
2019-02-14 11:11:36 +00:00
|
|
|
* @return static
|
2018-11-09 13:56:34 +00:00
|
|
|
*/
|
2019-02-22 01:54:21 +00:00
|
|
|
static function init($n_rows, $n_cols, $fill);
|
2018-11-09 13:56:34 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create the matrix from a textual description.
|
|
|
|
*
|
|
|
|
* @param string $text
|
2019-02-14 11:11:36 +00:00
|
|
|
* @return static
|
2018-11-09 13:56:34 +00:00
|
|
|
*/
|
|
|
|
static function fromString($text);
|
|
|
|
|
2019-02-23 02:07:23 +00:00
|
|
|
/**
|
|
|
|
* Set all the elements of an object to one, optionally first changing the size to specified dimensions.
|
|
|
|
*
|
|
|
|
* @param $n_rows[optional]
|
|
|
|
* @param $n_cols[optional]
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function ones($n_rows, $n_cols);
|
|
|
|
|
2019-02-22 01:54:21 +00:00
|
|
|
/**
|
|
|
|
* Set all the elements to random values, optionally first changing the size to specified dimensions.
|
|
|
|
*
|
|
|
|
* Uses a uniform distribution in the [0,1] interval.
|
|
|
|
*
|
|
|
|
* @param int $n_rows
|
|
|
|
* @param int $n_cols
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function randu($n_rows, $n_cols);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set all the elements to random values, optionally first changing the size to specified dimensions.
|
|
|
|
*
|
|
|
|
* Uses a normal/Gaussian distribution with zero mean and unit variance.
|
|
|
|
*
|
|
|
|
* @param int $n_rows
|
|
|
|
* @param int $n_cols
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function randn($n_rows, $n_cols);
|
2019-03-07 15:19:47 +00:00
|
|
|
|
2019-03-08 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*
|
|
|
|
* @param int $col_number
|
|
|
|
* @return SvCol
|
|
|
|
*/
|
|
|
|
function col($col_number);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*
|
|
|
|
* @param int $row_number
|
|
|
|
* @return SvRow
|
|
|
|
*/
|
|
|
|
function row($row_number);
|
|
|
|
|
2019-03-07 15:19:47 +00:00
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*
|
|
|
|
* @param int $first_col
|
|
|
|
* @param int $last_col
|
2019-03-08 14:15:02 +00:00
|
|
|
* @return SvMat
|
2019-03-07 15:19:47 +00:00
|
|
|
*/
|
|
|
|
function cols($first_col, $last_col);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*
|
|
|
|
* @param int $first_row
|
|
|
|
* @param int $last_row
|
2019-03-08 14:15:02 +00:00
|
|
|
* @return SvMat
|
2019-03-07 15:19:47 +00:00
|
|
|
*/
|
|
|
|
function rows($first_row, $last_row);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*
|
|
|
|
* @param int $first_row
|
|
|
|
* @param int $first_col
|
|
|
|
* @param int $last_row
|
|
|
|
* @param int $last_col
|
2019-03-08 14:15:02 +00:00
|
|
|
* @return SvMat
|
2019-03-07 15:19:47 +00:00
|
|
|
*/
|
|
|
|
function submat($first_row, $first_col, $last_row, $last_col);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*
|
2019-03-08 14:15:02 +00:00
|
|
|
* @param $n_cols
|
|
|
|
* @return SvMat
|
2019-03-07 15:19:47 +00:00
|
|
|
*/
|
2019-03-08 14:15:02 +00:00
|
|
|
function head_cols($n_cols);
|
2019-03-07 15:19:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*
|
2019-03-08 14:15:02 +00:00
|
|
|
* @param int $n_rows
|
|
|
|
* @return SvMat
|
2019-03-07 15:19:47 +00:00
|
|
|
*/
|
2019-03-08 14:15:02 +00:00
|
|
|
function head_rows($n_rows);
|
2019-03-07 15:19:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*
|
2019-03-08 14:15:02 +00:00
|
|
|
* @param int $n_cols
|
|
|
|
* @return SvMat
|
2019-03-07 15:19:47 +00:00
|
|
|
*/
|
2019-03-08 14:15:02 +00:00
|
|
|
function tail_cols($n_cols);
|
2019-03-07 15:19:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*
|
2019-03-08 14:15:02 +00:00
|
|
|
* @param int $n_rows
|
|
|
|
* @return SvMat
|
2019-03-07 15:19:47 +00:00
|
|
|
*/
|
2019-03-08 14:15:02 +00:00
|
|
|
function tail_rows($n_rows);
|
2019-03-07 15:19:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*
|
|
|
|
* @param int $k
|
|
|
|
* @return DiagView
|
|
|
|
*/
|
|
|
|
function diag($k = 0);
|
2019-02-05 13:31:16 +00:00
|
|
|
}
|