ulqr  0.1.0
Matrix Struct Reference

Represents a matrix of double-precision data. More...

#include <matrix.h>

Data Fields

int rows
 
int cols
 
double * data
 

Detailed Description

Represents a matrix of double-precision data.

Simple wrapper around an arbitrary pointer to the underlying data. The data is assumed to be stored in a contiguous block of memory. The data is interpreted column-wise, such that data[1] is element [1,0] of the matrix.

Initialization

A Matrix can be initialized a few ways. The easiest is via NewMatrix:

Matrix mat = slap_NewMatrix(rows, cols);

which allocates a new block of memory on the heap. It must be followed by a call to FreeMatrix().

If the data for the matrix is already stored in an array, the default brace initializer can be used:

double data[6] = {1,2,3,4,5,6};
Matrix mat = {2, 3, data};

Methods

The following methods are defined for the Matrix type:

Initialization and deconstruction

Indexing operations

  • MatrixNumElements()
  • MatrixGetLinearIndex()
  • MatrixGetElement()
  • MatrixGetElementTranspose()
  • MatrixSetElement()

Copying

  • MatrixCopy()
  • MatrixCopyTranspose()

Reshaping

  • MatrixFlatten()
  • MatrixFlattenToRow()

Utilities

  • PrintMatrix()
  • PrintRowVector()
  • MatrixNormedDifference()

The documentation for this struct was generated from the following file:
Matrix
Represents a matrix of double-precision data.
Definition: matrix.h:71
slap_NewMatrix
Matrix slap_NewMatrix(int rows, int cols)
Allocate a new matrix on the heap.
Definition: matrix.c:13