Skip to content

Public repository of the Cosmic Linear Anisotropy Solving System (master or 2.9 branches for standard code; ExoCLASS branch for exotic energy injection; class_matter branch for FFTlog)

Go to file

Latest commit

…proved coding style of pk_eq method; removed old test codes; plus minor bug fixes (Credits: J.L. Bernal, F. Lepori, I. Tutusaus)

* 2.9:
  pushed new version number 2.9.4
  fixed issue #339, credits J L Bernal
  removed obsolete test codes
  updated test_nonlinear
  renamed perturb_indices() and transfer_indices() for homogeneity of notations with other modules
  corrected typos in nonlinear (that would spoil renaming)
  back to intermediate shooting precision in the default settings
  increased 1d shooting precision, improved pk_eq handling, corrected two details in halofit formulas
  fixed bug in classy get_primordial()

Git stats


Failed to load latest commit information.
Latest commit message
Commit time

CLASS: Cosmic Linear Anisotropy Solving System {#mainpage}

Authors: Julien Lesgourgues and Thomas Tram

with several major inputs from other people, especially Benjamin Audren, Simon Prunet, Jesus Torrado, Miguel Zumalacarregui, Francesco Montanari, etc.

For download and information, see

Compiling CLASS and getting started

(the information below can also be found on the webpage, just below the download button)

Download the code from the webpage and unpack the archive (tar -zxvf class_vx.y.z.tar.gz), or clone it from Go to the class directory (cd class/ or class_public/ or class_vx.y.z/) and compile (make clean; make class). You can usually speed up compilation with the option -j: make -j class. If the first compilation attempt fails, you may need to open the Makefile and adapt the name of the compiler (default: gcc), of the optimization flag (default: -O4 -ffast-math) and of the OpenMP flag (default: -fopenmp; this flag is facultative, you are free to compile without OpenMP if you don't want parallel execution; note that you need the version 4.2 or higher of gcc to be able to compile with -fopenmp). Many more details on the CLASS compilation are given on the wiki page

(in particular, for compiling on Mac >= 10.9 despite of the clang incompatibility with OpenMP).

To check that the code runs, type:

./class explanatory.ini

The explanatory.ini file is THE reference input file, containing and explaining the use of all possible input parameters. We recommend to read it, to keep it unchanged (for future reference), and to create for your own purposes some shorter input files, containing only the input lines which are useful for you. Input files must have a *.ini extension.

If you want to play with the precision/speed of the code, you can use one of the provided precision files (e.g. cl_permille.pre) or modify one of them, and run with two input files, for instance:

./class test.ini cl_permille.pre

The files *.pre are suppposed to specify the precision parameters for which you don't want to keep default values. If you find it more convenient, you can pass these precision parameter values in your *.ini file instead of an additional *.pre file.

The automatically-generated documentation is located in


On top of that, if you wish to modify the code, you will find lots of comments directly in the files.


To use CLASS from python, or ipython notebooks, or from the Monte Python parameter extraction code, you need to compile not only the code, but also its python wrapper. This can be done by typing just 'make' instead of 'make class' (or for speeding up: 'make -j'). More details on the wrapper and its compilation are found on the wiki page

Plotting utility

Since version 2.3, the package includes an improved plotting script called (Class Plotting Utility), written by Benjamin Audren and Jesus Torrado. It can plot the Cl's, the P(k) or any other CLASS output, for one or several models, as well as their ratio or percentage difference. The syntax and list of available options is obtained by typing 'pyhton -h'. There is a similar script for MATLAB, written by Thomas Tram. To use it, once in MATLAB, type 'help plot_CLASS_output.m'

Developing the code

If you want to develop the code, we suggest that you download it from the github webpage

rather than from Then you will enjoy all the feature of git repositories. You can even develop your own branch and get it merged to the public distribution. For related instructions, check

Using the code

You can use CLASS freely, provided that in your publications, you cite at least the paper CLASS II: Approximation schemes <>. Feel free to cite more CLASS papers!


To get support, please open a new issue on the



Public repository of the Cosmic Linear Anisotropy Solving System (master or 2.9 branches for standard code; ExoCLASS branch for exotic energy injection; class_matter branch for FFTlog)



No packages published