This commit is contained in:
CismonX 2019-03-27 16:29:00 +08:00
parent 9d8cf4d911
commit 633e52f32f
23 changed files with 115 additions and 30 deletions

View File

@ -47,12 +47,6 @@ namespace php_arma
return Z_TYPE_P(zv) == IS_OBJECT && instanceof_function(Z_OBJCE_P(zv), PHP_ARMA_CE(complex, double));
}
template <>
struct scalar_type<cx_double>
{
static constexpr auto value = IS_OBJECT;
};
template <>
zend_always_inline
const char *scalar_type_name<cx_double>()

View File

@ -203,21 +203,6 @@ namespace php_arma
return Z_TYPE_P(zv) == IS_LONG;
}
template <typename>
struct scalar_type {};
template <>
struct scalar_type<double>
{
static constexpr auto value = IS_DOUBLE;
};
template <>
struct scalar_type<zend_long>
{
static constexpr auto value = IS_LONG;
};
template <typename T>
zend_always_inline
const char *scalar_type_name()

View File

@ -3,7 +3,7 @@
namespace Arma\Internal;
/**
* Interface for a dense matrix.
* Interface for dense matrices.
*
* @package Arma
*/
@ -11,6 +11,15 @@ interface DenseMatrix extends Dense, Matrix
{
// Subview
/**
* {@inheritdoc}
*
* @param int $i
* @param int $j[optional]
* @return \Arma\MapVal
*/
function __invoke($i, $j);;
/**
* {@inheritdoc}
*

View File

@ -2,6 +2,11 @@
namespace Arma\Internal;
/**
* Interface for non-resizable dense matrices (subview).
*
* @package Arma\Internal
*/
interface DenseNonResizableMatrix extends DenseMatrix, NonResizableMatrix
{
// Initialization

View File

@ -2,6 +2,11 @@
namespace Arma\Internal;
/**
* Interface for non-resizable dense vectors (subview).
*
* @package Arma\Internal
*/
interface DenseNonResizableVector extends DenseVector, NonResizableVector
{
// Initialization

View File

@ -3,7 +3,7 @@
namespace Arma\Internal;
/**
* Interface for a dense matrix which is resizable.
* Interface for resizable (non-subview) dense matrices.
*
* @package Arma\Internal
*/

View File

@ -2,6 +2,11 @@
namespace Arma\Internal;
/**
* Interface for resizable (non-subview) dense vectors.
*
* @package Arma\Internal
*/
interface DenseResizableVector extends DenseVector, ResizableVector
{
// Initialization

View File

@ -3,13 +3,22 @@
namespace Arma\Internal;
/**
* Interface for vectors with a Dense Layout (Row and Col)
* Interface for vectors with a Dense Layout (Row and Col).
*
* @package Arma\Internal
*/
interface DenseVector extends Dense, Vector
{
/// Subview
/**
* {@inheritdoc}
*
* @param int $idx
* @return \Arma\MapVal
*/
function __invoke($idx);
/**
* {@inheritdoc}
*

View File

@ -3,7 +3,7 @@
namespace Arma\Internal;
/**
* Interface for diagonal subview of matrix (Mat and SpMat).
* Interface for diagonal subview of matrices (Mat and SpMat).
*
* @package Arma\Internal
*/

View File

@ -94,6 +94,18 @@ interface Matrix
* @param int $j[optional]
* @return Scalar
*/
function __invoke($i, $j);
/**
* If $j is not specified, access the n-th element. Otherwise, access the element stored at the i-th row
* and j-th column.
*
* Without a bounds check. Not recommended for use unless your code has been thoroughly debugged.
*
* @param int $i
* @param int $j[optional]
* @return Scalar
*/
function at($i, $j);
/**

View File

@ -2,6 +2,11 @@
namespace Arma\Internal;
/**
* Interface for non-resizable container objects.
*
* @package Arma\Internal
*/
interface NonResizable
{
/**

View File

@ -2,6 +2,11 @@
namespace Arma\Internal;
/**
* Interface for non-resizable matrices (subview).
*
* @package Arma\Internal
*/
interface NonResizableMatrix extends NonResizable, Matrix
{
/**

View File

@ -2,6 +2,11 @@
namespace Arma\Internal;
/**
* Interface for non-resizable vectors (subview).
*
* @package Arma\Internal
*/
interface NonResizableVector extends NonResizable, Vector
{

View File

@ -3,7 +3,7 @@
namespace Arma\Internal;
/**
* Interface for resizable matrices.
* Interface for resizable (non-subview) matrices.
*
* @package Arma\Internal
*/

View File

@ -3,7 +3,7 @@
namespace Arma\Internal;
/**
* Interface for resizable vectors.
* Interface for resizable (non-subview) vectors.
*
* @package Arma\Internal
*/

View File

@ -3,7 +3,7 @@
namespace Arma\Internal;
/**
* Interface for objects whose elements are stored in CSC format.
* Interface for objects whose elements are stored in compressed sparse column (CSC) format.
*
* @package Arma\Internal
*/

View File

@ -3,7 +3,7 @@
namespace Arma\Internal;
/**
* Interface for a sparse matrix.
* Interface for sparse matrices.
*
* @package Arma
*/

View File

@ -2,10 +2,24 @@
namespace Arma\Internal;
/**
* Interface for resizable (non-subview) sparse matrices.
*
* @package Arma\Internal
*/
interface SparseNonResizableMatrix extends SparseMatrix, NonResizableMatrix
{
// Subview
/**
* {@inheritdoc}
*
* @param int $i
* @param int $j[optional]
* @return \Arma\SpSvMapVal
*/
function __invoke($i, $j);
/**
* {@inheritdoc}
*

View File

@ -6,6 +6,15 @@ interface SparseResizableMatrix extends SparseMatrix, ResizableMatrix
{
// Subview
/**
* {@inheritdoc}
*
* @param int $i
* @param int $j[optional]
* @return \Arma\SpMapVal
*/
function __invoke($i, $j);
/**
* {@inheritdoc}
*

View File

@ -2,6 +2,11 @@
namespace Arma\Internal;
/**
* Interface for resizable (non-subview) sparse vectors.
*
* @package Arma\Internal
*/
interface SparseResizableVector extends SparseVector, ResizableVector
{

View File

@ -6,6 +6,14 @@ interface SparseVector extends Sparse, Vector
{
/// Subview
/**
* {@inheritdoc}
*
* @param int $idx
* @return \Arma\SpMapVal
*/
function __invoke($idx);
/**
* {@inheritdoc}
*

View File

@ -3,7 +3,7 @@
namespace Arma\Internal;
/**
* Interface of object subview (Mat, Col, Row, SpMat).
* Interface of object (Mat, Col, Row, SpMat) subview.
*
* @package Arma\Internal
*/

View File

@ -38,6 +38,16 @@ interface Vector
* @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);
/**