gtsam
3rdparty
Eigen
doc
examples
class_CwiseBinaryOp.cpp
Go to the documentation of this file.
1
#include <Eigen/Core>
2
#include <iostream>
3
using namespace
Eigen
;
4
using namespace
std
;
5
6
// define a custom template binary functor
7
template
<
typename
Scalar>
struct
MakeComplexOp
{
8
EIGEN_EMPTY_STRUCT_CTOR
(
MakeComplexOp
)
9
typedef
complex
<
Scalar
>
result_type
;
10
complex
<
Scalar
> operator()(const
Scalar
&
a
, const
Scalar
&
b
)
const
{
return
complex<Scalar>
(
a
,
b
); }
11
};
12
13
int
main
(
int
,
char
**)
14
{
15
Matrix4d
m1
= Matrix4d::Random(),
m2
= Matrix4d::Random();
16
cout <<
m1
.binaryExpr(
m2
,
MakeComplexOp<double>
()) << endl;
17
return
0;
18
}
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
m2
MatrixType m2(n_dims)
a
ArrayXXi a
Definition:
Array_initializer_list_23_cxx11.cpp:1
std
Definition:
BFloat16.h:88
main
int main(int, char **)
Definition:
class_CwiseBinaryOp.cpp:13
MakeComplexOp
Definition:
class_CwiseBinaryOp.cpp:7
complex
Definition:
datatypes.h:12
Scalar
SCALAR Scalar
Definition:
bench_gemm.cpp:46
gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:11:15