| 234 | |
| 235 | template <class T> |
| 236 | void removeColumn(Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& matrix, std::size_t colToRemove) { |
| 237 | //template<class T> void removeColumn(Eigen::MatrixXd& matrix, std::size_t colToRemove){ |
| 238 | //void removeColumn(Eigen::MatrixXd& matrix, unsigned int colToRemove){ |
| 239 | //template <typename Derived> void removeColumn(Eigen::MatrixBase<Derived> &matrix, std::size_t colToRemove){ |
| 240 | std::size_t numRows = matrix.rows(); |
| 241 | std::size_t numCols = matrix.cols() - 1; |
| 242 | if (colToRemove < numCols) { |
| 243 | matrix.block(0, colToRemove, numRows, numCols - colToRemove) = matrix.block(0, colToRemove + 1, numRows, numCols - colToRemove); |
| 244 | } else { |
| 245 | if (colToRemove > numCols) { |
| 246 | throw ValueError(format("Your matrix does not have enough columns, %d is not greater or equal to %d.", numCols, colToRemove)); |
| 247 | } |
| 248 | // Do nothing, resize removes the last column |
| 249 | } |
| 250 | matrix.conservativeResize(numRows, numCols); |
| 251 | } |
| 252 | |
| 253 | ///// @param coefficients matrix containing the ordered coefficients |
| 254 | //template <class T> Eigen::Matrix<T, Eigen::Dynamic,Eigen::Dynamic> convert(const std::vector<std::vector<T> > &coefficients){ |
no test coverage detected