I was trying to use sympy - codegen to get a fortran code. It works fine except for one annoying thing for which I can`t find a solution. I simplified my example to this:
bar = Matrix([x*x,y*z,z*y])
result = codegen(('foo', bar), 'f95', 'project')
the results is:
subroutine foo(x, y, z, out_6551735094710235777)
implicit none
REAL*8, intent(in) :: x
REAL*8, intent(in) :: y
REAL*8, intent(in) :: z
REAL*8, intent(out), dimension(1:3, 1:1) :: out_6551735094710235777
out_6551735094710235777(1, 1) = x**2
out_6551735094710235777(2, 1) = y*z
out_6551735094710235777(3, 1) = y*z
end subroutine
The output of the routine is a two dimensional array. Is there a way to make it single dimensional - for this case the second dimension is one anyway. If I generate the C code for this example I am getting a one dimensional vector by default. Why for fortran it is different?
Also, how to define a name for an output for case like this instead of the auto generated one?