|
@@ -2,13 +2,13 @@
|
|
|
|
|
|
#include <Eigen/Dense>
|
|
|
|
|
|
-template <typename Mat, typename T>
|
|
|
+template <typename DerivedM>
|
|
|
IGL_INLINE void igl::matrix_to_list(
|
|
|
- const Mat & M,
|
|
|
- std::vector<std::vector<T > > & V)
|
|
|
+ const Eigen::MatrixBase<DerivedM> & M,
|
|
|
+ std::vector<std::vector<typename DerivedM::Scalar > > & V)
|
|
|
{
|
|
|
using namespace std;
|
|
|
- V.resize(M.rows(),vector<T >(M.cols()));
|
|
|
+ V.resize(M.rows(),vector<typename DerivedM::Scalar >(M.cols()));
|
|
|
// loop over rows
|
|
|
for(int i = 0;i<M.rows();i++)
|
|
|
{
|
|
@@ -20,8 +20,37 @@ IGL_INLINE void igl::matrix_to_list(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+template <typename DerivedM>
|
|
|
+IGL_INLINE void igl::matrix_to_list(
|
|
|
+ const Eigen::MatrixBase<DerivedM> & M,
|
|
|
+ std::vector<typename DerivedM::Scalar > & V)
|
|
|
+{
|
|
|
+ using namespace std;
|
|
|
+ V.resize(M.size());
|
|
|
+ // loop over rows
|
|
|
+ for(int i = 0;i<M.size();i++)
|
|
|
+ {
|
|
|
+ V[i] = M[i];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+template <typename DerivedM>
|
|
|
+IGL_INLINE std::vector<typename DerivedM::Scalar > igl::matrix_to_list(
|
|
|
+ const Eigen::MatrixBase<DerivedM> & M)
|
|
|
+{
|
|
|
+ std::vector<typename DerivedM::Scalar> V;
|
|
|
+ matrix_to_list(M,V);
|
|
|
+ return V;
|
|
|
+}
|
|
|
+
|
|
|
#ifndef IGL_HEADER_ONLY
|
|
|
// Explicit template specialization
|
|
|
-template void igl::matrix_to_list<Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >, int>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&);
|
|
|
-template void igl::matrix_to_list<Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >, double>(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >&);
|
|
|
+// generated by autoexplicit.sh
|
|
|
+template std::vector<Eigen::Matrix<double, -1, 1, 0, -1, 1>::Scalar, std::allocator<Eigen::Matrix<double, -1, 1, 0, -1, 1>::Scalar> > igl::matrix_to_list<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&);
|
|
|
+// generated by autoexplicit.sh
|
|
|
+template std::vector<Eigen::Matrix<int, -1, 1, 0, -1, 1>::Scalar, std::allocator<Eigen::Matrix<int, -1, 1, 0, -1, 1>::Scalar> > igl::matrix_to_list<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&);
|
|
|
+//template void igl::matrix_to_list<Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >, double>(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >&);
|
|
|
+//template void igl::matrix_to_list<Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >, int>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&);
|
|
|
+template void igl::matrix_to_list<Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<Eigen::Matrix<double, -1, -1, 0, -1, -1>::Scalar, std::allocator<Eigen::Matrix<double, -1, -1, 0, -1, -1>::Scalar> >, std::allocator<std::vector<Eigen::Matrix<double, -1, -1, 0, -1, -1>::Scalar, std::allocator<Eigen::Matrix<double, -1, -1, 0, -1, -1>::Scalar> > > >&);
|
|
|
+template void igl::matrix_to_list<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, std::allocator<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar> >, std::allocator<std::vector<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, std::allocator<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar> > > >&);
|
|
|
#endif
|