JAMA

# Class: Matrix Source Location: /PHPExcel/Shared/JAMA/Matrix.php
### Class Overview
| ### Variables $A $m $n | ### 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 38] [ Top ] ### Class Variables #### $A = array() [line 46] Matrix storage Matrix storage #### Tags:
access: | public
Type: | array
[ Top ] #### $m = [line 54] Matrix row dimension Matrix row dimension #### Tags:
access: | private
Type: | int
[ Top ] #### $n = [line 62] Matrix column dimension Matrix column dimension #### Tags:
access: | private
Type: | int
[ Top ] ### Class Methods ### constructor __construct [line 70]
`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. 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 1064]
`Matrix arrayLeftDivide( Matrix $B)`
arrayLeftDivide arrayLeftDivide Element-by-element Left division A / B #### Tags:
return: | Division result
access: | public
#### Parameters:
Matrix | $B | Matrix B
[ Top ] ### method arrayLeftDivideEquals [line 1101]
`Matrix arrayLeftDivideEquals( mixed $B)`
arrayLeftDivideEquals arrayLeftDivideEquals Element-by-element Left division Aij = Aij / Bij #### Tags:
return: | Matrix Aij
access: | public
#### Parameters:
mixed | $B | Matrix/Array
[ Top ] ### method arrayRightDivide [line 971]
`Matrix arrayRightDivide( Matrix $B)`
arrayRightDivide arrayRightDivide Element-by-element right division A / B #### Tags:
return: | Division result
access: | public
#### Parameters:
Matrix | $B | Matrix B
[ Top ] ### method arrayRightDivideEquals [line 1027]
`Matrix arrayRightDivideEquals( mixed $B)`
arrayRightDivideEquals arrayRightDivideEquals Element-by-element right division Aij = Aij / Bij #### Tags:
return: | Matrix Aij
access: | public
#### Parameters:
mixed | $B | Matrix/Array
[ Top ] ### method arrayTimes [line 883]
`Matrix arrayTimes( mixed $B)`
arrayTimes arrayTimes Element-by-element multiplication Cij = Aij * Bij #### Tags:
return: | Matrix Cij
access: | public
#### Parameters:
mixed | $B | Matrix/Array
[ Top ] ### method arrayTimesEquals [line 920]
`Matrix arrayTimesEquals( mixed $B)`
arrayTimesEquals arrayTimesEquals Element-by-element multiplication Aij = Aij * Bij #### Tags:
return: | Matrix Aij
access: | public
#### Parameters:
mixed | $B | Matrix/Array
[ Top ] ### method checkMatrixDimensions [line 407]
`boolean checkMatrixDimensions( [Matrix $B = null])`
checkMatrixDimensions checkMatrixDimensions Is matrix B the same size? #### Tags:
access: | public
#### Parameters:
Matrix | $B | Matrix B
[ Top ] ### method chol [line 1313]
`Matrix chol( )`
chol chol Cholesky decomposition #### Tags:
return: | Cholesky decomposition
access: | public
[ Top ] ### method concat [line 1278]
`Matrix concat( mixed $B)`
concat concat A = A & B #### Tags:
return: | Sum
access: | public
#### Parameters:
mixed | $B | Matrix/Array
[ Top ] ### method cond [line 671]
`ratio cond( )`
Matrix condition (2 norm) Matrix condition (2 norm) #### Tags:
return: | of largest to smallest singular value.
access: | public
[ Top ] ### method constructWithCopy [line 167]
`void constructWithCopy( double $A)`
constructWithCopy Construct a matrix from a copy of a 2-D array. 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 1395]
`float det( )`
det det Calculate determinant #### Tags:
return: | Determinant
access: | public
[ Top ] ### method diagonal [line 470]
`Matrix diagonal( [int $m = null], [int $n = null], [mixed $c = 1])`
diagonal 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 1346]
`Matrix eig( )`
eig eig Eigenvalue decomposition #### Tags:
return: | Eigenvalue decomposition
access: | public
[ Top ] ### method filled [line 488]
`Matrix filled( [int $m = null], [int $n = null], [int $c = 0])`
filled 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 245]
`mixed get( [int $i = null], [int $j = null])`
get Get the i,j-th element of the matrix. 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 145]
`array getArray( )`
getArray getArray #### Tags:
return: | Matrix array
access: | public
[ Top ] ### method getArrayCopy [line 155]
`array getArrayCopy( )`
getArrayCopy getArrayCopy #### Tags:
return: | Matrix array copy
access: | public
[ Top ] ### method getColumnDimension [line 232]
`int getColumnDimension( )`
getColumnDimension getColumnDimension #### Tags:
return: | Column dimension
access: | public
[ Top ] ### method getColumnPackedCopy [line 189]
`array getColumnPackedCopy( )`
getColumnPackedCopy getColumnPackedCopy Get a column-packed array #### Tags:
return: | Column-packed matrix array
access: | public
[ Top ] ### method getMatrix [line 260]
`Matrix getMatrix( int $i0, int $iF, int $j0, int $jF)`
getMatrix 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 560]
`Matrix getMatrixByCol( [ $j0 = null], [ $jF = null], int $i0, int $iF)`
getMatrixByCol 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 539]
`Matrix getMatrixByRow( [int $i0 = null], [int $iF = null])`
getMatrixByRow 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 222]
`int getRowDimension( )`
getRowDimension getRowDimension #### Tags:
return: | Row dimension
access: | public
[ Top ] ### method getRowPackedCopy [line 206]
`array getRowPackedCopy( )`
getRowPackedCopy getRowPackedCopy Get a row-packed array #### Tags:
return: | Row-packed matrix array
access: | public
[ Top ] ### method identity [line 456]
`Matrix identity( [int $m = null], [int $n = null])`
identity Generate an identity matrix. identity Generate an identity matrix. #### Tags:
return: | Identity matrix
access: | public
#### Parameters:
int | $m | Row dimension
int | $n | Column dimension
[ Top ] ### method inverse [line 1384]
`Matrix inverse( )`
Matrix inverse or pseudoinverse. Matrix inverse or pseudoinverse. #### Tags:
return: | ... Inverse(A) if A is square, pseudoinverse otherwise.
access: | public
[ Top ] ### method lu [line 1324]
`Matrix lu( )`
lu lu LU decomposition #### Tags:
return: | LU decomposition
access: | public
[ Top ] ### method minus [line 796]
`Matrix minus( mixed $B)`
minus minus A - B #### Tags:
return: | Sum
access: | public
#### Parameters:
mixed | $B | Matrix/Array
[ Top ] ### method minusEquals [line 832]
`Matrix minusEquals( mixed $B)`
minusEquals minusEquals A = A - B #### Tags:
return: | Sum
access: | public
#### Parameters:
mixed | $B | Matrix/Array
[ Top ] ### method mprint [line 1406]
`html mprint( $A, [ $format = "%01.2f"], [ $width = 2])`
Older debugging utility for backwards compatability. Older debugging utility for backwards compatability. #### Tags:
return: | version of matrix
access: | public
#### Parameters:
| $A |
| $format |
| $width |
[ Top ] ### method norm1 [line 596]
`float norm1( )`
norm1 norm1 One norm #### Tags:
return: | Maximum column sum
access: | public
[ Top ] ### method norm2 [line 615]
`float norm2( )`
norm2 norm2 Maximum singular value #### Tags:
return: | Maximum singular value
access: | public
[ Top ] ### method normF [line 644]
`float normF( )`
normF normF Frobenius norm #### Tags:
return: | Square root of the sum of all elements squared
access: | public
[ Top ] ### method normInf [line 625]
`float normInf( )`
normInf normInf Infinite norm #### Tags:
return: | Maximum row sum
access: | public
[ Top ] ### method packed [line 526]
`array packed( )`
packed packed Alias for getRowPacked #### Tags:
return: | Packed array
access: | public
[ Top ] ### method plus [line 710]
`Matrix plus( mixed $B)`
plus plus A + B #### Tags:
return: | Sum
access: | public
#### Parameters:
mixed | $B | Matrix/Array
[ Top ] ### method plusEquals [line 746]
`Matrix plusEquals( mixed $B)`
plusEquals plusEquals A = A + B #### Tags:
return: | Sum
access: | public
#### Parameters:
mixed | $B | Matrix/Array
[ Top ] ### method power [line 1228]
`Matrix power( mixed $B)`
power power A = A ^ B #### Tags:
return: | Sum
access: | public
#### Parameters:
mixed | $B | Matrix/Array
[ Top ] ### method qr [line 1335]
`Matrix qr( )`
qr qr QR decomposition #### Tags:
return: | QR decomposition
access: | public
[ Top ] ### method random [line 505]
`Matrix random( [int $m = null], [int $n = null], [ $a = RAND_MIN], [ $b = RAND_MAX])`
random 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 660]
`effective rank( )`
Matrix rank Matrix rank #### Tags:
return: | numerical rank, obtained from SVD.
access: | public
[ Top ] ### method set [line 430]
`mixed set( [int $i = null], [int $j = null], [mixed $c = null])`
set Set the i,j-th element of the matrix. 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 364]
`void setMatrix( int $i0, int $j0, mixed $S)`
setMatrix 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 1368]
`Matrix solve( Matrix $B)`
Solve A*X = 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 1357]
`Singular svd( )`
svd svd Singular value decomposition #### Tags:
return: | value decomposition
access: | public
[ Top ] ### method times [line 1137]
`Matrix times( mixed $n)`
times times Matrix multiplication #### Tags:
return: | Product
access: | public
#### Parameters:
mixed | $n | Matrix/Array/Scalar
[ Top ] ### method toHTML [line 1426]
`Output toHTML( [ $width = 2])`
Debugging utility. Debugging utility. #### Tags:
return: | HTML representation of matrix
access: | public
#### Parameters:
| $width |
[ Top ] ### method trace [line 683]
`float trace( )`
trace trace Sum of diagonal elements #### Tags:
return: | Sum of diagonal elements
access: | public
[ Top ] ### method transpose [line 579]
`Matrix transpose( )`
transpose transpose Tranpose matrix #### Tags:
return: | Transposed matrix
access: | public
[ Top ] ### method uminus [line 699]
`Matrix uminus( )`
uminus uminus Unary minus matrix -A #### Tags:
return: | Unary minus matrix
access: | public
[ Top ] Documentation generated on Mon, 11 Jan 2010 08:12:06 +0100 by phpDocumentor 1.4.1