Question: use optimize on coef

Is it possible to use the optimize option of CodeGeneration (or codegen) on a matrix/vector and get output for a matrix M like:
M[1,1]:=a*b*c*(d+e):

M[1,2]:=a*b*c-(d+e):

etc

output:
t1 = a*b*c
t2 = d+e
M(1,1) = t1*t2
M(1,2) = t1-t2
etc

Thank you.

Please Wait...