Eigen 3.4.90
Main Page
Related Pages
Modules
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Typedefs
_
a
b
c
d
e
f
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerations
Enumerator
a
b
c
d
e
f
h
i
k
m
n
o
p
q
r
s
t
u
v
Related Functions
o
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
a
b
c
d
e
g
h
i
j
l
m
n
o
p
q
r
s
t
v
w
x
y
Typedefs
a
b
c
d
e
f
i
l
m
n
r
s
t
u
Macros
_
a
b
c
d
e
f
g
h
l
m
p
s
u
v
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
doc
examples
class_CwiseUnaryOp_ptrfun.cpp
Go to the documentation of this file.
1
#include <
Eigen/Core
>
2
#include <iostream>
3
4
// define function to be applied coefficient-wise
5
double
ramp
(
double
x
)
6
{
7
if
(
x
> 0)
8
return
x
;
9
else
10
return
0;
11
}
12
13
int
main
(
int
,
char
**)
14
{
15
Eigen::Matrix4d
m1
=
Eigen::Matrix4d::Random
();
16
std::cout <<
m1
<< std::endl <<
"becomes: "
<< std::endl <<
m1
.unaryExpr(std::ptr_fun(
ramp
)) << std::endl;
17
return
0;
18
}
x
x
Definition:
BiCGSTAB_simple.cpp:7
Core
m1
Matrix3d m1
Definition:
IOFormat.cpp:2
Eigen::DenseBase::Random
static const RandomReturnType Random()
Definition:
Random.h:114
Eigen::Matrix
The matrix class, also used for vectors and row-vectors.
Definition:
Matrix.h:182
main
int main(int, char **)
Definition:
class_CwiseUnaryOp_ptrfun.cpp:13
ramp
double ramp(double x)
Definition:
class_CwiseUnaryOp_ptrfun.cpp:5
Code