MTMatrix

Subclasses of class Matrix are: Matrix44 (4.3), Matrix53 (4.4) and Vector (4.1).

Methods:

* read-only access
-(NSString*)description returns textual representation of this matrix

in the form: [[first row]...[last row]]

-(NSString*)toString same as -(NSString*)description
-(int)cols returns number of rows
-(int)rows returns number of cols
-(BOOL)isTransposed true if this matrix is transposed (rows and cols exchanged)
* getter
-(double)atRow:(int)row col:(int)col returns value at row/col
-(void)linearizeTo:(double*)mat maxElements:(int)count puts all values in row first order into the array of doubles mat, at most count elements.
-(id)matrixOfColumn:(int)col returns a nx1 matrix of all values in column col (start counting at 0)
* setter
-(id)atRow:(int)row col:(int)col value:(double)v sets value v at row/col
-(id)atRow:(int)row col:(int)col add:(double)v add value v to value at element row/col (in place!)
-(id)atRow:(int)row col:(int)col subtract:(double)v subtract value v from value at element row/col (in place!)
-(id)atRow:(int)row col:(int)col multiplyBy:(double)v multiply element at row/col with value v (in place!)
-(id)atRow:(int)row col:(int)col divideBy:(double)v divide element at row/col with value v (in place!)
* matrix operations
-(id)transpose transposes this matrix
-(double)sum calculates the sum of all elements
-(id)square squares every element (in place!)
-(id)addScalar: (double)scal adds a scalar to every element (in place!)
-(id)substractScalar: (double)scal subtracts scalar from every element (in place!)
-(id)multiplyByScalar: (double)scal multiplies every element by scalar (in place!)
-(id)divideByScalar: (double)scal divides every element by scalar (in place!)
-(id)madd: (MTMatrix*)m2 returns the resulting matrix from adding matrix m2 to this one
-(id)msubtract: (MTMatrix*)m2 returns the resulting matrix from subtracting matrix m2 from this one
-(id)mmultiply: (MTMatrix*)m2 pairwise multiplies elements in the matrix and returns the resulting matrix
-(id)x: (MTMatrix*)m2 returns the resulting matrix of matrix multiplication of this with m2
-(MTMatrix*)centerOfMass returns a 1xn matrix with the weighted sum of all values per columns
-(MTMatrix*)jacobianDiagonalizeWithMaxError: (double)error diagnoalises the matrix to given error, and returns matrix of eigenvectors in columns, eigenvalue in first row of column
* creation
+(MTMatrix*)matrixWithRows:(int)row cols:(int)col create a new matrix with rows/cols allocated
-(id)initFromString:(NSString*)str reinitialise the matrix from parsing the string
-(id)setRows:(int)row cols:(int)col resets the number of rows/cols, this destroys the content of the matrix!

moltalk@moltalk.org      version of this document: V3.0