diff options
43 files changed, 299 insertions, 46 deletions
@@ -20,7 +20,7 @@ namespace Eigen { * This module also provides some MatrixBase methods, including: * - MatrixBase::qr(), * - MatrixBase::eigenvalues(), - * - MatrixBase::matrixNorm() + * - MatrixBase::operatorNorm() * * \code * #include <Eigen/QR> diff --git a/Eigen/src/Array/CwiseOperators.h b/Eigen/src/Array/CwiseOperators.h index 0dd7bb01c..498bc86f2 100644 --- a/Eigen/src/Array/CwiseOperators.h +++ b/Eigen/src/Array/CwiseOperators.h @@ -29,7 +29,13 @@ /** \array_module * - * \returns an expression of the coefficient-wise square root of *this. */ + * \returns an expression of the coefficient-wise square root of *this. + * + * Example: \include Cwise_sqrt.cpp + * Output: \verbinclude Cwise_sqrt.out + * + * \sa pow(), square() + */ template<typename ExpressionType> inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_sqrt_op) Cwise<ExpressionType>::sqrt() const @@ -39,7 +45,13 @@ Cwise<ExpressionType>::sqrt() const /** \array_module * - * \returns an expression of the coefficient-wise exponential of *this. */ + * \returns an expression of the coefficient-wise exponential of *this. + * + * Example: \include Cwise_exp.cpp + * Output: \verbinclude Cwise_exp.out + * + * \sa pow(), log(), sin(), cos() + */ template<typename ExpressionType> inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_exp_op) Cwise<ExpressionType>::exp() const @@ -49,7 +61,13 @@ Cwise<ExpressionType>::exp() const /** \array_module * - * \returns an expression of the coefficient-wise logarithm of *this. */ + * \returns an expression of the coefficient-wise logarithm of *this. + * + * Example: \include Cwise_log.cpp + * Output: \verbinclude Cwise_log.out + * + * \sa exp() + */ template<typename ExpressionType> inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_log_op) Cwise<ExpressionType>::log() const @@ -59,7 +77,13 @@ Cwise<ExpressionType>::log() const /** \array_module * - * \returns an expression of the coefficient-wise cosine of *this. */ + * \returns an expression of the coefficient-wise cosine of *this. + * + * Example: \include Cwise_cos.cpp + * Output: \verbinclude Cwise_cos.out + * + * \sa sin(), exp() + */ template<typename ExpressionType> inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_cos_op) Cwise<ExpressionType>::cos() const @@ -70,7 +94,13 @@ Cwise<ExpressionType>::cos() const /** \array_module * - * \returns an expression of the coefficient-wise sine of *this. */ + * \returns an expression of the coefficient-wise sine of *this. + * + * Example: \include Cwise_sin.cpp + * Output: \verbinclude Cwise_sin.out + * + * \sa cos(), exp() + */ template<typename ExpressionType> inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_sin_op) Cwise<ExpressionType>::sin() const @@ -81,7 +111,13 @@ Cwise<ExpressionType>::sin() const /** \array_module * - * \returns an expression of the coefficient-wise power of *this to the given exponent. */ + * \returns an expression of the coefficient-wise power of *this to the given exponent. + * + * Example: \include Cwise_pow.cpp + * Output: \verbinclude Cwise_pow.out + * + * \sa exp(), log() + */ template<typename ExpressionType> inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_pow_op) Cwise<ExpressionType>::pow(const Scalar& exponent) const @@ -92,7 +128,13 @@ Cwise<ExpressionType>::pow(const Scalar& exponent) const /** \array_module * - * \returns an expression of the coefficient-wise inverse of *this. */ + * \returns an expression of the coefficient-wise inverse of *this. + * + * Example: \include Cwise_inverse.cpp + * Output: \verbinclude Cwise_inverse.out + * + * \sa operator/(), operator*() + */ template<typename ExpressionType> inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_inverse_op) Cwise<ExpressionType>::inverse() const @@ -102,7 +144,13 @@ Cwise<ExpressionType>::inverse() const /** \array_module * - * \returns an expression of the coefficient-wise square of *this. */ + * \returns an expression of the coefficient-wise square of *this. + * + * Example: \include Cwise_square.cpp + * Output: \verbinclude Cwise_square.out + * + * \sa operator/(), operator*(), abs2() + */ template<typename ExpressionType> inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_square_op) Cwise<ExpressionType>::square() const @@ -112,7 +160,13 @@ Cwise<ExpressionType>::square() const /** \array_module * - * \returns an expression of the coefficient-wise cube of *this. */ + * \returns an expression of the coefficient-wise cube of *this. + * + * Example: \include Cwise_cube.cpp + * Output: \verbinclude Cwise_cube.out + * + * \sa square(), pow() + */ template<typename ExpressionType> inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_cube_op) Cwise<ExpressionType>::cube() const @@ -127,9 +181,10 @@ Cwise<ExpressionType>::cube() const * * \returns an expression of the coefficient-wise \< operator of *this and \a other * - * See MatrixBase::all() for an example. + * Example: \include Cwise_less.cpp + * Output: \verbinclude Cwise_less.out * - * \sa class CwiseBinaryOp + * \sa MatrixBase::all(), MatrixBase::any(), operator>(), operator<=() */ template<typename ExpressionType> template<typename OtherDerived> @@ -143,7 +198,10 @@ Cwise<ExpressionType>::operator<(const MatrixBase<OtherDerived> &other) const * * \returns an expression of the coefficient-wise \<= operator of *this and \a other * - * \sa class CwiseBinaryOp + * Example: \include Cwise_less_equal.cpp + * Output: \verbinclude Cwise_less_equal.out + * + * \sa MatrixBase::all(), MatrixBase::any(), operator>=(), operator<() */ template<typename ExpressionType> template<typename OtherDerived> @@ -157,9 +215,10 @@ Cwise<ExpressionType>::operator<=(const MatrixBase<OtherDerived> &other) const * * \returns an expression of the coefficient-wise \> operator of *this and \a other * - * See MatrixBase::all() for an example. + * Example: \include Cwise_greater.cpp + * Output: \verbinclude Cwise_greater.out * - * \sa class CwiseBinaryOp + * \sa MatrixBase::all(), MatrixBase::any(), operator>=(), operator<() */ template<typename ExpressionType> template<typename OtherDerived> @@ -173,7 +232,10 @@ Cwise<ExpressionType>::operator>(const MatrixBase<OtherDerived> &other) const * * \returns an expression of the coefficient-wise \>= operator of *this and \a other * - * \sa class CwiseBinaryOp + * Example: \include Cwise_greater_equal.cpp + * Output: \verbinclude Cwise_greater_equal.out + * + * \sa MatrixBase::all(), MatrixBase::any(), operator>(), operator<=() */ template<typename ExpressionType> template<typename OtherDerived> @@ -187,7 +249,15 @@ Cwise<ExpressionType>::operator>=(const MatrixBase<OtherDerived> &other) const * * \returns an expression of the coefficient-wise == operator of *this and \a other * - * \sa class CwiseBinaryOp + * \warning this performs an exact comparison, which is generally a bad idea with floating-point types. + * In order to check for equality between two vectors or matrices with floating-point coefficients, it is + * generally a far better idea to use a fuzzy comparison as provided by MatrixBase::isApprox() and + * MatrixBase::isMuchSmallerThan(). + * + * Example: \include Cwise_equal_equal.cpp + * Output: \verbinclude Cwise_equal_equal.out + * + * \sa MatrixBase::all(), MatrixBase::any(), MatrixBase::isApprox(), MatrixBase::isMuchSmallerThan() */ template<typename ExpressionType> template<typename OtherDerived> @@ -201,7 +271,15 @@ Cwise<ExpressionType>::operator==(const MatrixBase<OtherDerived> &other) const * * \returns an expression of the coefficient-wise != operator of *this and \a other * - * \sa class CwiseBinaryOp + * \warning this performs an exact comparison, which is generally a bad idea with floating-point types. + * In order to check for equality between two vectors or matrices with floating-point coefficients, it is + * generally a far better idea to use a fuzzy comparison as provided by MatrixBase::isApprox() and + * MatrixBase::isMuchSmallerThan(). + * + * Example: \include Cwise_not_equal.cpp + * Output: \verbinclude Cwise_not_equal.out + * + * \sa MatrixBase::all(), MatrixBase::any(), MatrixBase::isApprox(), MatrixBase::isMuchSmallerThan() */ template<typename ExpressionType> template<typename OtherDerived> @@ -213,7 +291,14 @@ Cwise<ExpressionType>::operator!=(const MatrixBase<OtherDerived> &other) const /** \array_module - * \returns an expression of \c *this with each coeff incremented by the constant \a scalar */ + * + * \returns an expression of \c *this with each coeff incremented by the constant \a scalar + * + * Example: \include Cwise_plus.cpp + * Output: \verbinclude Cwise_plus.out + * + * \sa operator+=(), operator-() + */ template<typename ExpressionType> inline const typename Cwise<ExpressionType>::ScalarAddReturnType Cwise<ExpressionType>::operator+(const Scalar& scalar) const @@ -222,7 +307,14 @@ Cwise<ExpressionType>::operator+(const Scalar& scalar) const } /** \array_module - * \see operator+() */ + * + * Adds the given \a scalar to each coeff of this expression. + * + * Example: \include Cwise_plus_equal.cpp + * Output: \verbinclude Cwise_plus_equal.out + * + * \sa operator+(), operator-=() + */ template<typename ExpressionType> inline ExpressionType& Cwise<ExpressionType>::operator+=(const Scalar& scalar) { @@ -230,7 +322,14 @@ inline ExpressionType& Cwise<ExpressionType>::operator+=(const Scalar& scalar) } /** \array_module - * \returns an expression of \c *this with each coeff decremented by the constant \a scalar */ + * + * \returns an expression of \c *this with each coeff decremented by the constant \a scalar + * + * Example: \include Cwise_minus.cpp + * Output: \verbinclude Cwise_minus.out + * + * \sa operator+(), operator-=() + */ template<typename ExpressionType> inline const typename Cwise<ExpressionType>::ScalarAddReturnType Cwise<ExpressionType>::operator-(const Scalar& scalar) const @@ -239,7 +338,15 @@ Cwise<ExpressionType>::operator-(const Scalar& scalar) const } /** \array_module - * \see operator- */ + * + * Substracts the given \a scalar from each coeff of this expression. + * + * Example: \include Cwise_minus_equal.cpp + * Output: \verbinclude Cwise_minus_equal.out + * + * \sa operator+=(), operator-() + */ + template<typename ExpressionType> inline ExpressionType& Cwise<ExpressionType>::operator-=(const Scalar& scalar) { diff --git a/Eigen/src/Array/PartialRedux.h b/Eigen/src/Array/PartialRedux.h index 48daad770..bdd657368 100644 --- a/Eigen/src/Array/PartialRedux.h +++ b/Eigen/src/Array/PartialRedux.h @@ -139,10 +139,13 @@ struct ei_member_redux { * \param ExpressionType the type of the object on which to do partial reductions * \param Direction indicates the direction of the redux (Vertical or Horizontal) * - * This class represents an expression with additional partial reduction features. + * This class represents a pseudo expression with partial reduction features. * It is the return type of MatrixBase::colwise() and MatrixBase::rowwise() * and most of the time this is the only way it is used. * + * Example: \include MatrixBase_colwise.cpp + * Output: \verbinclude MatrixBase_colwise.out + * * \sa MatrixBase::colwise(), MatrixBase::rowwise(), class PartialReduxExpr */ template<typename ExpressionType, int Direction> class PartialRedux @@ -180,30 +183,50 @@ template<typename ExpressionType, int Direction> class PartialRedux /** \returns a row (or column) vector expression of the smallest coefficient * of each column (or row) of the referenced expression. + * + * Example: \include PartialRedux_minCoeff.cpp + * Output: \verbinclude PartialRedux_minCoeff.out + * * \sa MatrixBase::minCoeff() */ const typename ReturnType<ei_member_minCoeff>::Type minCoeff() const { return _expression(); } /** \returns a row (or column) vector expression of the largest coefficient * of each column (or row) of the referenced expression. + * + * Example: \include PartialRedux_maxCoeff.cpp + * Output: \verbinclude PartialRedux_maxCoeff.out + * * \sa MatrixBase::maxCoeff() */ const typename ReturnType<ei_member_maxCoeff>::Type maxCoeff() const { return _expression(); } /** \returns a row (or column) vector expression of the squared norm * of each column (or row) of the referenced expression. + * + * Example: \include PartialRedux_norm2.cpp + * Output: \verbinclude PartialRedux_norm2.out + * * \sa MatrixBase::norm2() */ const typename ReturnType<ei_member_norm2>::Type norm2() const { return _expression(); } /** \returns a row (or column) vector expression of the norm * of each column (or row) of the referenced expression. + * + * Example: \include PartialRedux_norm.cpp + * Output: \verbinclude PartialRedux_norm.out + * * \sa MatrixBase::norm() */ const typename ReturnType<ei_member_norm>::Type norm() const { return _expression(); } /** \returns a row (or column) vector expression of the sum * of each column (or row) of the referenced expression. + * + * Example: \include PartialRedux_sum.cpp + * Output: \verbinclude PartialRedux_sum.out + * * \sa MatrixBase::sum() */ const typename ReturnType<ei_member_sum>::Type sum() const { return _expression(); } @@ -216,7 +239,10 @@ template<typename ExpressionType, int Direction> class PartialRedux * * \returns a PartialRedux wrapper of *this providing additional partial reduction operations * - * \sa class PartialRedux + * Example: \include MatrixBase_colwise.cpp + * Output: \verbinclude MatrixBase_colwise.out + * + * \sa rowwise(), class PartialRedux */ template<typename Derived> inline const PartialRedux<Derived,Vertical> @@ -229,7 +255,10 @@ MatrixBase<Derived>::colwise() const * * \returns a PartialRedux wrapper of *this providing additional partial reduction operations * - * \sa class PartialRedux + * Example: \include MatrixBase_rowwise.cpp + * Output: \verbinclude MatrixBase_rowwise.out + * + * \sa colwise(), class PartialRedux */ template<typename Derived> inline const PartialRedux<Derived,Horizontal> diff --git a/Eigen/src/Core/Cwise.h b/Eigen/src/Core/Cwise.h index d89800faa..0f81a8a4b 100644 --- a/Eigen/src/Core/Cwise.h +++ b/Eigen/src/Core/Cwise.h @@ -48,7 +48,10 @@ * * Note that some methods are defined in the \ref Array module. * - * \sa MatrixBase::cwise() + * Example: \include MatrixBase_cwise_const.cpp + * Output: \verbinclude MatrixBase_cwise_const.out + * + * \sa MatrixBase::cwise() const, MatrixBase::cwise() */ template<typename ExpressionType> class Cwise { @@ -133,7 +136,10 @@ template<typename ExpressionType> class Cwise /** \returns a Cwise wrapper of *this providing additional coefficient-wise operations * - * \sa class Cwise + * Example: \include MatrixBase_cwise_const.cpp + * Output: \verbinclude MatrixBase_cwise_const.out + * + * \sa class Cwise, cwise() */ template<typename Derived> inline const Cwise<Derived> @@ -144,7 +150,10 @@ MatrixBase<Derived>::cwise() const /** \returns a Cwise wrapper of *this providing additional coefficient-wise operations * - * \sa class Cwise + * Example: \include MatrixBase_cwise.cpp + * Output: \verbinclude MatrixBase_cwise.out + * + * \sa class Cwise, cwise() const */ template<typename Derived> inline Cwise<Derived> diff --git a/Eigen/src/Core/CwiseBinaryOp.h b/Eigen/src/Core/CwiseBinaryOp.h index dcf2c9063..2f506377f 100644 --- a/Eigen/src/Core/CwiseBinaryOp.h +++ b/Eigen/src/Core/CwiseBinaryOp.h @@ -125,7 +125,9 @@ class CwiseBinaryOp : ei_no_assignment_operator, /**\returns an expression of the difference of \c *this and \a other * - * \sa class CwiseBinaryOp, MatrixBase::operator-=() + * \note If you want to substract a given scalar from all coefficients, see Cwise::operator-(). + * + * \sa class CwiseBinaryOp, MatrixBase::operator-=(), Cwise::operator-() */ template<typename Derived> template<typename OtherDerived> @@ -153,7 +155,9 @@ MatrixBase<Derived>::operator-=(const MatrixBase<OtherDerived> &other) * * \returns an expression of the sum of \c *this and \a other * - * \sa class CwiseBinaryOp, MatrixBase::operator+=() + * \note If you want to add a given scalar to all coefficients, see Cwise::operator+(). + * + * \sa class CwiseBinaryOp, MatrixBase::operator+=(), Cwise::operator+() */ template<typename Derived> template<typename OtherDerived> @@ -177,12 +181,10 @@ MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other) /** \returns an expression of the Schur product (coefficient wise product) of *this and \a other * - * \addexample CwiseProduct \label How to perform a component wise product of two matrices. - * * Example: \include Cwise_product.cpp * Output: \verbinclude Cwise_product.out * - * \sa class CwiseBinaryOp + * \sa class CwiseBinaryOp, operator/(), square() */ template<typename ExpressionType> template<typename OtherDerived> @@ -194,7 +196,10 @@ Cwise<ExpressionType>::operator*(const MatrixBase<OtherDerived> &other) const /** \returns an expression of the coefficient-wise quotient of *this and \a other * - * \sa class CwiseBinaryOp + * Example: \include Cwise_quotient.cpp + * Output: \verbinclude Cwise_quotient.out + * + * \sa class CwiseBinaryOp, operator*(), inverse() */ template<typename ExpressionType> template<typename OtherDerived> @@ -206,6 +211,9 @@ Cwise<ExpressionType>::operator/(const MatrixBase<OtherDerived> &other) const /** \returns an expression of the coefficient-wise min of *this and \a other * + * Example: \include Cwise_min.cpp + * Output: \verbinclude Cwise_min.out + * * \sa class CwiseBinaryOp */ template<typename ExpressionType> @@ -218,6 +226,9 @@ Cwise<ExpressionType>::min(const MatrixBase<OtherDerived> &other) const /** \returns an expression of the coefficient-wise max of *this and \a other * + * Example: \include Cwise_max.cpp + * Output: \verbinclude Cwise_max.out + * * \sa class CwiseBinaryOp */ template<typename ExpressionType> diff --git a/Eigen/src/Core/CwiseUnaryOp.h b/Eigen/src/Core/CwiseUnaryOp.h index e9aeb6608..85a8872c0 100644 --- a/Eigen/src/Core/CwiseUnaryOp.h +++ b/Eigen/src/Core/CwiseUnaryOp.h @@ -111,7 +111,7 @@ class CwiseUnaryOp : ei_no_assignment_operator, * * \addexample CustomCwiseUnaryFunctors \label How to use custom coeff wise unary functors * - * Here is an example: + * Example: * \include class_CwiseUnaryOp.cpp * Output: \verbinclude class_CwiseUnaryOp.out * @@ -135,6 +135,11 @@ MatrixBase<Derived>::operator-() const } /** \returns an expression of the coefficient-wise absolute value of \c *this + * + * Example: \include Cwise_abs.cpp + * Output: \verbinclude Cwise_abs.out + * + * \sa abs2() */ template<typename ExpressionType> inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_abs_op) @@ -144,6 +149,11 @@ Cwise<ExpressionType>::abs() const } /** \returns an expression of the coefficient-wise squared absolute value of \c *this + * + * Example: \include Cwise_abs2.cpp + * Output: \verbinclude Cwise_abs2.out + * + * \sa abs(), square() */ template<typename ExpressionType> inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_abs2_op) diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index 52b64283e..aa8e8983c 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -555,7 +555,7 @@ template<typename Derived> class MatrixBase const QR<EvalType> qr() const; EigenvaluesReturnType eigenvalues() const; - RealScalar matrixNorm() const; + RealScalar operatorNorm() const; /////////// Geometry module /////////// diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index 9bdbe3f26..2774b3f3b 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -261,7 +261,9 @@ template<typename LhsNested, typename RhsNested, int ProductMode> class Product /** \returns the matrix product of \c *this and \a other. * - * \sa lazy(), operator*=(const MatrixBase&) + * \note If instead of the matrix product you want the coefficient-wise product, see Cwise::operator*(). + * + * \sa lazy(), operator*=(const MatrixBase&), Cwise::operator*() */ template<typename Derived> template<typename OtherDerived> diff --git a/Eigen/src/QR/SelfAdjointEigenSolver.h b/Eigen/src/QR/SelfAdjointEigenSolver.h index d366bafc7..f8bd7bfad 100644 --- a/Eigen/src/QR/SelfAdjointEigenSolver.h +++ b/Eigen/src/QR/SelfAdjointEigenSolver.h @@ -259,10 +259,10 @@ MatrixBase<Derived>::eigenvalues() const } template<typename Derived, bool IsSelfAdjoint> -struct ei_matrixNorm_selector +struct ei_operatorNorm_selector { static inline typename NumTraits<typename ei_traits<Derived>::Scalar>::Real - matrixNorm(const MatrixBase<Derived>& m) + operatorNorm(const MatrixBase<Derived>& m) { // FIXME if it is really guaranteed that the eigenvalues are already sorted, // then we don't need to compute a maxCoeff() here, comparing the 1st and last ones is enough. @@ -270,10 +270,10 @@ struct ei_matrixNorm_selector } }; -template<typename Derived> struct ei_matrixNorm_selector<Derived, false> +template<typename Derived> struct ei_operatorNorm_selector<Derived, false> { static inline typename NumTraits<typename ei_traits<Derived>::Scalar>::Real - matrixNorm(const MatrixBase<Derived>& m) + operatorNorm(const MatrixBase<Derived>& m) { typename Derived::Eval m_eval(m); // FIXME if it is really guaranteed that the eigenvalues are already sorted, @@ -293,10 +293,10 @@ template<typename Derived> struct ei_matrixNorm_selector<Derived, false> */ template<typename Derived> inline typename NumTraits<typename ei_traits<Derived>::Scalar>::Real -MatrixBase<Derived>::matrixNorm() const +MatrixBase<Derived>::operatorNorm() const { - return ei_matrixNorm_selector<Derived, Flags&SelfAdjointBit> - ::matrixNorm(derived()); + return ei_operatorNorm_selector<Derived, Flags&SelfAdjointBit> + ::operatorNorm(derived()); } #ifndef EIGEN_EXTERN_INSTANTIATIONS diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index 353d3b1d4..dab473627 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -31,7 +31,7 @@ PROJECT_NAME = Eigen # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 2.0-alpha6 +PROJECT_NUMBER = 2.0-alpha7 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. @@ -1195,7 +1195,9 @@ PREDEFINED = EIGEN_EMPTY_STRUCT \ EXPAND_AS_DEFINED = EIGEN_MAKE_SCALAR_OPS \ EIGEN_MAKE_TYPEDEFS \ - EIGEN_MAKE_TYPEDEFS_ALL_SIZES + EIGEN_MAKE_TYPEDEFS_ALL_SIZES \ + EIGEN_CWISE_UNOP_RETURN_TYPE \ + EIGEN_CWISE_BINOP_RETURN_TYPE # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone diff --git a/doc/snippets/Cwise_abs.cpp b/doc/snippets/Cwise_abs.cpp new file mode 100644 index 000000000..7f94dbdc2 --- /dev/null +++ b/doc/snippets/Cwise_abs.cpp @@ -0,0 +1,2 @@ +Vector3d v(1,-2,-3); +cout << v.cwise().abs() << endl; diff --git a/doc/snippets/Cwise_abs2.cpp b/doc/snippets/Cwise_abs2.cpp new file mode 100644 index 000000000..3b338af3e --- /dev/null +++ b/doc/snippets/Cwise_abs2.cpp @@ -0,0 +1,2 @@ +Vector3d v(1,-2,-3); +cout << v.cwise().abs2() << endl; diff --git a/doc/snippets/Cwise_cos.cpp b/doc/snippets/Cwise_cos.cpp new file mode 100644 index 000000000..4eb230a80 --- /dev/null +++ b/doc/snippets/Cwise_cos.cpp @@ -0,0 +1,2 @@ +Vector3d v(M_PI, M_PI/2, M_PI/3); +cout << v.cwise().cos() << endl; diff --git a/doc/snippets/Cwise_cube.cpp b/doc/snippets/Cwise_cube.cpp new file mode 100644 index 000000000..fd404365a --- /dev/null +++ b/doc/snippets/Cwise_cube.cpp @@ -0,0 +1,2 @@ +Vector3d v(2,3,4); +cout << v.cwise().cube() << endl; diff --git a/doc/snippets/Cwise_equal_equal.cpp b/doc/snippets/Cwise_equal_equal.cpp new file mode 100644 index 000000000..ea49120f0 --- /dev/null +++ b/doc/snippets/Cwise_equal_equal.cpp @@ -0,0 +1,2 @@ +Vector3d v(1,2,3), w(3,2,1); +cout << (v.cwise()==w) << endl; diff --git a/doc/snippets/Cwise_exp.cpp b/doc/snippets/Cwise_exp.cpp new file mode 100644 index 000000000..c22fd4cb7 --- /dev/null +++ b/doc/snippets/Cwise_exp.cpp @@ -0,0 +1,2 @@ +Vector3d v(1,2,3); +cout << v.cwise().exp() << endl; diff --git a/doc/snippets/Cwise_greater.cpp b/doc/snippets/Cwise_greater.cpp new file mode 100644 index 000000000..54641e1ce --- /dev/null +++ b/doc/snippets/Cwise_greater.cpp @@ -0,0 +1,2 @@ +Vector3d v(1,2,3), w(3,2,1); +cout << (v.cwise()>w) << endl; diff --git a/doc/snippets/Cwise_greater_equal.cpp b/doc/snippets/Cwise_greater_equal.cpp new file mode 100644 index 000000000..744a9ae1e --- /dev/null +++ b/doc/snippets/Cwise_greater_equal.cpp @@ -0,0 +1,2 @@ +Vector3d v(1,2,3), w(3,2,1); +cout << (v.cwise()>=w) << endl; diff --git a/doc/snippets/Cwise_inverse.cpp b/doc/snippets/Cwise_inverse.cpp new file mode 100644 index 000000000..7f6eee85d --- /dev/null +++ b/doc/snippets/Cwise_inverse.cpp @@ -0,0 +1,2 @@ +Vector3d v(2,3,4); +cout << v.cwise().inverse() << endl; diff --git a/doc/snippets/Cwise_less.cpp b/doc/snippets/Cwise_less.cpp new file mode 100644 index 000000000..008e3d9e6 --- /dev/null +++ b/doc/snippets/Cwise_less.cpp @@ -0,0 +1,2 @@ +Vector3d v(1,2,3), w(3,2,1); +cout << (v.cwise()<w) << endl; diff --git a/doc/snippets/Cwise_less_equal.cpp b/doc/snippets/Cwise_less_equal.cpp new file mode 100644 index 000000000..3b7a68ece --- /dev/null +++ b/doc/snippets/Cwise_less_equal.cpp @@ -0,0 +1,2 @@ +Vector3d v(1,2,3), w(3,2,1); +cout << (v.cwise()<=w) << endl; diff --git a/doc/snippets/Cwise_log.cpp b/doc/snippets/Cwise_log.cpp new file mode 100644 index 000000000..2fa28ebdb --- /dev/null +++ b/doc/snippets/Cwise_log.cpp @@ -0,0 +1,2 @@ +Vector3d v(1,2,3); +cout << v.cwise().log() << endl; diff --git a/doc/snippets/Cwise_max.cpp b/doc/snippets/Cwise_max.cpp new file mode 100644 index 000000000..a03bccf76 --- /dev/null +++ b/doc/snippets/Cwise_max.cpp @@ -0,0 +1,2 @@ +Vector3d v(2,3,4), w(4,2,3); +cout << v.cwise().max(w) << endl; diff --git a/doc/snippets/Cwise_min.cpp b/doc/snippets/Cwise_min.cpp new file mode 100644 index 000000000..a31d5a827 --- /dev/null +++ b/doc/snippets/Cwise_min.cpp @@ -0,0 +1,2 @@ +Vector3d v(2,3,4), w(4,2,3); +cout << v.cwise().min(w) << endl; diff --git a/doc/snippets/Cwise_minus.cpp b/doc/snippets/Cwise_minus.cpp new file mode 100644 index 000000000..5b8e692f8 --- /dev/null +++ b/doc/snippets/Cwise_minus.cpp @@ -0,0 +1,2 @@ +Vector3d v(1,2,3); +cout << v.cwise()-5 << endl; diff --git a/doc/snippets/Cwise_minus_equal.cpp b/doc/snippets/Cwise_minus_equal.cpp new file mode 100644 index 000000000..6919ca1de --- /dev/null +++ b/doc/snippets/Cwise_minus_equal.cpp @@ -0,0 +1,3 @@ +Vector3d v(1,2,3); +v.cwise() -= 5; +cout << v << endl; diff --git a/doc/snippets/Cwise_not_equal.cpp b/doc/snippets/Cwise_not_equal.cpp new file mode 100644 index 000000000..fd0c38f58 --- /dev/null +++ b/doc/snippets/Cwise_not_equal.cpp @@ -0,0 +1,2 @@ +Vector3d v(1,2,3), w(3,2,1); +cout << (v.cwise()!=w) << endl; diff --git a/doc/snippets/Cwise_plus.cpp b/doc/snippets/Cwise_plus.cpp new file mode 100644 index 000000000..d62cf7b4e --- /dev/null +++ b/doc/snippets/Cwise_plus.cpp @@ -0,0 +1,2 @@ +Vector3d v(1,2,3); +cout << v.cwise()+5 << endl; diff --git a/doc/snippets/Cwise_plus_equal.cpp b/doc/snippets/Cwise_plus_equal.cpp new file mode 100644 index 000000000..8dfa2af53 --- /dev/null +++ b/doc/snippets/Cwise_plus_equal.cpp @@ -0,0 +1,3 @@ +Vector3d v(1,2,3); +v.cwise() += 5; +cout << v << endl; diff --git a/doc/snippets/Cwise_pow.cpp b/doc/snippets/Cwise_pow.cpp new file mode 100644 index 000000000..6a58ddfbe --- /dev/null +++ b/doc/snippets/Cwise_pow.cpp @@ -0,0 +1,2 @@ +Vector3d v(8,27,64); +cout << v.cwise().pow(0.333333) << endl; diff --git a/doc/snippets/Cwise_quotient.cpp b/doc/snippets/Cwise_quotient.cpp new file mode 100644 index 000000000..9ad204491 --- /dev/null +++ b/doc/snippets/Cwise_quotient.cpp @@ -0,0 +1,2 @@ +Vector3d v(2,3,4), w(4,2,3); +cout << v.cwise()/w << endl; diff --git a/doc/snippets/Cwise_sin.cpp b/doc/snippets/Cwise_sin.cpp new file mode 100644 index 000000000..41ffcc21d --- /dev/null +++ b/doc/snippets/Cwise_sin.cpp @@ -0,0 +1,2 @@ +Vector3d v(M_PI, M_PI/2, M_PI/3); +cout << v.cwise().sin() << endl; diff --git a/doc/snippets/Cwise_sqrt.cpp b/doc/snippets/Cwise_sqrt.cpp new file mode 100644 index 000000000..2b825b47d --- /dev/null +++ b/doc/snippets/Cwise_sqrt.cpp @@ -0,0 +1,2 @@ +Vector3d v(1,2,4); +cout << v.cwise().sqrt() << endl; diff --git a/doc/snippets/Cwise_square.cpp b/doc/snippets/Cwise_square.cpp new file mode 100644 index 000000000..9ed41c26e --- /dev/null +++ b/doc/snippets/Cwise_square.cpp @@ -0,0 +1,2 @@ +Vector3d v(2,3,4); +cout << v.cwise().square() << endl; diff --git a/doc/snippets/MatrixBase_colwise.cpp b/doc/snippets/MatrixBase_colwise.cpp new file mode 100644 index 000000000..c8b380cee --- /dev/null +++ b/doc/snippets/MatrixBase_colwise.cpp @@ -0,0 +1,5 @@ +Matrix3d m = Matrix3d::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the sum of each column:" << endl << m.colwise().sum() << endl; +cout << "Here is the maximum absolute value of each column:" + << endl << m.cwise().abs().colwise().maxCoeff() << endl; diff --git a/doc/snippets/MatrixBase_cwise.cpp b/doc/snippets/MatrixBase_cwise.cpp new file mode 100644 index 000000000..f246a1a5f --- /dev/null +++ b/doc/snippets/MatrixBase_cwise.cpp @@ -0,0 +1,4 @@ +Vector3d v(1,2,3); +v.cwise() += 3; +v.cwise() -= 2; +cout << v << endl; diff --git a/doc/snippets/MatrixBase_cwise_const.cpp b/doc/snippets/MatrixBase_cwise_const.cpp new file mode 100644 index 000000000..2b7e481c8 --- /dev/null +++ b/doc/snippets/MatrixBase_cwise_const.cpp @@ -0,0 +1,4 @@ +Vector3d v(-1,2,-3); +cout << "the absolute values:" << endl << v.cwise().abs() << endl; +cout << "the absolute values plus one:" << endl << v.cwise().abs().cwise()+1 << endl; +cout << "sum of the squares: " << v.cwise().square().sum() << endl; diff --git a/doc/snippets/MatrixBase_rowwise.cpp b/doc/snippets/MatrixBase_rowwise.cpp new file mode 100644 index 000000000..220546540 --- /dev/null +++ b/doc/snippets/MatrixBase_rowwise.cpp @@ -0,0 +1,5 @@ +Matrix3d m = Matrix3d::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the sum of each row:" << endl << m.rowwise().sum() << endl; +cout << "Here is the maximum absolute value of each row:" + << endl << m.cwise().abs().rowwise().maxCoeff() << endl; diff --git a/doc/snippets/PartialRedux_maxCoeff.cpp b/doc/snippets/PartialRedux_maxCoeff.cpp new file mode 100644 index 000000000..ff1a7ebdb --- /dev/null +++ b/doc/snippets/PartialRedux_maxCoeff.cpp @@ -0,0 +1,3 @@ +Matrix3d m = Matrix3d::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the maximum of each column:" << endl << m.colwise().maxCoeff() << endl;
\ No newline at end of file diff --git a/doc/snippets/PartialRedux_minCoeff.cpp b/doc/snippets/PartialRedux_minCoeff.cpp new file mode 100644 index 000000000..1256cee5e --- /dev/null +++ b/doc/snippets/PartialRedux_minCoeff.cpp @@ -0,0 +1,3 @@ +Matrix3d m = Matrix3d::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the minimum of each column:" << endl << m.colwise().minCoeff() << endl;
\ No newline at end of file diff --git a/doc/snippets/PartialRedux_norm.cpp b/doc/snippets/PartialRedux_norm.cpp new file mode 100644 index 000000000..46f26f715 --- /dev/null +++ b/doc/snippets/PartialRedux_norm.cpp @@ -0,0 +1,3 @@ +Matrix3d m = Matrix3d::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the norm of each column:" << endl << m.colwise().norm() << endl;
\ No newline at end of file diff --git a/doc/snippets/PartialRedux_norm2.cpp b/doc/snippets/PartialRedux_norm2.cpp new file mode 100644 index 000000000..9e1692ae3 --- /dev/null +++ b/doc/snippets/PartialRedux_norm2.cpp @@ -0,0 +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;
\ No newline at end of file diff --git a/doc/snippets/PartialRedux_sum.cpp b/doc/snippets/PartialRedux_sum.cpp new file mode 100644 index 000000000..dfd0eb9a9 --- /dev/null +++ b/doc/snippets/PartialRedux_sum.cpp @@ -0,0 +1,3 @@ +Matrix3d m = Matrix3d::Random(); +cout << "Here is the matrix m:" << endl << m << endl; +cout << "Here is the sum of each row:" << endl << m.rowwise().sum() << endl;
\ No newline at end of file |