What I am currently trying to do is get the data from my variable input, convert it into and Eigen matrix, do some computation and then map the result back to an c++ array.
void RBM::reconstruct(double *input, double *w)
{
double *data = input;
mexPrintf("\n");
for (int j = 0; j < 6; j++){
mexPrintf("%f", data[j]);
}
mexPrintf("\n");
Map<MatrixXd> XX(data,6,6);
MatrixXd resultEigen;
double *result;
Map<MatrixXd>( result, 6, 6 ) = XX;
resultEigen = XX.transpose();
Map<MatrixXd>( result, resultEigen.rows(), resultEigen.cols() ) = resultEigen;
}
The above code compiles but i get (run Time error) probably link to an access violation and i can't really figure out where the problem is. Thanks for any hint.
result
is not allocated. – akakatakEigen::Map
. It says 'A matrix or vector expression mapping an existing array of data.' expression means this object does not hold any data in rum-time. it's only a wrapper. existing means you have to prepare an array because this object is only a expression. – akakatakdouble *result[6*6];
– Ander Biguri