2018-11-09 13:56:34 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Arma;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface for a dense matrix.
|
|
|
|
*
|
|
|
|
* @package Arma
|
|
|
|
*/
|
2019-02-24 03:39:51 +00:00
|
|
|
interface Mat extends Internal\Dense, Internal\MatBase
|
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);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create the matrix from a column or row vector.
|
|
|
|
*
|
|
|
|
* @param Colvec|Rowvec $vector
|
2019-02-14 11:11:36 +00:00
|
|
|
* @return static
|
2018-11-09 13:56:34 +00:00
|
|
|
*/
|
|
|
|
static function fromVec($vector);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create the matrix from a sparse matrix.
|
|
|
|
*
|
|
|
|
* @param SpMat $sp_mat
|
2019-02-14 11:11:36 +00:00
|
|
|
* @return static
|
2018-11-09 13:56:34 +00:00
|
|
|
*/
|
|
|
|
static function fromSparse($sp_mat);
|
|
|
|
|
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-02-05 13:31:16 +00:00
|
|
|
}
|