- make MatrixBase and all expressions aware of their preferred traversal order.

Honor this preference in operator=.
- add several methods to the API
- rework API for diagonal matrices
- add benchmarking code
This commit is contained in:
Benoit Jacob
2008-01-05 10:57:14 +00:00
parent 23ffede3d0
commit d1d55e67e9
33 changed files with 354 additions and 84 deletions

View File

@@ -123,4 +123,27 @@ MatrixBase<Scalar, Derived>::normalized() const
return (*this) / norm();
}
template<typename Scalar, typename Derived>
template<typename OtherDerived>
bool MatrixBase<Scalar, Derived>::isOrtho
(const OtherDerived& other,
const typename NumTraits<Scalar>::Real& prec = precision<Scalar>()) const
{
return abs2(dot(other)) <= prec * prec * norm2() * other.norm2();
}
template<typename Scalar, typename Derived>
bool MatrixBase<Scalar, Derived>::isOrtho
(const typename NumTraits<Scalar>::Real& prec = precision<Scalar>()) const
{
for(int i = 0; i < cols(); i++)
{
if(!isApprox(col(i).norm2(), static_cast<Scalar>(1)))
return false;
for(int j = 0; j < i; j++)
if(!isMuchSmallerThan(col(i).dot(col(j)), static_cast<Scalar>(1)))
return false;
}
return true;
}
#endif // EIGEN_DOT_H