Browse Source

missing implementation

Alec Jacobson 5 years ago
parent
commit
215994dc07
1 changed files with 21 additions and 0 deletions
  1. 21 0
      include/igl/matlab/prepare_lhs.cpp

+ 21 - 0
include/igl/matlab/prepare_lhs.cpp

@@ -84,6 +84,27 @@ IGL_INLINE void igl::matlab::prepare_lhs_double(
 
 }
 
+
+template <typename Vtype>
+IGL_INLINE void igl::prepare_lhs_double(
+  const std::vector<Vtype> & V,
+  mxArray *plhs[])
+{
+  plhs[0] = mxCreateCellMatrix(V.size(), 1);
+  for(int  i=0; i<V.size(); i++)
+  {
+    const int m = V[i].rows();
+    const int n = V[i].cols();
+    mxArray * ai = mxCreateDoubleMatrix(m,n, mxREAL);
+    Eigen::Map< Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic> >
+      map(mxGetPr(ai),m,n);
+    map = V[i].template cast<double>();
+    mxSetCell(plhs[0],i,ai);
+  }
+}
+
+
+
 #ifdef IGL_STATIC_LIBRARY
 template void igl::matlab::prepare_lhs_index<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, mxArray_tag**);
 template void igl::matlab::prepare_lhs_index<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, mxArray_tag**);