19 #include "Eigen/Dense" 22 namespace perception {
31 size_t width() {
return width_; }
37 void Reserve(
const size_t reserve_height,
const size_t reserve_width) {
38 max_height_ = (reserve_height > max_height_) ? reserve_height : max_height_;
39 max_width_ = (reserve_width > max_width_) ? reserve_width : max_width_;
40 mat_.resize(max_height_, max_width_);
47 void Resize(
const size_t resize_height,
const size_t resize_width) {
48 height_ = resize_height;
49 width_ = resize_width;
50 if (resize_height <= max_height_ && resize_width <= max_width_) {
53 max_height_ = (resize_height > max_height_) ? resize_height : max_height_;
54 max_width_ = (resize_width > max_width_) ? resize_width : max_width_;
55 mat_.resize(max_height_, max_width_);
59 std::ostream& stream = *out_stream;
60 for (
size_t row = 0; row < height_; ++row) {
61 for (
size_t col = 0; col < width_; ++col) {
62 stream << mat_(row, col) <<
"\t";
68 inline const T&
operator()(
const size_t row,
const size_t col)
const {
69 return mat_(row, col);
72 inline T&
operator()(
const size_t row,
const size_t col) {
73 return mat_(row, col);
77 Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> mat_;
78 size_t max_height_ = 1000;
79 size_t max_width_ = 1000;
Definition: secure_matrix.h:26
void Reserve(const size_t reserve_height, const size_t reserve_width)
Definition: secure_matrix.h:37
const T & operator()(const size_t row, const size_t col) const
Definition: secure_matrix.h:68
SecureMat()
Definition: secure_matrix.h:28
size_t width()
Definition: secure_matrix.h:31
void ToString(std::ostream *out_stream)
Definition: secure_matrix.h:58
T & operator()(const size_t row, const size_t col)
Definition: secure_matrix.h:72
void Resize(const size_t resize_height, const size_t resize_width)
Definition: secure_matrix.h:47
size_t height()
Definition: secure_matrix.h:30