Hello Bianca,
Thanks for your reply. There is certainly nothing wrong with doing this in FORTRAN; I have tried it and it works. However, my FORTRAN code needs to read the coefficients (a1, a2,...) from a file, and it also needs to read the dataset from a file (READ( *, * ) x1, x2, ...).
This last thing is what I was trying to avoid, because the dataset is large and does not change, so reading it each time is a big overhead. I wanted the dataset to be already built into the executable, but the only way I know to do that is to type many very long DATA statements myself (or write a script to do it for me).
I was hoping Mathematica could create the code with the data statements already in it. I think I can do this with the CCodeGenerate and functions like CAssign, but I haven't gotten that to work yet.
I have tried simple things, such as:
Export["trycode.c", Compile[{x1, x2}, 3.0*x1^2 - 4.0*Exp[-2.5*x2^3]]]
Mathematica creates the source files, but I still need to figure out how to do the rest. I have tried the CCompilerDriver following the examples in the documentation. I guess I need to look into CCodeGenerate too.
Thanks,
OL.