python - Creating Fortran/C/Matlab function/(sub)routine for numerical symbolic matrix/array evaluation -


i evaluate numerically symbolic matrices created in python (sympy) using external function generated automatically.

my goal generate such subroutine

subroutine my_fun(y, x, z, m, c) implicit none real*8, intent(in) :: x real*8, intent(in) :: y real*8, intent(in) :: z integer*4, intent(in) :: m real*8, intent(out), dimension(1:m) :: c integer*4 :: line  line=1 c(line) = x + y*z line=line+1 c(line) = y*z-x   end subroutine 

i try use codegen in following way

c = symbols('c', cls=indexedbase) m= symbols('m', integer=true) = idx('line', m) [(c_name, c_code), (h_name, c_header)] = codegen(('my_fun', eq(c[line],x+y*z)),\  'f95', 'test10', header=true, empty=true) 

but result quite far

subroutine my_fun(x, y, z, m, c) implicit none real*8, intent(in) :: x real*8, intent(in) :: y real*8, intent(in) :: z integer*4, intent(in) :: m real*8, intent(out), dimension(1:m) :: c integer*4 :: line  line = 1, m    c(line) = x + y*z end  end subroutine 

in few words i'm not able input more 1 expression , generate array freely. idea how generate fortran subroutine sympy codegen

bests


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -