11 #ifndef EIGEN_COMMAINITIALIZER_H
12 #define EIGEN_COMMAINITIALIZER_H
27 template<
typename XprType>
30 typedef typename XprType::Scalar Scalar;
31 typedef typename XprType::Index Index;
34 : m_xpr(xpr), m_row(0), m_col(1), m_currentBlockRows(1)
36 m_xpr.coeffRef(0,0) = s;
39 template<
typename OtherDerived>
41 : m_xpr(xpr), m_row(0), m_col(other.cols()), m_currentBlockRows(other.rows())
43 m_xpr.block(0, 0, other.rows(), other.cols()) = other;
50 : m_xpr(o.m_xpr), m_row(o.m_row), m_col(o.m_col), m_currentBlockRows(o.m_currentBlockRows) {
60 if (m_col==m_xpr.cols())
62 m_row+=m_currentBlockRows;
64 m_currentBlockRows = 1;
65 eigen_assert(m_row<m_xpr.rows()
66 &&
"Too many rows passed to comma initializer (operator<<)");
68 eigen_assert(m_col<m_xpr.cols()
69 &&
"Too many coefficients passed to comma initializer (operator<<)");
70 eigen_assert(m_currentBlockRows==1);
71 m_xpr.coeffRef(m_row, m_col++) = s;
76 template<
typename OtherDerived>
79 if(other.cols()==0 || other.rows()==0)
81 if (m_col==m_xpr.cols())
83 m_row+=m_currentBlockRows;
85 m_currentBlockRows = other.rows();
86 eigen_assert(m_row+m_currentBlockRows<=m_xpr.rows()
87 &&
"Too many rows passed to comma initializer (operator<<)");
89 eigen_assert(m_col<m_xpr.cols()
90 &&
"Too many coefficients passed to comma initializer (operator<<)");
91 eigen_assert(m_currentBlockRows==other.rows());
92 if (OtherDerived::SizeAtCompileTime !=
Dynamic)
93 m_xpr.template block<OtherDerived::RowsAtCompileTime !=
Dynamic ? OtherDerived::RowsAtCompileTime : 1,
94 OtherDerived::ColsAtCompileTime !=
Dynamic ? OtherDerived::ColsAtCompileTime : 1>
95 (m_row, m_col) = other;
97 m_xpr.block(m_row, m_col, other.rows(), other.cols()) = other;
98 m_col += other.cols();
104 eigen_assert((m_row+m_currentBlockRows) == m_xpr.rows()
105 && m_col == m_xpr.cols()
106 &&
"Too few coefficients passed to comma initializer (operator<<)");
121 Index m_currentBlockRows;
137 template<
typename Derived>
144 template<
typename Derived>
145 template<
typename OtherDerived>
154 #endif // EIGEN_COMMAINITIALIZER_H
const int Dynamic
Definition: Constants.h:21
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:41
Helper class used by the comma initializer operator.
Definition: CommaInitializer.h:28
CommaInitializer< Derived > operator<<(const Scalar &s)
Definition: CommaInitializer.h:138
XprType & finished()
Definition: CommaInitializer.h:116