some more cleanup and reorganisation

This commit is contained in:
Benoit Jacob
2007-12-17 07:25:11 +00:00
parent 9314b8e024
commit f75a0c5179
28 changed files with 138 additions and 102 deletions

View File

@@ -70,8 +70,7 @@ template<typename Scalar, typename Derived> class MatrixBase
Transpose<Derived> transpose() const;
const Conjugate<Derived> conjugate() const;
const Transpose<Conjugate<Derived> > adjoint() const
{ return conjugate().transpose(); }
const Transpose<Conjugate<Derived> > adjoint() const;
Scalar trace() const;
template<typename OtherDerived>
@@ -139,71 +138,55 @@ template<typename Scalar, typename Derived> class MatrixBase
Derived& operator/=(const std::complex<float>& other);
Derived& operator/=(const std::complex<double>& other);
Scalar read(int row, int col, AssertLevel assertLevel = InternalDebugging) const
Scalar coeff(int row, int col, AssertLevel assertLevel = InternalDebugging) const
{
eigen_assert(assertLevel, row >= 0 && row < rows()
&& col >= 0 && col < cols());
return static_cast<const Derived *>(this)->_read(row, col);
return static_cast<const Derived *>(this)->_coeff(row, col);
}
Scalar operator()(int row, int col) const { return read(row, col, UserDebugging); }
Scalar operator()(int row, int col) const { return coeff(row, col, UserDebugging); }
Scalar& write(int row, int col, AssertLevel assertLevel = InternalDebugging)
Scalar& coeffRef(int row, int col, AssertLevel assertLevel = InternalDebugging)
{
eigen_assert(assertLevel, row >= 0 && row < rows()
&& col >= 0 && col < cols());
return static_cast<Derived *>(this)->_write(row, col);
return static_cast<Derived *>(this)->_coeffRef(row, col);
}
Scalar& operator()(int row, int col) { return write(row, col, UserDebugging); }
Scalar& operator()(int row, int col) { return coeffRef(row, col, UserDebugging); }
Scalar read(int index, AssertLevel assertLevel = InternalDebugging) const
Scalar coeff(int index, AssertLevel assertLevel = InternalDebugging) const
{
eigen_assert(assertLevel, IsVector);
if(RowsAtCompileTime == 1)
{
eigen_assert(assertLevel, index >= 0 && index < cols());
return read(0, index);
return coeff(0, index);
}
else
{
eigen_assert(assertLevel, index >= 0 && index < rows());
return read(index, 0);
return coeff(index, 0);
}
}
Scalar operator[](int index) const { return read(index, UserDebugging); }
Scalar operator[](int index) const { return coeff(index, UserDebugging); }
Scalar& write(int index, AssertLevel assertLevel = InternalDebugging)
Scalar& coeffRef(int index, AssertLevel assertLevel = InternalDebugging)
{
eigen_assert(assertLevel, IsVector);
if(RowsAtCompileTime == 1)
{
eigen_assert(assertLevel, index >= 0 && index < cols());
return write(0, index);
return coeffRef(0, index);
}
else
{
eigen_assert(assertLevel, index >= 0 && index < rows());
return write(index, 0);
return coeffRef(index, 0);
}
}
Scalar& operator[](int index) { return write(index, UserDebugging); }
Scalar& operator[](int index) { return coeffRef(index, UserDebugging); }
Eval<Derived> eval() const EIGEN_ALWAYS_INLINE;
};
template<typename Scalar, typename Derived>
std::ostream & operator <<
( std::ostream & s,
const MatrixBase<Scalar, Derived> & m )
{
for( int i = 0; i < m.rows(); i++ )
{
s << m( i, 0 );
for (int j = 1; j < m.cols(); j++ )
s << " " << m( i, j );
if( i < m.rows() - 1)
s << std::endl;
}
return s;
}
#endif // EIGEN_MATRIXBASE_H