[SML Overview]

Class SMLXMatrix

#include "smlxmatrix.h"

SMLXMatrix class encapsulates resizable matrix object. Matrix elements are floating-point numbers.

Class includes methods and data which allow to form resizable matrix, multiply two matrices, transpose them, add, subtract, copy, initialize, find maximum absolute value among elements, and others.


Public Interface

Constructors and Destructor

constructors

destructor

Access

Get

MaxAbs

TMat

Data

operator[]

Index

Size

SMLMatrix3f&

SMLMatrix4f&

ncols

nrows

Export

Modifiers

Invert

Identity

IdentityMinus

Negate

Resize

Set

Swap

Zero

Transpose

const Operations

operator*

operator+

operator-

Transform

TransformTransposed

modifiable Operations

NSub

Sub

Add

Cross

Scale

operator*=

operator+=

operator-=

operator=

Transformations

LUDecomposition

SVDecomposition

Predicats

IsDefined

MarkAsDefined

MarkAsUndefined

Others

Output


SMLLIBENTRY SMLXMatrix();

Discussion

Default SMLXMatrix object constructor. Creates matrix of size 0X0.

Example:

SMLXMatrix A;

Parameters

No.

[top]


SMLLIBENTRY SMLXMatrix(const SMLXMatrix& B);

Discussion

SMLXMatrix object copy-constructor.

Example:

SMLXMatrix A(6, 6); A.Identity();
SMLXMatrix B(A);

Parameters

B - reference to SMLXMatrix object to copy.

[top]


SMLLIBENTRY SMLXMatrix(short nrow, short ncol);

Discussion

SMLXMatrix creates matrix with nrow x ncol size.

Example:

SMLXMatrix A(6, 6);

Parameters

nrow - number of matrix rows.

ncol - number of matrix columns.

[top]


SMLLIBENTRY SMLXMatrix(short nrow, short ncol, const float* initialValues);

Discussion

SMLXMatrix creates matrix with nrow x ncol size and sets matrix elements to values pointed by initialValues. It is assumed that array initialValues contains matrix elements starting from 1st row and till the last row, i.e. data[i][j] = initialValues[i * ncol + j];

Example:

float src[4] = {1, 2, 3, 4};
SMLXMatrix A(2, 2, src);

Parameters

nrow - number of matrix rows.

ncol - number of matrix columns.

initialValues - pointer to initial values. Initial values should be stored in row based manner (first row is placed first, etc.).

[top]


SMLLIBENTRY explicit SMLXMatrix(const SMLMatrix3f& m33);

Discussion

Explicit SMLXMatrixobject constructor. Constructs 3x3 matrix and initializes it with corresponding values of SMLMatrix3f object.

Example:

float src[9] = {1,2,3,4,5,6,7,8,9};
SMLMatrix3f A(src);
SMLXMatrix B(A);

Parameters

m33 - reference to SMLMatrix3f object.

[top]


SMLLIBENTRY explicit SMLXMatrix(const SMLMatrix4f& m44);

Discussion

Explicit SMLXMatrixobject constructor. Constructs 4x4 matrix and initializes it with corresponding values of SMLMatrix4f object.

Example:

float src[16] = {1,2,3,4,5,6,7,8,9,2,5,3,7,8,3,9};
SMLMatrix4f A(src);
SMLXMatrix B(A);

Parameters

m44 - reference to SMLMatrix4f object.

[top]


SMLLIBENTRY ~SMLXMatrix();

Discussion

SMLXMatrix object destructor.

Parameters

No.

[top]


SMLLIBENTRY float Get(int i, int j) const;

Discussion

Access to specified matrix element, lying on the intersection of i-th row and j-th column.

Example:

float element;
float src[4] = {1, 2, 3, 4};
SMLXMatrix A(2, 2, src);
element = A.Get(1, 1); // element = 4

Parameters

i - row index.

j - column index.

Return Value

Matrix element value.

[top]


SMLLIBENTRY float MaxAbs() const;

Discussion

Finds maximum absolute value among matrix elements.

Example:

float maEl;
float src[4] = {-1, 2, -5, 4};
SMLXMatrix A(2, 2, src);
maEl = A.MaxAbs(); // maEl = -5

Parameters

No.

Return Value

Maximum absolute value of all matrix elements.

[top]


SMLLIBENTRY float* Data();

SMLLIBENTRY const float* Data() const;

Discussion

Access matrix data.

Example:

float *ptrData;
float src[3] = {-1, 3, 4};
SMLXMatrix A(1, 3, src);
ptrData = A.Data(); // ptrData[1] = 3

Parameters

No.

Return Value

Returns a pointer to an array storing matrix elements in row-based manner.

[top]


SMLLIBENTRY float* operator[](int i);

SMLLIBENTRY const float* operator[](int i) const;

Discussion

Method is an overloaded operator-function. Access to i-th row.

Example:

float *temp;
float src[6] = {1, 0, 2, -1, 3, 4};
SMLXMatrix A(3, 2, src);
temp = A[2]; // temp[0] = 3

Parameters

i - matrix row.

Return Value

Returns pointer to an array storing i matrix row.

[top]


SMLLIBENTRY int Index(int i, int j) const;

Discussion

Calculates an index of element specified by (i , j) in an array storing matrix elements. (See method Data())

Example:

int ind;
float src[6] = {1, 0, 2, -1, 3, 4};
SMLXMatrix A(3, 2, src);
ind = A.Index(2,1); // ind = 5

Parameters

i - matrix row in which element resides.

j - matrix column in which element resides.

Return Value

Returns matrix element index in matrix data array.

[top]


SMLLIBENTRY int Size() const;

Discussion

Return size of this matrix (# of rows * # of columns).

Example:

int sz;
float src[6] = {1, 0, 2, -1, 3, 4};
SMLXMatrix A(3, 2, src);
sz = A.Size(); // sz = 6

Parameters

No.

Return Value

Size of this matrix.

[top]


SMLLIBENTRY operator const SMLMatrix3f&() const;

Discussion

Method is an overloaded operator-function cast to SMLMatrix3f type. It is assumed, that current matrix is 3x3 matrix.

Example:

float src[9] = {1,2,3,4,5,6,7,8,9};
SMLXMatrix A(3, 3, src);
SMLMatrix3f B(A);

Parameters

No.

Return Value

Reference to SMLMatrix3f object.

[top]


SMLLIBENTRY operator const SMLMatrix4f&() const;

Discussion

Method is an overloaded operator-function cast to SMLMatrix4f type. It is assumed, that current matrix is 4x4 matrix.

Example:

float src[16] = {1,2,3,4,5,6,7,8,9,2,5,3,7,8,3,9};
SMLXMatrix A(4, 4, src);
SMLMatrix4f B(A);

Parameters

No.

Return Value

Reference to SMLMatrix4f object.

[top]


SMLLIBENTRY short ncols() const;

Discussion

Returns number of matrix columns.

Example:

short clmn;
float src[6] = {1, 0, 2, -1, 3, 4};
SMLXMatrix A(3, 2, src);
clmn = A.ncols(); // clmn = 2

Parameters

No.

Return Value

Number of matrix columns.

[top]


SMLLIBENTRY short nrows() const;

Discussion

Returns number of matrix rows.

Example:

short rws;
float src[6] = {1, 0, 2, -1, 3, 4};
SMLXMatrix A(3, 2, src);
rws = A.nrows(); // rws = 3

Parameters

No.

Return Value

Number of matrix rows.

[top]


SMLLIBENTRY void Export(float* dst) const;

Discussion

Exports matrix data to an array pointed by dst.

Example:

float dst[6];
float src[6] = {1, 0, 2, -1, 3, 4};
SMLXMatrix A(3, 2, src);
A.Export(dst); // dst[i] = src[i], i=0...5

Parameters

dst - pointer to destination array.

Return Value

No.

[top]


SMLLIBENTRY SMLXTmpMatrix& TMat() const;

Discussion

Creates SMLXTmpMatrix object from this SMLXMatrix object (memory is allocated from the static pool).

Example:

SMLXMatrix A(3, 2);
SMLXTmpMatrix B = A.TMat();

Parameters

No.

Return Value

Reference to the created SMLXTmpMatrix object.

[top]


SMLLIBENTRY static SMLXTmpMatrix& TMat(const SMLXMatrix& A);

Discussion

Creates SMLXTmpMatrix object from object A SMLXMatrix class with sizes of object A (memory is allocated from the static pool).

Example:

SMLXMatrix A(3, 2);
SMLXTmpMatrix B(A);

Parameters

A - reference to SMLXMatrix object.

Return Value

Reference to SMLXTmpMatrix object.

[top]


SMLLIBENTRY bool Invert();

Discussion

Inverts this matrix.

Example:

float src[4] = {2, 0, 0.5, 1};
SMLXMatrix A(2, 2, src);
A.Invert(); // inverse matrix = {0.5, 0, -0.25, 1}

Parameters

No.

Return Value

true, if matrix was inverted.

false, otherwise.

[top]


SMLLIBENTRY void Identity();

Discussion

Sets main diagonal elements of matrix to 1 and all others to 0.

Example:

SMLXMatrix A(2, 2);
A.Identity(); // matrix = {1, 0, 0, 1}

Parameters

No.

Return Value

No.

[top]


SMLLIBENTRY void Identity(short nrow);

Discussion

Resizes matrix to nrow x nrow and sets main diagonal elements of matrix to 1 and all others to 0.

Example:

SMLXMatrix A();
A.Identity(2); // matrix = {1, 0, 0, 1}

Parameters

nrow - number of matrix rows.

Return Value

No.

[top]


SMLLIBENTRY void Identity(short nrow, short ncol);

Discussion

Resizes matrix to nrow x ncol and set main diagonal elements of matrix to 1 and all others to 0.

Example:

SMLXMatrix A();
A.Identity(2, 3); // matrix = {1, 0, 0, 0, 1, 0}

Parameters

nrow - number of matrix rows.

ncol - number of matrix columns.

Return Value

No.

[top]


SMLLIBENTRY void IdentityMinus();

Discussion

This matrix is replaced with matrix (E - *this), where E - is appropriate identity matrix.

Example:

float src[4] = {1, 0, 2, -1};
SMLXMatrix A(2, 2, src);
A.IdentityMinus(); // matrix = {0, 0, -2, 2}

Parameters

No.

Return Value

No.

[top]


SMLLIBENTRY void Negate();

Discussion

Negates all matrix elements.

Example:

float src[4] = {1, 0, 2, -1};
SMLXMatrix A(2, 2, src);
A.Negate(); // matrix = {-1, 0, -2, 1}

Parameters

No.

Return Value

No.

[top]


SMLLIBENTRY void Resize(const SMLXMatrix& A);

Discussion

Resizes this matrix to A sizes.

Example:

SMLXMatrix A(2, 2), B(4, 4);
A.Resize(B); // resize 2x2 to 4x4

Parameters

A - reference to SMLXMatrix object.

Return Value

No.

[top]


SMLLIBENTRY void Resize(short nrow, short ncol);

Discussion

Resizes this matrix to nrow x ncol.

Example:

SMLXMatrix A(2, 2);
A.Resize(4, 4); // resize 2x2 to 4x4

Parameters

nrow - number of matrix row.

ncol - number of matrix column.

Return Value

No.

[top]


SMLLIBENTRY void Set(float initialValue);

Discussion

Set all matrix elements to initialValue.

Example:

SMLXMatrix A(2, 2); A.Set(1.0f); // set all matrix elements to 1.0

Parameters

initialValue - initialization value.

Return Value

No.

[top]


SMLLIBENTRY void Swap(const SMLXMatrix& A);

Discussion

Swap A and this SMLXMatrix objects. After this operation, A will have matrix data of this matrix, and this matrix will have A's data.

Example:

SMLXMatrix A(2, 2); A.Set(1.0f);
SMLXMatrix B(2, 2); A.Set(2.0f);
A.Swap(B);

Parameters

A - reference to SMLXMatrix object to be swapped.

Return Value

No.

[top]


SMLLIBENTRY void Zero();

Discussion

Set all matrix elements to 0.

Example:

SMLXMatrix A(2, 2); A.Zero();

Parameters

No.

Return Value

No.

[top]


SMLLIBENTRY void Transpose();

Discussion

Transpose this matrix.

Example:

float src[4] = {1, 0, 2, -1};
SMLXMatrix A(2, 2, src);
A.Transpose(); // matrix = {1, 2, 0, -1}

Parameters

No.

Return Value

No.

[top]


inline SMLXTransposedMatrix & Transpose(const SMLXMatrix& m);

Discussion

Global method, which casts matrix m to class SMLXTransposedMatrix. Actual transposition is not performed, but next multiplication operator will know, that it is using transposed matrix.

Example:

SMLXMatrixA(6, 6); A.Identity();
SMLXMatrixB(6, 6); B.Set(1.23f);
SMLXMatrix C;
C = A * Transpose(B);

Parameters

m - reference to SMLXMatrix object to be transposed.

Return Value

Reference to SMLXTransposedMatrix representing Transpose(m).

[top]


SMLLIBENTRY void Transpose(const SMLXMatrix& m);

Discussion

Replaces this matrix with transposed matrix m.

Example:

float src[4] = {1, 0, 2, -1};
SMLXMatrix A(2, 2, src), B(2, 2);
B.Transpose(A); // matrix B = {1, 2, 0, -1}

Parameters

m - reference to SMLXMatrix object to be transposed.

Return Value

No.

[top]


SMLLIBENTRY SMLXTmpMatrix& operator*(float scale) const;

Discussion

Method is an overloaded operator-function. It multiplies all matrix elements on parameter scale.

Example:

float src[4] = {1, 0, 2, -1};
SMLXMatrix A(2, 2, src);
SMLXTmpMatrix TM = A * 2.05f;

Parameters

scale - multiplier.

Return Value

Reference to SMLXTmpMatrix object, which is equal to product of this matrix and number scale.

[top]


SMLLIBENTRY SMLXTmpMatrix& operator+(SMLXTmpMatrix& B) const;

Discussion

Method is an overloaded operator-function. It computes sum of two matrices (this SMLXMatrix object and matrix B) and returns a sum as a temporary matrix object.

Example:

float src1[4] = {1, 0, 2, -1};
float src2[4] = {3, 1, -1, -4};
SMLXMatrix A(2, 2, src1);
SMLXMatrix B(2, 2, src2); SMLXTmpMatrix tb = B.TMat();
SMLXTmpMatrix TM = A + tb;

Parameters

B - reference to SMLXTmpMatrix to add to this SMLXMatrix object.

Return Value

Reference to sum SMLXTmpMatrix object.

[top]


SMLLIBENTRY SMLXTmpMatrix& operator-(SMLXTmpMatrix& B) const;

Discussion

Method is an overloaded operator-function. It computes difference of two matrices: this and matrix B and returns a difference as a temporary matrix object.

Example:

float src1[4] = {1, 0, 2, -1};
float src2[4] = {3, 1, -1, -4};
SMLXMatrix A(2, 2, src1);
SMLXMatrix B(2, 2, src2); SMLXTmpMatrix tb = B.TMat();
SMLXTmpMatrix TM = A - tb;

Parameters

B - reference to SMLXTmpMatrix, which is subtracted from this SMLXMatrix object.

Return Value

Reference to difference SMLXTmpMatrix object.

[top]


SMLLIBENTRY void Transform(SMLXSpatialVector const& A, SMLXSpatialVector& B) const;

Discussion

Transforms spatial vector A (SMLXSpatialVector object) by this matrix (multiplies matrix by vector). Result is assigned to vector B.

Example:

//create and initialize transform matrix A and spatial vector svB, create spatial vector svC
...
A.Transform(svB, svC);

Parameters

A - reference to SMLXSpatialVector object.

B - reference to SMLXSpatialVector object (transformed vector).

Return Value

No.

[top]


SMLLIBENTRY void TransformTransposed(SMLXSpatialVector const& A, SMLXSpatialVector& B) const;

Discussion

Transform spatial vector A (SMLXSpatialVector object) with transpose of this matrix.

Example:

//create and initialize transform matrix A and spatial vector svB, create spatial vector svC
...
A.TransformTransposed(svB, svC);

Parameters

A - reference to SMLXSpatialVector object.

B - reference to SMLXSpatialVector object (transformed vector).

Return Value

No.

[top]


SMLLIBENTRY void Mult(const SMLXMatrix& A, const SMLXMatrix& B, short Atranspose, short Btranspose);

Discussion

Method computes product of matrices of objects A and B. This product depends on the value of parameters Atranspose and Btranspose. If parameter is zero, the corresponding matrix is not transposed. If parameter is not 0, the corresponding matrix is transposed. Result in this.

Example:

//create and initialize matrix A and matrix B
...
C.Mul(A, B, 0, 1); //multiplication matrix A and transposed matrix B

Parameters

A - reference to SMLXMatrix object.

B - reference to SMLXMatrix object.

Atranspose - flag, which shows if the method uses transposed matrix A (!= 0) or not (0).

Btranspose - flag, which shows if the method uses transposed matrix B (!= 0) or not (0).

Return Value

No.

[top]


SMLLIBENTRY void NSub(const SMLXMatrix& B);

Discussion

Subtracts this matrix from matrix B. Result is assigned to this.

Example:

float src1[4] = {1, 0, 2, -1};
float src2[4] = {3, 1, -1, -4};
SMLXMatrix A(2, 2, src1), B(2, 2, src2);
A.NSub(B); // A = B - A

Parameters

B - reference to SMLXMatrix object.

Return Value

No.

[top]


SMLLIBENTRY void Sub(const SMLXMatrix& B);

Discussion

Subtract matrix B from this matrix. Result is assigned to this.

Example:

float src1[4] = {1, 0, 2, -1};
float src2[4] = {3, 1, -1, -4};
SMLXMatrix A(2, 2, src1), B(2, 2, src2);
A.Sub(B); // A = A - B

Parameters

B - reference to SMLXMatrix object.

Return Value

No.

[top]


SMLLIBENTRY void Add(const SMLXMatrix& B);

Discussion

Adds matrix B to this. Result is assigned to this.

Example:

float src1[4] = {1, 0, 2, -1};
float src2[4] = {3, 1, -1, -4};
SMLXMatrix A(2, 2, src1), B(2, 2, src2);
A.Add(B); // A = A + B

Parameters

B - reference to SMLXMatrix object.

Return Value

No.

[top]


SMLLIBENTRY void Cross(const SMLVec3f& V);

Discussion

Creates matrix cross operator for vector V. Result is assigned to this (see SMLMatrix3f::Cross).

Example:

float src[9] = {1, 0, 2, -1, 2, 4, 1, -4, 0}; SMLXMatrix A(3, 3, src);
SMLVec3f B(2, 4, 6);
A.Cross(B);

Parameters

V -reference to SMLVec3f object.

Return Value

No.

[top]


SMLLIBENTRY void Scale(float scale);

Discussion

Computes product of matrix and parameter scale. Result is assigned to this.

Example:

float src[4] = {1, 0, 2, -1}; SMLXMatrix A(2, 2, src); 
A.Scale(2.13f); // A = A * 2.13

Parameters

scale - multiplier.

Return Value

No.

[top]


SMLLIBENTRY void operator*=(float scale);

Discussion

Method is an overloaded operator-function. It computes product of matrix and parameter scale. Result is assigned to this.

Example:

float src[4] = {1, 0, 2, -1}; SMLXMatrix A(2, 2, src); 
A *= 2.13f; // A = A * 2.13

Parameters

scale - multiplier.

Return Value

No.

[top]


SMLLIBENTRY void operator+=(const SMLXMatrix& B);

Discussion

Method is an overloaded operator-function. It computes sum of two matrices (this with matrix B). Result is assigned to this.

Example:

float src1[4] = {1, 0, 2, -1};
float src2[4] = {3, 1, -1, -4};
SMLXMatrix A(2, 2, src1), SMLXMatrix B(2, 2, src2);
A += B; // A = A + B

Parameters

B - reference to SMLXMatrix, which is added to this SMLXMatrix object..

Return Value

No.

[top]


SMLLIBENTRY void operator-=(const SMLXMatrix& B);

Discussion

Method is an overloaded operator-function. It computes difference of two matrices (this and matrix B). Result is assigned to this.

Example:

float src1[4] = {1, 0, 2, -1};
float src2[4] = {3, 1, -1, -4};
SMLXMatrix A(2, 2, src1), SMLXMatrix B(2, 2, src2);
A -= B; // A = A - B

Parameters

B - reference to SMLXMatrix, which is subtracted to this SMLXMatrix object.

Return Value

No.

[top]


SMLLIBENTRY void operator=(const SMLXMatrix& B);

Discussion

Method is an overloaded operator-function. Initializes this SMLXMatrix object with data and sizes of matrix B.

Example:

float src[4] = {1, 0, 2, -1}; SMLXMatrix A(2, 2, src), B;
B = A;

Parameters

B - reference to using for initialization SMLXMatrix object.

Return Value

No.

[top]


SMLLIBENTRY void operator=(const SMLXTmpMatrix& B);

Discussion

Method is an overloaded operator-function. Initializes this SMLXMatrix object with data and sizes of matrix B. Method is using fast Swap operation.

Example:

float src[4] = {1, 0, 2, -1}; SMLXMatrix A(2, 2, src);
SMLXTmpMatrix B = A;

Parameters

B - reference to SMLXTmpMatrix object, which is swapped with this.

Return Value

No.

[top]


SMLLIBENTRY float Pythag(double a, double b) const;

Discussion

Computes (a2 + b2)1/2.

Parameters

a - first parameter.

b - second parameter.

Return Value

(a2 + b2)1/2.

[top]


SMLLIBENTRY bool LUDecomposition(SMLXMatrix& indx, double& d);

Discussion

LU - decomposition of this SMLXMatrix object. Factors this matrix into LU where L is lower triangular and U is upper triangular. Matrices L and U overwrite this matrix, while the diagonal elements of L (which are unity) are not stored. It is assumed that this is a square matrix.

Note:

Calling of this function is to be followed by (some) LUBackSubstitutions, if this method is used to solve a linear system of equations.

Example:

float src[9] = {1, 1, 2, 2, 1, 0, 3, 0 ,2}; SMLXMatrix A(3, 3, src);
SMLXMatrix xmid;
double ddet; bool per;
per = A.LUDecomposition(xmid, ddet);

Output Parameters

d - determinant of this matrix multiplied by +1 or -1 indicating that the number of row interchanges was even or odd respectively.

indx - reference to some auxiliary matrix. It will be used by LUBackSubstitution method.

Return Value

Function returns true, if determinant is not 0, false otherwise.

[top]


SMLLIBENTRY void LUBackSubstitution(SMLXMatrix& indx, SMLXMatrix& b) const;

Discussion

Uses the LU decomposition stored in this to solve the system of n linear equations A x = b. It is assumed, that method LUDecomposition was called for matrix A (this matrix).

Example:

float src[9] = {1, 1, 2, 2, 1, 0, 3, 0 ,2}; SMLXMatrix A(3, 3, src);
float bb[3] = {1, 3, 2}; SMLXMatrix xb(3, 1, bb);
SMLXMatrix xmid;
double ddet; bool per;
per = A.LUDecomposition(xmid, ddet);
A.LUBackSubstitution(xmid, xb);

Parameters

indx- reference to auxiliary matrix, which was used by LUDecomposition.

b - vector (1 x n matrix), representing right part in the linear system. Upon completion of this function, b is overwritten with x (solution).

Return Value

No.

[top]


SMLLIBENTRY bool SVDecomposition(SMLXMatrix& W, SMLXMatrix& V, SMLXMatrix& tmp);

Discussion

Singular value decomposition of this SMLXMatrix object. Factors this matrix into A = U W VT , where U and V are orthogonal matrices (for which UT = U-1), W is diagonal matrix. Matrix U overwrites this, matrices and V are output parameters.

Output Parameters

W - reference to output diagonal matrix.

V - reference to output orthogonal matrix.

tmp - reference to some auxiliary matrix.

Return Value

Function returns true, if decomposition was successful, false otherwise.

[top]


SMLLIBENTRY void SVDBackSubstitution(const SMLXMatrix& U, const SMLXMatrix& W, const SMLXMatrix& V, const SMLXMatrix& b, SMLXMatrix& tmp);

Discussion

Uses the SVD decomposition represented as A = U W VT to solve the system of linear equations x = b. It is assumed, that method SVDecomposition was called for matrix A, which is not required to be square. If A is square matrix, and A-1 exists, then x = A-1 b, otherwise solution is sought in some generalized sense.

Parameters

U, W, V - matrices representing singular value decomposition of the original matrix A(performed by SVDecomposition).

b - vector (1 x n matrix), representing right part in the linear system. Upon completion of this function, b is overwritten with x (solution).

tmp- reference to auxiliary matrix, which was used by SVDecomposition.

Return Value

No.

[top]


SMLLIBENTRY void SVDInvert(SMLXMatrix const& U, SMLXMatrix const& W, SMLXMatrix& V);

Discussion

This matrix will be overwritten with V W-1 UT, where U, W, Vare matrices used by SVDecomposition. If some elements on diagonal of W are less then FLT_EPSILON by absolute value, they are replaced by 0 in W-1. Upon completion of this function, matrix V is changed to V W-1. This methods yields A-1, if it exists.

Parameters

U, W, V - matrices representing singular value decomposition of the original matrix A(performed by SVDecomposition).

Return Value

No.

[top]


SMLLIBENTRY bool IsDefined() const;

Discussion

Defines whether current matrix is valid one.

Parameters

No.

Return Value

true, if matrix was defined with non-zero sizes,

false, otherwise.

[top]


SMLLIBENTRY void MarkAsDefined();

Discussion

Sets internal flag. Next call of IsDefined() will return true.

Parameters

No.

Return Value

No.

[top]


SMLLIBENTRY void MarkAsUndefined();

Discussion

Unsets internal flag. Next call of IsDefined() will return false.

Parameters

No.

Return Value

No.

[top]


SMLLIBENTRY void Output(const char* caption = NULL) const;

Discussion

Method will print the data using OutputDebugString function.

Parameters

caption - text caption printed data.

Return Value

No.

[top]


friend inline SMLXTmpMatrix& __fastcall operator*(const SMLXMatrix& A, const SMLXMatrix& B);

Discussion

Function in global scope to compute and return A B.

[top]


friend inline SMLXTmpMatrix& __fastcall operator*(const SMLXMatrix& A, const SMLXTransposedMatrix& B);

Discussion

Function in global scope to compute and return A BT.

Example:

SMLXMatrix A(6, 6); A.Identity();
SMLXMatrix B(6, 6); B.Set(1.23f);
SMLXMatrix C;
C = A * Transpose(B);

Function Transposeperforms cast to class SMLXTransposedMatrix, derived from SMLXMatrix. As a result, proper operator* will be used, while transposition is never performed "live".

[top]


friend inline SMLXTmpMatrix& __fastcall operator*(const SMLXTransposedMatrix& A, const SMLXMatrix& B);

Discussion

Function in global scope to compute and return AT B.

[top]


friend inline SMLXTmpMatrix& __fastcall operator*(const SMLXTransposedMatrix& A, const SMLXTransposedMatrix& B);

Discussion

Function in global scope to compute and return AT BT.

[top]


friend inline SMLXTmpMatrix& __fastcall operator+(const SMLXMatrix& A, const SMLXMatrix& B);

Discussion

Function in global scope to compute and return A + B.

[top]


friend inline SMLXTmpMatrix& __fastcall operator-(const SMLXMatrix& A, const SMLXMatrix& B);

Discussion

Function in global scope to compute and return A - B.

[top]


friend inline void Assign(SMLXMatrix& A, float value);

Discussion

Function in global scope to set all values in matrix A to value.

[top]


friend inline void Assign(SMLXMatrix& A, const SMLXMatrix& B);

Discussion

Function in global scope to set all values in matrix A to those of B.

[top]