Dwith Swig / Examples /
Gi Na C
Difference (last change) (no other diffs, normal page display)
Deleted: 154,264d153
![]() |
|
C++ classes for symbolic manipulation
The classes provided by GiNaC allow for symbolic expressions to be expressed and manipulated.
There are three classes provided in GiNaC which made are available in D using SWIG.
- symbol is an object initialised to a string. e.g.
![]() |
|
- ex is an expression involving one or more symbols. e.g.
![]() |
|
- lst is a list of expressions. e.g.
![]() |
|
An object of class lst can be used to initalise an expression from a string e.g.
![]() |
|
where l provides a list of the symbols in the expression.
Features used
The features used here are the same as described in /Examples/Qdmath . The interface contains a lot of code to implement overloaded operators. The implementation of this in D is considerably easier than some other languages, such as Ruby and python.
Code to be wrapped
This is contained in the header files for GiNaC. The current version uses GiNaC 1.1.4. This needs to be upadated to the current version.
Interface file
This is rather long so I will not put it here. It is getting more urgent to set up a location for distribution of these files to those who would like them. It was not a long task to adapt the interface file which I already used for Ruby.
Run SWIG
![]() |
|
The output is the following files
- ginacd.d
- classsymbol.d
- classex.d
- classlst.d
- ginacdPINVOKE.d
- ginacd_wrap.cxx
Example application
runginacd.d
![]() |
|
Compile and Link
Linux
![]() |
|
Windows
GiNaC is not available for Windows.
Output
![]() |
|