From what I've read (please correct me if I am wrong), REAL*8 is still
valid in Fortran 95. However, we really ought to allow specifying
multiple standards to the function, so that the newer standards can
output more idiomatic code.
I believe it should be possible to change what codegen() is outputting
from changing the DataType that is used. I'm not quite clear how to
pass it in to the codegen() function. In SymPy 1.1 you can pass in a
custom CodeGen subclass, so it should be doable, however it's
complicated because currently types are handled by the classes in the
codegen module rather than the code printers.
Maybe someone more well versed in the module can give a better answer,
but monkeypatching should work
import sympy.utilities.codegen as codegen_mod
codegen_mod.default_datatypes.update({
"int": codegen_mod.DataType("int", "INTEGER(kind=4)", "int", "", "", "i32"),
"float": codegen_mod.DataType("double", "REAL(kind=8)", "float",
"", "", "f64"),
})
(see
https://github.com/sympy/sympy/blob/b2b4bfbbbe85e4b19fbc68fb4f72bdaccb476e79/sympy/utilities/codegen.py#L240)
Aaron Meurer
> --
> 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 post to this group, send email to
sy...@googlegroups.com.
> Visit this group at
https://groups.google.com/group/sympy.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/sympy/dcd1bd81-3be1-45fa-a828-62aec52d398a%40googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.