login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

In FriCAS the word algebra normally means collection of constructors (categories, domains and packages) provided with FriCAS. For this meaning see FriCAS Library. The source code for algebra is contained in src/algebra subdirectory of the FriCAS source tree. Below we use algebra to mean just a single part (a single constructor or a small collection of tightly coupled constructors).

Adding new algebra in FriCAS

The process of adding new algebra to FriCAS is considerably different from Axiom and OpenAxiom. FriCAS no longer uses the old Lisp bootstrap method. Instead the build proceeds directly from the SPAD source code in several phases. The dependencies between SPAD modules are no longer so critical and build process should handle them automatically.

To add new algebra code you need:

1) Create a new file(s) and and it to the SPAD_SRCS variable in src/algebra/Makefile.in. This step is not needed if you are adding code to an already existing file.

2) Add the constructor(s) (more precisely its abbreviation(s)) to apropriate SPADLIST variable in src/algebra/Makefile.in. To assist parallel build abbreviations are divided between several variables, in lexicographic order.

3) If you are adding a category and it to the CATLIST variable in src/algebra/Makefile.in

4) If you are adding category with default implementation add it to the CATDOMS variable in src/algebra/Makefile.in

5) If you are adding a domain which should be subject to inlining optimization add it to DOMLIST variable in src/algebra/Makefile.in (to activate inlining you also need to add it to |$optimizableConstructorNames| in src/interp/setq.lisp

Rebuilding the algebra from scratch

Historically building algebra was a complicated process. FriCAS has special support to simplify it. Basic idea is that once declarations of constructors and exported functions are known we can compile implementation parts in any order. FriCAS contains special function which performs first part of algebra build collecting informations about constructors. There is an extra complication because we want inlining optimization: calls to simple function in a few core domains are replaced by function bodies. Fortunately all this is handled by the algebra Makefile and to add new constructor it is enough to follow instructions above.

Note: FriCAS algebra is build from scratch during full build (when you fetch sources from SVN repository). However release tarball contains partially compiled machine independent files, which saves build time, but means that actual Spad files are not used. To force full rebuild one can remove pre-generated directory from the source tree, (re)configure and build.

  Subject:   Be Bold !!
  ( 14 subscribers )  
Please rate this page: