aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/CommaInitializer.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2008-03-12 18:10:52 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2008-03-12 18:10:52 +0000
commit35bce20954581415a9e5057cc24f6e4769ef78f5 (patch)
tree2f2b3c0eebb1001a32c035b31631d5e633edebf8 /Eigen/src/Core/CommaInitializer.h
parent6da4d9d25620a025f00331bfd36794b89119b739 (diff)
Removed Column and Row in favor of Block
Diffstat (limited to 'Eigen/src/Core/CommaInitializer.h')
-rw-r--r--Eigen/src/Core/CommaInitializer.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/Eigen/src/Core/CommaInitializer.h b/Eigen/src/Core/CommaInitializer.h
index 5456eb7c6..c7a292437 100644
--- a/Eigen/src/Core/CommaInitializer.h
+++ b/Eigen/src/Core/CommaInitializer.h
@@ -52,8 +52,11 @@ struct MatrixBase<Derived>::CommaInitializer
m_row+=m_currentBlockRows;
m_col = 0;
m_currentBlockRows = 1;
+ assert(m_row<m_matrix.rows()
+ && "Too many rows passed to MatrixBase::operator<<");
}
- assert(m_col<m_matrix.cols() && "Too many coefficients passed to Matrix::operator<<");
+ assert(m_col<m_matrix.cols()
+ && "Too many coefficients passed to MatrixBase::operator<<");
assert(m_currentBlockRows==1);
m_matrix.coeffRef(m_row, m_col++) = s;
return *this;
@@ -67,10 +70,17 @@ struct MatrixBase<Derived>::CommaInitializer
m_row+=m_currentBlockRows;
m_col = 0;
m_currentBlockRows = other.rows();
+ assert(m_row+m_currentBlockRows<=m_matrix.rows()
+ && "Too many rows passed to MatrixBase::operator<<");
}
- assert(m_col<m_matrix.cols() && "Too many coefficients passed to Matrix::operator<<");
+ assert(m_col<m_matrix.cols()
+ && "Too many coefficients passed to MatrixBase::operator<<");
assert(m_currentBlockRows==other.rows());
- m_matrix.block(m_row, m_col, other.rows(), other.cols()) = other;
+ if (OtherDerived::RowsAtCompileTime>0 && OtherDerived::ColsAtCompileTime>0)
+ m_matrix.block< (OtherDerived::RowsAtCompileTime>0?OtherDerived::RowsAtCompileTime:1) ,
+ (OtherDerived::ColsAtCompileTime>0?OtherDerived::ColsAtCompileTime:1) >(m_row, m_col) = other;
+ else
+ m_matrix.block(m_row, m_col, other.rows(), other.cols()) = other;
m_col += other.cols();
return *this;
}