Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for slicing / restricting the output domain. #21

Open
tehrengruber opened this issue Jul 17, 2024 · 1 comment
Open

Add support for slicing / restricting the output domain. #21

tehrengruber opened this issue Jul 17, 2024 · 1 comment

Comments

@tehrengruber
Copy link
Collaborator

We would like to have something like this:

lap(in_field, offset_provider=offset_provider, backend="py", out=out_field[1:-1, 1:-1])
@lorenzovarese
Copy link
Collaborator

Currently, the laplacian operation exhibits the following behavior:

Executing 'test_lap' with args: py, constant_cartesian_domain, true
----------------------------------------------------------------------------
Input Matrix before applying the laplacian:
1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
----------------------------------------------------------------------------
Output Matrix after applying lap() operator in the field operator:
-2.0  0.0   0.0   0.0   0.0   0.0   0.0   -1.0
-1.0  0.0   0.0   0.0   0.0   0.0   0.0   -1.0
-1.0  0.0   0.0   0.0   0.0   0.0   0.0   -1.0
-1.0  0.0   0.0   0.0   0.0   0.0   0.0   -1.0
-1.0  0.0   0.0   0.0   0.0   0.0   0.0   -1.0
-1.0  0.0   0.0   0.0   0.0   0.0   0.0   -1.0
-1.0  0.0   0.0   0.0   0.0   0.0   0.0   -1.0
-1.0  0.0   0.0   0.0   0.0   0.0   0.0   -2.0
----------------------------------------------------------------------------
Expected ground truth of laplacian computation without field operator:
1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
1.0  0.0  0.0  0.0  0.0  0.0  0.0  1.0
1.0  0.0  0.0  0.0  0.0  0.0  0.0  1.0
1.0  0.0  0.0  0.0  0.0  0.0  0.0  1.0
1.0  0.0  0.0  0.0  0.0  0.0  0.0  1.0
1.0  0.0  0.0  0.0  0.0  0.0  0.0  1.0
1.0  0.0  0.0  0.0  0.0  0.0  0.0  1.0
1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0


Executing 'test_lap' with args: py, simple_cartesian_domain, true
----------------------------------------------------------------------------
Input Matrix before applying the laplacian:
0.0   1.0   2.0   3.0   4.0 
5.0   6.0   7.0   8.0   9.0 
10.0  11.0  12.0  13.0  14.0
15.0  16.0  17.0  18.0  19.0
20.0  21.0  22.0  23.0  24.0
----------------------------------------------------------------------------
Output Matrix after applying lap() operator in the field operator:
6.0    24.0   24.0   24.0   19.0 
-4.0   0.0    0.0    0.0    -10.0
-9.0   0.0    0.0    0.0    -15.0
-14.0  0.0    0.0    0.0    -20.0
-43.0  -24.0  -24.0  -24.0  -54.0
----------------------------------------------------------------------------
Expected ground truth of laplacian computation without field operator:
0.0   1.0   2.0   3.0   4.0 
5.0   0.0   0.0   0.0   9.0 
10.0  0.0   0.0   0.0   14.0
15.0  0.0   0.0   0.0   19.0
20.0  21.0  22.0  23.0  24.0


Executing 'test_lap_lap' with args: py, constant_cartesian_domain, true
----------------------------------------------------------------------------
Input Matrix before applying the laplacian of laplacian (lap_lap):
1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
----------------------------------------------------------------------------
Output Matrix after applying lap(lap()) operator in the field operator:
10.0  -3.0  0.0   0.0   0.0   0.0   -1.0  15.0
2.0   -1.0  0.0   0.0   0.0   0.0   -1.0  5.0 
3.0   -1.0  0.0   0.0   0.0   0.0   -1.0  6.0 
3.0   -1.0  0.0   0.0   0.0   0.0   -1.0  6.0 
3.0   -1.0  0.0   0.0   0.0   0.0   -1.0  6.0 
3.0   -1.0  0.0   0.0   0.0   0.0   -1.0  6.0 
3.0   -1.0  0.0   0.0   0.0   0.0   -1.0  5.0 
5.0   -1.0  0.0   0.0   0.0   0.0   -3.0  35.0
----------------------------------------------------------------------------
Expected ground truth of lap(lap()) computation without field operator:
1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
1.0  1.0  0.0  0.0  0.0  0.0  1.0  1.0
1.0  1.0  0.0  0.0  0.0  0.0  1.0  1.0
1.0  1.0  0.0  0.0  0.0  0.0  1.0  1.0
1.0  1.0  0.0  0.0  0.0  0.0  1.0  1.0
1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0


Executing 'test_lap_lap' with args: py, simple_cartesian_domain, true
----------------------------------------------------------------------------
Input Matrix before applying the laplacian of laplacian (lap_lap):
0.0   1.0   2.0   3.0   4.0 
5.0   6.0   7.0   8.0   9.0 
10.0  11.0  12.0  13.0  14.0
15.0  16.0  17.0  18.0  19.0
20.0  21.0  22.0  23.0  24.0
----------------------------------------------------------------------------
Output Matrix after applying lap(lap()) operator in the field operator:
16.0    -109.0  -72.0   -77.0   -58.0 
18.0    20.0    24.0    14.0    53.0  
28.0    -9.0    0.0     -15.0   60.0  
19.0    -38.0   -24.0   -44.0   48.0  
178.0   53.0    72.0    37.0    252.0 
----------------------------------------------------------------------------
Expected ground truth of lap(lap()) computation without field operator:
0.0   1.0   2.0   3.0   4.0 
5.0   6.0   7.0   8.0   9.0 
10.0  11.0  0.0   13.0  14.0
15.0  16.0  17.0  18.0  19.0
20.0  21.0  22.0  23.0  24.0

When developing this feature, it would be beneficial to test the behavior using the existing test suite and the debug print developed during the laplacian example. After implementing this feature, it would be valuable to add a test case that checks the border values after the laplacian computation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants