#include "prepare_lhs.h" #include template IGL_INLINE void igl::prepare_lhs_double( const Eigen::PlainObjectBase & V, mxArray *plhs[]) { using namespace std; using namespace Eigen; plhs[0] = mxCreateDoubleMatrix(V.rows(),V.cols(), mxREAL); double * Vp = mxGetPr(plhs[0]); typedef typename DerivedV::Scalar Scalar; const Scalar * V_data; Matrix VT; if(DerivedV::IsRowMajor) { VT = V.transpose(); V_data = VT.data(); }else { V_data = V.data(); } copy(V_data,V_data+V.size(),Vp); } template IGL_INLINE void igl::prepare_lhs_logical( const Eigen::PlainObjectBase & V, mxArray *plhs[]) { using namespace std; using namespace Eigen; plhs[0] = mxCreateLogicalMatrix(V.rows(),V.cols()); mxLogical * Vp = static_cast(mxGetData(plhs[0])); typedef typename DerivedV::Scalar Scalar; const Scalar * V_data; Matrix VT; if(DerivedV::IsRowMajor) { VT = V.transpose(); V_data = VT.data(); }else { V_data = V.data(); } copy(V_data,V_data+V.size(),Vp); } template IGL_INLINE void igl::prepare_lhs_index( const Eigen::PlainObjectBase & V, mxArray *plhs[]) { // Treat indices as reals const auto Vd = (V.template cast().array()+1).eval(); return prepare_lhs_double(Vd,plhs); } #ifdef IGL_STATIC_LIBRARY template void igl::prepare_lhs_index >(Eigen::PlainObjectBase > const&, mxArray_tag**); template void igl::prepare_lhs_index >(Eigen::PlainObjectBase > const&, mxArray_tag**); template void igl::prepare_lhs_double >(Eigen::PlainObjectBase > const&, mxArray_tag**); template void igl::prepare_lhs_index >(Eigen::PlainObjectBase > const&, mxArray_tag**); template void igl::prepare_lhs_logical >(Eigen::PlainObjectBase > const&, mxArray_tag**); template void igl::prepare_lhs_double >(Eigen::PlainObjectBase > const&, mxArray_tag**); #endif