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). |
![]() | 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 double B, CDMatrix& C ) const Element wise equal to. Comparison of a matrix and a double. |
![]() | Eq ( const CDMatrix& B, CDMatrix& C ) const Element wise equal to. Comparison of two matrices. |
![]() | Eye () Converts the matrix in the identity matrix. |
![]() | FlipLR () Flip matrix in left/right direction. |
![]() | FlipUD () Flip matrix in up/down direction. |
![]() | FromFile (const CDString & sFilename) Reads a matrix from disk in binary format. |
![]() | FromFile ( FILE *fh ) 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 double B, CDMatrix& C ) const Element wise greater than or equal. Comparison of a matrix and a double. |
![]() | Ge ( const CDMatrix& B, CDMatrix& C ) const Element wise greater than or equal. Comparison of two matrices. |
![]() | Gt ( const CDMatrix& B, CDMatrix& C ) const Element wise greater than. Comparison of two matrices. |
![]() | Gt (const double B, CDMatrix& C ) const Element wise greater than. Comparison of a matrix and a double. |
![]() | Kron (CDMatrix &mX, CDMatrix &mY) Forms the Kronecker tensor product of two matrices. |
![]() | Le (const double B, CDMatrix& C ) const Element wise less than or equal. Comparison of a matrix and a double. |
![]() | Le ( const CDMatrix& B, CDMatrix& C ) const Element wise less than or equal. Comparison of two matrices. |
![]() | Log () Takes the natural logarithm (base e=2.71..) of each matrix element. |
![]() | Lt (const double B, CDMatrix& C ) const Element wise less than. Comparison of a matrix and a double. |
![]() | Lt ( const CDMatrix& B, CDMatrix& C ) const Element wise less than. Comparison of two matrices. |
![]() | Mean () const Calcs the mean value of the matrix. |
![]() | MeanCol (CDVector& vMean) const Calc the mean of each column into a vector. |
![]() | Ne ( const CDMatrix& B, CDMatrix& C ) const Element wise not equal to. Comparison of two matrices. |
![]() | Ne (const double B, CDMatrix& C ) const Element wise not equal to. Comparison of a matrix and a double. |
![]() | 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. |
![]() | 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.
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'.
DIVAMatrixExport void CombVert(CVisDMatrix &Top, CVisDMatrix &Bottom)
Bottom - Matrix to be placed in the bottom of this matrix.
DIVAMatrixExport void Diag(const CDVector &vec)
DIVAMatrixExport void ElementDivide(const CDMatrix& matrix)
DIVAMatrixExport void ElementMultiply(const CDMatrix& matrix)
DIVAMatrixExport void Eq(const double B, CDMatrix& C ) const
DIVAMatrixExport void Eq( const CDMatrix& B, CDMatrix& C ) const
DIVAMatrixExport void Eye()
DIVAMatrixExport void FlipLR()
DIVAMatrixExport void FlipUD()
DIVAMatrixExport void FromFile(const CDString & sFilename)
DIVAMatrixExport void FromFile( FILE *fh )
DIVAMatrixExport void FromMatlab(const CDString& sFilename, const CDString& sName)
sName - The name to search for (and load) inside the matlab file.
DIVAMatrixExport void Ge(const double B, CDMatrix& C ) const
DIVAMatrixExport void Ge( const CDMatrix& B, CDMatrix& C ) const
DIVAMatrixExport void Gt(const double B, CDMatrix& C ) const
DIVAMatrixExport void Gt( const CDMatrix& B, CDMatrix& C ) const
DIVAMatrixExport void Kron(CDMatrix &mX, CDMatrix &mY)
DIVAMatrixExport void Le(const double B, CDMatrix& C ) const
DIVAMatrixExport void Le( const CDMatrix& B, CDMatrix& C ) const
DIVAMatrixExport void Log()
DIVAMatrixExport void Lt(const double B, CDMatrix& C ) const
DIVAMatrixExport void Lt( const CDMatrix& B, CDMatrix& C ) const
DIVAMatrixExport double Mean() const
DIVAMatrixExport void MeanCol(CDVector& vMean) const
DIVAMatrixExport void Ne(const double B, CDMatrix& C ) const
DIVAMatrixExport void Ne( const CDMatrix& B, CDMatrix& C ) const
DIVAMatrixExport void OneWayANOVA(double& dZ, int& nDFModel, int& nDFError) const
nDFModel -
nDFError -
DIVAMatrixExport void OuterProduct(const CDVector &v1, const CDVector &v2)
v2 - Input vector.
DIVAMatrixExport void Rand()
DIVAMatrixExport void Row(int i, CDVector& vRow) const
vRow - Output vector;
DIVAMatrixExport void Sqr()
DIVAMatrixExport void Sqrt()
DIVAMatrixExport double Std() const
DIVAMatrixExport void StdCol(CDVector& vStd) const
DIVAMatrixExport double Sum() const
DIVAMatrixExport void SumCol(CDVector& vSum) const
DIVAMatrixExport void TTest( const int iCol1, const int iCol2, double& dZ, int& nDF ) const
iCol2 -
dZ -
nDF -
DIVAMatrixExport void ToFile(const CDString & sFilename) const
DIVAMatrixExport void ToFile( FILE *fh ) const
DIVAMatrixExport void ToLaTeX( const CDString& sFilename, const CDString& sVarName, const CDString& sComment, bool fWriteAsTable, const CDString& sNumFmt, const CDString& sBracketType, bool fAppend ) const
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.
DIVAMatrixExport void ToMatlab( const CDString& sFilename, const CDString& sName, const CDString& sComment, bool fAppend) const
sName - Name of destination matlab variable.
sComment - Optional comment inside the file.
fAppend - If true, the vector is appended to the file
'sFilename'.
DIVAMatrixExport CDString ToString() const
DIVAMatrixExport void TriL( CDMatrix &matrix, const int K ) const
DIVAMatrixExport void TriU( CDMatrix &matrix, const int K ) const
DIVAMatrixExport double Var() const
DIVAMatrixExport void VarCol(CDVector& vVar) const
DIVAMatrix.h DIVAMatrixExport CDMatrix& operator=(const CVisDMatrix &mat)
DIVAMatrixExport CDMatrix& operator=(const CDMatrix &mat)
DIVAMatrixExport CDMatrix& operator=(double value)
Back | DIVA Reference Manual | The DIVA-Site |