Ceygen is a binary Python extension module for linear algebra with Cython typed memoryviews. Ceygen is built atop the Eigen C++ library. Ceygen is not a Cython wrapper or an interface to Eigen!
The name Ceygen is a rather poor wordplay on Cython + Eigen; it has nothing to do with software piracy. Ceygen is currently distributed under GNU GPL v2+ license. The authors of Ceygen are however open to other licensing suggestions. (Do you want to use Ceygen in e.g. a BSD-licensed project? Ask!)
Cython is being developed by Matěj Laitl with support from the Institute of Information Theory and Automation, Academy of Sciences of the Czech Republic. Feel free to send me a mail to matej at laitl dot cz.
Ceygen...
On the other hand, Ceygen...
A simple example to compute matrix product within a big matrix may look like
>>> cdef double[:, :] big = np.array([[1., 2., 2., 0., 0., 0.],
>>> [3., 4., 0., -2., 0., 0.]])
>>> ceygen.core.dot_mm(big[:, 0:2], big[:, 2:4], big[:, 4:6])
[[ 2. -4.]
[ 6. -8.]]
>>> big
[[ 1. 2. 2. 0. 2. -4.]
[ 3. 4. 0. -2. 6. -8.]],
where the dot_mm call above doesn’t copy any data, allocates no memory on heap, doesn’t need the GIL and uses vectorization (SSE, AltiVec...) to get the best out of your processor.
Ceygen development happens in its github repository, git clone git@github.com:strohel/Ceygen.git -ing is the preferred way to get it as you’ll have the latest & greatest version (which shouldn’t break thanks to continuous integration). Released versions are available from Ceygen’s PyPI page.
Ceygen uses standard Distutils to build, test and install itself, simply run:
Commands can be combined, automatically call dependent commands and can take options, the recommended combo to safely install Ceygen is therefore python setup.py -v test install.
You can set various build options as it is usual with distutils, see python setup.py --help. Notable is the build_ext command and its –include-dirs (standard) and following additional options (whose are Ceygen extensions):
--include-dirs | defaults to /usr/include/eigen3 and must be specified if you’ve installed Eigen 3 to a non-standard directory, |
--cflags | defaults to -O2 -march=native -fopenmp. Please note that it is important to enable optimizations and generation of appropriate MMX/SSE/altivec-enabled code as the actual computation code from Eigen is built along with the boilerplate Ceygen code, |
--ldflags | additional flags to pass to linker, defaults to -fopenmp. Use standard –libraries for specifying extra libraries to link against, |
--annotate | pass –annotate to Cython to produce annotated HTML files during compiling. Only useful during Ceygen development. |
You may want to remove -fopenmp from cflags and ldflags if you are already parallelising above Ceygen. The resulting command could look like python setup.py -v build_ext --include-dirs=/usr/local/include/eigen3 --cflags="-O3 -march=core2" --ldflags= test. The same could be achieved by putting the options to a setup.cfg file:
[build_ext]
include_dirs = /usr/local/include/eigen3
cflags = -O3 -march=core2
ldflags =
Ceygen documentation is maintained in reStructuredText format under doc/ directory and can be exported into a variety of formats using Sphinx (version at least 1.0 needed). Just type make in that directory to see a list of supported formats and for example make html to build HTML pages with the documentation.
See ChangeLog.rst file for changes between versions or view it online.
On-line documentation is available at http://strohel.github.com/Ceygen-doc/
Please report any bugs you find and suggestions you may have to Ceygen’s github Issue Tracker.