Another set of UI messages fixes and tweaks! No functional changes.
[blender.git] / extern / Eigen3 / Eigen / src / plugins / ArrayCwiseBinaryOps.h
1 /** \returns an expression of the coefficient wise product of \c *this and \a other
2   *
3   * \sa MatrixBase::cwiseProduct
4   */
5 template<typename OtherDerived>
6 EIGEN_STRONG_INLINE const EIGEN_CWISE_PRODUCT_RETURN_TYPE(Derived,OtherDerived)
7 operator*(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
8 {
9   return EIGEN_CWISE_PRODUCT_RETURN_TYPE(Derived,OtherDerived)(derived(), other.derived());
10 }
11
12 /** \returns an expression of the coefficient wise quotient of \c *this and \a other
13   *
14   * \sa MatrixBase::cwiseQuotient
15   */
16 template<typename OtherDerived>
17 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, const Derived, const OtherDerived>
18 operator/(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
19 {
20   return CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
21 }
22
23 /** \returns an expression of the coefficient-wise min of \c *this and \a other
24   *
25   * Example: \include Cwise_min.cpp
26   * Output: \verbinclude Cwise_min.out
27   *
28   * \sa max()
29   */
30 EIGEN_MAKE_CWISE_BINARY_OP(min,internal::scalar_min_op)
31
32 /** \returns an expression of the coefficient-wise max of \c *this and \a other
33   *
34   * Example: \include Cwise_max.cpp
35   * Output: \verbinclude Cwise_max.out
36   *
37   * \sa min()
38   */
39 EIGEN_MAKE_CWISE_BINARY_OP(max,internal::scalar_max_op)
40
41 /** \returns an expression of the coefficient-wise \< operator of *this and \a other
42   *
43   * Example: \include Cwise_less.cpp
44   * Output: \verbinclude Cwise_less.out
45   *
46   * \sa all(), any(), operator>(), operator<=()
47   */
48 EIGEN_MAKE_CWISE_BINARY_OP(operator<,std::less)
49
50 /** \returns an expression of the coefficient-wise \<= operator of *this and \a other
51   *
52   * Example: \include Cwise_less_equal.cpp
53   * Output: \verbinclude Cwise_less_equal.out
54   *
55   * \sa all(), any(), operator>=(), operator<()
56   */
57 EIGEN_MAKE_CWISE_BINARY_OP(operator<=,std::less_equal)
58
59 /** \returns an expression of the coefficient-wise \> operator of *this and \a other
60   *
61   * Example: \include Cwise_greater.cpp
62   * Output: \verbinclude Cwise_greater.out
63   *
64   * \sa all(), any(), operator>=(), operator<()
65   */
66 EIGEN_MAKE_CWISE_BINARY_OP(operator>,std::greater)
67
68 /** \returns an expression of the coefficient-wise \>= operator of *this and \a other
69   *
70   * Example: \include Cwise_greater_equal.cpp
71   * Output: \verbinclude Cwise_greater_equal.out
72   *
73   * \sa all(), any(), operator>(), operator<=()
74   */
75 EIGEN_MAKE_CWISE_BINARY_OP(operator>=,std::greater_equal)
76
77 /** \returns an expression of the coefficient-wise == operator of *this and \a other
78   *
79   * \warning this performs an exact comparison, which is generally a bad idea with floating-point types.
80   * In order to check for equality between two vectors or matrices with floating-point coefficients, it is
81   * generally a far better idea to use a fuzzy comparison as provided by isApprox() and
82   * isMuchSmallerThan().
83   *
84   * Example: \include Cwise_equal_equal.cpp
85   * Output: \verbinclude Cwise_equal_equal.out
86   *
87   * \sa all(), any(), isApprox(), isMuchSmallerThan()
88   */
89 EIGEN_MAKE_CWISE_BINARY_OP(operator==,std::equal_to)
90
91 /** \returns an expression of the coefficient-wise != operator of *this and \a other
92   *
93   * \warning this performs an exact comparison, which is generally a bad idea with floating-point types.
94   * In order to check for equality between two vectors or matrices with floating-point coefficients, it is
95   * generally a far better idea to use a fuzzy comparison as provided by isApprox() and
96   * isMuchSmallerThan().
97   *
98   * Example: \include Cwise_not_equal.cpp
99   * Output: \verbinclude Cwise_not_equal.out
100   *
101   * \sa all(), any(), isApprox(), isMuchSmallerThan()
102   */
103 EIGEN_MAKE_CWISE_BINARY_OP(operator!=,std::not_equal_to)
104
105 // scalar addition
106
107 /** \returns an expression of \c *this with each coeff incremented by the constant \a scalar
108   *
109   * Example: \include Cwise_plus.cpp
110   * Output: \verbinclude Cwise_plus.out
111   *
112   * \sa operator+=(), operator-()
113   */
114 inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived>
115 operator+(const Scalar& scalar) const
116 {
117   return CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived>(derived(), internal::scalar_add_op<Scalar>(scalar));
118 }
119
120 friend inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived>
121 operator+(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>& other)
122 {
123   return other + scalar;
124 }
125
126 /** \returns an expression of \c *this with each coeff decremented by the constant \a scalar
127   *
128   * Example: \include Cwise_minus.cpp
129   * Output: \verbinclude Cwise_minus.out
130   *
131   * \sa operator+(), operator-=()
132   */
133 inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived>
134 operator-(const Scalar& scalar) const
135 {
136   return *this + (-scalar);
137 }
138
139 friend inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const CwiseUnaryOp<internal::scalar_opposite_op<Scalar>, const Derived> >
140 operator-(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>& other)
141 {
142   return (-other) + scalar;
143 }