Update on codegen

I’ve been studying the codegen utility a bit more.  According to  ‘git blame’, the module is mainly written by Toon Verstraelen.  I’d like to give him credit, because it is a very nice piece of code, and it seems like the perfect starting point of my project.

I especially like the straightforward, object oriented structure. There are classes to represent routines, data types, arguments and return values.  The actual code generators are also organized in a class hierarchy, and the abstract and language specific elements seem to be cleanly separated.  The clear structure makes the code very well readable, and it appears easily extensible.

The current status of the utility can be summarized as:

  1. The utility can  create compilable functions written in C.
  2. As far as I can see, it is restricted to scalar arguments and a single scalar return value. 
  3. There are tests that will compile and run binaries created from several elementary functions and also some more complicated expressions.

For each of these points, there is a corresponding improvement that I need to implement in order to prepare codegen for the demands of the quantum physics framwork:

  1. Implement a Fortran code generator.  This is not essential, but it will certainly be useful.   Implementing for two programming languages from the start will help me keep the language specific code separate from the language agnostic code.
  2. Extend the functionality to allow multidimensional arguments and return values.  I do not know yet the specifics of the quantum module Matt is working on,  but I’m pretty sure that numerical Quantum Mechanics will need to involve arrays in one way or another.
  3. Write tests for all new functionality.

Looking forward to a quantum pythonical adventure!

Advertisements
This entry was posted in sympy. Bookmark the permalink.

One Response to Update on codegen

  1. Pingback: Fortran free-form and a code generator | Jensen's Sympy Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s