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;
49 if (m_col==m_xpr.cols())
51 m_row+=m_currentBlockRows;
53 m_currentBlockRows = 1;
54 eigen_assert(m_row<m_xpr.rows()
55 &&
"Too many rows passed to comma initializer (operator<<)");
57 eigen_assert(m_col<m_xpr.cols()
58 &&
"Too many coefficients passed to comma initializer (operator<<)");
59 eigen_assert(m_currentBlockRows==1);
60 m_xpr.coeffRef(m_row, m_col++) = s;
65 template<
typename OtherDerived>
68 if(other.cols()==0 || other.rows()==0)
70 if (m_col==m_xpr.cols())
72 m_row+=m_currentBlockRows;
74 m_currentBlockRows = other.rows();
75 eigen_assert(m_row+m_currentBlockRows<=m_xpr.rows()
76 &&
"Too many rows passed to comma initializer (operator<<)");
78 eigen_assert(m_col<m_xpr.cols()
79 &&
"Too many coefficients passed to comma initializer (operator<<)");
80 eigen_assert(m_currentBlockRows==other.rows());
81 if (OtherDerived::SizeAtCompileTime !=
Dynamic)
82 m_xpr.template block<OtherDerived::RowsAtCompileTime !=
Dynamic ? OtherDerived::RowsAtCompileTime : 1,
83 OtherDerived::ColsAtCompileTime !=
Dynamic ? OtherDerived::ColsAtCompileTime : 1>
84 (m_row, m_col) = other;
86 m_xpr.block(m_row, m_col, other.rows(), other.cols()) = other;
87 m_col += other.cols();
93 eigen_assert((m_row+m_currentBlockRows) == m_xpr.rows()
94 && m_col == m_xpr.cols()
95 &&
"Too few coefficients passed to comma initializer (operator<<)");
110 Index m_currentBlockRows;
126 template<
typename Derived>
133 template<
typename Derived>
134 template<
typename OtherDerived>
143 #endif // EIGEN_COMMAINITIALIZER_H