MCPcopy Create free account
hub / github.com/CoolProp/CoolProp / removeColumn

Function removeColumn

include/CoolProp/numerics/MatrixMath.h:236–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

234
235template <class T>
236void 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){

Callers 3

evaluateMethod · 0.85
MatrixMath.cppFile · 0.85
minor_matrixFunction · 0.85

Calls 1

formatFunction · 0.50

Tested by

no test coverage detected