repo.or.cz
/
librepilot.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git]
/
ground
/
gcs
/
src
/
libs
/
eigen
/
doc
/
examples
/
class_CwiseUnaryOp_ptrfun.cpp
blob
36706d8eddc3d4efaf2839d48107a2de76865ad8
1
#include <Eigen/Core>
2
#include <iostream>
3
using namespace
Eigen
;
4
using namespace
std
;
5
6
// define function to be applied coefficient-wise
7
double
ramp
(
double
x
)
8
{
9
if
(
x
>
0
)
10
return
x
;
11
else
12
return
0
;
13
}
14
15
int
main
(
int
,
char
**)
16
{
17
Matrix4d m1
=
Matrix4d
::
Random
();
18
cout
<<
m1
<<
endl
<<
"becomes: "
<<
endl
<<
m1
.
unaryExpr
(
ptr_fun
(
ramp
)) <<
endl
;
19
return
0
;
20
}