|
@@ -147,13 +147,13 @@ IGL_INLINE void igl::sort2(
|
|
|
{
|
|
|
using namespace Eigen;
|
|
|
using namespace std;
|
|
|
- Y = X;
|
|
|
+ typedef typename Eigen::PlainObjectBase<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<DerivedX>::Scalar Scalar;
|
|
|
typedef typename Eigen::PlainObjectBase<DerivedIX>::Scalar Index;
|
|
|
IX.resize(X.rows(),X.cols());
|
|
|
if(dim==1)
|
|
@@ -168,8 +168,8 @@ IGL_INLINE void igl::sort2(
|
|
|
// loop over columns (or rows)
|
|
|
for(int i = 0;i<num_outer;i++)
|
|
|
{
|
|
|
- Scalar & a = (dim==1 ? Y(0,i) : Y(i,0));
|
|
|
- Scalar & b = (dim==1 ? Y(1,i) : Y(i,1));
|
|
|
+ YScalar & a = (dim==1 ? Y(0,i) : Y(i,0));
|
|
|
+ YScalar & b = (dim==1 ? Y(1,i) : Y(i,1));
|
|
|
Index & ai = (dim==1 ? IX(0,i) : IX(i,0));
|
|
|
Index & bi = (dim==1 ? IX(1,i) : IX(i,1));
|
|
|
if((ascending && a>b) || (!ascending && a<b))
|
|
@@ -226,4 +226,6 @@ template void igl::sort_new<Eigen::Matrix<int, 1, 6, 1, 1, 6>, Eigen::Matrix<int
|
|
|
template void igl::sort<Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<int, -1, 2, 0, -1, 2> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> >&);
|
|
|
template void igl::sort<Eigen::Matrix<double, -1, 4, 0, -1, 4>, Eigen::Matrix<double, -1, 4, 0, -1, 4>, Eigen::Matrix<int, -1, 4, 0, -1, 4> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 4, 0, -1, 4> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 4, 0, -1, 4> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 4, 0, -1, 4> >&);
|
|
|
template void igl::sort<Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
|
|
|
+template void igl::sort<long>(std::vector<long, std::allocator<long> > const&, bool, std::vector<long, std::allocator<long> >&, std::vector<unsigned long, std::allocator<unsigned long> >&);
|
|
|
+template void igl::sort<Eigen::Matrix<double, -1, 2, 0, -1, 2>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 2, 0, -1, 2> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
|
|
|
#endif
|