Functions
CommonCwiseBinaryOps.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename CustomBinaryOp , typename OtherDerived >
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE CwiseBinaryOp< CustomBinaryOp, const Derived, const OtherDerived > binaryExpr (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other, const CustomBinaryOp &func=CustomBinaryOp()) const
 
template<typename OtherDerived >
const EIGEN_DEVICE_FUNC CwiseBinaryOp< internal::scalar_boolean_and_op, const Derived, const OtherDerived > operator&& (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
 
template<typename OtherDerived >
const EIGEN_DEVICE_FUNC CwiseBinaryOp< internal::scalar_boolean_or_op, const Derived, const OtherDerived > operator|| (const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
 

Function Documentation

◆ binaryExpr()

template<typename CustomBinaryOp , typename OtherDerived >
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE CwiseBinaryOp<CustomBinaryOp, const Derived, const OtherDerived> binaryExpr ( const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &  other,
const CustomBinaryOp &  func = CustomBinaryOp() 
) const
Returns
an expression of the difference of *this and other
Note
If you want to substract a given scalar from all coefficients, see Cwise::operator-().
See also
class CwiseBinaryOp, operator-=()
Returns
an expression of the sum of *this and other
Note
If you want to add a given scalar to all coefficients, see Cwise::operator+().
See also
class CwiseBinaryOp, operator+=()
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 <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
// define a custom template binary functor
template<typename Scalar> struct MakeComplexOp {
typedef complex<Scalar> result_type;
complex<Scalar> operator()(const Scalar& a, const Scalar& b) const { return complex<Scalar>(a,b); }
};
int main(int, char**)
{
Matrix4d m1 = Matrix4d::Random(), m2 = Matrix4d::Random();
cout << m1.binaryExpr(m2, MakeComplexOp<double>()) << endl;
return 0;
}

Output:

See also
class CwiseBinaryOp, operator+(), operator-(), cwiseProduct()

Definition at line 43 of file CommonCwiseBinaryOps.h.

◆ operator&&()

template<typename OtherDerived >
const EIGEN_DEVICE_FUNC CwiseBinaryOp<internal::scalar_boolean_and_op, const Derived, const OtherDerived> operator&& ( const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &  other) const
inline
Returns
an expression of the coefficient-wise boolean and operator of *this and other
Warning
this operator is for expression of bool only.

Example:

Array3d v(-1,2,1), w(-3,2,3);
cout << ((v<w) && (v<0)) << endl;

Output:

See also
operator||(), select()

Definition at line 91 of file CommonCwiseBinaryOps.h.

◆ operator||()

template<typename OtherDerived >
const EIGEN_DEVICE_FUNC CwiseBinaryOp<internal::scalar_boolean_or_op, const Derived, const OtherDerived> operator|| ( const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &  other) const
inline
Returns
an expression of the coefficient-wise boolean or operator of *this and other
Warning
this operator is for expression of bool only.

Example:

Array3d v(-1,2,1), w(-3,2,3);
cout << ((v<w) || (v<0)) << endl;

Output:

See also
operator&&(), select()

Definition at line 110 of file CommonCwiseBinaryOps.h.

w
RowVector3d w
Definition: Matrix_resize_int.cpp:3
EIGEN_EMPTY_STRUCT_CTOR
#define EIGEN_EMPTY_STRUCT_CTOR(X)
Definition: XprHelper.h:22
Eigen
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
b
Scalar * b
Definition: benchVecAdd.cpp:17
m1
Matrix3d m1
Definition: IOFormat.cpp:2
main
int main(int argc, char **argv)
Definition: cmake/example_cmake_find_gtsam/main.cpp:63
m2
MatrixType m2(n_dims)
operator()
internal::enable_if< internal::valid_indexed_view_overload< RowIndices, ColIndices >::value &&internal::traits< typename EIGEN_INDEXED_VIEW_METHOD_TYPE< RowIndices, ColIndices >::type >::ReturnAsIndexedView, typename EIGEN_INDEXED_VIEW_METHOD_TYPE< RowIndices, ColIndices >::type >::type operator()(const RowIndices &rowIndices, const ColIndices &colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST
Definition: IndexedViewMethods.h:73
a
ArrayXXi a
Definition: Array_initializer_list_23_cxx11.cpp:1
std
Definition: BFloat16.h:88
v
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
MakeComplexOp
Definition: class_CwiseBinaryOp.cpp:7
complex
Definition: datatypes.h:12
Scalar
SCALAR Scalar
Definition: bench_gemm.cpp:46


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:43:15