Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
b063e64b
Commit
b063e64b
authored
Jul 05, 2016
by
Ben North
Browse files
Eigen tests: '2*' functions for col-, row-vectors
parent
3b48482f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
example/eigen.cpp
example/eigen.cpp
+9
-0
No files found.
example/eigen.cpp
View file @
b063e64b
...
@@ -10,6 +10,12 @@
...
@@ -10,6 +10,12 @@
#include "example.h"
#include "example.h"
#include <pybind11/eigen.h>
#include <pybind11/eigen.h>
Eigen
::
VectorXf
double_col
(
const
Eigen
::
VectorXf
&
x
)
{
return
2.0
f
*
x
;
}
Eigen
::
RowVectorXf
double_row
(
const
Eigen
::
RowVectorXf
&
x
)
{
return
2.0
f
*
x
;
}
void
init_eigen
(
py
::
module
&
m
)
{
void
init_eigen
(
py
::
module
&
m
)
{
typedef
Eigen
::
Matrix
<
float
,
5
,
6
,
Eigen
::
RowMajor
>
FixedMatrixR
;
typedef
Eigen
::
Matrix
<
float
,
5
,
6
,
Eigen
::
RowMajor
>
FixedMatrixR
;
typedef
Eigen
::
Matrix
<
float
,
5
,
6
>
FixedMatrixC
;
typedef
Eigen
::
Matrix
<
float
,
5
,
6
>
FixedMatrixC
;
...
@@ -23,6 +29,9 @@ void init_eigen(py::module &m) {
...
@@ -23,6 +29,9 @@ void init_eigen(py::module &m) {
mat
<<
0
,
3
,
0
,
0
,
0
,
11
,
22
,
0
,
0
,
0
,
17
,
11
,
7
,
5
,
0
,
1
,
0
,
11
,
0
,
mat
<<
0
,
3
,
0
,
0
,
0
,
11
,
22
,
0
,
0
,
0
,
17
,
11
,
7
,
5
,
0
,
1
,
0
,
11
,
0
,
0
,
0
,
0
,
0
,
11
,
0
,
0
,
14
,
0
,
8
,
11
;
0
,
0
,
0
,
0
,
11
,
0
,
0
,
14
,
0
,
8
,
11
;
m
.
def
(
"double_col"
,
&
double_col
);
m
.
def
(
"double_row"
,
&
double_row
);
m
.
def
(
"fixed_r"
,
[
mat
]()
->
FixedMatrixR
{
m
.
def
(
"fixed_r"
,
[
mat
]()
->
FixedMatrixR
{
return
FixedMatrixR
(
mat
);
return
FixedMatrixR
(
mat
);
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment