An error occurred while fetching the assigned milestone of the selected merge_request.
Allow vector assignments
>>>import pystencils as ps
>>>import sympy as sp
>>>a, b, c = sp.symbols("a b c")
>>>ps.Assignment(sp.Matrix([a,b,c]), sp.Matrix([1,2,3]))
(Assignment(a, 1), Assignment(b, 2), Assignment(c, 3))
Fixes #17 (closed)
Edited by Michael Kuron
Merge request reports
Activity
Filter activity
added 1 commit
- c98ee84d - Assert same length when performing vector assignment
added 1 commit
- 1c57a059 - Assert same length when performing vector assignment
I assume this can only be used through an
AssignmentCollection
, which then flattens the list of lists ofAssignment
s? So something likea = [ps.Assignment(field.center_vector, [0,0,0])] ps.create_kernel(a)
still wouldn't work, only
a = ps.AssignmentCollection([ps.Assignment(field.center_vector, [0,0,0])]) ps.create_kernel(a)
would. I guess all functions that accept a list of
Assignment
s need to be made aware of vector assignments or we need to forbid the use of lists of assignments and useAssignmentCollection
s everywhere.Btw. This should work and it is also more natural if constructing an Assignment from a vector yields a tuple
a = ps.AssignmentCollection([*ps.Assignment(field.center_vector, [0,0,0])]) ps.create_kernel(a)
I only added the flatting in AssignmentCollection to make them work with dicts
AssignmentCollection({ field.center_vector: [0,0,0] })
where you cannot unpack.
Edited by Stephan Seitzmentioned in commit 46b7b88d
Please register or sign in to reply