ILIAS
Release_4_0_x_branch Revision 61816
|
Public Member Functions | |
__construct () | |
Polymorphic constructor. | |
getArray () | |
getArray | |
getArrayCopy () | |
getArrayCopy | |
constructWithCopy ($A) | |
constructWithCopy Construct a matrix from a copy of a 2-D array. | |
getColumnPackedCopy () | |
getColumnPackedCopy | |
getRowPackedCopy () | |
getRowPackedCopy | |
getRowDimension () | |
getRowDimension | |
getColumnDimension () | |
getColumnDimension | |
get ($i=null, $j=null) | |
get | |
getMatrix () | |
getMatrix | |
setMatrix () | |
setMatrix | |
checkMatrixDimensions ($B=null) | |
checkMatrixDimensions | |
set ($i=null, $j=null, $c=null) | |
set | |
identity ($m=null, $n=null) | |
identity | |
diagonal ($m=null, $n=null, $c=1) | |
diagonal | |
filled ($m=null, $n=null, $c=0) | |
filled | |
random ($m=null, $n=null, $a=RAND_MIN, $b=RAND_MAX) | |
random | |
packed () | |
packed | |
getMatrixByRow ($i0=null, $iF=null) | |
getMatrixByRow | |
getMatrixByCol ($j0=null, $jF=null) | |
getMatrixByCol | |
transpose () | |
transpose | |
norm1 () | |
norm1 | |
norm2 () | |
norm2 | |
normInf () | |
normInf | |
normF () | |
normF | |
rank () | |
Matrix rank. | |
cond () | |
Matrix condition (2 norm) | |
trace () | |
trace | |
uminus () | |
uminus | |
plus () | |
plus | |
plusEquals () | |
plusEquals | |
minus () | |
minus | |
minusEquals () | |
minusEquals | |
arrayTimes () | |
arrayTimes | |
arrayTimesEquals () | |
arrayTimesEquals | |
arrayRightDivide () | |
arrayRightDivide | |
arrayRightDivideEquals () | |
arrayRightDivideEquals | |
arrayLeftDivide () | |
arrayLeftDivide | |
arrayLeftDivideEquals () | |
arrayLeftDivideEquals | |
times () | |
times | |
power () | |
power | |
concat () | |
concat | |
chol () | |
chol | |
lu () | |
lu | |
qr () | |
qr | |
eig () | |
eig | |
svd () | |
svd | |
solve ($B) | |
Solve A*X = B. | |
inverse () | |
Matrix inverse or pseudoinverse. | |
det () | |
det | |
mprint ($A, $format="%01.2f", $width=2) | |
Older debugging utility for backwards compatability. | |
toHTML ($width=2) | |
Debugging utility. |
Data Fields | |
$A = array() |
Private Attributes | |
$m | |
$n |
Definition at line 36 of file Matrix.php.
Matrix::__construct | ( | ) |
Polymorphic constructor.
As PHP has no support for polymorphic constructors, we hack our own sort of polymorphism using func_num_args, func_get_arg, and gettype. In essence, we're just implementing a simple RTTI filter and calling the appropriate constructor.
Definition at line 68 of file Matrix.php.
References $m, $n, ArrayLengthException, JAMAError(), n, and PolymorphicArgumentException.
Matrix::arrayLeftDivide | ( | ) |
arrayLeftDivide
Element-by-element Left division A / B
Definition at line 1001 of file Matrix.php.
References $m, $n, ArgumentTypeException, checkMatrixDimensions(), JAMAError(), and PolymorphicArgumentException.
Matrix::arrayLeftDivideEquals | ( | ) |
arrayLeftDivideEquals
Element-by-element Left division Aij = Aij / Bij
mixed | $B | Matrix/Array |
Definition at line 1038 of file Matrix.php.
References $m, $n, ArgumentTypeException, checkMatrixDimensions(), JAMAError(), and PolymorphicArgumentException.
Matrix::arrayRightDivide | ( | ) |
arrayRightDivide
Element-by-element right division A / B
Definition at line 927 of file Matrix.php.
References $m, $n, ArgumentTypeException, checkMatrixDimensions(), JAMAError(), and PolymorphicArgumentException.
Matrix::arrayRightDivideEquals | ( | ) |
arrayRightDivideEquals
Element-by-element right division Aij = Aij / Bij
mixed | $B | Matrix/Array |
Definition at line 964 of file Matrix.php.
References $m, $n, ArgumentTypeException, checkMatrixDimensions(), JAMAError(), and PolymorphicArgumentException.
Matrix::arrayTimes | ( | ) |
arrayTimes
Element-by-element multiplication Cij = Aij * Bij
mixed | $B | Matrix/Array |
Definition at line 853 of file Matrix.php.
References $m, $n, ArgumentTypeException, checkMatrixDimensions(), JAMAError(), and PolymorphicArgumentException.
Matrix::arrayTimesEquals | ( | ) |
arrayTimesEquals
Element-by-element multiplication Aij = Aij * Bij
mixed | $B | Matrix/Array |
Definition at line 890 of file Matrix.php.
References $m, $n, ArgumentTypeException, checkMatrixDimensions(), JAMAError(), and PolymorphicArgumentException.
Matrix::checkMatrixDimensions | ( | $B = null | ) |
checkMatrixDimensions
Is matrix B the same size?
Definition at line 405 of file Matrix.php.
References ArgumentTypeException, JAMAError(), MatrixDimensionException, and n.
Referenced by arrayLeftDivide(), arrayLeftDivideEquals(), arrayRightDivide(), arrayRightDivideEquals(), arrayTimes(), arrayTimesEquals(), concat(), minus(), minusEquals(), plus(), plusEquals(), and power().
Matrix::chol | ( | ) |
chol
Cholesky decomposition
Definition at line 1236 of file Matrix.php.
Matrix::concat | ( | ) |
concat
A = A & B
mixed | $B | Matrix/Array |
Definition at line 1201 of file Matrix.php.
References $m, $n, ArgumentTypeException, checkMatrixDimensions(), JAMAError(), and PolymorphicArgumentException.
Matrix::cond | ( | ) |
Matrix condition (2 norm)
Definition at line 669 of file Matrix.php.
Matrix::constructWithCopy | ( | $A | ) |
constructWithCopy Construct a matrix from a copy of a 2-D array.
double | A[][] Two-dimensional array of doubles. |
IllegalArgumentException | All rows must have the same length |
Definition at line 165 of file Matrix.php.
References $A, $m, $n, JAMAError(), n, and RowLengthException.
Referenced by TestMatrix\TestMatrix().
Matrix::det | ( | ) |
Matrix::diagonal | ( | $m = null , |
|
$n = null , |
|||
$c = 1 |
|||
) |
diagonal
Generate a diagonal matrix
int | $m | Row dimension |
int | $n | Column dimension |
mixed | $c | Diagonal value |
Definition at line 468 of file Matrix.php.
Referenced by identity().
Matrix::eig | ( | ) |
eig
Eigenvalue decomposition
Definition at line 1269 of file Matrix.php.
Matrix::filled | ( | $m = null , |
|
$n = null , |
|||
$c = 0 |
|||
) |
filled
Generate a filled matrix
int | $m | Row dimension |
int | $n | Column dimension |
int | $c | Fill constant |
Definition at line 486 of file Matrix.php.
References $m, $n, ArgumentTypeException, and JAMAError().
Matrix::get | ( | $i = null , |
|
$j = null |
|||
) |
get
Get the i,j-th element of the matrix.
int | $i | Row position |
int | $j | Column position |
Definition at line 243 of file Matrix.php.
Matrix::getArray | ( | ) |
Matrix::getArrayCopy | ( | ) |
getArrayCopy
Definition at line 153 of file Matrix.php.
References $A.
Matrix::getColumnDimension | ( | ) |
getColumnDimension
Definition at line 230 of file Matrix.php.
References $n.
Matrix::getColumnPackedCopy | ( | ) |
getColumnPackedCopy
Get a column-packed array
Definition at line 187 of file Matrix.php.
Matrix::getMatrix | ( | ) |
getMatrix
Get a submatrix
int | $i0 | Initial row index |
int | $iF | Final row index |
int | $j0 | Initial column index |
int | $jF | Final column index |
Definition at line 258 of file Matrix.php.
References $m, $n, ArgumentBoundsException, JAMAError(), n, and PolymorphicArgumentException.
Referenced by getMatrixByCol(), and getMatrixByRow().
Matrix::getMatrixByCol | ( | $j0 = null , |
|
$jF = null |
|||
) |
getMatrixByCol
Get a submatrix by column index/range
int | $i0 | Initial column index |
int | $iF | Final column index |
Definition at line 558 of file Matrix.php.
References ArgumentTypeException, getMatrix(), and JAMAError().
Matrix::getMatrixByRow | ( | $i0 = null , |
|
$iF = null |
|||
) |
getMatrixByRow
Get a submatrix by row index/range
int | $i0 | Initial row index |
int | $iF | Final row index |
Definition at line 537 of file Matrix.php.
References ArgumentTypeException, getMatrix(), JAMAError(), and n.
Matrix::getRowDimension | ( | ) |
Matrix::getRowPackedCopy | ( | ) |
getRowPackedCopy
Get a row-packed array
Definition at line 204 of file Matrix.php.
Matrix::identity | ( | $m = null , |
|
$n = null |
|||
) |
identity
Generate an identity matrix.
int | $m | Row dimension |
int | $n | Column dimension |
Definition at line 454 of file Matrix.php.
References $m, $n, and diagonal().
Referenced by inverse(), and TestMatrix\TestMatrix().
Matrix::inverse | ( | ) |
Matrix inverse or pseudoinverse.
Definition at line 1307 of file Matrix.php.
References identity(), and solve().
Matrix::lu | ( | ) |
Matrix::minus | ( | ) |
minus
A - B
mixed | $B | Matrix/Array |
Definition at line 780 of file Matrix.php.
References $m, $n, ArgumentTypeException, checkMatrixDimensions(), JAMAError(), and PolymorphicArgumentException.
Matrix::minusEquals | ( | ) |
minusEquals
A = A - B
mixed | $B | Matrix/Array |
Definition at line 816 of file Matrix.php.
References $m, $n, ArgumentTypeException, checkMatrixDimensions(), JAMAError(), and PolymorphicArgumentException.
Matrix::mprint | ( | $A, | |
$format = "%01.2f" , |
|||
$width = 2 |
|||
) |
Older debugging utility for backwards compatability.
Definition at line 1329 of file Matrix.php.
Matrix::norm1 | ( | ) |
Matrix::norm2 | ( | ) |
norm2
Maximum singular value
Definition at line 613 of file Matrix.php.
Matrix::normF | ( | ) |
normF
Frobenius norm
Definition at line 642 of file Matrix.php.
References $f, $m, $n, and hypo().
Matrix::normInf | ( | ) |
Matrix::packed | ( | ) |
packed
Alias for getRowPacked
Definition at line 524 of file Matrix.php.
Matrix::plus | ( | ) |
plus
A + B
mixed | $B | Matrix/Array |
Definition at line 708 of file Matrix.php.
References $m, $n, ArgumentTypeException, checkMatrixDimensions(), JAMAError(), and PolymorphicArgumentException.
Matrix::plusEquals | ( | ) |
plusEquals
A = A + B
mixed | $B | Matrix/Array |
Definition at line 744 of file Matrix.php.
References $m, $n, ArgumentTypeException, checkMatrixDimensions(), JAMAError(), and PolymorphicArgumentException.
Matrix::power | ( | ) |
power
A = A ^ B
mixed | $B | Matrix/Array |
Definition at line 1165 of file Matrix.php.
References $m, $n, ArgumentTypeException, checkMatrixDimensions(), JAMAError(), and PolymorphicArgumentException.
Matrix::qr | ( | ) |
random
Generate a random matrix
int | $m | Row dimension |
int | $n | Column dimension |
Definition at line 503 of file Matrix.php.
References $m, $n, ArgumentTypeException, and JAMAError().
Referenced by Benchmark\runCholesky(), Benchmark\runEig(), Benchmark\runLU(), Benchmark\runQR(), and Benchmark\runSVD().
Matrix::rank | ( | ) |
Matrix rank.
Definition at line 658 of file Matrix.php.
Matrix::set | ( | $i = null , |
|
$j = null , |
|||
$c = null |
|||
) |
set
Set the i,j-th element of the matrix.
int | $i | Row position |
int | $j | Column position |
mixed | $c | Int/float/double value |
Definition at line 428 of file Matrix.php.
Matrix::setMatrix | ( | ) |
setMatrix
Set a submatrix
int | $i0 | Initial row index |
int | $j0 | Initial column index |
mixed | $S | Matrix/Array submatrix ($i0, $j0, $S) $S = Matrix ($i0, $j0, $S) $S = Array |
Definition at line 362 of file Matrix.php.
References ArgumentBoundsException, ArgumentTypeException, JAMAError(), and PolymorphicArgumentException.
Matrix::solve | ( | $B | ) |
Solve A*X = B.
Matrix | $B | Right hand side |
Definition at line 1291 of file Matrix.php.
References n.
Referenced by inverse().
Matrix::svd | ( | ) |
svd
Singular value decomposition
Definition at line 1280 of file Matrix.php.
Matrix::times | ( | ) |
times
Matrix multiplication
mixed | $n | Matrix/Array/Scalar |
Definition at line 1074 of file Matrix.php.
References $m, $n, ArgumentTypeException, JAMAError(), n, and PolymorphicArgumentException.
Matrix::toHTML | ( | $width = 2 | ) |
Debugging utility.
Definition at line 1349 of file Matrix.php.
Matrix::trace | ( | ) |
Matrix::transpose | ( | ) |
transpose
Tranpose matrix
Definition at line 577 of file Matrix.php.
Matrix::uminus | ( | ) |
uminus
Unary minus matrix -A
Definition at line 697 of file Matrix.php.
Matrix::$A = array() |
Definition at line 44 of file Matrix.php.
Referenced by constructWithCopy(), getArray(), getArrayCopy(), and mprint().
|
private |
Definition at line 52 of file Matrix.php.
Referenced by __construct(), arrayLeftDivide(), arrayLeftDivideEquals(), arrayRightDivide(), arrayRightDivideEquals(), arrayTimes(), arrayTimesEquals(), concat(), constructWithCopy(), diagonal(), filled(), getColumnPackedCopy(), getMatrix(), getRowDimension(), getRowPackedCopy(), identity(), minus(), minusEquals(), mprint(), norm1(), normF(), normInf(), plus(), plusEquals(), power(), random(), times(), toHTML(), and transpose().
|
private |
Definition at line 60 of file Matrix.php.
Referenced by __construct(), arrayLeftDivide(), arrayLeftDivideEquals(), arrayRightDivide(), arrayRightDivideEquals(), arrayTimes(), arrayTimesEquals(), concat(), constructWithCopy(), diagonal(), filled(), getColumnDimension(), getColumnPackedCopy(), getMatrix(), getRowPackedCopy(), identity(), minus(), minusEquals(), mprint(), norm1(), normF(), normInf(), plus(), plusEquals(), power(), random(), times(), toHTML(), trace(), and transpose().