1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #include "mat_min.h"
- template <typename DerivedX, typename DerivedY, typename DerivedI>
- IGL_INLINE void igl::mat_min(
- const Eigen::DenseBase<DerivedX> & X,
- const int dim,
- Eigen::PlainObjectBase<DerivedY> & Y,
- Eigen::PlainObjectBase<DerivedI> & I)
- {
- assert(dim==1||dim==2);
-
- int n = (dim==1?X.cols():X.rows());
-
- Y.resize(n);
- I.resize(n);
-
- for(int j = 0;j<n;j++)
- {
- typename DerivedX::Index PHONY,i;
- typename DerivedX::Scalar m;
- if(dim==1)
- {
- m = X.col(j).minCoeff(&i,&PHONY);
- }else
- {
- m = X.row(j).minCoeff(&PHONY,&i);
- }
- Y(j) = m;
- I(j) = i;
- }
- }
- #ifdef IGL_STATIC_LIBRARY
- template void igl::mat_min<Eigen::Array<bool, -1, 3, 0, -1, 3>, Eigen::Array<bool, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::DenseBase<Eigen::Array<bool, -1, 3, 0, -1, 3> > const&, int, Eigen::PlainObjectBase<Eigen::Array<bool, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
- template void igl::mat_min<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::DenseBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
- #endif
|