Browse Source

templates

Former-commit-id: 23e1c5a50cef41e3096fc8216dae378c24469564
Alec Jacobson (jalec 11 years ago
parent
commit
3d9295b22a
3 changed files with 20 additions and 1 deletions
  1. 1 0
      include/igl/randperm.cpp
  2. 14 1
      include/igl/slice.cpp
  3. 5 0
      include/igl/slice.h

+ 1 - 0
include/igl/randperm.cpp

@@ -31,4 +31,5 @@ IGL_INLINE Eigen::PlainObjectBase<DerivedI> igl::randperm( const int n)
 #ifndef IGL_HEADER_ONLY
 // Explicit template specialization
 template void igl::randperm<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > igl::randperm<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(int);
 #endif

+ 14 - 1
include/igl/slice.cpp

@@ -167,11 +167,22 @@ IGL_INLINE Eigen::PlainObjectBase<DerivedX> igl::slice(
   const Eigen::Matrix<int,Eigen::Dynamic,1> & R)
 {
   Eigen::PlainObjectBase<DerivedX> Y;
-  // phony column indices
   igl::slice(X,R,Y);
   return Y;
 }
 
+template <typename DerivedX>
+IGL_INLINE Eigen::PlainObjectBase<DerivedX> igl::slice(
+  const Eigen::PlainObjectBase<DerivedX>& X,
+  const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
+  const int dim)
+{
+  Eigen::PlainObjectBase<DerivedX> Y;
+  // phony column indices
+  igl::slice(X,R,dim,Y);
+  return Y;
+}
+
 #ifndef IGL_HEADER_ONLY
 // Explicit template specialization
 // generated by autoexplicit.sh
@@ -188,4 +199,6 @@ template void igl::slice<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::PlainOb
 template void igl::slice<Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
 template void igl::slice<Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int, Eigen::Matrix<double, -1, -1, 0, -1, -1>&);
 template void igl::slice<Eigen::SparseMatrix<double, 0, int> >(Eigen::SparseMatrix<double, 0, int> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int, Eigen::SparseMatrix<double, 0, int>&);
+template Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > igl::slice<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int);
+template Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > igl::slice<Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int);
 #endif

+ 5 - 0
include/igl/slice.h

@@ -58,6 +58,11 @@ namespace igl
   IGL_INLINE Eigen::PlainObjectBase<DerivedX> slice(
     const Eigen::PlainObjectBase<DerivedX> & X,
     const Eigen::Matrix<int,Eigen::Dynamic,1> & R);
+  template <typename DerivedX>
+  IGL_INLINE Eigen::PlainObjectBase<DerivedX> slice(
+    const Eigen::PlainObjectBase<DerivedX>& X,
+    const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
+    const int dim);
 }
 
 #ifdef IGL_HEADER_ONLY