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
e2ab314e
Verified
Commit
e2ab314e
authored
Apr 19, 2022
by
Justin Carpentier
Browse files
test: fix
parent
90cf65ca
Pipeline
#18403
passed with stage
in 2 minutes and 14 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
unittest/eigen_ref.cpp
View file @
e2ab314e
...
...
@@ -42,8 +42,13 @@ Eigen::Ref<MatType> editBlock(Eigen::Ref<MatType> mat, Eigen::DenseIndex i,
Eigen
::
DenseIndex
j
,
Eigen
::
DenseIndex
n
,
Eigen
::
DenseIndex
m
)
{
typename
Eigen
::
Ref
<
MatType
>::
BlockXpr
B
=
mat
.
block
(
i
,
j
,
n
,
m
);
Eigen
::
Map
<
VectorXd
>
view
(
B
.
data
(),
B
.
size
());
view
.
setLinSpaced
(
0.
,
(
double
)
view
.
size
()
-
1.
);
int
k
=
0
;
for
(
int
i
=
0
;
i
<
B
.
rows
();
++
i
)
{
for
(
int
j
=
0
;
j
<
B
.
cols
();
++
j
)
{
B
(
i
,
j
)
=
k
++
;
}
}
std
::
cout
<<
"B:
\n
"
<<
B
<<
std
::
endl
;
return
mat
;
}
...
...
unittest/python/test_eigen_ref.py
View file @
e2ab314e
...
...
@@ -22,7 +22,6 @@ def test(mat):
assert
np
.
all
(
ref
==
mat
)
const_ref
=
asConstRef
(
mat
)
# import pdb; pdb.set_trace()
assert
np
.
all
(
const_ref
==
mat
)
mat
.
fill
(
0.0
)
...
...
@@ -37,11 +36,12 @@ def test(mat):
mat
.
fill
(
0.0
)
mat_as_C_order
=
np
.
array
(
mat
,
order
=
"F"
)
mat_copy
=
mat_as_C_order
.
copy
()
getBlock
(
mat_as_C_order
,
0
,
0
,
3
,
2
)[:,
:]
=
1.0
assert
np
.
all
(
mat_as_C_order
[:
3
,
:
2
]
==
np
.
ones
((
3
,
2
)))
mat_as_C_order
[:
3
,
:
2
]
=
0.0
mat_copy
=
mat_as_C_order
.
copy
()
editBlock
(
mat_as_C_order
,
0
,
0
,
3
,
2
)
mat_copy
[:
3
,
:
2
]
=
np
.
arange
(
6
).
reshape
(
3
,
2
)
...
...
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