Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stack Of Tasks
eigenpy
Commits
5a6f4804
Verified
Commit
5a6f4804
authored
May 23, 2020
by
Justin Carpentier
Browse files
test: test registration of a new type
parent
cec1bd83
Changes
2
Hide whitespace changes
Inline
Side-by-side
unittest/matrix.cpp
View file @
5a6f4804
...
...
@@ -81,12 +81,22 @@ MatrixDerived base(const Eigen::MatrixBase<MatrixDerived> & m)
return
m
.
derived
();
}
template
<
typename
Scalar
>
Eigen
::
Matrix
<
Scalar
,
6
,
6
>
matrix6
(
const
Scalar
&
value
)
{
typedef
Eigen
::
Matrix
<
Scalar
,
6
,
6
>
ReturnType
;
return
ReturnType
::
Constant
(
value
);
}
BOOST_PYTHON_MODULE
(
matrix
)
{
using
namespace
Eigen
;
namespace
bp
=
boost
::
python
;
eigenpy
::
enableEigenPy
();
typedef
Eigen
::
Matrix
<
double
,
6
,
6
>
Matrix6
;
eigenpy
::
enableEigenPySpecific
<
Matrix6
>
();
Eigen
::
MatrixXd
(
*
naturalsXX
)(
int
,
int
,
bool
)
=
naturals
;
Eigen
::
VectorXd
(
*
naturalsX
)(
int
,
bool
)
=
naturals
;
Eigen
::
Matrix3d
(
*
naturals33
)(
bool
)
=
naturals
;
...
...
@@ -108,4 +118,6 @@ BOOST_PYTHON_MODULE(matrix)
bp
::
def
(
"base"
,
base
<
VectorXd
>
);
bp
::
def
(
"base"
,
base
<
MatrixXd
>
);
bp
::
def
(
"matrix6"
,
matrix6
<
double
>
);
}
unittest/python/test_matrix.py
View file @
5a6f4804
...
...
@@ -126,3 +126,7 @@ assert(mat1x1[0,0] == value)
vec1x1
=
eigenpy
.
vector1x1
(
value
)
assert
(
vec1x1
.
size
==
1
)
assert
(
vec1x1
[
0
]
==
value
)
# test registration of matrix6
mat6
=
eigenpy
.
matrix6
(
0.
)
assert
(
mat6
.
size
==
36
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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