update
This commit is contained in:
parent
c4bb5767ed
commit
9d8cf4d911
|
@ -28,12 +28,12 @@ namespace php_arma
|
|||
zend_object *current = Z_OBJ_P(getThis());
|
||||
|
||||
if (EXPECTED(has_real)) {
|
||||
if (UNEXPECTED(!zval_check_scalar<T>(real))) {
|
||||
if (!zval_check_scalar<T>(real)) {
|
||||
return;
|
||||
}
|
||||
object_set_property(current, 0, real);
|
||||
if (EXPECTED(has_imag)) {
|
||||
if (UNEXPECTED(!zval_check_scalar<T>(imag))) {
|
||||
if (!zval_check_scalar<T>(imag)) {
|
||||
return;
|
||||
}
|
||||
object_set_property(current, 1, imag);
|
||||
|
|
|
@ -12,4 +12,4 @@ namespace php_arma
|
|||
void operator_init();
|
||||
}
|
||||
|
||||
#endif // !PHP_ARMA_OPERATOR_HH
|
||||
#endif // !PHP_ARMA_OPERATOR_HH
|
||||
|
|
|
@ -294,7 +294,7 @@ namespace php_arma
|
|||
zend_always_inline
|
||||
bool zval_check_scalar(zval *zv)
|
||||
{
|
||||
if (!zval_is_scalar<T>(zv)) {
|
||||
if (UNEXPECTED(!zval_is_scalar<T>(zv))) {
|
||||
ex_bad_type(scalar_type_name<T>(), zval_get_type_name(zv));
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace Arma;
|
||||
|
||||
/**
|
||||
* Abstract class for a column vector.
|
||||
* Column vector.
|
||||
*
|
||||
* @package Arma
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace Arma;
|
||||
|
||||
/**
|
||||
* Interface for diagonal subview of dense matrix.
|
||||
* Diagonal subview of dense matrix.
|
||||
*
|
||||
* @package Arma\Internal
|
||||
*/
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
namespace Arma;
|
||||
|
||||
/**
|
||||
* Constants for saving/loading options.
|
||||
*
|
||||
* @package Arma
|
||||
*/
|
||||
abstract class FileType
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
namespace Arma;
|
||||
|
||||
/**
|
||||
* Constants for filling options when constructing a new matrix/vector object.
|
||||
*
|
||||
* @package Arma
|
||||
*/
|
||||
abstract class Fill
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
namespace Arma;
|
||||
|
||||
/**
|
||||
* Reference to a single value in a dense matrix/vector.
|
||||
*
|
||||
* @package Arma
|
||||
*/
|
||||
abstract class MapVal implements Internal\Scalar
|
||||
{
|
||||
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
namespace Arma;
|
||||
|
||||
/**
|
||||
* Dense matrix.
|
||||
*
|
||||
* @package Arma
|
||||
*/
|
||||
abstract class Mat implements Internal\DenseResizableMatrix
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace Arma;
|
||||
|
||||
/**
|
||||
* Abstract class for a row vector.
|
||||
* Row vector.
|
||||
*
|
||||
* @package Arma
|
||||
*/
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
namespace Arma;
|
||||
|
||||
/**
|
||||
* Constants for specifying sorting directions of elements.
|
||||
*
|
||||
* @package Arma
|
||||
*/
|
||||
abstract class SortDirection
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
namespace Arma;
|
||||
|
||||
/**
|
||||
* Sparse matrix which contains a single column.
|
||||
*
|
||||
* @package Arma
|
||||
*/
|
||||
abstract class SpCol implements Internal\SparseResizableVector
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace Arma;
|
||||
|
||||
/**
|
||||
* Abstract class for diagonal subview of sparse matrix.
|
||||
* Diagonal subview of sparse matrix.
|
||||
*
|
||||
* @package Arma\Internal
|
||||
*/
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
namespace Arma;
|
||||
|
||||
/**
|
||||
* Reference to a single value in a sparse matrix.
|
||||
*
|
||||
* @package Arma
|
||||
*/
|
||||
abstract class SpMapVal implements Internal\Scalar
|
||||
{
|
||||
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
namespace Arma;
|
||||
|
||||
/**
|
||||
* Sparse matrix.
|
||||
*
|
||||
* @package Arma
|
||||
*/
|
||||
abstract class SpMat implements Internal\SparseResizableMatrix
|
||||
{
|
||||
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
namespace Arma;
|
||||
|
||||
/**
|
||||
* Sparse matrix which contains a single row.
|
||||
*
|
||||
* @package Arma
|
||||
*/
|
||||
abstract class SpRow implements Internal\SparseResizableVector
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
namespace Arma;
|
||||
|
||||
/**
|
||||
* Reference to a single value in a sparse matrix subview.
|
||||
*
|
||||
* @package Arma
|
||||
*/
|
||||
abstract class SpSvMapVal implements Internal\Scalar
|
||||
{
|
||||
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
namespace Arma;
|
||||
|
||||
/**
|
||||
* Subview of a sparse matrix.
|
||||
*
|
||||
* @package Arma
|
||||
*/
|
||||
abstract class SpSvMat implements Internal\SparseNonResizableMatrix, Internal\Subview
|
||||
{
|
||||
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
namespace Arma;
|
||||
|
||||
/**
|
||||
* Dense matrix subview as a column vector.
|
||||
*
|
||||
* @package Arma
|
||||
*/
|
||||
abstract class SvCol implements Internal\DenseNonResizableVector, Internal\Subview
|
||||
{
|
||||
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
namespace Arma;
|
||||
|
||||
/**
|
||||
* Subview of a dense matrix.
|
||||
*
|
||||
* @package Arma
|
||||
*/
|
||||
abstract class SvMat implements Internal\DenseNonResizableMatrix, Internal\Subview
|
||||
{
|
||||
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
namespace Arma;
|
||||
|
||||
/**
|
||||
* Dense matrix subview as a row vector.
|
||||
*
|
||||
* @package Arma
|
||||
*/
|
||||
abstract class SvRow implements Internal\DenseNonResizableVector, Internal\Subview
|
||||
{
|
||||
|
||||
|
|
|
@ -20,15 +20,6 @@ interface DenseMatrix extends Dense, Matrix
|
|||
*/
|
||||
function at($i, $j);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param int $i
|
||||
* @param int $j[optional]
|
||||
* @return \Arma\MapVal
|
||||
*/
|
||||
function __invoke($i, $j);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
namespace Arma\Internal;
|
||||
|
||||
/**
|
||||
* Interface for a dense matrix which is resizable.
|
||||
*
|
||||
* @package Arma\Internal
|
||||
*/
|
||||
interface DenseResizableMatrix extends DenseMatrix, ResizableMatrix
|
||||
{
|
||||
// Initialization
|
||||
|
|
|
@ -10,14 +10,6 @@ interface DenseVector extends Dense, Vector
|
|||
{
|
||||
/// Subview
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param int $idx
|
||||
* @return \Arma\MapVal
|
||||
*/
|
||||
function __invoke($idx);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
|
|
|
@ -94,18 +94,6 @@ 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);
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,13 +14,4 @@ interface SparseNonResizableMatrix extends SparseMatrix, NonResizableMatrix
|
|||
* @return \Arma\SpSvMapVal
|
||||
*/
|
||||
function at($i, $j);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param int $i
|
||||
* @param int $j[optional]
|
||||
* @return \Arma\SpSvMapVal
|
||||
*/
|
||||
function __invoke($i, $j);
|
||||
}
|
||||
|
|
|
@ -14,13 +14,4 @@ interface SparseResizableMatrix extends SparseMatrix, ResizableMatrix
|
|||
* @return \Arma\SpMapVal
|
||||
*/
|
||||
function at($i, $j);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param int $i
|
||||
* @param int $j[optional]
|
||||
* @return \Arma\SpMapVal
|
||||
*/
|
||||
function __invoke($i, $j);
|
||||
}
|
||||
|
|
|
@ -6,14 +6,6 @@ interface SparseVector extends Sparse, Vector
|
|||
{
|
||||
/// Subview
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param int $idx
|
||||
* @return \Arma\SpMapVal
|
||||
*/
|
||||
function __invoke($idx);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
|
|
|
@ -38,16 +38,6 @@ 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);
|
||||
|
||||
/**
|
||||
|
|
Reference in New Issue