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
7b8d9e02
Commit
7b8d9e02
authored
Jul 05, 2016
by
Ben North
Browse files
Test eigen converts slices of 3d arrays correctly
parent
3e0e7793
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
example/eigen.py
example/eigen.py
+8
-0
example/eigen.ref
example/eigen.ref
+6
-0
No files found.
example/eigen.py
View file @
7b8d9e02
...
@@ -10,6 +10,7 @@ from example import dense_passthrough_r, dense_passthrough_c
...
@@ -10,6 +10,7 @@ from example import dense_passthrough_r, dense_passthrough_c
from
example
import
sparse_r
,
sparse_c
from
example
import
sparse_r
,
sparse_c
from
example
import
sparse_passthrough_r
,
sparse_passthrough_c
from
example
import
sparse_passthrough_r
,
sparse_passthrough_c
from
example
import
double_row
,
double_col
from
example
import
double_row
,
double_col
from
example
import
double_mat_cm
,
double_mat_rm
import
numpy
as
np
import
numpy
as
np
ref
=
np
.
array
(
ref
=
np
.
array
(
...
@@ -55,3 +56,10 @@ print("double_row(first_row) = %s" % check_got_vs_ref(double_row(first_row), 2.0
...
@@ -55,3 +56,10 @@ print("double_row(first_row) = %s" % check_got_vs_ref(double_row(first_row), 2.0
print
(
"double_col(first_row) = %s"
%
check_got_vs_ref
(
double_col
(
first_row
),
2.0
*
first_row
))
print
(
"double_col(first_row) = %s"
%
check_got_vs_ref
(
double_col
(
first_row
),
2.0
*
first_row
))
print
(
"double_row(first_col) = %s"
%
check_got_vs_ref
(
double_row
(
first_col
),
2.0
*
first_col
))
print
(
"double_row(first_col) = %s"
%
check_got_vs_ref
(
double_row
(
first_col
),
2.0
*
first_col
))
print
(
"double_col(first_col) = %s"
%
check_got_vs_ref
(
double_col
(
first_col
),
2.0
*
first_col
))
print
(
"double_col(first_col) = %s"
%
check_got_vs_ref
(
double_col
(
first_col
),
2.0
*
first_col
))
counting_3d
=
np
.
arange
(
27.0
,
dtype
=
np
.
float32
).
reshape
((
3
,
3
,
3
))
slices
=
[
counting_3d
[
0
,
:,
:],
counting_3d
[:,
0
,
:],
counting_3d
[:,
:,
0
]]
for
slice_idx
,
ref_mat
in
enumerate
(
slices
):
print
(
"double_mat_cm(%d) = %s"
%
(
slice_idx
,
check_got_vs_ref
(
double_mat_cm
(
ref_mat
),
2.0
*
ref_mat
)))
print
(
"double_mat_rm(%d) = %s"
%
(
slice_idx
,
check_got_vs_ref
(
double_mat_rm
(
ref_mat
),
2.0
*
ref_mat
)))
example/eigen.ref
View file @
7b8d9e02
...
@@ -20,3 +20,9 @@ double_row(first_row) = OK
...
@@ -20,3 +20,9 @@ double_row(first_row) = OK
double_col(first_row) = OK
double_col(first_row) = OK
double_row(first_col) = OK
double_row(first_col) = OK
double_col(first_col) = OK
double_col(first_col) = OK
double_mat_cm(0) = OK
double_mat_rm(0) = OK
double_mat_cm(1) = OK
double_mat_rm(1) = OK
double_mat_cm(2) = OK
double_mat_rm(2) = OK
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