|
@@ -6,6 +6,8 @@
|
|
|
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
|
|
// obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
#include "slice_mask.h"
|
|
|
+#include "slice.h"
|
|
|
+#include "find.h"
|
|
|
#include <cassert>
|
|
|
|
|
|
template <typename DerivedX,typename DerivedY>
|
|
@@ -115,15 +117,42 @@ IGL_INLINE DerivedX igl::slice_mask(
|
|
|
return Y;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+template <typename XType, typename YType>
|
|
|
+IGL_INLINE void igl::slice_mask(
|
|
|
+ const Eigen::SparseMatrix<XType> & X,
|
|
|
+ const Eigen::Array<bool,Eigen::Dynamic,1> & R,
|
|
|
+ const int dim,
|
|
|
+ Eigen::SparseMatrix<YType> & Y)
|
|
|
+{
|
|
|
+ // Cheapskate solution
|
|
|
+ Eigen::VectorXi Ri;
|
|
|
+ find(R,Ri);
|
|
|
+ return slice(X,Ri,dim,Y);
|
|
|
+}
|
|
|
+
|
|
|
+template <typename XType, typename YType>
|
|
|
+IGL_INLINE void igl::slice_mask(
|
|
|
+ const Eigen::SparseMatrix<XType> & X,
|
|
|
+ const Eigen::Array<bool,Eigen::Dynamic,1> & R,
|
|
|
+ const Eigen::Array<bool,Eigen::Dynamic,1> & C,
|
|
|
+ Eigen::SparseMatrix<YType> & Y)
|
|
|
+{
|
|
|
+ // Cheapskate solution
|
|
|
+ Eigen::VectorXi Ri;
|
|
|
+ find(R,Ri);
|
|
|
+ Eigen::VectorXi Ci;
|
|
|
+ find(C,Ci);
|
|
|
+ return slice(X,Ri,Ci,Y);
|
|
|
+}
|
|
|
+
|
|
|
#ifdef IGL_STATIC_LIBRARY
|
|
|
// Explicit template specialization
|
|
|
// generated by autoexplicit.sh
|
|
|
+template void igl::slice_mask<bool, bool>(Eigen::SparseMatrix<bool, 0, int> const&, Eigen::Array<bool, -1, 1, 0, -1, 1> const&, int, Eigen::SparseMatrix<bool, 0, int>&);
|
|
|
template void igl::slice_mask<Eigen::Matrix<double, -1, 2, 0, -1, 2>, Eigen::Matrix<double, -1, 2, 0, -1, 2> >(Eigen::DenseBase<Eigen::Matrix<double, -1, 2, 0, -1, 2> > const&, Eigen::Array<bool, -1, 1, 0, -1, 1> const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 2, 0, -1, 2> >&);
|
|
|
-// generated by autoexplicit.sh
|
|
|
template void igl::slice_mask<Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<int, -1, 2, 0, -1, 2> >(Eigen::DenseBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, Eigen::Array<bool, -1, 1, 0, -1, 1> const&, int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> >&);
|
|
|
-// generated by autoexplicit.sh
|
|
|
template void igl::slice_mask<Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, Eigen::Array<bool, -1, 1, 0, -1, 1> const&, int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
|
|
|
-// generated by autoexplicit.sh
|
|
|
template void igl::slice_mask<Eigen::Array<bool, -1, 1, 0, -1, 1>, Eigen::Array<bool, -1, 1, 0, -1, 1> >(Eigen::DenseBase<Eigen::Array<bool, -1, 1, 0, -1, 1> > const&, Eigen::Array<bool, -1, 1, 0, -1, 1> const&, int, Eigen::PlainObjectBase<Eigen::Array<bool, -1, 1, 0, -1, 1> >&);
|
|
|
template void igl::slice_mask<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Array<bool, -1, 1, 0, -1, 1> const&, int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
|
|
|
template void igl::slice_mask<Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::Array<bool, -1, 1, 0, -1, 1> const&, Eigen::Array<bool, -1, 1, 0, -1, 1> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
|