35 const mwSize* dims = mxGetDimensions(pr);
36 int row =
static_cast<int>(dims[0]);
37 int column =
static_cast<int>(dims[1]);
39 double * data = mxGetPr(pr);
43 for (
int i = 0; i < row; i += 1 )
44 for (
int j = 0; j < column; j += 1 )
45 (*mat)(i,j) = data[j*row+i];
52 int row = mat->
Rows();
56 double * data = mxGetPr(pr);
57 for (
int i = 0; i < row; i += 1 )
58 for (
int j = 0; j < column; j += 1 )
59 data[j*row+i] = (*mat)(i,j);
66 const mwSize* dims = mxGetDimensions(pr);
67 int row =
static_cast<int>(dims[0]);
68 int column =
static_cast<int>(dims[1]);
70 utlException(row>1 && column>1,
"mxArray is not a vector");
72 double * data = mxGetPr(pr);
73 if (mat->
Size()!=size )
76 for (
int i = 0; i < size; i += 1 )
84 int row = mat->
Size();
87 double * data = mxGetPr(pr);
88 for (
int i = 0; i < row; i += 1 )
NDArray<T,1> is a vector class which uses blas mkl.
#define utlException(cond, expout)
NDArray<T,2> is a row-major matrix.
mxArray * CreateMatrix< double >(int m, int n)
Create a m x n double matrix.
const T & max(const T &a, const T &b)
Return the maximum between a and b.
void GetMXArrayFromUtlMatrix(const NDArray< T, 2 > *mat, mxArray *&pr)
void GetMXArrayFromUtlVector(const NDArray< T, 1 > *mat, mxArray *&pr)
Contains miscellaneous functions for mex files. utl functions for mex code. Some codes are from spams...
void GetUtlMatrixFromMXArray(const mxArray *pr, NDArray< T, 2 > *mat)
bool ReSize(const SizeType rows, const SizeType cols)
bool ReSize(const SizeType size)
void GetUtlVectorFromMXArray(const mxArray *pr, NDArray< T, 1 > *mat)