Skip to content
Snippets Groups Projects
Commit 977960a4 authored by Stephan Seitz's avatar Stephan Seitz
Browse files

Add get_random_sampling

parent 03ee157a
Branches
Tags
No related merge requests found
import itertools import itertools
import sympy as sp import sympy as sp
from sympy.matrices.dense import matrix_multiply_elementwise
import pystencils import pystencils
from pystencils import Field, x_vector from pystencils import Field, x_vector
...@@ -32,3 +34,10 @@ def add_fixed_constant_boundary_handling(assignments, with_cse=True): ...@@ -32,3 +34,10 @@ def add_fixed_constant_boundary_handling(assignments, with_cse=True):
return safe_assignments return safe_assignments
else: else:
return pystencils.AssignmentCollection(safe_assignments) return pystencils.AssignmentCollection(safe_assignments)
def get_random_sampling(random_numbers, aabb_min, aabb_max):
random_numbers = sp.Matrix(random_numbers)
aabb_min = sp.Matrix(aabb_min)
aabb_max = sp.Matrix(aabb_max)
return matrix_multiply_elementwise(random_numbers, (aabb_max - aabb_min)) + aabb_min
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment