30 #ifndef MEX_MATRIX_SEPARATE_HPP_INCLUDED
31 #define MEX_MATRIX_SEPARATE_HPP_INCLUDED
34 #include "../core/result_matrix.hpp"
38 #include <type_traits>
108 static mxClassID
const value = mxINT32_CLASS;
113 struct classID<double>
116 static mxClassID
const value = mxDOUBLE_CLASS;
121 struct classID<float>
124 static mxClassID
const value = mxSINGLE_CLASS;
134 public Eigen::Map<Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> >
137 typedef Eigen::Map< Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> > base_t;
150 static_cast<
scalar_t *>(mxGetData(output = mxCreateNumericMatrix(rows, cols,
classID<
scalar_t>::value, mxREAL))),
160 : base_t(static_cast<
scalar_t *>(mxGetData(input)), mxGetM(input), mxGetN(input))
166 template <
class Parent>
179 : m_parent(
matrix), m_row(row), m_col(col)
186 operator std::complex<scalar_t>()
const
188 return std::complex<scalar_t>(
real(),
imag());
196 return m_parent.m_real[m_row + m_parent.rows()*m_col];
204 return m_parent.m_imag[m_row + m_parent.rows()*m_col];
210 template <
class complex_rhs_t>
213 real() = data.real();
214 imag() = data.imag();
220 template <
class complex_rhs_t>
223 real() += data.real();
224 imag() += data.imag();
272 output = mxCreateNumericMatrix(
293 std::complex<scalar_t>
operator() (
size_t row,
size_t col)
const
295 return std::complex<scalar_t>(
316 template <
class Scalar>
317 Scalar
const &get_scalar(mxArray
const *pa)
319 return *
static_cast<Scalar *
>(mxGetPr(pa));
T scalar_t
the scalar type
complex_matrix(size_t rows, size_t cols, mxArray *&output)
output matrix (allocating) constructor
real_matrix(size_t rows, size_t cols, mxArray *&output)
output matrix (allocating) constructor
size_t m_rows
number of rows
T scalar_t
the real scalar type
metafunction assigning a Matlab class ID to a C type
Parent::scalar_t scalar_t
the scalar type of the parent class
size_t m_cols
number of columns
Implementation of Eigen related utility classes.
size_t cols(void) const
return number of columns
scalar_t * m_real
array of real data
void operator+=(complex_rhs_t const &data) const
increment operator
index_proxy(Parent &matrix, size_t row, size_t col)
constructor
Container class of a complex matrix stored in Matlab format.
void operator=(complex_rhs_t const &data) const
assignment operator
index proxy class of a complex matrix
scalar_t & imag(void) const
return reference to the imaginary part
base class of a Matlab mex matrix
complex_matrix(mxArray const *input)
input matrix constructor
std::complex< scalar_t > operator()(size_t row, size_t col) const
index operator that returns a complex number
scalar_t & real(void) const
return reference to the real part
size_t rows(void) const
return number of rows
real_matrix(mxArray const *input)
input matrix constructor
matrix_base(size_t rows, size_t cols)
output matrix constructor
matrix_base(mxArray const *input)
input matrix constructor
scalar_t * m_imag
array of imaginary data