On Oct 24, 2008, at 5:28 AM, peter wrote:
OK, sorry, I explain a little bit more in detail: - I work on thermal building simulation. We use for example one environment (TRNSYS) where you can connect models (for example building model to heating system model etc.). The models are mainly written in Fortran or C++ and compiled in DLL's that are then called by the equation solver. Our goal is to write the models not in C+++ or fortran anymore, but either in Matlab (and or Simulink), Scilab or Sage. So in clear, I want to profit of one of these mathematical environments, write models there and use them later in our simulation program.
One thing you can do is prototype in Sage and python, make use of profiling tools and then re-write the computation intensive portions using Cython or Pysco. At the moment, there really aren't tools to generate C++ or Fortran code from the Sage code. However, the latter tools are close to Python in syntax and can work with Sage.
That said, I'm fairly certain that it wouldn't be very difficult to write a code generator for Sage. If one can get the underlying structure of each of the expressions, it shouldn't be very difficult to convert that to C++ or Fortran as long as the expressions can be represented in the language without additional code. This is the approach that most the code generators I've seen use. Maxima has GENTRAN if someone is interested in seeing how one works and I know there is(are) paper(s) that discuss it. The main problem is that someone doing this would need to be fairly familiar with Sage internals.
Cheers, Tim. --- Tim Lahey PhD Candidate, Systems Design Engineering University of Waterloo
smime.p7s
Description: S/MIME cryptographic signature