Эх сурвалжийг харах

PlainObjectBase objects should not be declared

Former-commit-id: 80c91fa85cb3069302c654d7c064f55ab77a4b96
Alec Jacobson 8 жил өмнө
parent
commit
97bf3c6fb5

+ 11 - 11
include/igl/active_set.cpp

@@ -56,7 +56,7 @@ IGL_INLINE igl::SolverStatus igl::active_set(
   // Discard const qualifiers
   //if(B.size() == 0)
   //{
-  //  B = Eigen::PlainObjectBase<DerivedB>::Zero(n,1);
+  //  B = DerivedB::Zero(n,1);
   //}
   assert(n == B.rows() && "B.rows() must match A.rows()");
   assert(B.cols() == 1 && "B must be a column vector");
@@ -71,7 +71,7 @@ IGL_INLINE igl::SolverStatus igl::active_set(
   Eigen::Matrix<typename Derivedux::Scalar,Eigen::Dynamic,1> ux;
   if(p_lx.size() == 0)
   {
-    lx = Eigen::PlainObjectBase<Derivedlx>::Constant(
+    lx = Derivedlx::Constant(
       n,1,-numeric_limits<typename Derivedlx::Scalar>::max());
   }else
   {
@@ -79,7 +79,7 @@ IGL_INLINE igl::SolverStatus igl::active_set(
   }
   if(p_ux.size() == 0)
   {
-    ux = Eigen::PlainObjectBase<Derivedux>::Constant(
+    ux = Derivedux::Constant(
       n,1,numeric_limits<typename Derivedux::Scalar>::max());
   }else
   {
@@ -109,8 +109,8 @@ IGL_INLINE igl::SolverStatus igl::active_set(
   Matrix<BOOL,Dynamic,1> as_ieq = Matrix<BOOL,Dynamic,1>::Constant(Aieq.rows(),1,FALSE);
 
   // Keep track of previous Z for comparison
-  PlainObjectBase<DerivedZ> old_Z;
-  old_Z = PlainObjectBase<DerivedZ>::Constant(
+  DerivedZ old_Z;
+  old_Z = DerivedZ::Constant(
       n,1,numeric_limits<typename DerivedZ::Scalar>::max());
 
   int iter = 0;
@@ -143,7 +143,7 @@ IGL_INLINE igl::SolverStatus igl::active_set(
       }
       if(Aieq.rows() > 0)
       {
-        PlainObjectBase<DerivedZ> AieqZ;
+        DerivedZ AieqZ;
         AieqZ = Aieq*Z;
         for(int a = 0;a<Aieq.rows();a++)
         {
@@ -190,9 +190,9 @@ IGL_INLINE igl::SolverStatus igl::active_set(
 #endif
 
     // PREPARE FIXED VALUES
-    PlainObjectBase<Derivedknown> known_i;
+    Derivedknown known_i;
     known_i.resize(nk + as_lx_count + as_ux_count,1);
-    PlainObjectBase<DerivedY> Y_i;
+    DerivedY Y_i;
     Y_i.resize(nk + as_lx_count + as_ux_count,1);
     {
       known_i.block(0,0,known.rows(),known.cols()) = known;
@@ -225,7 +225,7 @@ IGL_INLINE igl::SolverStatus igl::active_set(
     // PREPARE EQUALITY CONSTRAINTS
     VectorXi as_ieq_list(as_ieq_count,1);
     // Gather active constraints and resp. rhss
-    PlainObjectBase<DerivedBeq> Beq_i;
+    DerivedBeq Beq_i;
     Beq_i.resize(Beq.rows()+as_ieq_count,1);
     Beq_i.head(Beq.rows()) = Beq;
     {
@@ -262,7 +262,7 @@ IGL_INLINE igl::SolverStatus igl::active_set(
     }
 #endif
 
-    Eigen::PlainObjectBase<DerivedZ> sol;
+    DerivedZ sol;
     if(known_i.size() == A.rows())
     {
       // Everything's fixed?
@@ -311,7 +311,7 @@ IGL_INLINE igl::SolverStatus igl::active_set(
     SparseMatrix<AT> Ak;
     // Slow
     slice(A,known_i,1,Ak);
-    Eigen::PlainObjectBase<DerivedB> Bk;
+    DerivedB Bk;
     slice(B,known_i,Bk);
     MatrixXd Lambda_known_i = -(0.5*Ak*Z + 0.5*Bk);
     // reverse the lambda values for lx

+ 1 - 2
include/igl/angle_bound_frame_fields.cpp

@@ -38,8 +38,7 @@ namespace igl {
       Eigen::VectorXi indInteriorToFull;
       Eigen::VectorXi indFullToInterior;
 
-//#warning "Constructing Eigen::PlainObjectBase directly is deprecated"
-      Eigen::PlainObjectBase<DerivedV> B1, B2, FN;
+      DerivedV B1, B2, FN;
 
       //laplacians
       Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar>> DDA, DDB;

+ 2 - 2
include/igl/arap.cpp

@@ -55,8 +55,8 @@ IGL_INLINE bool igl::arap_precomputation(
   assert(data.dim <= V.cols() && "solve dim should be <= embedding");
   bool flat = (V.cols() - data.dim)==1;
 
-  PlainObjectBase<DerivedV> plane_V;
-  PlainObjectBase<DerivedF> plane_F;
+  DerivedV plane_V;
+  DerivedF plane_F;
   typedef SparseMatrix<Scalar> SparseMatrixS;
   SparseMatrixS ref_map,ref_map_dim;
   if(flat)

+ 2 - 2
include/igl/boundary_facets.cpp

@@ -110,9 +110,9 @@ IGL_INLINE void igl::boundary_facets(
   using namespace std;
   using namespace Eigen;
   // Cop out: use vector of vectors version
-  vector<vector<typename Eigen::PlainObjectBase<DerivedT>::Scalar> > vT;
+  vector<vector<typename DerivedT::Scalar> > vT;
   matrix_to_list(T,vT);
-  vector<vector<typename Eigen::PlainObjectBase<DerivedF>::Scalar> > vF;
+  vector<vector<typename DerivedF::Scalar> > vF;
   boundary_facets(vT,vF);
   list_to_matrix(vF,F);
 }

+ 1 - 1
include/igl/ceil.cpp

@@ -14,7 +14,7 @@ IGL_INLINE void igl::ceil(
   Eigen::PlainObjectBase<DerivedY>& Y)
 {
   using namespace std;
-  //Y = Eigen::PlainObjectBase<DerivedY>::Zero(m,n);
+  //Y = DerivedY::Zero(m,n);
 //#pragma omp parallel for
   //for(int i = 0;i<m;i++)
   //{

+ 2 - 2
include/igl/dot_row.cpp

@@ -8,7 +8,7 @@
 #include "igl/dot_row.h"
 
 template <typename DerivedV>
-IGL_INLINE Eigen::PlainObjectBase<DerivedV> igl::dot_row(
+IGL_INLINE DerivedV igl::dot_row(
   const Eigen::PlainObjectBase<DerivedV>& A,
   const Eigen::PlainObjectBase<DerivedV>& B
   )
@@ -22,5 +22,5 @@ IGL_INLINE Eigen::PlainObjectBase<DerivedV> igl::dot_row(
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 // generated by autoexplicit.sh
-template Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > igl::dot_row<Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&);
+template Eigen::Matrix<double, -1, -1, 0, -1, -1> igl::dot_row<Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&);
 #endif

+ 1 - 1
include/igl/dot_row.h

@@ -23,7 +23,7 @@ namespace igl
   //   d a column vector with r entries that contains the dot product of each corresponding row of A and B
   //
   template <typename DerivedV>
-  IGL_INLINE Eigen::PlainObjectBase<DerivedV> dot_row(
+  IGL_INLINE DerivedV dot_row(
     const Eigen::PlainObjectBase<DerivedV>& A,
     const Eigen::PlainObjectBase<DerivedV>& B);
 

+ 1 - 1
include/igl/doublearea.cpp

@@ -43,7 +43,7 @@ IGL_INLINE void igl::doublearea(
   {
     case 3:
     {
-      dblA = Eigen::PlainObjectBase<DeriveddblA>::Zero(m,1);
+      dblA = DeriveddblA::Zero(m,1);
       for(size_t f = 0;f<m;f++)
       {
         for(int d = 0;d<3;d++)

+ 1 - 1
include/igl/face_areas.cpp

@@ -16,7 +16,7 @@ IGL_INLINE void igl::face_areas(
   Eigen::PlainObjectBase<DerivedA>& A)
 {
   assert(T.cols() == 4);
-  typename Eigen::PlainObjectBase<DerivedA> L;
+  DerivedA L;
   edge_lengths(V,T,L);
   return face_areas(L,A);
 }

+ 1 - 1
include/igl/floor.cpp

@@ -15,7 +15,7 @@ IGL_INLINE void igl::floor(
   Eigen::PlainObjectBase<DerivedY>& Y)
 {
   using namespace std;
-  //Y = Eigen::PlainObjectBase<DerivedY>::Zero(m,n);
+  //Y = DerivedY::Zero(m,n);
 //#pragma omp parallel for
   //for(int i = 0;i<m;i++)
   //{

+ 5 - 6
include/igl/line_field_missmatch.cpp

@@ -31,16 +31,15 @@ public:
     const Eigen::PlainObjectBase<DerivedF> &F;
     const Eigen::PlainObjectBase<DerivedV> &PD1;
     const Eigen::PlainObjectBase<DerivedV> &PD2;
-//#warning "Constructing Eigen::PlainObjectBase directly is deprecated"
-    Eigen::PlainObjectBase<DerivedV> N;
+    DerivedV N;
 
 private:
     // internal
     std::vector<bool> V_border; // bool
     std::vector<std::vector<int> > VF;
     std::vector<std::vector<int> > VFi;
-    Eigen::PlainObjectBase<DerivedF> TT;
-    Eigen::PlainObjectBase<DerivedF> TTi;
+    DerivedF TT;
+    DerivedF TTi;
 
 
 private:
@@ -123,8 +122,8 @@ IGL_INLINE void igl::line_field_missmatch(const Eigen::PlainObjectBase<DerivedV>
                                 const bool isCombed,
                                 Eigen::PlainObjectBase<DerivedO> &missmatch)
 {
-    Eigen::PlainObjectBase<DerivedV> PD1_combed;
-    Eigen::PlainObjectBase<DerivedV> PD2_combed;
+    DerivedV PD1_combed;
+    DerivedV PD2_combed;
 
     if (!isCombed)
         igl::comb_line_field(V,F,PD1,PD1_combed);

+ 3 - 3
include/igl/list_to_matrix.cpp

@@ -86,10 +86,10 @@ IGL_INLINE bool igl::list_to_matrix(const std::vector<T > & V,Eigen::PlainObject
   {
     //fprintf(stderr,"Error: list_to_matrix() list is empty()\n");
     //return false;
-    if(Eigen::PlainObjectBase<Derived>::ColsAtCompileTime == 1)
+    if(Derived::ColsAtCompileTime == 1)
     {
       M.resize(0,1);
-    }else if(Eigen::PlainObjectBase<Derived>::RowsAtCompileTime == 1)
+    }else if(Derived::RowsAtCompileTime == 1)
     {
       M.resize(1,0);
     }else
@@ -99,7 +99,7 @@ IGL_INLINE bool igl::list_to_matrix(const std::vector<T > & V,Eigen::PlainObject
     return true;
   }
   // Resize output
-  if(Eigen::PlainObjectBase<Derived>::RowsAtCompileTime == 1)
+  if(Derived::RowsAtCompileTime == 1)
   {
     M.resize(1,m);
   }else

+ 10 - 10
include/igl/min_quad_with_fixed.cpp

@@ -486,15 +486,15 @@ IGL_INLINE bool igl::min_quad_with_fixed_solve(
   }else
   {
     assert(data.solver_type == min_quad_with_fixed_data<T>::QR_LLT);
-    PlainObjectBase<DerivedBeq> eff_Beq;
+    DerivedBeq eff_Beq;
     // Adjust Aeq rhs to include known parts
     eff_Beq =
       //data.AeqTQR.colsPermutation().transpose() * (-data.Aeqk * Y + Beq);
       data.AeqTET * (-data.Aeqk * Y + Beq);
     // Where did this -0.5 come from? Probably the same place as above.
-    PlainObjectBase<DerivedB> Bu;
+    DerivedB Bu;
     slice(B,data.unknown,Bu);
-    PlainObjectBase<DerivedB> NB;
+    DerivedB NB;
     NB = -0.5*(Bu + data.preY * Y);
     // Trim eff_Beq
     const int nc = data.AeqTQR.rank();
@@ -502,24 +502,24 @@ IGL_INLINE bool igl::min_quad_with_fixed_solve(
     eff_Beq = eff_Beq.topLeftCorner(nc,1).eval();
     data.AeqTR1T.template triangularView<Lower>().solveInPlace(eff_Beq);
     // Now eff_Beq = (data.AeqTR1T \ (data.AeqTET * (-data.Aeqk * Y + Beq)))
-    PlainObjectBase<DerivedB> lambda_0;
+    DerivedB lambda_0;
     lambda_0 = data.AeqTQ1 * eff_Beq;
     //cout<<matlab_format(lambda_0,"lambda_0")<<endl;
-    PlainObjectBase<DerivedB> QRB;
+    DerivedB QRB;
     QRB = -data.AeqTQ2T * (data.Auu * lambda_0) + data.AeqTQ2T * NB;
-    PlainObjectBase<Derivedsol> lambda;
+    Derivedsol lambda;
     lambda = data.llt.solve(QRB);
     // prepare output
-    PlainObjectBase<Derivedsol> solu;
+    Derivedsol solu;
     solu = data.AeqTQ2 * lambda + lambda_0;
     //  http://www.math.uh.edu/~rohop/fall_06/Chapter3.pdf
-    PlainObjectBase<Derivedsol> solLambda;
+    Derivedsol solLambda;
     {
-      PlainObjectBase<Derivedsol> temp1,temp2;
+      Derivedsol temp1,temp2;
       temp1 = (data.AeqTQ1T * NB - data.AeqTQ1T * data.Auu * solu);
       data.AeqTR1.template triangularView<Upper>().solveInPlace(temp1);
       //cout<<matlab_format(temp1,"temp1")<<endl;
-      temp2 = PlainObjectBase<Derivedsol>::Zero(neq,1);
+      temp2 = Derivedsol::Zero(neq,1);
       temp2.topLeftCorner(nc,1) = temp1;
       //solLambda = data.AeqTQR.colsPermutation() * temp2;
       solLambda = data.AeqTE * temp2;

+ 1 - 1
include/igl/on_boundary.cpp

@@ -123,7 +123,7 @@ IGL_INLINE void igl::on_boundary(
   using namespace std;
   using namespace Eigen;
   // Cop out: use vector of vectors version
-  vector<vector<typename Eigen::PlainObjectBase<DerivedT>::Scalar> > vT;
+  vector<vector<typename DerivedT::Scalar> > vT;
   matrix_to_list(T,vT);
   vector<bool> vI;
   vector<vector<bool> > vC;

+ 1 - 1
include/igl/orient_outward.cpp

@@ -40,7 +40,7 @@ IGL_INLINE void igl::orient_outward(
   {
     FF = F;
   }
-  PlainObjectBase<DerivedV> N,BC,BCmean;
+  DerivedV N,BC,BCmean;
   Matrix<typename DerivedV::Scalar,Dynamic,1> A;
   VectorXd totA(num_cc), dot(num_cc);
   Matrix<typename DerivedV::Scalar,3,1> Z(1,1,1);

+ 1 - 1
include/igl/per_vertex_attribute_smoothing.cpp

@@ -15,7 +15,7 @@ IGL_INLINE void igl::per_vertex_attribute_smoothing(
     Eigen::PlainObjectBase<DerivedV> & Aout)
 {
     std::vector<double> denominator(Ain.rows(), 0);
-    Aout = Eigen::PlainObjectBase<DerivedV>::Zero(Ain.rows(), Ain.cols());
+    Aout = DerivedV::Zero(Ain.rows(), Ain.cols());
     for (int i = 0; i < F.rows(); ++i) {
         for (int j = 0; j < 3; ++j) {
             int j1 = (j + 1) % 3;

+ 1 - 1
include/igl/point_simplex_squared_distance.cpp

@@ -34,7 +34,7 @@ IGL_INLINE void igl::point_simplex_squared_distance(
   typedef typename Derivedp::Scalar Scalar;
   typedef typename Eigen::Matrix<Scalar,1,DIM> Vector;
   typedef Vector Point;
-  //typedef Eigen::PlainObjectBase<Derivedb> BaryPoint;
+  //typedef Derivedb BaryPoint;
   typedef Eigen::Matrix<typename Derivedb::Scalar,1,3> BaryPoint;
 
   const auto & Dot = [](const Point & a, const Point & b)->Scalar

+ 2 - 2
include/igl/project_isometrically_to_plane.cpp

@@ -24,14 +24,14 @@ IGL_INLINE void igl::project_isometrically_to_plane(
   using namespace std;
   using namespace Eigen;
   assert(F.cols() == 3 && "F should contain triangles");
-  typedef Eigen::PlainObjectBase<DerivedV> MatrixX;
+  typedef DerivedV MatrixX;
   MatrixX l;
   edge_lengths(V,F,l);
   // Number of faces
   const int m = F.rows();
 
   // First corner at origin
-  U = Eigen::PlainObjectBase<DerivedU>::Zero(m*3,2);
+  U = DerivedU::Zero(m*3,2);
   // Second corner along x-axis
   U.block(m,0,m,1) = l.col(2);
   // Third corner rotated onto plane

+ 2 - 1
include/igl/quad_planarity.cpp

@@ -23,7 +23,8 @@ IGL_INLINE void igl::quad_planarity(
     const Eigen::Matrix<typename DerivedV::Scalar,1,3> &v3 = V.row(F(i,2));
     const Eigen::Matrix<typename DerivedV::Scalar,1,3> &v4 = V.row(F(i,3));
     Eigen::Matrix<typename DerivedV::Scalar,1,3> diagCross=(v3-v1).cross(v4-v2);
-    typename Eigen::PlainObjectBase<DerivedV>::Scalar denom = diagCross.norm()*(((v3-v1).norm()+(v4-v2).norm())/2);
+    typename DerivedV::Scalar denom = 
+      diagCross.norm()*(((v3-v1).norm()+(v4-v2).norm())/2);
     if (fabs(denom)<1e-8)
       //degenerate quad is still planar
       P[i] = 0;

+ 0 - 9
include/igl/randperm.cpp

@@ -20,17 +20,8 @@ IGL_INLINE void igl::randperm(
   std::random_shuffle(I.data(),I.data()+n);
 }
 
-//template <typename DerivedI>
-//IGL_INLINE Eigen::PlainObjectBase<DerivedI> igl::randperm( const int n)
-//{
-//  Eigen::PlainObjectBase<DerivedI> I;
-//  randperm(n,I);
-//  return I;
-//}
-
 #ifdef IGL_STATIC_LIBRARY
 // 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 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

+ 0 - 2
include/igl/randperm.h

@@ -21,8 +21,6 @@ namespace igl
   IGL_INLINE void randperm(
     const int n,
     Eigen::PlainObjectBase<DerivedI> & I);
-  //template <typename DerivedI>
-  //IGL_INLINE DerivedI randperm( const int n);
 }
 #ifndef IGL_STATIC_LIBRARY
 #  include "randperm.cpp"

+ 1 - 1
include/igl/setdiff.cpp

@@ -42,7 +42,7 @@ IGL_INLINE void igl::setdiff(
   typedef Matrix<typename DerivedB::Scalar,Dynamic,1> VectorB;
   VectorA uA;
   VectorB uB;
-  typedef PlainObjectBase<DerivedIA> IAType;
+  typedef DerivedIA IAType;
   IAType uIA,uIuA,uIB,uIuB;
   unique(A,uA,uIA,uIuA);
   unique(B,uB,uIB,uIuB);

+ 19 - 20
include/igl/slice_into.cpp

@@ -47,12 +47,12 @@ IGL_INLINE void igl::slice_into(
   Y = Eigen::SparseMatrix<T>(dyn_Y);
 }
 
-template <typename DerivedX>
+template <typename DerivedX, typename DerivedY>
 IGL_INLINE void igl::slice_into(
   const Eigen::PlainObjectBase<DerivedX> & X,
   const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
   const Eigen::Matrix<int,Eigen::Dynamic,1> & C,
-  Eigen::PlainObjectBase<DerivedX> & Y)
+  Eigen::PlainObjectBase<DerivedY> & Y)
 {
 
   int xm = X.rows();
@@ -80,12 +80,12 @@ IGL_INLINE void igl::slice_into(
   }
 }
 
-template <typename Mat>
+template <typename MatX, typename MatY>
 IGL_INLINE void igl::slice_into(
-  const Mat& X,
+  const MatX& X,
   const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
   const int dim,
-  Mat& Y)
+  MatY& Y)
 {
   Eigen::VectorXi C;
   switch(dim)
@@ -114,11 +114,11 @@ IGL_INLINE void igl::slice_into(
   }
 }
 
-template <typename DerivedX>
+template <typename DerivedX, typename DerivedY>
 IGL_INLINE void igl::slice_into(
   const Eigen::PlainObjectBase<DerivedX> & X,
   const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
-  Eigen::PlainObjectBase<DerivedX> & Y)
+  Eigen::PlainObjectBase<DerivedY> & Y)
 {
   // phony column indices
   Eigen::Matrix<int,Eigen::Dynamic,1> C;
@@ -130,17 +130,16 @@ IGL_INLINE void igl::slice_into(
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 // generated by autoexplicit.sh
-template void igl::slice_into<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&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
-template void igl::slice_into<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&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
-template void igl::slice_into<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_into<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&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
-template void igl::slice_into<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_into<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 void igl::slice_into<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int, Eigen::Matrix<int, -1, 1, 0, -1, 1>&);
-template void igl::slice_into<Eigen::PlainObjectBase<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, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
-template void igl::slice_into<Eigen::PlainObjectBase<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, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
-template void igl::slice_into<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&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
-template void igl::slice_into<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&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
-template void igl::slice_into<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int, Eigen::Matrix<int, -1, -1, 0, -1, -1>&);
-template void igl::slice_into<int>(Eigen::SparseMatrix<int, 0, int> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::SparseMatrix<int, 0, int>&);
+template void igl::slice_into<double>(Eigen::SparseMatrix<double, 0, int> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::SparseMatrix<double, 0, int>&);
+// generated by autoexplicit.sh
+template void igl::slice_into<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 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>&);
+// generated by autoexplicit.sh
+template void igl::slice_into<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 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&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
+// generated by autoexplicit.sh
+template void igl::slice_into<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::PlainObjectBase<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::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+// generated by autoexplicit.sh
+template void igl::slice_into<Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<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::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
+template void igl::slice_into<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 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_into<Eigen::Matrix<int, -1, 1, 0, -1, 1>, 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&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template void igl::slice_into<Eigen::SparseMatrix<double, 0, int>, 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>&);
 #endif

+ 7 - 7
include/igl/slice_into.h

@@ -30,30 +30,30 @@ namespace igl
     const Eigen::Matrix<int,Eigen::Dynamic,1> & C,
     Eigen::SparseMatrix<T>& Y);
 
-  template <typename DerivedX>
+  template <typename DerivedX, typename DerivedY>
   IGL_INLINE void slice_into(
     const Eigen::PlainObjectBase<DerivedX> & X,
     const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
     const Eigen::Matrix<int,Eigen::Dynamic,1> & C,
-    Eigen::PlainObjectBase<DerivedX> & Y);
+    Eigen::PlainObjectBase<DerivedY> & Y);
   // Wrapper to only slice in one direction
   //
   // Inputs:
   //   dim  dimension to slice in 1 or 2, dim=1 --> X(R,:), dim=2 --> X(:,R)
   //
   // Note: For now this is just a cheap wrapper.
-  template <typename Mat>
+  template <typename MatX, typename MatY>
   IGL_INLINE void slice_into(
-    const Mat& X,
+    const MatX & X,
     const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
     const int dim,
-    Mat& Y);
+    MatY& Y);
 
-  template <typename DerivedX>
+  template <typename DerivedX, typename DerivedY>
   IGL_INLINE void slice_into(
     const Eigen::PlainObjectBase<DerivedX> & X,
     const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
-    Eigen::PlainObjectBase<DerivedX> & Y);
+    Eigen::PlainObjectBase<DerivedY> & Y);
 }
 
 #ifndef IGL_STATIC_LIBRARY

+ 14 - 14
include/igl/sort.cpp

@@ -158,23 +158,23 @@ IGL_INLINE void igl::sort2(
 {
   using namespace Eigen;
   using namespace std;
-  typedef typename Eigen::PlainObjectBase<DerivedY>::Scalar YScalar;
+  typedef typename DerivedY::Scalar YScalar;
   Y = X.template cast<YScalar>();
   // get number of columns (or rows)
   int num_outer = (dim == 1 ? X.cols() : X.rows() );
   // get number of rows (or columns)
   int num_inner = (dim == 1 ? X.rows() : X.cols() );
   assert(num_inner == 2);(void)num_inner;
-  typedef typename Eigen::PlainObjectBase<DerivedIX>::Scalar Index;
+  typedef typename DerivedIX::Scalar Index;
   IX.resize(X.rows(),X.cols());
   if(dim==1)
   {
-    IX.row(0).setConstant(0);// = Eigen::PlainObjectBase<DerivedIX>::Zero(1,IX.cols());
-    IX.row(1).setConstant(1);// = Eigen::PlainObjectBase<DerivedIX>::Ones (1,IX.cols());
+    IX.row(0).setConstant(0);// = DerivedIX::Zero(1,IX.cols());
+    IX.row(1).setConstant(1);// = DerivedIX::Ones (1,IX.cols());
   }else
   {
-    IX.col(0).setConstant(0);// = Eigen::PlainObjectBase<DerivedIX>::Zero(IX.rows(),1);
-    IX.col(1).setConstant(1);// = Eigen::PlainObjectBase<DerivedIX>::Ones (IX.rows(),1);
+    IX.col(0).setConstant(0);// = DerivedIX::Zero(IX.rows(),1);
+    IX.col(1).setConstant(1);// = DerivedIX::Ones (IX.rows(),1);
   }
   // loop over columns (or rows)
   for(int i = 0;i<num_outer;i++)
@@ -201,25 +201,25 @@ IGL_INLINE void igl::sort3(
 {
   using namespace Eigen;
   using namespace std;
-  typedef typename Eigen::PlainObjectBase<DerivedY>::Scalar YScalar;
+  typedef typename DerivedY::Scalar YScalar;
   Y = X.template cast<YScalar>();
   // get number of columns (or rows)
   int num_outer = (dim == 1 ? X.cols() : X.rows() );
   // get number of rows (or columns)
   int num_inner = (dim == 1 ? X.rows() : X.cols() );
   assert(num_inner == 3);(void)num_inner;
-  typedef typename Eigen::PlainObjectBase<DerivedIX>::Scalar Index;
+  typedef typename DerivedIX::Scalar Index;
   IX.resize(X.rows(),X.cols());
   if(dim==1)
   {
-    IX.row(0).setConstant(0);// = Eigen::PlainObjectBase<DerivedIX>::Zero(1,IX.cols());
-    IX.row(1).setConstant(1);// = Eigen::PlainObjectBase<DerivedIX>::Ones (1,IX.cols());
-    IX.row(2).setConstant(2);// = Eigen::PlainObjectBase<DerivedIX>::Ones (1,IX.cols());
+    IX.row(0).setConstant(0);// = DerivedIX::Zero(1,IX.cols());
+    IX.row(1).setConstant(1);// = DerivedIX::Ones (1,IX.cols());
+    IX.row(2).setConstant(2);// = DerivedIX::Ones (1,IX.cols());
   }else
   {
-    IX.col(0).setConstant(0);// = Eigen::PlainObjectBase<DerivedIX>::Zero(IX.rows(),1);
-    IX.col(1).setConstant(1);// = Eigen::PlainObjectBase<DerivedIX>::Ones (IX.rows(),1);
-    IX.col(2).setConstant(2);// = Eigen::PlainObjectBase<DerivedIX>::Ones (IX.rows(),1);
+    IX.col(0).setConstant(0);// = DerivedIX::Zero(IX.rows(),1);
+    IX.col(1).setConstant(1);// = DerivedIX::Ones (IX.rows(),1);
+    IX.col(2).setConstant(2);// = DerivedIX::Ones (IX.rows(),1);
   }
 
 

+ 1 - 1
include/igl/writeSTL.cpp

@@ -105,7 +105,7 @@ IGL_INLINE bool igl::writeSTL(
   const Eigen::PlainObjectBase<DerivedF> & F,
   const bool ascii)
 {
-  return writeSTL(filename,V,F, Eigen::PlainObjectBase<DerivedV>(), ascii);
+  return writeSTL(filename,V,F, DerivedV(), ascii);
 }
 
 #ifdef IGL_STATIC_LIBRARY