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
8b03257b
Verified
Commit
8b03257b
authored
Aug 24, 2020
by
Justin Carpentier
Browse files
test: add test of PlainObjectBase feature
parent
500401b3
Changes
2
Hide whitespace changes
Inline
Side-by-side
unittest/matrix.cpp
View file @
8b03257b
...
...
@@ -81,6 +81,12 @@ MatrixDerived base(const Eigen::MatrixBase<MatrixDerived> & m)
return
m
.
derived
();
}
template
<
typename
MatrixDerived
>
MatrixDerived
plain
(
const
Eigen
::
PlainObjectBase
<
MatrixDerived
>
&
m
)
{
return
m
.
derived
();
}
template
<
typename
Scalar
>
Eigen
::
Matrix
<
Scalar
,
6
,
6
>
matrix6
(
const
Scalar
&
value
)
{
...
...
@@ -123,6 +129,9 @@ BOOST_PYTHON_MODULE(matrix)
bp
::
def
(
"base"
,
base
<
VectorXd
>
);
bp
::
def
(
"base"
,
base
<
MatrixXd
>
);
bp
::
def
(
"plain"
,
plain
<
VectorXd
>
);
bp
::
def
(
"plain"
,
plain
<
MatrixXd
>
);
bp
::
def
(
"matrix6"
,
matrix6
<
double
>
);
}
unittest/python/test_matrix.py
View file @
8b03257b
...
...
@@ -36,6 +36,10 @@ Mref = np.reshape(np.array(range(64),np.double),[8,8])
Mref_from_base
=
eigenpy
.
base
(
Mref
)
assert
(
np
.
array_equal
(
Mref
,
Mref_from_base
)
);
# Test plain function
Mref_from_plain
=
eigenpy
.
plain
(
Mref
)
assert
(
np
.
array_equal
(
Mref
,
Mref_from_plain
)
);
if
verbose
:
print
(
"===> Matrix 8x8"
)
M
=
Mref
assert
(
np
.
array_equal
(
M
,
eigenpy
.
reflex
(
M
,
verbose
))
);
...
...
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