Eigen libary for mbed

Committer:
jsoh91
Date:
Tue Sep 24 00:18:23 2019 +0000
Revision:
1:3b8049da21b8
Parent:
0:13a5d365ba16
ignore and revise some of error parts

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ykuroda 0:13a5d365ba16 1 // This file is part of Eigen, a lightweight C++ template library
ykuroda 0:13a5d365ba16 2 // for linear algebra.
ykuroda 0:13a5d365ba16 3 //
ykuroda 0:13a5d365ba16 4 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>
ykuroda 0:13a5d365ba16 5 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
ykuroda 0:13a5d365ba16 6 //
ykuroda 0:13a5d365ba16 7 // This Source Code Form is subject to the terms of the Mozilla
ykuroda 0:13a5d365ba16 8 // Public License v. 2.0. If a copy of the MPL was not distributed
ykuroda 0:13a5d365ba16 9 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
ykuroda 0:13a5d365ba16 10
ykuroda 0:13a5d365ba16 11 // This file is a base class plugin containing matrix specifics coefficient wise functions.
ykuroda 0:13a5d365ba16 12
ykuroda 0:13a5d365ba16 13 /** \returns an expression of the Schur product (coefficient wise product) of *this and \a other
ykuroda 0:13a5d365ba16 14 *
ykuroda 0:13a5d365ba16 15 * Example: \include MatrixBase_cwiseProduct.cpp
ykuroda 0:13a5d365ba16 16 * Output: \verbinclude MatrixBase_cwiseProduct.out
ykuroda 0:13a5d365ba16 17 *
ykuroda 0:13a5d365ba16 18 * \sa class CwiseBinaryOp, cwiseAbs2
ykuroda 0:13a5d365ba16 19 */
ykuroda 0:13a5d365ba16 20 template<typename OtherDerived>
ykuroda 0:13a5d365ba16 21 EIGEN_STRONG_INLINE const EIGEN_CWISE_PRODUCT_RETURN_TYPE(Derived,OtherDerived)
ykuroda 0:13a5d365ba16 22 cwiseProduct(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
ykuroda 0:13a5d365ba16 23 {
ykuroda 0:13a5d365ba16 24 return EIGEN_CWISE_PRODUCT_RETURN_TYPE(Derived,OtherDerived)(derived(), other.derived());
ykuroda 0:13a5d365ba16 25 }
ykuroda 0:13a5d365ba16 26
ykuroda 0:13a5d365ba16 27 /** \returns an expression of the coefficient-wise == operator of *this and \a other
ykuroda 0:13a5d365ba16 28 *
ykuroda 0:13a5d365ba16 29 * \warning this performs an exact comparison, which is generally a bad idea with floating-point types.
ykuroda 0:13a5d365ba16 30 * In order to check for equality between two vectors or matrices with floating-point coefficients, it is
ykuroda 0:13a5d365ba16 31 * generally a far better idea to use a fuzzy comparison as provided by isApprox() and
ykuroda 0:13a5d365ba16 32 * isMuchSmallerThan().
ykuroda 0:13a5d365ba16 33 *
ykuroda 0:13a5d365ba16 34 * Example: \include MatrixBase_cwiseEqual.cpp
ykuroda 0:13a5d365ba16 35 * Output: \verbinclude MatrixBase_cwiseEqual.out
ykuroda 0:13a5d365ba16 36 *
ykuroda 0:13a5d365ba16 37 * \sa cwiseNotEqual(), isApprox(), isMuchSmallerThan()
ykuroda 0:13a5d365ba16 38 */
ykuroda 0:13a5d365ba16 39 template<typename OtherDerived>
ykuroda 0:13a5d365ba16 40 inline const CwiseBinaryOp<std::equal_to<Scalar>, const Derived, const OtherDerived>
ykuroda 0:13a5d365ba16 41 cwiseEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
ykuroda 0:13a5d365ba16 42 {
ykuroda 0:13a5d365ba16 43 return CwiseBinaryOp<std::equal_to<Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
ykuroda 0:13a5d365ba16 44 }
ykuroda 0:13a5d365ba16 45
ykuroda 0:13a5d365ba16 46 /** \returns an expression of the coefficient-wise != operator of *this and \a other
ykuroda 0:13a5d365ba16 47 *
ykuroda 0:13a5d365ba16 48 * \warning this performs an exact comparison, which is generally a bad idea with floating-point types.
ykuroda 0:13a5d365ba16 49 * In order to check for equality between two vectors or matrices with floating-point coefficients, it is
ykuroda 0:13a5d365ba16 50 * generally a far better idea to use a fuzzy comparison as provided by isApprox() and
ykuroda 0:13a5d365ba16 51 * isMuchSmallerThan().
ykuroda 0:13a5d365ba16 52 *
ykuroda 0:13a5d365ba16 53 * Example: \include MatrixBase_cwiseNotEqual.cpp
ykuroda 0:13a5d365ba16 54 * Output: \verbinclude MatrixBase_cwiseNotEqual.out
ykuroda 0:13a5d365ba16 55 *
ykuroda 0:13a5d365ba16 56 * \sa cwiseEqual(), isApprox(), isMuchSmallerThan()
ykuroda 0:13a5d365ba16 57 */
ykuroda 0:13a5d365ba16 58 template<typename OtherDerived>
ykuroda 0:13a5d365ba16 59 inline const CwiseBinaryOp<std::not_equal_to<Scalar>, const Derived, const OtherDerived>
ykuroda 0:13a5d365ba16 60 cwiseNotEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
ykuroda 0:13a5d365ba16 61 {
ykuroda 0:13a5d365ba16 62 return CwiseBinaryOp<std::not_equal_to<Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
ykuroda 0:13a5d365ba16 63 }
ykuroda 0:13a5d365ba16 64
ykuroda 0:13a5d365ba16 65 /** \returns an expression of the coefficient-wise min of *this and \a other
ykuroda 0:13a5d365ba16 66 *
ykuroda 0:13a5d365ba16 67 * Example: \include MatrixBase_cwiseMin.cpp
ykuroda 0:13a5d365ba16 68 * Output: \verbinclude MatrixBase_cwiseMin.out
ykuroda 0:13a5d365ba16 69 *
ykuroda 0:13a5d365ba16 70 * \sa class CwiseBinaryOp, max()
ykuroda 0:13a5d365ba16 71 */
ykuroda 0:13a5d365ba16 72 template<typename OtherDerived>
ykuroda 0:13a5d365ba16 73 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar>, const Derived, const OtherDerived>
ykuroda 0:13a5d365ba16 74 cwiseMin(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
ykuroda 0:13a5d365ba16 75 {
ykuroda 0:13a5d365ba16 76 return CwiseBinaryOp<internal::scalar_min_op<Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
ykuroda 0:13a5d365ba16 77 }
ykuroda 0:13a5d365ba16 78
ykuroda 0:13a5d365ba16 79 /** \returns an expression of the coefficient-wise min of *this and scalar \a other
ykuroda 0:13a5d365ba16 80 *
ykuroda 0:13a5d365ba16 81 * \sa class CwiseBinaryOp, min()
ykuroda 0:13a5d365ba16 82 */
ykuroda 0:13a5d365ba16 83 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar>, const Derived, const ConstantReturnType>
ykuroda 0:13a5d365ba16 84 cwiseMin(const Scalar &other) const
ykuroda 0:13a5d365ba16 85 {
ykuroda 0:13a5d365ba16 86 return cwiseMin(Derived::Constant(rows(), cols(), other));
ykuroda 0:13a5d365ba16 87 }
ykuroda 0:13a5d365ba16 88
ykuroda 0:13a5d365ba16 89 /** \returns an expression of the coefficient-wise max of *this and \a other
ykuroda 0:13a5d365ba16 90 *
ykuroda 0:13a5d365ba16 91 * Example: \include MatrixBase_cwiseMax.cpp
ykuroda 0:13a5d365ba16 92 * Output: \verbinclude MatrixBase_cwiseMax.out
ykuroda 0:13a5d365ba16 93 *
ykuroda 0:13a5d365ba16 94 * \sa class CwiseBinaryOp, min()
ykuroda 0:13a5d365ba16 95 */
ykuroda 0:13a5d365ba16 96 template<typename OtherDerived>
ykuroda 0:13a5d365ba16 97 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar>, const Derived, const OtherDerived>
ykuroda 0:13a5d365ba16 98 cwiseMax(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
ykuroda 0:13a5d365ba16 99 {
ykuroda 0:13a5d365ba16 100 return CwiseBinaryOp<internal::scalar_max_op<Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
ykuroda 0:13a5d365ba16 101 }
ykuroda 0:13a5d365ba16 102
ykuroda 0:13a5d365ba16 103 /** \returns an expression of the coefficient-wise max of *this and scalar \a other
ykuroda 0:13a5d365ba16 104 *
ykuroda 0:13a5d365ba16 105 * \sa class CwiseBinaryOp, min()
ykuroda 0:13a5d365ba16 106 */
ykuroda 0:13a5d365ba16 107 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar>, const Derived, const ConstantReturnType>
ykuroda 0:13a5d365ba16 108 cwiseMax(const Scalar &other) const
ykuroda 0:13a5d365ba16 109 {
ykuroda 0:13a5d365ba16 110 return cwiseMax(Derived::Constant(rows(), cols(), other));
ykuroda 0:13a5d365ba16 111 }
ykuroda 0:13a5d365ba16 112
ykuroda 0:13a5d365ba16 113
ykuroda 0:13a5d365ba16 114 /** \returns an expression of the coefficient-wise quotient of *this and \a other
ykuroda 0:13a5d365ba16 115 *
ykuroda 0:13a5d365ba16 116 * Example: \include MatrixBase_cwiseQuotient.cpp
ykuroda 0:13a5d365ba16 117 * Output: \verbinclude MatrixBase_cwiseQuotient.out
ykuroda 0:13a5d365ba16 118 *
ykuroda 0:13a5d365ba16 119 * \sa class CwiseBinaryOp, cwiseProduct(), cwiseInverse()
ykuroda 0:13a5d365ba16 120 */
ykuroda 0:13a5d365ba16 121 template<typename OtherDerived>
ykuroda 0:13a5d365ba16 122 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, const Derived, const OtherDerived>
ykuroda 0:13a5d365ba16 123 cwiseQuotient(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
ykuroda 0:13a5d365ba16 124 {
ykuroda 0:13a5d365ba16 125 return CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
ykuroda 0:13a5d365ba16 126 }
ykuroda 0:13a5d365ba16 127
ykuroda 0:13a5d365ba16 128 typedef CwiseBinaryOp<internal::scalar_cmp_op<Scalar,internal::cmp_EQ>, const Derived, const ConstantReturnType> CwiseScalarEqualReturnType;
ykuroda 0:13a5d365ba16 129
ykuroda 0:13a5d365ba16 130 /** \returns an expression of the coefficient-wise == operator of \c *this and a scalar \a s
ykuroda 0:13a5d365ba16 131 *
ykuroda 0:13a5d365ba16 132 * \warning this performs an exact comparison, which is generally a bad idea with floating-point types.
ykuroda 0:13a5d365ba16 133 * In order to check for equality between two vectors or matrices with floating-point coefficients, it is
ykuroda 0:13a5d365ba16 134 * generally a far better idea to use a fuzzy comparison as provided by isApprox() and
ykuroda 0:13a5d365ba16 135 * isMuchSmallerThan().
ykuroda 0:13a5d365ba16 136 *
ykuroda 0:13a5d365ba16 137 * \sa cwiseEqual(const MatrixBase<OtherDerived> &) const
ykuroda 0:13a5d365ba16 138 */
ykuroda 0:13a5d365ba16 139 inline const CwiseScalarEqualReturnType
ykuroda 0:13a5d365ba16 140 cwiseEqual(const Scalar& s) const
ykuroda 0:13a5d365ba16 141 {
ykuroda 0:13a5d365ba16 142 return CwiseScalarEqualReturnType(derived(), Derived::Constant(rows(), cols(), s), internal::scalar_cmp_op<Scalar,internal::cmp_EQ>());
ykuroda 0:13a5d365ba16 143 }