11#ifndef EIGEN_COMMAINITIALIZER_H
12#define EIGEN_COMMAINITIALIZER_H
15#include "./InternalHeaderCheck.h"
30template <
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<<)");
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());
88 other.cols()) = other;
89 m_col += other.cols();
94#if defined VERIFY_RAISES_ASSERT && (!defined EIGEN_NO_ASSERTION_CHECKING) && defined EIGEN_EXCEPTIONS
95 EIGEN_EXCEPTION_SPEC(Eigen::eigen_assert_exception)
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;
134template <
typename Derived>
136 return CommaInitializer<Derived>(*
static_cast<Derived*
>(
this), s);
Base class for all dense matrices, vectors, and arrays.
Definition ForwardDeclarations.h:59
FixedBlockXpr<...,... >::Type block(Index startRow, Index startCol, NRowsType blockRows, NColsType blockCols)
Definition DenseBase.h:122
Helper class used by the comma initializer operator.
Definition ForwardDeclarations.h:179
XprType & finished()
Definition CommaInitializer.h:108