You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I stumbled over something using lambdify on a matrix expression with version 1.5.1 and wanted to ask if this behavior is intended.
I wanted to lambdify a matrix and give numpy arrays as input for some symbols and constant ints for others.
As a minimal example I construct following matrix
importsympyimportnumpyasnpa, b, c, d=sympy.symbols("a b c d")
matrix=sympy.Matrix([ [a, b], [c, d]])
matrix_fct=sympy.lambdify([a, b, c, d], matrix)
If I would now like to evaluate the matrix for multiple values of a but fixed b, c and d, I assumed that this expression
Sympy lambdify is basically dispatching to `numpy.array([[a, b], [c, d]]), and if numpy is not broadcasting the scalars into ragged array by default, we shouldn't do that because it breaks other consistency.
I'm alternatively thinking of providing a fully symbolic API for matrix shape, because I don't think that there is any way to bind matrix shape into any code generation purposes unless it is accessed in implicit way.
Hey,
I stumbled over something using lambdify on a matrix expression with version
1.5.1
and wanted to ask if this behavior is intended.I wanted to lambdify a matrix and give numpy arrays as input for some symbols and constant ints for others.
As a minimal example I construct following matrix
If I would now like to evaluate the matrix for multiple values of
a
but fixedb
,c
andd
, I assumed that this expressionwould produce
matrix_values
as a (2, 2, 4) shapped numpy array. But instead I getTo get the desired I need to use constant arrays
Is this behavior intended?
I find the array that I get for the first version highly unusable and don't see in what situation I would want it.
The text was updated successfully, but these errors were encountered: