66class SizeInfo :
public std::vector<unsigned int>
69 using std::vector<
unsigned int>::vector;
71 bool isScalar()
const {
return size() == 1 && (*this)[0] == 1; }
72 bool isVector()
const {
return size() == 1 && (*this)[0] > 1; }
73 bool is2DMatrix()
const {
return size() == 2; }
74 std::size_t dimension()
const noexcept
76 return size() == 1 && (*this)[0] == 1 ? 0 : size();
79 std::size_t totalElements()
const
88 static SizeInfo Scalar() {
return {1U}; }
89 static SizeInfo RowVector(
unsigned int rows) {
return {rows}; }
90 static SizeInfo Matrix(
unsigned int rows,
unsigned int cols)
92 return {{rows, cols}};
95 Matrix(
unsigned int layers,
unsigned int rows,
unsigned int cols)
97 return {{layers, rows, cols}};
100 unsigned int layers()
const
104 return size() >= 3 ? operator[](size() - 3) : 1;
107 unsigned int rows()
const
111 return size() >= 2 ? operator[](size() - 2) : 1;
114 unsigned int columns()
const {
return empty() ? 0 : back(); }