aesara_function and dot products

17 views
Skip to first unread message

Peter Bleackley

unread,
Oct 21, 2022, 1:59:10 PM10/21/22
to sympy
I have an expression that involves a dot product, and I want to generate aesara code from it. Unfortunately, aesara_function does not seem to recognise DotProduct objects (I get a KeyError expection from the mapping dictionary). I have tried using MatMul instead, but elsewhere in the expression I need to subtract a scalar from the dot product, and sympy will not subract a scalar from a matrix expression.

Can anybody suggest what I should do about this?

Peter Stahlecker

unread,
Oct 21, 2022, 2:03:12 PM10/21/22
to sy...@googlegroups.com
If you convert the scalar into a sympy matrix, like sympy.Matrix([scalar]) subtraction will work. I believe it worked for me once.

On Fri 21. Oct 2022 at 20:59, Peter Bleackley <peter.b...@playfultechnology.co.uk> wrote:
I have an expression that involves a dot product, and I want to generate aesara code from it. Unfortunately, aesara_function does not seem to recognise DotProduct objects (I get a KeyError expection from the mapping dictionary). I have tried using MatMul instead, but elsewhere in the expression I need to subtract a scalar from the dot product, and sympy will not subract a scalar from a matrix expression.

Can anybody suggest what I should do about this?

--
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 sympy+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/12f74a20-d8ed-47c8-9d68-38339ff36922n%40googlegroups.com.
--
Best regards,

Peter Stahlecker

Aaron Meurer

unread,
Oct 21, 2022, 6:30:05 PM10/21/22
to sy...@googlegroups.com
It sounds like whatever the Aesara version of dot product is just
needs to be added to the Aesara printer so that it knows how to handle
DotProduct.

Aaron Meurer
Reply all
Reply to author
Forward
0 new messages