-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
codegen C output of MatrixSymbol writes undefined behavior #14049
Comments
I don't think that codegen works with MatrixSymbols yet in this way. You'd need to do something like: from sympy import MatrixSymbol, Matrix
from sympy.utilities.codegen import codegen
M = MatrixSymbol('M', 2, 1)
F = 2 * M
G = Matrix([F[0, 0], F[1, 0]])
stuff = codegen( ('example', F), "C", "bad_function")
print(stuff[0][1]) I think there is an open issue for this already. |
Master produces this:
|
This all seems to work here: http://www.sympy.org/scipy-2017-codegen-tutorial/notebooks/08-cythonizing.html#2.-Generating-C-Code-with-SymPy's-codegen() Not quite sure what I'm missing that is different here though. |
This works:
|
I'm thinking that it misinterprets the MatMul object. This works too:
|
This seems to work also: F = Matrix(2*M) |
generates
which is not ok in c as far as I know...I would expect something more like
The text was updated successfully, but these errors were encountered: