Hello,
I'm new to sympy and I really like it. I have a question about code
generation. I want to generate code that works with a Matrix as an output
with the gradient of a function.
Is it possible to do something like this?
x = symbols('x:2', real=True)
x = symbols('x:2', real=True)
i = Idx('i', (0, 2))
A = IndexedBase('A')
f = Matrix([sin(x[0] * x[1])])
gr = f.jacobian(x)
codegen(('gr', Eq(A[i], gr[i])), 'C')
The main problem here seems to be that I can not tell my matrix to be
indexed by an Idx variable and I can't assign a valuation to an Indexed
object.
Can someone orient me please?
Best!
D
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.