Slicing_custom_padding_cxx11.cpp
Go to the documentation of this file.
1 struct pad {
2  Index size() const { return out_size; }
3  Index operator[] (Index i) const { return std::max<Index>(0,i-(out_size-in_size)); }
5 };
6 
7 Matrix3i A;
8 A.reshaped() = VectorXi::LinSpaced(9,1,9);
9 cout << "Initial matrix A:\n" << A << "\n\n";
10 MatrixXi B(5,5);
11 B = A(pad{3,5}, pad{3,5});
12 cout << "A(pad{3,N}, pad{3,N}):\n" << B << "\n\n";
Index size() const
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
Index operator[](Index i) const


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:35:50