29 lines
916 B
C++
29 lines
916 B
C++
#pragma once
|
|
#include <Eigen/Core>
|
|
namespace mix_cc {
|
|
namespace dataframe {
|
|
namespace detail {
|
|
void remove_row(Eigen::MatrixXd* const matrix, unsigned int row_to_rm) {
|
|
unsigned int num_row = matrix->rows() - 1;
|
|
unsigned int num_col = matrix->cols();
|
|
|
|
if (row_to_rm < num_row)
|
|
matrix->block(row_to_rm, 0, num_row - row_to_rm, num_col) =
|
|
matrix->block(row_to_rm + 1, 0, num_row - row_to_rm, num_col);
|
|
|
|
matrix->conservativeResize(num_row, num_col);
|
|
}
|
|
|
|
void remove_column(Eigen::MatrixXd* const matrix, unsigned int col_to_rm) {
|
|
unsigned int num_row = matrix->rows();
|
|
unsigned int num_col = matrix->cols() - 1;
|
|
|
|
if (col_to_rm < num_col)
|
|
matrix->block(0, col_to_rm, num_row, num_col - col_to_rm) =
|
|
matrix->block(0, col_to_rm + 1, num_row, num_col - col_to_rm);
|
|
|
|
matrix->conservativeResize(num_row, num_col);
|
|
}
|
|
} // namespace detail
|
|
} // namespace dataframe
|
|
} // namespace mix_cc
|