JAMA

# Class: Matrix Source Location: /PHPExcel/Shared/JAMA/Matrix.php
### Class Overview
| ### Variables $A | ### Methods __construct arrayLeftDivide arrayLeftDivideEquals arrayRightDivide arrayRightDivideEquals arrayTimes arrayTimesEquals checkMatrixDimensions chol concat cond constructWithCopy det diagonal eig filled get getArray getArrayCopy getColumnDimension getColumnPackedCopy getMatrix getMatrixByCol getMatrixByRow getRowDimension getRowPackedCopy identity inverse lu minus minusEquals mprint norm1 norm2 normF normInf packed plus plusEquals power qr random rank set setMatrix solve svd times toHTML trace transpose uminus
### Class Details [line 45] [ Top ] ### Class Variables #### $A = array() [line 53] Matrix storage #### Tags:
access: | public
Type: | array
[ Top ] ### Class Methods ### constructor __construct [line 77]
`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. #### Tags:
access: | public
[ Top ] ### method arrayLeftDivide [line 1071]
`Matrix arrayLeftDivide( Matrix $B)`
arrayLeftDivide Element-by-element Left division A / B #### Tags:
return: | Division result
access: | public
#### Parameters:
Matrix | $B | Matrix B
[ Top ] ### method arrayLeftDivideEquals [line 1108]
`Matrix arrayLeftDivideEquals( mixed $B)`
arrayLeftDivideEquals Element-by-element Left division Aij = Aij / Bij #### Tags:
return: | Matrix Aij
access: | public
#### Parameters:
mixed | $B | Matrix/Array
[ Top ] ### method arrayRightDivide [line 978]
`Matrix arrayRightDivide( Matrix $B)`
arrayRightDivide Element-by-element right division A / B #### Tags:
return: | Division result
access: | public
#### Parameters:
Matrix | $B | Matrix B
[ Top ] ### method arrayRightDivideEquals [line 1034]
`Matrix arrayRightDivideEquals( mixed $B)`
arrayRightDivideEquals Element-by-element right division Aij = Aij / Bij #### Tags:
return: | Matrix Aij
access: | public
#### Parameters:
mixed | $B | Matrix/Array
[ Top ] ### method arrayTimes [line 890]
`Matrix arrayTimes( mixed $B)`
arrayTimes Element-by-element multiplication Cij = Aij * Bij #### Tags:
return: | Matrix Cij
access: | public
#### Parameters:
mixed | $B | Matrix/Array
[ Top ] ### method arrayTimesEquals [line 927]
`Matrix arrayTimesEquals( mixed $B)`
arrayTimesEquals Element-by-element multiplication Aij = Aij * Bij #### Tags:
return: | Matrix Aij
access: | public
#### Parameters:
mixed | $B | Matrix/Array
[ Top ] ### method checkMatrixDimensions [line 414]
`boolean checkMatrixDimensions( [Matrix $B = null])`
checkMatrixDimensions Is matrix B the same size? #### Tags:
access: | public
#### Parameters:
Matrix | $B | Matrix B
[ Top ] ### method chol [line 1320]
`Matrix chol( )`
chol Cholesky decomposition #### Tags:
return: | Cholesky decomposition
access: | public
[ Top ] ### method concat [line 1285]
`Matrix concat( mixed $B)`
concat A = A & B #### Tags:
return: | Sum
access: | public
#### Parameters:
mixed | $B | Matrix/Array
[ Top ] ### method cond [line 678]
`ratio cond( )`
Matrix condition (2 norm) #### Tags:
return: | of largest to smallest singular value.
access: | public
[ Top ] ### method constructWithCopy [line 174]
`void constructWithCopy( double $A)`
constructWithCopy Construct a matrix from a copy of a 2-D array. #### Tags:
exception: | IllegalArgumentException All rows must have the same length
access: | public
#### Parameters:
double | $A | A[][] Two-dimensional array of doubles.
[ Top ] ### method det [line 1402]
`float det( )`
det Calculate determinant #### Tags:
return: | Determinant
access: | public
[ Top ] ### method diagonal [line 477]
`Matrix diagonal( [int $m = null], [int $n = null], [mixed $c = 1])`
diagonal Generate a diagonal matrix #### Tags:
return: | Diagonal matrix
access: | public
#### Parameters:
int | $m | Row dimension
int | $n | Column dimension
mixed | $c | Diagonal value
[ Top ] ### method eig [line 1353]
`Matrix eig( )`
eig Eigenvalue decomposition #### Tags:
return: | Eigenvalue decomposition
access: | public
[ Top ] ### method filled [line 495]
`Matrix filled( [int $m = null], [int $n = null], [int $c = 0])`
filled Generate a filled matrix #### Tags:
return: | Filled matrix
access: | public
#### Parameters:
int | $m | Row dimension
int | $n | Column dimension
int | $c | Fill constant
[ Top ] ### method get [line 252]
`mixed get( [int $i = null], [int $j = null])`
get Get the i,j-th element of the matrix. #### Tags:
return: | Element (int/float/double)
access: | public
#### Parameters:
int | $i | Row position
int | $j | Column position
[ Top ] ### method getArray [line 152]
`array getArray( )`
getArray #### Tags:
return: | Matrix array
access: | public
[ Top ] ### method getArrayCopy [line 162]
`array getArrayCopy( )`
getArrayCopy #### Tags:
return: | Matrix array copy
access: | public
[ Top ] ### method getColumnDimension [line 239]
`int getColumnDimension( )`
getColumnDimension #### Tags:
return: | Column dimension
access: | public
[ Top ] ### method getColumnPackedCopy [line 196]
`array getColumnPackedCopy( )`
getColumnPackedCopy Get a column-packed array #### Tags:
return: | Column-packed matrix array
access: | public
[ Top ] ### method getMatrix [line 267]
`Matrix getMatrix( int $i0, int $iF, int $j0, int $jF)`
getMatrix Get a submatrix #### Tags:
return: | Submatrix
access: | public
#### Parameters:
int | $i0 | Initial row index
int | $iF | Final row index
int | $j0 | Initial column index
int | $jF | Final column index
[ Top ] ### method getMatrixByCol [line 567]
`Matrix getMatrixByCol( [ $j0 = null], [ $jF = null], int $i0, int $iF)`
getMatrixByCol Get a submatrix by column index/range #### Tags:
return: | Submatrix
access: | public
#### Parameters:
int | $i0 | Initial column index
int | $iF | Final column index
| $j0 |
| $jF |
[ Top ] ### method getMatrixByRow [line 546]
`Matrix getMatrixByRow( [int $i0 = null], [int $iF = null])`
getMatrixByRow Get a submatrix by row index/range #### Tags:
return: | Submatrix
access: | public
#### Parameters:
int | $i0 | Initial row index
int | $iF | Final row index
[ Top ] ### method getRowDimension [line 229]
`int getRowDimension( )`
getRowDimension #### Tags:
return: | Row dimension
access: | public
[ Top ] ### method getRowPackedCopy [line 213]
`array getRowPackedCopy( )`
getRowPackedCopy Get a row-packed array #### Tags:
return: | Row-packed matrix array
access: | public
[ Top ] ### method identity [line 463]
`Matrix identity( [int $m = null], [int $n = null])`
identity Generate an identity matrix. #### Tags:
return: | Identity matrix
access: | public
#### Parameters:
int | $m | Row dimension
int | $n | Column dimension
[ Top ] ### method inverse [line 1391]
`Matrix inverse( )`
Matrix inverse or pseudoinverse. #### Tags:
return: | ... Inverse(A) if A is square, pseudoinverse otherwise.
access: | public
[ Top ] ### method lu [line 1331]
`Matrix lu( )`
lu LU decomposition #### Tags:
return: | LU decomposition
access: | public
[ Top ] ### method minus [line 803]
`Matrix minus( mixed $B)`
minus A - B #### Tags:
return: | Sum
access: | public
#### Parameters:
mixed | $B | Matrix/Array
[ Top ] ### method minusEquals [line 839]
`Matrix minusEquals( mixed $B)`
minusEquals A = A - B #### Tags:
return: | Sum
access: | public
#### Parameters:
mixed | $B | Matrix/Array
[ Top ] ### method mprint [line 1413]
`html mprint( $A, [ $format = "%01.2f"], [ $width = 2])`
Older debugging utility for backwards compatability. #### Tags:
return: | version of matrix
access: | public
#### Parameters:
| $A |
| $format |
| $width |
[ Top ] ### method norm1 [line 603]
`float norm1( )`
norm1 One norm #### Tags:
return: | Maximum column sum
access: | public
[ Top ] ### method norm2 [line 622]
`float norm2( )`
norm2 Maximum singular value #### Tags:
return: | Maximum singular value
access: | public
[ Top ] ### method normF [line 651]
`float normF( )`
normF Frobenius norm #### Tags:
return: | Square root of the sum of all elements squared
access: | public
[ Top ] ### method normInf [line 632]
`float normInf( )`
normInf Infinite norm #### Tags:
return: | Maximum row sum
access: | public
[ Top ] ### method packed [line 533]
`array packed( )`
packed Alias for getRowPacked #### Tags:
return: | Packed array
access: | public
[ Top ] ### method plus [line 717]
`Matrix plus( mixed $B)`
plus A + B #### Tags:
return: | Sum
access: | public
#### Parameters:
mixed | $B | Matrix/Array
[ Top ] ### method plusEquals [line 753]
`Matrix plusEquals( mixed $B)`
plusEquals A = A + B #### Tags:
return: | Sum
access: | public
#### Parameters:
mixed | $B | Matrix/Array
[ Top ] ### method power [line 1235]
`Matrix power( mixed $B)`
power A = A ^ B #### Tags:
return: | Sum
access: | public
#### Parameters:
mixed | $B | Matrix/Array
[ Top ] ### method qr [line 1342]
`Matrix qr( )`
qr QR decomposition #### Tags:
return: | QR decomposition
access: | public
[ Top ] ### method random [line 512]
`Matrix random( [int $m = null], [int $n = null], [ $a = RAND_MIN], [ $b = RAND_MAX])`
random Generate a random matrix #### Tags:
return: | Random matrix
access: | public
#### Parameters:
int | $m | Row dimension
int | $n | Column dimension
| $a |
| $b |
[ Top ] ### method rank [line 667]
`effective rank( )`
Matrix rank #### Tags:
return: | numerical rank, obtained from SVD.
access: | public
[ Top ] ### method set [line 437]
`mixed set( [int $i = null], [int $j = null], [mixed $c = null])`
set Set the i,j-th element of the matrix. #### Tags:
return: | Element (int/float/double)
access: | public
#### Parameters:
int | $i | Row position
int | $j | Column position
mixed | $c | Int/float/double value
[ Top ] ### method setMatrix [line 371]
`void setMatrix( int $i0, int $j0, mixed $S)`
setMatrix Set a submatrix #### Tags:
access: | public
#### Parameters:
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
[ Top ] ### method solve [line 1375]
`Matrix solve( Matrix $B)`
Solve A*X = B. #### Tags:
return: | ... Solution if A is square, least squares solution otherwise
access: | public
#### Parameters:
Matrix | $B | Right hand side
[ Top ] ### method svd [line 1364]
`Singular svd( )`
svd Singular value decomposition #### Tags:
return: | value decomposition
access: | public
[ Top ] ### method times [line 1144]
`Matrix times( mixed $n)`
times Matrix multiplication #### Tags:
return: | Product
access: | public
#### Parameters:
mixed | $n | Matrix/Array/Scalar
[ Top ] ### method toHTML [line 1433]
`Output toHTML( [ $width = 2])`
Debugging utility. #### Tags:
return: | HTML representation of matrix
access: | public
#### Parameters:
| $width |
[ Top ] ### method trace [line 690]
`float trace( )`
trace Sum of diagonal elements #### Tags:
return: | Sum of diagonal elements
access: | public
[ Top ] ### method transpose [line 586]
`Matrix transpose( )`
transpose Tranpose matrix #### Tags:
return: | Transposed matrix
access: | public
[ Top ] ### method uminus [line 706]
`Matrix uminus( )`
uminus Unary minus matrix -A #### Tags:
return: | Unary minus matrix
access: | public
[ Top ] Documentation generated on Tue, 01 Jun 2010 17:05:12 +0200 by phpDocumentor 1.4.3