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:
- The utility can create compilable functions written in C.
- As far as I can see, it is restricted to scalar arguments and a single scalar return value.
- 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:
- 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.
- 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.
- Write tests for all new functionality.
Looking forward to a quantum pythonical adventure!