11 #ifndef EIGEN_COMMAINITIALIZER_H 12 #define EIGEN_COMMAINITIALIZER_H 27 template<
typename XprType>
30 typedef typename XprType::Scalar Scalar;
34 : m_xpr(xpr), m_row(0), m_col(1), m_currentBlockRows(1)
36 m_xpr.coeffRef(0,0) = s;
39 template<
typename OtherDerived>
42 : m_xpr(xpr), m_row(0), m_col(other.cols()), m_currentBlockRows(other.rows())
44 m_xpr.block(0, 0, other.rows(), other.cols()) = other;
51 inline CommaInitializer(
const CommaInitializer& o)
52 : m_xpr(o.m_xpr), m_row(o.m_row), m_col(o.m_col), m_currentBlockRows(o.m_currentBlockRows) {
54 const_cast<CommaInitializer&
>(o).m_row = m_xpr.rows();
55 const_cast<CommaInitializer&
>(o).m_col = m_xpr.cols();
56 const_cast<CommaInitializer&
>(o).m_currentBlockRows = 0;
61 CommaInitializer& operator,(
const Scalar& s)
63 if (m_col==m_xpr.cols())
65 m_row+=m_currentBlockRows;
67 m_currentBlockRows = 1;
68 eigen_assert(m_row<m_xpr.rows()
69 &&
"Too many rows passed to comma initializer (operator<<)");
71 eigen_assert(m_col<m_xpr.cols()
72 &&
"Too many coefficients passed to comma initializer (operator<<)");
73 eigen_assert(m_currentBlockRows==1);
74 m_xpr.coeffRef(m_row, m_col++) = s;
79 template<
typename OtherDerived>
83 if (m_col==m_xpr.cols() && (other.cols()!=0 || other.rows()!=m_currentBlockRows))
85 m_row+=m_currentBlockRows;
87 m_currentBlockRows = other.rows();
88 eigen_assert(m_row+m_currentBlockRows<=m_xpr.rows()
89 &&
"Too many rows passed to comma initializer (operator<<)");
91 eigen_assert((m_col + other.cols() <= m_xpr.cols())
92 &&
"Too many coefficients passed to comma initializer (operator<<)");
93 eigen_assert(m_currentBlockRows==other.rows());
94 m_xpr.template block<OtherDerived::RowsAtCompileTime, OtherDerived::ColsAtCompileTime>
95 (m_row, m_col, other.rows(), other.cols()) = other;
96 m_col += other.cols();
101 inline ~CommaInitializer()
102 #if defined VERIFY_RAISES_ASSERT && (!defined EIGEN_NO_ASSERTION_CHECKING) && defined EIGEN_EXCEPTIONS 118 eigen_assert(((m_row+m_currentBlockRows) == m_xpr.rows() || m_xpr.cols() == 0)
119 && m_col == m_xpr.cols()
120 &&
"Too few coefficients passed to comma initializer (operator<<)");
127 Index m_currentBlockRows;
143 template<
typename Derived>
150 template<
typename Derived>
151 template<
typename OtherDerived>
160 #endif // EIGEN_COMMAINITIALIZER_H internal::traits< Derived >::Scalar Scalar
The numeric type of the expression' coefficients, e.g.
Definition: DenseBase.h:66
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:85
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:41
EIGEN_DEVICE_FUNC CommaInitializer< Derived > operator<<(const Scalar &s)
Definition: CommaInitializer.h:144
Helper class used by the comma initializer operator.
Definition: CommaInitializer.h:28
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
EIGEN_DEVICE_FUNC XprType & finished()
Definition: CommaInitializer.h:117