norm2() renamed to squaredNorm(), kept as deprecated for now.

This commit is contained in:
Benoit Jacob
2008-11-03 19:14:17 +00:00
parent 3f580e240e
commit 3d90c13970
17 changed files with 51 additions and 36 deletions

View File

@@ -32,13 +32,13 @@ inline Scalar& at(uint i, uint j) { return this->operator()(i,j); }
inline Scalar at(uint i) const { return this->operator[](i); }
inline Scalar& at(uint i) { return this->operator[](i); }
inline RealScalar squaredLength() const { return norm2(); }
inline RealScalar squaredLength() const { return squaredNorm(); }
inline RealScalar length() const { return norm(); }
inline RealScalar invLength(void) const { return fast_inv_sqrt(norm2()); }
inline RealScalar invLength(void) const { return fast_inv_sqrt(squaredNorm()); }
template<typename OtherDerived>
inline Scalar squaredDistanceTo(const MatrixBase<OtherDerived>& other) const
{ return (derived() - other.derived()).norm2(); }
{ return (derived() - other.derived()).squaredNorm(); }
template<typename OtherDerived>
inline RealScalar distanceTo(const MatrixBase<OtherDerived>& other) const

View File

@@ -352,7 +352,7 @@ vec3 = vec1.cross(vec2);\endcode</td></tr>
Eigen provides several reduction methods such as:
\link MatrixBase::minCoeff() minCoeff() \endlink, \link MatrixBase::maxCoeff() maxCoeff() \endlink,
\link MatrixBase::sum() sum() \endlink, \link MatrixBase::trace() trace() \endlink,
\link MatrixBase::norm() norm() \endlink, \link MatrixBase::norm2() norm2() \endlink,
\link MatrixBase::norm() norm() \endlink, \link MatrixBase::squaredNorm() squaredNorm() \endlink,
\link MatrixBase::all() all() \endlink,and \link MatrixBase::any() any() \endlink.
All reduction operations can be done matrix-wise,
\link MatrixBase::colwise() column-wise \endlink or
@@ -473,8 +473,8 @@ mat3 = mat1.adjoint() * mat2;
</td></tr>
<tr><td>
\link MatrixBase::norm() norm \endlink of a vector \n
\link MatrixBase::norm2() squared norm \endlink of a vector
</td><td>\code vec.norm(); \endcode \n \code vec.norm2() \endcode
\link MatrixBase::squaredNorm() squared norm \endlink of a vector
</td><td>\code vec.norm(); \endcode \n \code vec.squaredNorm() \endcode
</td></tr>
<tr><td>
returns a \link MatrixBase::normalized() normalized \endlink vector \n

View File

@@ -1,3 +1,3 @@
Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the square norm of each row:" << endl << m.rowwise().norm2() << endl;
cout << "Here is the square norm of each row:" << endl << m.rowwise().squaredNorm() << endl;