11 #ifndef EIGEN_COMMAINITIALIZER_H 12 #define EIGEN_COMMAINITIALIZER_H 15 #include "./InternalHeaderCheck.h" 30 template <
typename XprType>
32 typedef typename XprType::Scalar Scalar;
35 : m_xpr(xpr), m_row(0), m_col(1), m_currentBlockRows(1) {
36 eigen_assert(m_xpr.rows() > 0 && m_xpr.cols() > 0 &&
"Cannot comma-initialize a 0x0 matrix (operator<<)");
37 m_xpr.coeffRef(0, 0) = s;
40 template <
typename OtherDerived>
42 : m_xpr(xpr), m_row(0), m_col(other.
cols()), m_currentBlockRows(other.
rows()) {
43 eigen_assert(m_xpr.rows() >= other.
rows() && m_xpr.cols() >= other.
cols() &&
44 "Cannot comma-initialize a 0x0 matrix (operator<<)");
45 m_xpr.template block<OtherDerived::RowsAtCompileTime, OtherDerived::ColsAtCompileTime>(0, 0, other.
rows(),
46 other.
cols()) = other;
53 : m_xpr(o.m_xpr), m_row(o.m_row), m_col(o.m_col), m_currentBlockRows(o.m_currentBlockRows) {
62 if (m_col == m_xpr.cols()) {
63 m_row += m_currentBlockRows;
65 m_currentBlockRows = 1;
66 eigen_assert(m_row < m_xpr.rows() &&
"Too many rows passed to comma initializer (operator<<)");
68 eigen_assert(m_col < m_xpr.cols() &&
"Too many coefficients passed to comma initializer (operator<<)");
69 eigen_assert(m_currentBlockRows == 1);
70 m_xpr.coeffRef(m_row, m_col++) = s;
75 template <
typename OtherDerived>
77 if (m_col == m_xpr.cols() && (other.
cols() != 0 || other.
rows() != m_currentBlockRows)) {
78 m_row += m_currentBlockRows;
80 m_currentBlockRows = other.
rows();
81 eigen_assert(m_row + m_currentBlockRows <= m_xpr.rows() &&
82 "Too many rows passed to comma initializer (operator<<)");
84 eigen_assert((m_col + other.
cols() <= m_xpr.cols()) &&
85 "Too many coefficients passed to comma initializer (operator<<)");
86 eigen_assert(m_currentBlockRows == other.
rows());
87 m_xpr.template block<OtherDerived::RowsAtCompileTime, OtherDerived::ColsAtCompileTime>(m_row, m_col, other.
rows(),
88 other.
cols()) = other;
89 m_col += other.
cols();
94 #if defined VERIFY_RAISES_ASSERT && (!defined EIGEN_NO_ASSERTION_CHECKING) && defined EIGEN_EXCEPTIONS 109 eigen_assert(((m_row + m_currentBlockRows) == m_xpr.rows() || m_xpr.cols() == 0) && m_col == m_xpr.cols() &&
110 "Too few coefficients passed to comma initializer (operator<<)");
117 Index m_currentBlockRows;
134 template <
typename Derived>
140 template <
typename Derived>
141 template <
typename OtherDerived>
149 #endif // EIGEN_COMMAINITIALIZER_H XprType & finished()
Definition: CommaInitializer.h:108
internal::traits< Derived >::Scalar Scalar
Definition: DenseBase.h:62
Namespace containing all symbols from the Eigen library.
Definition: B01_Experimental.dox:1
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:38
CommaInitializer< Derived > operator<<(const Scalar &s)
Definition: CommaInitializer.h:135
Helper class used by the comma initializer operator.
Definition: CommaInitializer.h:31
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:82
constexpr Index rows() const noexcept
Definition: EigenBase.h:59
constexpr Index cols() const noexcept
Definition: EigenBase.h:61