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

Module Description

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

Modules

 Cleanup
 
 Expression display
 
 Expression comparison
 
 Notebooks and packages
 
 Python Core
 
 Scalar algebra
 
 Algorithms
 
 Properties
 

Namespaces

 cadabra
 Functions to handle the exchange properties of two or more symbols in a product.
 

Classes

class  cadabra::Algorithm
 
class  cadabra::Ex_is_equivalent
 
class  cadabra::index_iterator
 
class  PermutationException
 
class  preprocessor
 
class  cadabra::property
 FIXME: the above two need to be merged, because parse may need access to the actual pattern tree, and once we are there, we may as well do checking. More...
 
class  cadabra::Properties
 
class  cadabra::str_node
 
class  cadabra::Ex
 
class  cadabra::nset_it_less
 
class  cadabra::DependsBase
 

Functions

void cadabra::do_list (const Ex &tr, Ex::iterator it, std::function< bool(Ex::iterator)> f)
 
int cadabra::list_size (const Ex &tr, Ex::iterator it)
 
Ex::iterator cadabra::find_in_list (const Ex &tr, Ex::iterator it, std::function< Ex::iterator(Ex::iterator)> f)
 
Ex::iterator cadabra::find_in_subtree (const Ex &tr, Ex::iterator it, std::function< bool(Ex::iterator)> f, bool including_head)
 
Ex cadabra::make_list (Ex el)
 
template<typename T >
T::iterator cadabra::do_subtree (const T &tr, typename T::iterator it, std::function< typename T::iterator(typename T::iterator)> f)
 
void cadabra::multiply (rset_t::iterator &num, multiplier_t fac)
 
std::ostream & operator<< (std::ostream &, const cadabra::Ex &)
 

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 = true 
)

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 &  ,
multiplier_t   
)

Helper functions for manipulation of multipliers.

◆ operator<<()

std::ostream& operator<< ( std::ostream &  ,
const cadabra::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.