|
template<typename CustomBinaryOp , typename OtherDerived > |
const CwiseBinaryOp< CustomBinaryOp, const Derived, const OtherDerived > | binaryExpr (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other, const CustomBinaryOp &func=CustomBinaryOp()) const |
|
template<typename OtherDerived > |
const CwiseBinaryOp< internal::scalar_bitwise_and_op< Scalar >, const Derived, const OtherDerived > | operator& (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const |
|
template<typename OtherDerived > |
const CwiseBinaryOp< internal::scalar_boolean_and_op< Scalar >, const Derived, const OtherDerived > | operator&& (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const |
|
template<typename T > |
const CwiseBinaryOp< internal::scalar_product_op< Scalar, T >, Derived, Constant< T > > | operator* (const T &scalar) const |
|
template<typename T > |
const CwiseBinaryOp< internal::scalar_product_op< T, Scalar >, Constant< T >, Derived > | operator* (const T &scalar, const StorageBaseType &expr) |
|
template<typename OtherDerived > |
const CwiseBinaryOp< sum< Scalar >, const Derived, const OtherDerived > | operator+ (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const |
|
template<typename OtherDerived > |
const CwiseBinaryOp< difference< Scalar >, const Derived, const OtherDerived > | operator- (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const |
|
template<typename T > |
const CwiseBinaryOp< internal::scalar_quotient_op< Scalar, T >, Derived, Constant< T > > | operator/ (const T &scalar) const |
|
template<typename OtherDerived > |
const CwiseBinaryOp< internal::scalar_bitwise_xor_op< Scalar >, const Derived, const OtherDerived > | operator^ (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const |
|
template<typename OtherDerived > |
const CwiseBinaryOp< internal::scalar_bitwise_or_op< Scalar >, const Derived, const OtherDerived > | operator| (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const |
|
template<typename OtherDerived > |
const CwiseBinaryOp< internal::scalar_boolean_or_op< Scalar >, const Derived, const OtherDerived > | operator|| (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const |
|
template<typename CustomBinaryOp , typename OtherDerived >
const CwiseBinaryOp<CustomBinaryOp, const Derived, const OtherDerived> binaryExpr |
( |
const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > & |
other, |
|
|
const CustomBinaryOp & |
func = CustomBinaryOp() |
|
) |
| const |
|
inline |
- Returns
- an expression of a custom coefficient-wise operator func of *this and other
The template parameter CustomBinaryOp is the type of the functor of the custom operator (see class CwiseBinaryOp for an example)
Here is an example illustrating the use of custom functors:
#include <iostream>
template<typename Scalar> struct MakeComplexOp {
typedef std::complex<Scalar> result_type;
result_type
operator()(
const Scalar&
a,
const Scalar&
b)
const {
return result_type(
a,
b); }
};
{
std::cout <<
m1.binaryExpr(
m2, MakeComplexOp<double>()) << std::endl;
return 0;
}
IndexedView_or_Block operator()(const RowIndices &rowIndices, const ColIndices &colIndices)
Matrix< double, 4, 4 > Matrix4d
4×4 matrix of type double.
Output:
(0.68,0.271) (0.823,-0.967) (-0.444,-0.687) (-0.27,0.998)
(-0.211,0.435) (-0.605,-0.514) (0.108,-0.198) (0.0268,-0.563)
(0.566,-0.717) (-0.33,-0.726) (-0.0452,-0.74) (0.904,0.0259)
(0.597,0.214) (0.536,0.608) (0.258,-0.782) (0.832,0.678)
- See also
- class CwiseBinaryOp, operator+(), operator-(), cwiseProduct()
Definition at line 43 of file CommonCwiseBinaryOps.h.
45 return CwiseBinaryOp<CustomBinaryOp, const Derived, const OtherDerived>(derived(), other.derived(), func);