* compilation fixes for gcc 3.3

* test Part::swap
This commit is contained in:
Gael Guennebaud 2009-05-06 08:43:38 +00:00
parent 23f073625d
commit 1e286464ab
4 changed files with 36 additions and 28 deletions

View File

@ -221,7 +221,7 @@ class Block<MatrixType,BlockRows,BlockCols,PacketAccess,HasDirectAccess>
class InnerIterator;
typedef typename ei_traits<Block>::AlignedDerivedType AlignedDerivedType;
friend class Block<MatrixType,BlockRows,BlockCols,AsRequested,HasDirectAccess>;
friend class Block<MatrixType,BlockRows,BlockCols,PacketAccess==AsRequested?ForceAligned:AsRequested,HasDirectAccess>;
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block)

View File

@ -117,10 +117,10 @@ template<typename MatrixType, unsigned int Mode> class Part
const Block<Part, RowsAtCompileTime, 1> col(int i) { return Base::col(i); }
const Block<Part, RowsAtCompileTime, 1> col(int i) const { return Base::col(i); }
template<typename OtherDerived/*, int OtherMode*/>
template<typename OtherDerived>
void swap(const MatrixBase<OtherDerived>& other)
{
Part<SwapWrapper<MatrixType>,Mode>(SwapWrapper<MatrixType>(const_cast<MatrixType&>(m_matrix))).lazyAssign(other.derived());
Part<SwapWrapper<MatrixType>,Mode>(const_cast<MatrixType&>(m_matrix)).lazyAssign(other.derived());
}
protected:

View File

@ -114,6 +114,14 @@ template<typename MatrixType> void triangular(const MatrixType& m)
VERIFY((m1.template part<Eigen::UpperTriangular>() * m2.template part<Eigen::UpperTriangular>()).isUpperTriangular());
// test swap
m1.setOnes();
m2.setZero();
m2.template part<Eigen::UpperTriangular>().swap(m1);
m3.setZero();
m3.template part<Eigen::UpperTriangular>().setOnes();
VERIFY_IS_APPROX(m2,m3);
}
void test_triangular()