Function uw12::linalg::mat(double *, const size_t, const size_t, const bool)

Function Documentation

inline Mat uw12::linalg::mat(double *mem, const size_t n_row, const size_t n_col, const bool copy = false)

Initialise a Mat object given a memory location and the size

Initialise a matrix of size n_row * n_col given these values and a pointer to the first entry of the final matrix.

No checking is done by the function to check whether the is an n_row * n_col array at the given location so ensure memory is assigned before using this function. TODO: Require memory checks whenever this function is called

Parameters
  • mem – Pointer to first entry in array

  • n_row – Number of rows in final matrix

  • n_col – Number of columns in final matrix

  • copy – Whether to copy memory or construct matrix pointing to original memory

Returns

Mat object of size n_row * n_col