6 namespace honey {
namespace matrix
10 template<
class Matrix>
15 Builder(
Builder&& rhs) : m(rhs.m), row(rhs.row), col(rhs.col), height(rhs.height) { rhs.height = 0; }
19 if (height == 0)
return;
20 assert(row + height == m.rows() && col == m.cols(),
sout()
21 <<
"Assigned too few matrix elements in comma initializer.\n"
22 <<
"Matrix size: (" << m.rows() <<
", " << m.cols() <<
")\n"
23 <<
"Cursor index: (" << row <<
", " << col <<
")\n"
24 <<
"Current row height: " << height);
44 preAppend(rhs.rows(), rhs.cols());
46 m.
block<Rhs::s_rows, Rhs::s_cols>(row, col) = rhs;
48 m.
block(row, col, rhs.rows(), rhs.cols()) = rhs;
59 void preAppend(
sdt rows,
sdt cols)
69 assert(row + rows <= m.rows() && col + cols <= m.cols(),
sout()
70 <<
"Block assignment in comma initializer out of matrix bounds.\n"
71 <<
"Matrix size: (" << m.rows() <<
", " << m.cols() <<
")\n"
72 <<
"Cursor index: (" << row <<
", " << col <<
")\n"
73 <<
"Block size: (" << rows <<
", " << cols <<
")");
75 if (height < rows) height = rows;
(m x n)-dimensional matrix
Definition: Matrix.h:24
static const sdt dynamic
Definition: Traits.h:23
Builder & operator,(const MatrixBase< T > &rhs)
Append matrix.
Definition: Builder.h:41
Matrix comma initializer.
Definition: Builder.h:11
matrix::Block< MatrixS, Rows, Cols > block(sdt row, sdt col, sdt rows=-1, sdt cols=-1)
Get block at offset (row,col) with size (Rows, Cols). If Rows or Cols is fixed then rows or cols may ...
Definition: Base.h:252
ptrdiff_t sdt
Size difference type, shorthand for ptrdiff_t.
Definition: Core.h:92
Matrix & eval() const
Get initialized matrix.
Definition: Builder.h:54
Builder & operator,(typename Matrix::Real rhs)
Append scalar.
Definition: Builder.h:32
ostringstream sout()
Shorthand to create ostringstream.
Definition: Stream.h:15
#define assert(...)
Forwards to assert_#args. See assert_1(), assert_2().
Definition: Debug.h:24
float Real
Real number type. See Real_ for real number operations and constants.
Definition: Real.h:21
~Builder()
Definition: Builder.h:17
Builder(Builder &&rhs)
Definition: Builder.h:15
Builder & operator,(const Builder< T > &rhs)
Append builder.
Definition: Builder.h:29
Builder(Matrix &m)
Definition: Builder.h:14
Matrix base class.
Definition: Base.h:17
Global Honeycomb namespace.