Menu

Tree [f70675] master release_0_13_0_1 /
 History

HTTPS access


File Date Author Commit
 .devcontainer 2024-01-11 Paul Leopardi Paul Leopardi [3cdfa6] Add .devcontainer for GitHub Codespaces
 admin 2022-05-11 Paul Leopardi Paul Leopardi [8d0c13] Allow later versions of GNU Autotools etc.
 doc 2021-09-12 Paul Leopardi Paul Leopardi [78a598] Rename a rule so that it is not mistaken for a ...
 gfft_test 2022-01-20 Paul Leopardi Paul Leopardi [9d2b52] Improve linking: Treat libraries and linker fla...
 glucat 2025-01-04 Paul Leopardi Paul Leopardi [b606e0] Remove unused local typedefs
 m4 2022-01-20 Paul Leopardi Paul Leopardi [e66078] Use USER_LDFLAGS instead of all_libraries
 products 2022-01-20 Paul Leopardi Paul Leopardi [9d2b52] Improve linking: Treat libraries and linker fla...
 pyclical 2025-03-04 Paul Leopardi Paul Leopardi [8f2f14] Improve the Mayavi2 installation script
 squaring 2022-01-20 Paul Leopardi Paul Leopardi [9d2b52] Improve linking: Treat libraries and linker fla...
 test 2025-02-14 Paul Leopardi Paul Leopardi [41e7ec] Use tee so that test output is displayed sooner
 test00 2022-01-20 Paul Leopardi Paul Leopardi [9d2b52] Improve linking: Treat libraries and linker fla...
 test01 2022-01-20 Paul Leopardi Paul Leopardi [9d2b52] Improve linking: Treat libraries and linker fla...
 test02 2022-01-20 Paul Leopardi Paul Leopardi [9d2b52] Improve linking: Treat libraries and linker fla...
 test03 2022-01-20 Paul Leopardi Paul Leopardi [9d2b52] Improve linking: Treat libraries and linker fla...
 test04 2022-01-20 Paul Leopardi Paul Leopardi [9d2b52] Improve linking: Treat libraries and linker fla...
 test05 2022-01-20 Paul Leopardi Paul Leopardi [9d2b52] Improve linking: Treat libraries and linker fla...
 test06 2022-01-20 Paul Leopardi Paul Leopardi [9d2b52] Improve linking: Treat libraries and linker fla...
 test07 2022-01-20 Paul Leopardi Paul Leopardi [9d2b52] Improve linking: Treat libraries and linker fla...
 test08 2022-01-20 Paul Leopardi Paul Leopardi [9d2b52] Improve linking: Treat libraries and linker fla...
 test09 2022-01-20 Paul Leopardi Paul Leopardi [9d2b52] Improve linking: Treat libraries and linker fla...
 test10 2022-01-20 Paul Leopardi Paul Leopardi [9d2b52] Improve linking: Treat libraries and linker fla...
 test11 2022-05-11 Paul Leopardi Paul Leopardi [f849b2] Rename error functions to error_squared_tol(), ...
 test12 2022-01-20 Paul Leopardi Paul Leopardi [9d2b52] Improve linking: Treat libraries and linker fla...
 test13 2022-01-20 Paul Leopardi Paul Leopardi [9d2b52] Improve linking: Treat libraries and linker fla...
 test14 2022-01-20 Paul Leopardi Paul Leopardi [9d2b52] Improve linking: Treat libraries and linker fla...
 test15 2022-01-20 Paul Leopardi Paul Leopardi [9d2b52] Improve linking: Treat libraries and linker fla...
 test16 2022-01-20 Paul Leopardi Paul Leopardi [9d2b52] Improve linking: Treat libraries and linker fla...
 test17 2022-01-20 Paul Leopardi Paul Leopardi [9d2b52] Improve linking: Treat libraries and linker fla...
 test_runtime 2025-02-18 Paul Leopardi Paul Leopardi [7a8328] Test results for version 0.13.0.
 transforms 2022-01-20 Paul Leopardi Paul Leopardi [9d2b52] Improve linking: Treat libraries and linker fla...
 AUTHORS.md 2025-03-02 Paul Leopardi Paul Leopardi [fcafe5] Update for version 0.13.0
 COPYING 2007-08-22 Paul C. Leopardi Paul C. Leopardi [349def] Relicense under LGPLv3.
 ChangeLog 2025-03-09 Paul Leopardi Paul Leopardi [f70675] Update for version 0.3.0
 DESIGN.md 2022-03-27 Paul Leopardi Paul Leopardi [8f11ea] Update to version 0.11.0
 Doxyfile.in 2025-03-02 Paul Leopardi Paul Leopardi [45d272] Exclude pyclical/PyClical_nocython.cpp code.
 INSTALL.md 2025-03-04 Paul Leopardi Paul Leopardi [71f3e4] Improve the installation instructions
 Makefile.am.in 2025-03-09 Paul Leopardi Paul Leopardi [90bed6] Add Mayavi Kubuntu installation scripts to dist...
 Makefile.dist 2002-08-13 Paul C. Leopardi Paul C. Leopardi [506325] Update to automake 1.6.3 and autoconf 2.52
 NEWS 2025-03-02 Paul Leopardi Paul Leopardi [b8f121] Update for version 0.13.0
 README.md 2025-03-02 Paul Leopardi Paul Leopardi [fcafe5] Update for version 0.13.0
 TODO.md 2025-03-02 Paul Leopardi Paul Leopardi [fcafe5] Update for version 0.13.0
 configure.ac.in 2025-02-13 Paul Leopardi Paul Leopardi [2635ef] Rearrange configuration of libqd. Bump version ...
 configure.files 2015-09-01 Paul Leopardi Paul Leopardi [20ddff] Simplify the use of Autotools in the configure,...
 glucat.lsm 2025-03-02 Paul Leopardi Paul Leopardi [fcafe5] Update for version 0.13.0
 stamp-h1 2002-08-14 Paul C. Leopardi Paul C. Leopardi [dc8396] (Re)add files possibly needed by autoconf, auto...

Read Me

README for GluCat 0.13.0 with PyClical

GluCat is a library of C++ template classes for calculations with the universal
Clifford algebras over the real field. The dimension of the algebras you can
use is limited only by computer word size. Unlike some software packages for
Clifford algebras, the maximum signature is fixed by default or by user defined
template parameter values, and calculations are performed in the appropriate
subalgebra.

GluCat classes are meant to be used as numeric classes with other template
libraries. To do this, GluCat classes need to look and behave like floating
point numeric types such as float and double. The GluCat classes do this by
providing a definition for std::numeric_limits<>, most or all the expected
operators like +, -, *, /, and functions like sqrt(). In use with other template
libraries, you will need to look out for the differences between GluCat classes
and floating point numeric types. Two key differences are that Clifford algebras
do not have a total ordering, and that multiplication in Clifford algebras is
not necessarily commutative. A third difference is that not all non-zero
elements of a Clifford algebra have a multiplicative inverse.

PyClical is a Python extension module that is designed to make it easy for you
to use Python to perform computations in Clifford algebras, and to implement
algorithms and programs that use these computations. The syntax and semantics
of the main index_set and clifford classes in PyClical is designed to be as
similar as possible to that of the GluCat template classes index_set<> and
matrix_multi<double>, so that you should be able to use PyClical to teach
yourself how to use calculations in Clifford algebras, and then transfer that
knowledge to your ability to use GluCat template classes in C++.</double>

Before you go any further

To make the best use of the GluCat template library and the PyClical extension
module, you will need to become familiar with Geometric Algebra and Clifford
algebras in general. The AUTHORS.md file includes lists of recommended web pages,
books, and software that can help you to learn about Clifford algebras. Here is
a short list to get you started.

You should also install PyClical and run the tutorials. Once you have run the
PyClical tutorials, run the PyClical demos and look at the sample demo output.
Now examine the C++ code for the GluCat tests, as well as the sample output.
Finally, look at Glucat API documentation. Instructions for each of these steps
are given below.

Getting started

To use the software to its full potential, you will want to:
1. Download and update the software,
2. Understand the source code directory structure,
3. Resolve dependencies, install and test the software,
4. Use the PyClical extension module with Python,
5. Write C++ programs that use GluCat classes,
6. Compile and run C++ programs that use GluCat classes, and finally,
7. Help to improve the software by requesting features, filing bug reports and
writing your own source code patches.

These tasks are treated in some detail below.

1 Downloading and updating the software

You can download new versions of GluCat from
http://sourceforge.net/projects/glucat/files/
or alternatively, use the Git version:
From SourceForge: http://sourceforge.net/p/glucat/git/ci/master/tree/
From GitHub: https://github.com/penguian/glucat
For more on installing from Git, see INSTALL.md.

2 Understanding the source code directory structure

GluCat is a C++ template library, similar to the C++ Standard Library or the
Boost uBLAS Library (uBLAS). It consists of source code header files, a
suite of test routines, and the PyClical Python extension module and associated
files.

Once you have downloaded, unzipped and untarred the GluCat source code,
you should have a directory, glucat-xxx, where xxx is the version number.
Under glucat-xxx you should see a number of directories, including ./admin,
./doc, ./gfft_test, ./glucat, ./m4, ./products, ./pyclical,
./squaring, ./test, ./test_runtime, ./testxx, and ./transforms.

The ./glucat directory contains all the header files that define the GluCat C++
template library.

The ./pyclical directory contains the C++ and Cython source code for the
PyClical Python extension module, as well as a subdirectory ./pyclical/demos
containing Python source code for the PyClical demos and tutorials, and sample
demo output.

The ./admin and ./m4 directories are part of the autotools infrastructure for
building GluCat, and should normally be left unchanged.

The ./doc directory contains documentation. Currently only the GluCat API
Reference Manual can be found here, under ./doc/api.

The ./gfft_test, ./products, ./squaring and ./transform directories
contain the C++ source code for timing tests for GluCat.

The ./test and ./testxx directories contain the C++ source code for
programming examples and regression tests for GluCat.

The ./test_runtime directory contains regression test input and sample output
for the GluCat timing and regression tests.

3 Resolving dependencies, installing and testing the software

Detailed instructions for these tasks are included in the ./INSTALL.md file in the
same directory that contains this README.md file.

4 Using the PyClical extension module with Python

The PyClical Python extension module is written in C++ and Cython, and is defined
in the files pyclical/glucat.pxd, pyclical/PyClical.h, pyclical/PyClical.pxd,
and pyclical/PyClical.pyx. PyClical is designed to be installed using make. For
details on building PyClical, see the ./INSTALL.md file.

The following instructions assume that you have already installed PyClical. If
you have only run make within the PyClical directory, but have not yet
installed PyClical, then, assuming you are using the bash interpreter on Linux,
you will need to set the PYTHONPATH environment variable so that Python can
find your newly built copy of PyClical. If the make has succeeded, you should
have the file ./pyclical/PyClical.so. Set PYTHONPATH to include the full
./pyclical directory path name before any other path names. For example:

  export PYTHONPATH=/home/leopardi/src/glucat/pyclical:$PYTHONPATH

or you can change the PYTHONPATH variable for just one command, e.g.

  PYTHONPATH=/home/leopardi/src/glucat/pyclical:$PYTHONPATH python3

PyClical is designed to be used within a Python environment. You will usually
need to run a Python IDE or interpreter, such as IDLE, ipython3 or python3. The
following instructions use the standard python3 interpreter.

To use the capabilities of PyClical from within Python, you must either import
the PyClical extension module or import objects from this module. The simplest
way to do this is to use the following Python statement:

>>> from PyClical import *

Probably the easiest way to get familiar with PyClical is to make a copy of the
pyclical/demos directory and run the tutorials and demos. By default, the
pyclical/demos directory installs into /usr/local/share/pyclical/demos.

For example, assuming you are using the Bash shell on Linux, and have installed
PyClical, use the following commands:

% cp /usr/local/share/pyclical/demos /path/to/my/demos
% cd /path/to/my/demos
% python3 pyclical_tutorials.py

where you must replace /path/to/my/demos with the real pathname you want to use.

The pyclical_tutorials program starts by displaying

    Currently available PyClical tutorials:

    0.0 Notation.
    0.1 Index sets.
    0.2 Operations.
    0.3 Algebraic functions.
    0.4 Square root and transcendental functions.
    1.0 Plane geometry.
    1.1 Complex numbers.
    1.2 Space geometry and vector algebra.
    1.3 Electromagnetism and Lorentz transformations.
    1.4 The fourth dimension.
    1.5 Conformal Geometric Algebra.
    2.0 Exterior product.

    Enter the number for the tutorial you want to run, or Q to quit:

Just enter one of the numbers, e.g. 0.0, or Q to quit. At any point in an
individual tutorial, you can interrupt by entering CTRL-c.

If you are running Linux or a Unix equivalent, the following should also work:

% cd /path/to/my/demos
% chmod +x pyclical_tutorials.py
% ./pyclical_tutorials.py

For more usage examples, see the example Python files clifford_demo.py,
pyclical_demo.py, plotting_demo.py, plotting_demo_dialog.py,
plotting_demo_mayavi.py, and sqrt_log_demo.py, and the example output files
pyclical_demo.out and sqrt_log_demo.out.

To run clifford_demo.py, pyclical_demo.py, or sqrt_log_demo.py, use the
following commands:

% cd /path/to/my/demos
% python3 $DEMO.py

where $DEMO is one of clifford_demo, pyclical_demo or sqrt_log_demo.

If you are running Linux or a Unix equivalent, the following should also work:

% cd /path/to/my/demos
% chmod +x $DEMO.py
% ./$DEMO.py

To run plotting_demo.py, run ipython3 --pylab and enter the following command
at the IPython prompt:

In [1]: %run plotting_demo

This demo uses Matplotlib to produce a number of plots.

To run plotting_demo_mayavi.py, first ensure that you have Mayavi2 and wxPython
installed and working.
(See http://code.enthought.com/projects/mayavi/ and http://www.wxpython.org/ )
Then run ipython3 and enter the following command at the ipython3 prompt:

In [1]: %run plotting_demo_mayavi

This demo uses Matplotlib to produce a number of plots. With Mayavi and wxPython,
these plots are displayed in interactive windows, you can rotate, zoom and pan
them. See (e.g.) http://mayavi.sourceforge.net/docs/guide/ch03s04.html

You can also run the Mayavi plotting demo from a graphical user interface.
To do this, run ./plotting_demo_dialog.py.

The tutorials and demos are also accompanied by a corresponding set of Jupyter
notebooks. To build the notebooks, see INSTALL.md. To run the notebooks, assuming
that you have a copy of the notebooks in the directory /path/to/my/demos, you have
ipython3 installed, you have installed PyClical, or set PYTHONPATH appropriately,
and you are able to use Jupyter notebooks via a web browser, use the following
commands:

% cd /path/to/my/demos
% jupyter notebook

Your web browser should open a new window or tab, displaying a page that lists
all of the available tutorials and demos as notebooks. To select a notebook,
click on the corresponding name in the list.

5 Writing C++ programs that use GluCat classes

Once you have familiarized yourself with Clifford algebras and have tried using
PyClical, take a good look at the test C++ code in ./test00 to ./test17 and the
test output in ./test_runtime.

A good way to begin writing your own C++ code using GluCat is to start with the
programming example code in ./test01. The file test01/peg01.cpp includes
test/driver.h and test01/peg01.h.

The key lines of code in test/driver.h are:

 #include "glucat/glucat.h"
 #include "glucat/glucat_imp.h"
 #include "test/tuning.h"

The first line includes "glucat/glucat.h", a convenience header that includes
all the GluCat declarations.

The second line includes "glucat/glucat_imp.h", a convenience header that
includes all the GluCat definitions.

The third line includes "test/tuning.h", a convenience header that defines
specific instances of tuning<> for use as Tune_P, the tuning policy class.
This class is used as a template parameter in in the template classes
framed_multi<> and matrix_multi<>. The tuning<> template class is defined in
"glucat/tuning.h". See this file and "test/tuning.h" for examples of values
that you can use for the template parameters of tuning<> for use as Tune_P.

The key line of code in test01/peg01.h is:

 using namespace glucat;

Glucat defines and uses the `glucat:: namespace. You can use names from this
namespace by using the glucat:: prefix or by the using declaration above.

To obtain detailed information on the GluCat namespaces, classes and functions,
see the Doxygen documentation in doc/api/GluCat-API-reference-manual.pdf (PDF)
and doc/api/html/ (HTML). By default, this documentation is installed in
the directories /usr/local/doc/glucat/api/pdf and /usr/local/doc/glucat/api/html
respectively.

5.1 Truncation

Because the transform from framed_multi<> to matrix_multi<> may involve many
multiplications and additions, rounding errors can accumulate and result in one
or more non-zero matrix entries where exact arithmetic would have yielded zero.
Similarly, the inverse transform from matrix_multi<> to framed_multi<> can
result in small non-zero terms which would be zero in exact arithmetic.

The clifford_algebra::truncated() member function returns the multivector
*this with all relatively small terms set to zero. The function compares the
absolute value of each term to the largest absolute value of any term, and sets
to zero any term whose relative absolute value is smaller than the given limit.
The default limit is std::numeric_limits<Scalar_T>::epsilon(). The truncated()
matrix function operates similarly to set relatively small matrix entries to zero.

5.1.1 Printing uses truncation

Printing using operator<<() uses truncation to suppress the printing of
relatively small terms. Depending on the floating point format used, the
truncation used is calculated using the floating point precision as follows.

scientific:
truncation = 10 ** -(precision+1)

fixed:
truncation = (10 ** -precision) / max_abs
This has the effect of deleting all terms whose absolute value is less than
10 ** -precision.

hexfloat:
truncation = default_truncation

default:
truncation = 10 ** -precision

See (e.g.) https://www.cplusplus.com/reference/ios/ios_base/precision/
and see ./test17 for examples.

6 Compiling and running C++ programs that use GluCat classes

You can use the Makefile for ./test01 as the starting point for your own
Makefile. Your Makefile needs to pass the appropriate flags to your compiler.

  • Make sure that the header installation directory is in your include path.
    The default header installation directory is /usr/local/include/.

  • GluCat uses preprocessor defines to control header files.
    See "To Configure" in the ./INSTALL.md file for details of these preprocessor
    defines.

7 Helping to improve the software

To request features, file bug reports or submit source code patches:

The fastest way to ask for help with GluCat or to submit patches is to send an
email to the project manager ( Paul Leopardi < paul.leopardi@gmail.com > ).

The SourceForge page http://sourceforge.net/projects/glucat/support also
provides project forums, project mailing lists and project trackers.

The GitHub project page at https://github.com/penguian/glucat provides a
convenient interface that allows you to fork the code and create pull requests.

If you are thinking of writing patches, please try to match the programming
style used in the relevant source files, and be aware of the coding standards
used, as listed below.

Coding standards

The headers are split into declarations and definitions. The software was
developed using the GNU g++ compiler. Separate compilation is possible, if
you include both the declarations and definitions in each compilation unit,
but compilation is slow and the resulting binary is large.

The code follows many, but not all of the guidelines in the
GNU C++ Standard Library Style Guidelines at
https://gcc.gnu.org/onlinedocs/libstdc++/manual/source_code_style.html

The code also follows much of Scott Meyers' advice from "Effective C++",
Second Edition.

Some code conventions are:
* name_t: The name of a type, either global or local to a class.
* Sentence_Case_T: The name of a type used as a template parameter.
* Other_Sentence_Case: Other template parameters, including template template
parameters.
* ALL_CAPS_WITH_UNDERSCORES: A global constant defined in <glucat/global.h>

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.