matrix

 

Name

matrix

Remark

An Origin C matrix (lower case m) is a dynamically allocated and sized two dimensional array that is not tied to an internal Origin matrix allowing a greater degree of flexibility. matrix is a template class with a default type of double but a matrix of any basic data type (including char, byte, short, word, int, uint and complex but not string) can be constructed using the syntax matrix<type>. The matrix class is derived from the matrixbase class from which it inherits methods and properties.

Hierarchy

Examples

EX1

void matrix_ex1()
{
    int ii, jj;
    matrix<int> mInts = {{1,2,3},{4,5,6},{7,8,9}};
    printf("mInts:\n");
    for(ii = 0; ii < mInts.GetNumRows(); ii++)
    {
        for(jj = 0; jj < mInts.GetNumCols(); jj++)
            printf("%d\t",mInts[ii][jj]);
        printf("\n");
    }

    matrix mDoublesByDefault = {{1.1,2.2,3.3},{4.4,5.5,6.6},{7.7,8.8,9.9}};
    printf("mDoublesByDefault:\n");
    for(ii = 0; ii < mDoublesByDefault.GetNumRows(); ii++)
    {
        for(jj = 0; jj < mDoublesByDefault.GetNumCols(); jj++)
            printf("%g\t",mDoublesByDefault[ii][jj]);
        printf("\n");
    }
}

header to Include

origin.h

Reference

Members

Name Brief Example
GetSourceDim It returns the dimensions of the source Matrix used by the constructor matrix(MatrixObject &mo, BOOL bWriteback = FALSE) if bWriteback is TRUE. See that constructor and the accompanying example for more details. Examples
matrix Default constructor for matrix class. Examples