If I make a Sympy expression with symbols a,b,c as follows
import sympy as sm
import numpy as np
a,b,c = sm.symbols("a,b,c")
expr = 4*a + b*a + b*c + a*b*c
f = sm.lambdify((a,b,c), expr)
a_1 = np.random.rand(10,10)
b_1 = np.random.rand(10,10)
c_1 = np.random.rand(10,10)
f(a_1, b_1, c_1)
The problem here for me, is that lambdify uses * in numpy which is just the element-by-element multiplication, but I need the matmul or @ operator in the above function. Above code is just an example, and in some of my use cases the expression becomes complicated to use. I tried to look for methods to achieve this in Sympy, but lambdify does not work with this operator. I was wondering whether a symbol existed which acts like a matrix for multiplication operators in Sympy, where the matrix size specification is not necessary, but I could not find any. It is also important for me that I can use the same function for matrices of different size choice of a, b and c. Any suggestion would be very helpful. Thanks!