Matrix class with double precision.
DIVAMatrixExport void | Col (int i, CDVector& vCol) const Return the i-th column of the matrix. |
DIVAMatrixExport void | CombVert (CVisDMatrix &Top, CVisDMatrix &Bottom) Composes the matrix of Top and Bottom (on top of each other). |
DIVAMatrixExport void | Diag (const CDVector &vec) Make the matrix a diagonal matrix containing 'vec'. |
DIVAMatrixExport void | ElementDivide (const CDMatrix& matrix) Element-wise matrix division. |
DIVAMatrixExport void | ElementMultiply (const CDMatrix& matrix) Element-wise matrix multiply. |
DIVAMatrixExport void | Eq (const double B, CDMatrix& C ) const Element wise equal to. Comparison of a matrix and a double. |
DIVAMatrixExport void | Eq ( const CDMatrix& B, CDMatrix& C ) const Element wise equal to. Comparison of two matrices. |
DIVAMatrixExport void | Eye () Converts the matrix in the identity matrix. |
DIVAMatrixExport void | FlipLR () Flip matrix in left/right direction. |
DIVAMatrixExport void | FlipUD () Flip matrix in up/down direction. |
DIVAMatrixExport void | FromFile (const CDString & sFilename) Reads a matrix from disk in binary format. |
DIVAMatrixExport void | FromFile ( FILE *fh ) Reads a matrix from disk in binary format. |
DIVAMatrixExport void | FromMatlab (const CDString& sFilename, const CDString& sName) Reads a matrix from disk in MatLab (.m) format. |
DIVAMatrixExport void | Ge (const double B, CDMatrix& C ) const Element wise greater than or equal. Comparison of a matrix and a double. |
DIVAMatrixExport void | Ge ( const CDMatrix& B, CDMatrix& C ) const Element wise greater than or equal. Comparison of two matrices. |
DIVAMatrixExport void | Gt ( const CDMatrix& B, CDMatrix& C ) const Element wise greater than. Comparison of two matrices. |
DIVAMatrixExport void | Gt (const double B, CDMatrix& C ) const Element wise greater than. Comparison of a matrix and a double. |
DIVAMatrixExport void | Kron (CDMatrix &mX, CDMatrix &mY) Forms the Kronecker tensor product of two matrices. |
DIVAMatrixExport void | Le (const double B, CDMatrix& C ) const Element wise less than or equal. Comparison of a matrix and a double. |
DIVAMatrixExport void | Le ( const CDMatrix& B, CDMatrix& C ) const Element wise less than or equal. Comparison of two matrices. |
DIVAMatrixExport void | Log () Takes the natural logarithm (base e=2.71..) of each matrix element. |
DIVAMatrixExport void | Lt (const double B, CDMatrix& C ) const Element wise less than. Comparison of a matrix and a double. |
DIVAMatrixExport void | Lt ( const CDMatrix& B, CDMatrix& C ) const Element wise less than. Comparison of two matrices. |
DIVAMatrixExport double | Mean () const Calcs the mean value of the matrix. |
DIVAMatrixExport void | MeanCol (CDVector& vMean) const Calc the mean of each column into a vector. |
DIVAMatrixExport void | Ne ( const CDMatrix& B, CDMatrix& C ) const Element wise not equal to. Comparison of two matrices. |
DIVAMatrixExport void | Ne (const double B, CDMatrix& C ) const Element wise not equal to. Comparison of a matrix and a double. |
DIVAMatrixExport void | OneWayANOVA (double& dZ, int& nDFModel, int& nDFError) const One-way analysis of variance (ANOVA). |
DIVAMatrixExport void | OuterProduct (const CDVector &v1, const CDVector &v2) Forms the outer product of two vectors. |
DIVAMatrixExport void | Rand () Uniformly distributed random numbers. |
DIVAMatrixExport void | Row (int i, CDVector& vRow) const Return the i-th row of the matrix. |
DIVAMatrixExport void | Sqr () Takes the power of two of each element. |
DIVAMatrixExport void | Sqrt () Takes the square root of each element. |
DIVAMatrixExport double | Std () const Calc the standard diviation of the matrix. |
DIVAMatrixExport void | StdCol (CDVector& vStd) const Calc the standard deviation of each column into a vector. |
DIVAMatrixExport double | Sum () const Calc the total sum of the matrix. |
DIVAMatrixExport void | SumCol (CDVector& vSum) const Calc the sum of each column into a vector. |
DIVAMatrixExport void | TTest ( const int iCol1, const int iCol2, double& dZ, int& nDF ) const Student's T-test. |
DIVAMatrixExport void | ToFile ( FILE *fh ) const Writes the matrix to disk in binary format. |
DIVAMatrixExport void | ToFile (const CDString & sFilename) const Writes the matrix to disk in binary format. |
DIVAMatrixExport void | ToLaTeX ( const CDString& sFilename, const CDString& sVarName, const CDString& sComment, bool fWriteAsTable, const CDString& sNumFmt, const CDString& sBracketType, bool fAppend ) const Writes the matrix in LaTeX format. Throws: CVisError. |
DIVAMatrixExport void | ToMatlab ( const CDString& sFilename, const CDString& sName, const CDString& sComment, bool fAppend) const Writes the matrix to disk in MatLab (.m) format. |
DIVAMatrixExport CDString | ToString () const Returns a string representing the matrix. |
DIVAMatrixExport void | TriL ( CDMatrix &matrix, const int K ) const Extract lower triangular part of matrix. |
DIVAMatrixExport void | TriU ( CDMatrix &matrix, const int K ) const Extract upper triangular part of matrix. |
DIVAMatrixExport double | Var () const Calc the variance of the matrix. |
DIVAMatrixExport void | VarCol (CDVector& vVar) const Calc the variance of each column into a vector. |
DIVAMatrixExport CDMatrix& | operator= (double value) Assignment operator. |
DIVAMatrix.h DIVAMatrixExport CDMatrix& | operator= (const CVisDMatrix &mat) Assignment operator. |
DIVAMatrixExport CDMatrix& | operator= (const CDMatrix &mat) Assignment operator. |
Matrix class with double precision based upon the VisSDK matrix class CVisDMatrix.
Return the i-th column of the matrix. The vector will be resized if it doesn't have the right length.
Alternatively, one could use the more costly CVisDVector CVisDMatrix::Row(int r) method.
To set the i-th col use: void CVisDMatrix::SetColumn(int c, const CVisDVector &v)
Composes the matrix of Top and Bottom (on top of each other).
This function transforms the matrix into a diagonal matrix,
with the values of 'vec' in the diagonal.
Divide each element in the matrix with
the corresponding element of the input matrix.
Multiply each element in the matrix with
the corresponding element of the input matrix.
Compares each element in this matrix (A) with double B.
Result matrix C has elements with values 1 or 0. C(i,j) = 1 if A(i,j) == B
C(i,j) = 0 else
Compares each element in this matrix (A) with
corresponding element in B.
Result matrix C has elements with values 1 or 0. C(i,j) = 1 if A(i,j) == B(i,j)
C(i,j) = 0 else
Converts the matrix in the identity matrix -
i.e. zeros all-over except the ones in the diagonal.
FlipLR modifies the matrix with row preserved
and columns flipped in the left/right direction.
FlipUD(X) modifies the matrix with columns preserved
and rows flipped in the up/down direction.
Reads a matrix from disk in binary format, as
written from CDMatrix::ToFile(). The matrix is resizew if it doesn't fit the
disk matrix.
Reads a matrix from disk in binary format (from
the current position of the file pointer), as
written from CDMatrix::ToFile(). The matrix is resizew if it doesn't fit the
disk matrix.
Reads a matrix from disk in MatLab (.m) format into
'this'. Notice that this should be used for storage a (really)
large matrices, due to the computational and i/o overhead
induced by the simple MatLab text format. Also, remember that MatLab can't read (.m) files with lines
longer than 4096 bytes. If no communication with MatLab is needed, but merely
to/from disk functionality within a DIVA program, it is
suggested to use the fast binary i/o methods ToFile() and
FromFile().
Compares each element in this matrix (A) with double B.
Result matrix C has elements with values 1 or 0. C(i,j) = 1 if A(i,j) >= B
C(i,j) = 0 else
Compares each element in this matrix (A) with
corresponding element in B.
Result matrix C has elements with values 1 or 0. C(i,j) = 1 if A(i,j) <= B(i,j)
C(i,j) = 0 else
Compares each element in this matrix (A) with double B.
Result matrix C has elements with values 1 or 0. C(i,j) = 1 if A(i,j) > B
C(i,j) = 0 else
Compares each element in this matrix (A) with
corresponding element in B.
Result matrix C has elements with values 1 or 0. C(i,j) = 1 if A(i,j) > B(i,j)
C(i,j) = 0 else
Forms the Kronecker tensor product of two matrices.
The result is placed in this.
Compares each element in this matrix (A) with double B.
Result matrix C has elements with values 1 or 0. C(i,j) = 1 if A(i,j) <= B
C(i,j) = 0 else
Compares each element in this matrix (A) with
corresponding element in B.
Result matrix C has elements with values 1 or 0. C(i,j) = 1 if A(i,j) <= B(i,j)
C(i,j) = 0 else
Takes the natural logarithm (base e=2.71..) of each matrix element.
Compares each element in this matrix (A) with double B.
Result matrix C has elements with values 1 or 0. C(i,j) = 1 if A(i,j) < B
C(i,j) = 0 else
Compares each element in this matrix (A) with
corresponding element in B.
Result matrix C has elements with values 1 or 0. C(i,j) = 1 if A(i,j) < B(i,j)
C(i,j) = 0 else
Calcs the mean value of the matrix.
Calc the mean of each column into a vector.
The vector will be resized if it doesn't have the right length.
Compares each element in this matrix (A) with double B.
Result matrix C has elements with values 1 or 0. C(i,j) = 1 if A(i,j) != B
C(i,j) = 0 else
Compares each element in this matrix (A) with
corresponding element in B.
Result matrix C has elements with values 1 or 0. C(i,j) = 1 if A(i,j) != B(i,j)
C(i,j) = 0 else
Determination of the fluctuations observed
in a sample, and their dependencies in the
form of a one-way analysis of variance
(ANOVA).
Forms the outer product of two vectors and store the result in this.
If the matrix does have the correct size, it will be resized.
Inserts uniformly distributed random numbers in
the range [0;1].
Return the i-th row of the matrix.
The vector will be resized if it doesn't have the right length. Notice that due to the row major nature of matrices, row
read/writes are *much* faster than col read/writes. Alternatively, one could use the more costly
CVisDVector CVisDMatrix::Row(int r) method. To set the i-th row use:
void CVisDMatrix::SetRow(int r, const CVisDVector &v)
Takes the power of two of each element.
Takes the square root of each element.
Calc the standard diviation of the matrix.
Calc the standard deviation of each column into a vector.
The vector will be resized if it doesn't have the right length.
Calc the total sum of the matrix.
Calc the sum of each column into a vector.
The vector will be resized if it doesn't have the right length.
Student's T-test.
Writes the matrix to disk in binary format.
The dimensions are saved as two doubles (!!?)
(rows,cols) in the start. Modified: Mikkel B. Stegmann 14/3-00
Writes the matrix to disk in binary format.
The dimensions are saved as two doubles (!!?)
(rows,cols) in the start.
The matrix is written to the binary file 'fh'
at the current position of the file pointer. Modified: Mikkel B. Stegmann 14/3-00
Writes the matrix in LaTeX format. Throws: CVisError.
Writes the matrix to disk in MatLab (.m) format.
To read the matrix into MatLab write e.g.
'my_matrix.m' at the MatLab prompt. Notice that this should be used for storage a (really)
large matrices, due to the computational and i/o overhead
induced by the simple MatLab text format. Also, remember that MatLab can't read (.m) files with lines
longer than 4096 bytes. If no communication with MatLab is needed, but merely
to/from disk functionality within a DIVA program, it is
suggested to use the fast binary i/o methods ToFile() and
FromFile().
Returns a string representing the matrix.
Extracts the elements on and below the K-th diagonal.
K = 0 is the main diagonal, K > 0 is above the main
diagonal and K < 0 is below the main diagonal.
Extracts the elements on and above the K-th diagonal.
K = 0 is the main diagonal, K > 0 is above the main
diagonal and K < 0 is below the main diagonal.
Calc the variance of the matrix.
Calc the variance of each column into a vector.
The vector will be resized if it doesn't have the right length.
Assignment operator (CVisDMatrix).
Assignment operator (CDMatrix).
Assignment operator (double). Set all values equal to 'value'.
Bottom - Matrix to be placed in the bottom of this matrix.
sName - The name to search for (and load) inside the matlab file.
nDFModel -
nDFError -
v2 - Input vector.
vRow - Output vector;
iCol2 -
dZ -
nDF -
sVarName - Name of matrix.
sComment - Comment in the LaTeX file.
fWriteAsTable - If true the matrix is formatted as a table.
sNumFmt - printf c-stype format of numbers, e.g. "%.2f".
sBracketType - Either "[" or "(".
fAppend - If true 'sFilename' is append with this matrix.
sName - Name of destination matlab variable.
sComment - Optional comment inside the file.
fAppend - If true, the vector is appended to the file
'sFilename'.
Back | DIVA Reference Manual | The DIVA-Site |