class CDMatrix |
Matrix class with double precision.
| Col (int i, CDVector& vCol) const Return the i-th column of the matrix. | |
| CombVert (CVisDMatrix &Top, CVisDMatrix &Bottom) Composes the matrix of Top and Bottom (on top of each other). | |
| Det () const Calculates the determinant of a square matrix up to the 3rd order. | |
| Diag (const CDVector &vec) Make the matrix a diagonal matrix containing 'vec'. | |
| ElementDivide (const CDMatrix& matrix) Element-wise matrix division. | |
| ElementMultiply (const CDMatrix& matrix) Element-wise matrix multiply. | |
| Eq ( const CDMatrix& B, CDMatrix& C ) const Element wise equal to. Comparison of two matrices. | |
| Eq (const double B, CDMatrix& C ) const Element wise equal to. Comparison of a matrix and a double. | |
| Eye () Converts the matrix in the identity matrix. | |
| FlipLR () Flip matrix in left/right direction. | |
| FlipUD () Flip matrix in up/down direction. | |
| FromFile ( FILE* fh ) Reads a matrix from disk in binary format. | |
| FromFile (const CDString & sFilename) Reads a matrix from disk in binary format. | |
| FromMatlab (const CDString& sFilename, const CDString& sName) Reads a matrix from disk in MatLab (.m) format. | |
| Ge ( const CDMatrix& B, CDMatrix& C ) const Element wise greater than or equal. Comparison of two matrices. | |
| Ge (const double B, CDMatrix& C ) const Element wise greater than or equal. Comparison of a matrix and a double. | |
| Gt (const double B, CDMatrix& C ) const Element wise greater than. Comparison of a matrix and a double. | |
| Gt ( const CDMatrix& B, CDMatrix& C ) const Element wise greater than. Comparison of two matrices. | |
| Kron (CDMatrix &mX, CDMatrix &mY) Forms the Kronecker tensor product of two matrices. | |
| Le ( const CDMatrix& B, CDMatrix& C ) const Element wise less than or equal. Comparison of two matrices. | |
| Le (const double B, CDMatrix& C ) const Element wise less than or equal. Comparison of a matrix and a double. | |
| Log () Takes the natural logarithm (base e=2.71..) of each matrix element. | |
| Lt ( const CDMatrix& B, CDMatrix& C ) const Element wise less than. Comparison of two matrices. | |
| Lt (const double B, CDMatrix& C ) const Element wise less than. Comparison of a matrix and a double. | |
| Mean () const Calcs the mean value of the matrix. | |
| MeanCol (CDVector& vMean) const Calc the mean of each column into a vector. | |
| Ne (const double B, CDMatrix& C ) const Element wise not equal to. Comparison of a matrix and a double. | |
| Ne ( const CDMatrix& B, CDMatrix& C ) const Element wise not equal to. Comparison of two matrices. | |
| OneWayANOVA (double& dZ, int& nDFModel, int& nDFError) const One-way analysis of variance (ANOVA). | |
| OuterProduct (const CDVector &v1, const CDVector &v2) Forms the outer product of two vectors. | |
| Rand () Uniformly distributed random numbers. | |
| Row (int i, CDVector& vRow) const Return the i-th row of the matrix. | |
| Sqr () Takes the power of two of each element. | |
| Sqrt () Takes the square root of each element. | |
| Std () const Calc the standard diviation of the matrix. | |
| StdCol (CDVector& vStd) const Calc the standard deviation of each column into a vector. | |
| Sum () const Calc the total sum of the matrix. | |
| SumCol (CDVector& vSum) const Calc the sum of each column into a vector. | |
| TTest ( const int iCol1, const int iCol2, double& dZ, int& nDF ) const Student's T-test. | |
| ToFile ( FILE* fh ) const Writes the matrix to disk in binary format. | |
| ToFile (const CDString & sFilename) const Writes the matrix to disk in binary format. | |
| 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. | |
| ToMatlab ( const CDString& sFilename, const CDString& sName, const CDString& sComment, bool fAppend) const Writes the matrix to disk in MatLab (.m) format. | |
| ToString () const Returns a string representing the matrix. | |
| ToVector ( CDVector &v, bool rowWise ) Converts this matrix to a vector. | |
| Trace () const Calculates the trace - i.e. the sum of diagonal elements. | |
| TriL ( CDMatrix &matrix, const int K ) const Extract lower triangular part of matrix. | |
| TriU ( CDMatrix &matrix, const int K ) const Extract upper triangular part of matrix. | |
| Var () const Calc the variance of the matrix. | |
| VarCol (CDVector& vVar) const Calc the variance of each column into a vector. | |
| operator= (double value) Assignment operator. | |
| operator= (const CVisDMatrix &mat) Assignment operator. | |
| operator= (const CDMatrix &mat) Assignment operator. |
Matrix class with double precision based upon the VisSDK matrix class CVisDMatrix.
Assignment operator (CVisDMatrix).
Assignment operator (CDMatrix).
Assignment operator (double). Set all values equal to 'value'.
Calc the sum of each column into a vector. The vector will be resized if it doesn't have the right length.
Calc the mean of each column into a vector. The vector will be resized if it doesn't have the right length.
Calc the variance of each column into a vector. The vector will be resized if it doesn't have the right length.
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.
Calcs the mean value of the matrix.
Calc the variance of the matrix.
Calc the standard diviation of the matrix.
Determination of the fluctuations observed in a sample, and their dependencies in the form of a one-way analysis of variance (ANOVA).
Student's T-test.
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)
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::Column(int r) method.
To set the i-th col use: void CVisDMatrix::SetColumn(int c, const CVisDVector &v)
This function transforms the matrix into a diagonal matrix, with the values of 'vec' in the diagonal.
Returns a string representing the matrix.
Composes the matrix of Top and Bottom (on top of each other).
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().
Takes the square root of each element.
Takes the power of two of each element.
Multiply each element in the matrix with the corresponding element of the input matrix.
Divide each element in the matrix with the corresponding element of the input 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().
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
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.
Forms the Kronecker tensor product of two matrices. The result is placed in this.
Converts the matrix in the identity matrix - i.e. zeros all-over except the ones in the diagonal.
Writes the matrix in LaTeX format. Throws: CVisError.
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.
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.
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
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
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
Takes the natural logarithm (base e=2.71..) of each matrix element.
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.
Inserts uniformly distributed random numbers in the range [0;1].
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.
Calculates the determinant of a square matrix up to the 3rd order.
Calculates the trace - i.e. the sum of diagonal elements.
Converts this matrix to a vector, either by row (default) or column.
Alphabetic index HTML hierarchy of classes or Java
| Back | DIVA Reference Manual | The DIVA-Site |