Cadabra
Computer algebra system for field theory problems
Modules | Classes | Functions
Core

Module Description

All computer algebra functionality in the form of C++ classes.

Modules

 Cleanup
 Functionality to clean up expressions so that they satisfy the requirements of a consistent expression tree.
 
 Expression display
 Classes to handle printing of expressions in various formats.
 
 Expression comparison
 Functions to compare and match expressions stored in Ex objects.
 
 Notebooks and packages
 Graphical notebook interface and Cadabra packages.
 
 Python Core
 Python wrapper around the C++ core module.
 
 Scalar algebra
 Functionality to make Cadabra interface with scalar computer algebra systems such as Sympy or Mathematica.
 
 Numerical evaluation
 Functionality to evaluate mathematical expressions numerically.
 
 Algorithms
 Containing all algorithms acting on symbolic expression trees.
 
 Properties
 Containing all properties that can be attached to symbolic expressions.
 

Classes

class  cadabra::Algorithm
 Base class for all algorithms, containing generic routines and in particular the logic for index classification. More...
 
class  cadabra::Ex_is_equivalent
 Basic comparison operator for tree iterators, so we can use them as keys in maps. More...
 
class  cadabra::index_iterator
 An iterator which iterates over indices even if they are at lower levels, i.e. More...
 
class  cadabra::Parser
 Class which turns the string output of a preprocessor object and turns it into an Ex expression tree. More...
 
class  PermutationException
 Generic permutation group material. More...
 
class  preprocessor
 Preprocessing class which takes infix mathematical notation with all sorts of maths shortcuts and transforms it into a string which is properly formatted in prefix notation. More...
 
class  ProgressMonitor
 Object keeping track of time spent in nested execution blocks, and keeping track of out-of-band messages produced by these blocks. More...
 
class  cadabra::property
 Base class for all properties, handling argument parsing and defining the interface. More...
 
class  cadabra::Properties
 Class holding a collection of properties attached to expressions. More...
 
class  cadabra::str_node
 Elementary building block for a mathematical expression. More...
 
class  cadabra::Ex
 Basic storage class for symbolic mathemematical expressions. More...
 
class  cadabra::nset_it_less
 Compare two nset iterators by comparing the strings to which they point. More...
 
class  cadabra::DependsBase
 

Functions

void cadabra::do_list (const Ex &tr, Ex::iterator it, std::function< bool(Ex::iterator)> f)
 Apply a function on every element of a list, or if the iterator 'it' does not point to a list, only on that single element. More...
 
int cadabra::list_size (const Ex &tr, Ex::iterator it)
 For lists as defined above for 'do_list', return their size (in case you really need to know the size before iterating over the elements). More...
 
Ex::iterator cadabra::find_in_list (const Ex &tr, Ex::iterator it, std::function< Ex::iterator(Ex::iterator)> f)
 Returns an iterator to the first element for which 'f' does not return tr.end(). More...
 
Ex::iterator cadabra::find_in_subtree (const Ex &tr, Ex::iterator it, std::function< bool(Ex::iterator)> f, bool including_head=true)
 Returns an iterator to the first element for which 'f' returns 'true', or 'tr.end()'. More...
 
Ex cadabra::make_list (Ex el)
 Ensure that the tree is a list, even if it contains only a single element. More...
 
template<typename T >
T::iterator cadabra::do_subtree (const T &tr, typename T::iterator it, std::function< typename T::iterator(typename T::iterator)> f)
 Apply a function on every node in the tree at and below the given node, depth-first. More...
 
void cadabra::multiply (rset_t::iterator &, multiplier_t)
 Helper functions for manipulation of multipliers. More...
 
std::ostream & operator<< (std::ostream &, const cadabra::Ex &)
 Bare output operator for Ex objects, mainly to provide a simple way to generate debugging output. More...
 

Function Documentation

◆ do_list()

void cadabra::do_list ( const Ex tr,
Ex::iterator  it,
std::function< bool(Ex::iterator)>  f 
)

Apply a function on every element of a list, or if the iterator 'it' does not point to a list, only on that single element.

Handles lists wrapped in an \expression node as well. It is safe to remove the node pointed to by 'it' in 'f'. If your 'f' returns false, the loop is aborted immediately.

◆ do_subtree()

template<typename T >
T::iterator cadabra::do_subtree ( const T &  tr,
typename T::iterator  it,
std::function< typename T::iterator(typename T::iterator)>  f 
)

Apply a function on every node in the tree at and below the given node, depth-first.

Return an iterator to the top node, which replaces 'it' (may be the same).

◆ find_in_list()

Ex::iterator cadabra::find_in_list ( const Ex tr,
Ex::iterator  it,
std::function< Ex::iterator(Ex::iterator)>  f 
)

Returns an iterator to the first element for which 'f' does not return tr.end().

◆ find_in_subtree()

Ex::iterator cadabra::find_in_subtree ( const Ex tr,
Ex::iterator  it,
std::function< bool(Ex::iterator)>  f,
bool  including_head 
)

Returns an iterator to the first element for which 'f' returns 'true', or 'tr.end()'.

◆ list_size()

int cadabra::list_size ( const Ex tr,
Ex::iterator  it 
)

For lists as defined above for 'do_list', return their size (in case you really need to know the size before iterating over the elements).

◆ make_list()

Ex cadabra::make_list ( Ex  el)

Ensure that the tree is a list, even if it contains only a single element.

◆ multiply()

void cadabra::multiply ( rset_t::iterator &  num,
multiplier_t  fac 
)

Helper functions for manipulation of multipliers.

◆ operator<<()

std::ostream& operator<< ( std::ostream &  str,
const cadabra::Ex ex 
)

Bare output operator for Ex objects, mainly to provide a simple way to generate debugging output.

Does not do any fancy formatting; just prints a nested list representation. For more fancy output, look at DisplayTeX, DisplaySympy and DisplayTerminal.