Cadabra
Computer algebra system for field theory problems
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
cadabra Namespace Reference

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

Namespaces

 symbols
 

Classes

class  Accent
 
class  ActionAddCell
 
class  ActionBase
 
class  ActionEraseText
 
class  ActionInsertText
 
class  ActionPositionCursor
 
class  ActionRemoveCell
 
class  ActionSetRunStatus
 
class  ActionSplitCell
 
class  Algorithm
 
class  AntiCommuting
 
class  AntiSymmetric
 
class  BoundProperty
 
class  BoundPropertyBase
 
class  CadabraJupyter
 
class  canonicalise
 
class  chain_rule
 
class  ChooseColoursDialog
 
class  CodeInput
 
class  collect_components
 
class  collect_factors
 
class  collect_terms
 
class  combine
 
class  Commuting
 
class  CommutingAsProduct
 
class  CommutingAsSum
 
class  CommutingBehaviour
 
class  complete
 
class  ComputeThread
 
class  Console
 
class  Coordinate
 
class  DAntiSymmetric
 
class  DataCell
 
class  decompose
 
class  decompose_product
 
class  Depends
 
class  DependsBase
 
class  DependsInherit
 
class  Derivative
 
class  Determinant
 
class  Diagonal
 
class  DifferentialForm
 
class  DifferentialFormBase
 
class  DiracBar
 
class  DisplayBase
 
class  DisplayMMA
 
class  DisplaySympy
 
class  DisplayTerminal
 
class  DisplayTeX
 
class  Distributable
 
class  distribute
 
class  DocumentThread
 
class  drop_keep_weight
 
class  drop_weight
 
class  einsteinify
 
class  eliminate_converter
 
class  eliminate_kronecker
 
class  eliminate_metric
 
class  eliminate_vielbein
 
class  epsilon_to_delta
 
class  EpsilonTensor
 
class  evaluate
 
class  Evaluator
 
class  Ex
 
class  Ex_comparator
 
class  Ex_hasher
 
class  Ex_is_equivalent
 
class  Ex_is_less
 
class  exchange
 
class  expand
 
class  expand_delta
 
class  expand_diracbar
 
class  expand_power
 
class  explicit_indices
 
class  ExteriorDerivative
 
class  factor_in
 
class  factor_out
 
class  fierz
 
class  FilledTableau
 
class  flatten_product
 
class  flatten_sum
 
class  GammaMatrix
 
class  GammaTraceless
 
class  GUIBase
 
class  ImageView
 
class  ImaginaryI
 
class  ImplicitIndex
 
class  index_iterator
 
class  IndexClassifier
 
class  IndexInherit
 
class  indexsort
 
class  Indices
 
class  Inherit
 If a property X derives from Inherit<Y>, and get<Y> is called on an object which has an X property (but no Y property), then the get<Y> will look at the non-index child of the object to see if that has a Y property. More...
 
class  Integer
 
class  integrate_by_parts
 
class  InverseMetric
 
class  InverseVielbein
 
class  join_gamma
 
class  keep_terms
 
class  keep_weight
 
class  Kernel
 
class  keyval_t
 Arguments to properties get parsed into a keyval_t structure. More...
 
class  KroneckerDelta
 
class  labelled_property
 
class  LaTeXForm
 
class  list_property
 Something cannot be both a list property and a normal property at the same time, so we can safely inherit without virtual. More...
 
class  lower_free_indices
 
class  lr_tensor
 
class  map_mma
 
class  map_sympy
 
class  Matrix
 
class  Metric
 
class  NonCommuting
 
class  NotebookCanvas
 
class  NotebookWindow
 
class  nset_it_less
 
class  NumericalFlat
 Property indicating that an operator is numerically flat, so that numerical factors in the argument can be taken outside. More...
 
class  order
 
class  Parser
 
class  PartialDerivative
 
class  pattern
 
class  product_rule
 
class  Properties
 
class  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  PropertyInherit
 PropertyInherit is like Inherit<T> for all properties. More...
 
class  reduce_delta
 
class  rename_dummies
 
class  replace_match
 
class  rewrite_indices
 
class  RiemannTensor
 
class  SatisfiesBianchi
 
class  SelfAntiCommuting
 
class  SelfCommuting
 
class  SelfCommutingBehaviour
 
class  SelfNonCommuting
 
class  simplify
 
class  sort_product
 
class  sort_spinors
 
class  sort_sum
 
class  SortOrder
 
class  Spinor
 
class  split_gamma
 
class  split_index
 
class  str_node
 
class  substitute
 
class  sym
 
class  Symbol
 
class  Symmetric
 
class  tab_basics
 
class  tabdimension
 
class  Tableau
 
class  TableauBase
 
class  TableauSymmetry
 
class  take_match
 
class  TerminalStream
 
class  TeXEngine
 
class  TextViewProxy
 
class  TeXView
 
class  Trace
 
class  Traceless
 
class  tree_equal_obj
 
class  tree_exact_equal_mod_prel_obj
 
class  tree_exact_equal_obj
 
class  tree_exact_less_for_indexmap_obj
 Compare for indexmap_t. More...
 
class  tree_exact_less_mod_prel_obj
 
class  tree_exact_less_no_wildcards_mod_prel_obj
 
class  tree_exact_less_no_wildcards_obj
 Compare two trees exactly, treat wildcard names as ordinary names. More...
 
class  tree_exact_less_obj
 Compare two trees exactly, i.e. including exact index names. More...
 
class  tree_less_modprel_obj
 
class  tree_less_obj
 Compare two trees by pattern logic, i.e. modulo index names. More...
 
class  untrace
 
class  unwrap
 
class  unzoom
 
class  vary
 
class  Vielbein
 
class  VisualCell
 
class  Weight
 
class  WeightBase
 
class  WeightInherit
 
class  WeylTensor
 
class  young_project
 
class  young_project_product
 
class  young_project_tensor
 
class  young_reduce
 
class  zoom
 

Typedefs

typedef void(* dispatcher_t) (const Kernel &k, Ex &, Ex::iterator &it)
 
typedef tree< DataCellDTree
 
using flags_base_t = std::underlying_type_t< HashFlags >
 
typedef mpq_class multiplier_t
 
typedef std::set< std::string > nset_t
 
typedef std::set< multiplier_trset_t
 
typedef uintptr_t hashval_t
 
using Ex_ptr = std::shared_ptr< Ex >
 
using tab_t = TableauBase::tab_t
 

Enumerations

enum  HashFlags : unsigned int {
  HASH_DEFAULT = 0x0, HASH_IGNORE_TOP_MULTIPLIER = 0x1, HASH_IGNORE_MULTIPLIER = 0x2, HASH_IGNORE_PRODUCT_ORDER = 0x4,
  HASH_IGNORE_SUM_ORDER = 0x8, HASH_IGNORE_INDEX_ORDER = 0x10, HASH_IGNORE_PARENT_REL = 0x20, HASH_IGNORE_BRACKET_TYPE = 0x40,
  HASH_IGNORE_CHILDREN = 0x80, HASH_IGNORE_NAMES = 0x100, HASH_IGNORE_INDICES = 0x200, HASH_IGNORE_CHILD_ORDER = 0x400
}
 

Functions

std::string escape_quotes (const std::string &)
 
std::string cdb2python (const std::string &, bool display)
 
std::string cdb2python_string (const std::string &, bool display)
 
std::string convert_line (const std::string &, std::string &lhs, std::string &rhs, std::string &op, std::string &indent, bool display)
 
std::string cnb2python (const std::string &, bool display)
 
void cleanup_dispatch (const Kernel &kernel, Ex &tr, Ex::iterator &it)
 
void check_index_consistency (const Kernel &k, Ex &tr, Ex::iterator it)
 Generic tool to check for index inconsistencies independent of running any algorithm. More...
 
bool cleanup_powlike (const Kernel &k, Ex &, Ex::iterator &it)
 Individual node cleanup routines. More...
 
bool cleanup_productlike (const Kernel &k, Ex &tr, Ex::iterator &it)
 
bool cleanup_sumlike (const Kernel &k, Ex &tr, Ex::iterator &it)
 
bool push_down_multiplier (const Kernel &k, Ex &tr, Ex::iterator it)
 Given a node with a non-unit multiplier, push this multiplier down the tree if the node is not allowed to have a non-unit multiplier. More...
 
bool cleanup_components (const Kernel &k, Ex &tr, Ex::iterator &it)
 
bool cleanup_partialderivative (const Kernel &, Ex &tr, Ex::iterator &it)
 
bool cleanup_derivative (const Kernel &k, Ex &tr, Ex::iterator &it)
 
bool cleanup_numericalflat (const Kernel &, Ex &tr, Ex::iterator &it)
 
bool cleanup_diagonal (const Kernel &, Ex &tr, Ex::iterator &it)
 
bool cleanup_kronecker (const Kernel &, Ex &tr, Ex::iterator &it)
 
bool cleanup_exterior_derivative (const Kernel &k, Ex &tr, Ex::iterator &it)
 
void cleanup_dispatch_deep (const Kernel &k, Ex &tr, dispatcher_t dispatch)
 
void cleanup_dispatch_deep (const Kernel &k, Ex &tr, Ex::iterator &, dispatcher_t dispatch)
 
int subtree_compare (const Properties *properties, Ex::iterator one, Ex::iterator two, int mod_prel, bool, int compare_multiplier, bool literal_wildcards)
 
bool tree_less (const Properties *, const Ex &one, const Ex &two, int mod_prel=-2, bool checksets=true, int compare_multiplier=-2)
 Various comparison functions, some exact, some with pattern logic. More...
 
bool tree_equal (const Properties *properties, const Ex &one, const Ex &two, int mod_prel, bool checksets, int compare_multiplier)
 
bool tree_exact_less (const Properties *properties, const Ex &one, const Ex &two, int mod_prel, bool checksets, int compare_multiplier, bool literal_wildcards)
 
bool tree_exact_equal (const Properties *properties, const Ex &one, const Ex &two, int mod_prel, bool checksets, int compare_multiplier, bool literal_wildcards)
 
bool subtree_less (const Properties *properties, Ex::iterator one, Ex::iterator two, int mod_prel, bool checksets, int compare_multiplier)
 
bool subtree_equal (const Properties *properties, Ex::iterator one, Ex::iterator two, int mod_prel, bool checksets, int compare_multiplier)
 
bool subtree_exact_less (const Properties *properties, Ex::iterator one, Ex::iterator two, int mod_prel, bool checksets, int compare_multiplier, bool literal_wildcards)
 
bool subtree_exact_equal (const Properties *properties, Ex::iterator one, Ex::iterator two, int mod_prel, bool checksets, int compare_multiplier, bool literal_wildcards)
 
std::string JSON_serialise (const DTree &)
 Serialise a document into .cj format, which is a JSON version of the document tree. More...
 
void JSON_recurse (const DTree &, DTree::iterator, Json::Value &)
 
void JSON_deserialise (const std::string &, DTree &)
 Load a document from .cj format, i.e. the inverse of the above. More...
 
void JSON_in_recurse (DTree &doc, DTree::iterator loc, const Json::Value &cells)
 
std::string export_as_HTML (const DTree &doc, bool for_embedding=false, bool strip_code=false, std::string title="")
 Export a document to a single self-contained HTML file containing inline CSS. More...
 
void HTML_recurse (const DTree &doc, DTree::iterator it, std::ostringstream &str, const std::string &preamble_string, bool for_embedding=false, bool strip_code=false, std::string title="")
 
std::string latex_to_html (const std::string &)
 Convert various LaTeX constructions to HTML-with-Mathjax, e.g. More...
 
std::string export_as_LaTeX (const DTree &doc, const std::string &image_file_base)
 Export a document to a single self-contained LaTeX file, with the exception of images which get saved as separate numbered files. More...
 
void LaTeX_recurse (const DTree &doc, DTree::iterator it, std::ostringstream &str, const std::string &preamble_string, const std::string &image_file_base, int &image_num)
 
std::string export_as_python (const DTree &doc)
 Export a document to a python-like file (converting text cells to comments and python cells to python code, dropping output cells). More...
 
void python_recurse (const DTree &doc, DTree::iterator it, std::ostringstream &str)
 
const char * unichar (kunichar c)
 
bool operator< (const exchange::tensor_type_t &one, const exchange::tensor_type_t &two)
 
void do_list (const Ex &tr, Ex::iterator it, std::function< bool(Ex::iterator)> f)
 
int list_size (const Ex &tr, Ex::iterator it)
 
Ex::iterator find_in_subtree (const Ex &tr, Ex::iterator it, std::function< bool(Ex::iterator)> f, bool including_head)
 
Ex::iterator find_in_list (const Ex &tr, Ex::iterator it, std::function< Ex::iterator(Ex::iterator)> f)
 
Ex make_list (Ex el)
 
template<typename T >
T::iterator do_subtree (const T &tr, typename T::iterator it, std::function< typename T::iterator(typename T::iterator)> f)
 
HashFlags operator~ (HashFlags flags)
 
HashFlags operator| (HashFlags lhs, HashFlags rhs)
 
HashFlags operator& (HashFlags lhs, HashFlags rhs)
 
HashFlagsoperator|= (HashFlags &lhs, HashFlags rhs)
 
HashFlagsoperator&= (HashFlags &lhs, HashFlags rhs)
 
Ex_hasher::result_t hash_ex (Ex::iterator it, HashFlags flags)
 
bool hash_compare (Ex::iterator lhs, Ex::iterator rhs, HashFlags flags)
 
std::string install_prefix ()
 Return an absolute path to the installation path. More...
 
void pre_clean_dispatch (const Kernel &kernel, Ex &ex, Ex::iterator &it)
 
void pre_clean_dispatch_deep (const Kernel &k, Ex &tr)
 
void cleanup_updown (const Kernel &k, Ex &, Ex::iterator &it)
 Cleanup for individual node types. More...
 
void cleanup_rational (const Kernel &, Ex &, Ex::iterator &st)
 
void cleanup_frac (const Kernel &, Ex &tr, Ex::iterator &st)
 
void cleanup_sqrt (const Kernel &, Ex &tr, Ex::iterator &st)
 
void cleanup_sub (const Kernel &, Ex &tr, Ex::iterator &it)
 
void cleanup_indexbracket (const Kernel &k, Ex &, Ex::iterator &it)
 Convert parser output which indicates an indexbracket to an actual indexbracket node. More...
 
std::string replace_all (std::string const &original, std::string const &from, std::string const &to)
 Replace all occurrances of 'from' with 'to', return result (does not replace in-place). More...
 
long to_long (multiplier_t mul)
 
std::string to_string (long num)
 
void multiply (rset_t::iterator &num, multiplier_t fac)
 
void add (rset_t::iterator &num, multiplier_t fac)
 
void zero (rset_t::iterator &num)
 
void one (rset_t::iterator &num)
 
void flip_sign (rset_t::iterator &num)
 
void half (rset_t::iterator &num)
 
template<typename T >
bool is_in (const T &val, const std::initializer_list< T > &list)
 
void init_algorithms (py::module &m)
 
template<class Algo >
Ex_ptr apply_algo_base (Algo &algo, Ex_ptr ex, bool deep, bool repeat, unsigned int depth, bool pre_order=false)
 
template<class Algo >
Ex_ptr apply_algo (Ex_ptr ex, bool deep, bool repeat, unsigned int depth)
 
template<class Algo , typename Arg1 >
Ex_ptr apply_algo (Ex_ptr ex, Arg1 arg1, bool deep, bool repeat, unsigned int depth)
 
template<class Algo , typename Arg1 , typename Arg2 >
Ex_ptr apply_algo (Ex_ptr ex, Arg1 arg1, Arg2 arg2, bool deep, bool repeat, unsigned int depth)
 
template<class Algo , typename Arg1 , typename Arg2 , typename Arg3 >
Ex_ptr apply_algo (Ex_ptr ex, Arg1 arg1, Arg2 arg2, Arg3 arg3, bool deep, bool repeat, unsigned int depth)
 
template<class Algo , typename... Args, typename... PyArgs>
void def_algo (pybind11::module &m, const char *name, bool deep, bool repeat, unsigned int depth, PyArgs... pyargs)
 
template<class Algo >
Ex_ptr apply_algo_preorder (Ex_ptr ex, bool deep, bool repeat, unsigned int depth)
 
template<class Algo , typename Arg1 >
Ex_ptr apply_algo_preorder (Ex_ptr ex, Arg1 arg1, bool deep, bool repeat, unsigned int depth)
 
template<class Algo , typename Arg1 , typename Arg2 >
Ex_ptr apply_algo_preorder (Ex_ptr ex, Arg1 arg1, Arg2 arg2, bool deep, bool repeat, unsigned int depth)
 
template<class Algo , typename... Args, typename... PyArgs>
void def_algo_preorder (pybind11::module &m, const char *name, bool deep, bool repeat, unsigned int depth, PyArgs... pyargs)
 
void init_algorithms (pybind11::module &m)
 
bool Ex_compare (Ex_ptr one, Ex_ptr other)
 
bool Ex_compare (Ex_ptr one, int other)
 
Ex_ptr Ex_add (const Ex_ptr ex1, const ExNode ex2)
 
Ex_ptr Ex_add (const Ex_ptr ex1, const Ex_ptr ex2)
 
Ex_ptr Ex_add (const Ex_ptr ex1, const Ex_ptr ex2, Ex::iterator top2)
 
Ex_ptr Ex_mul (const Ex_ptr ex1, const Ex_ptr ex2)
 
Ex_ptr Ex_mul (const Ex_ptr ex1, const Ex_ptr ex2, Ex::iterator top2)
 
Ex_ptr Ex_sub (const Ex_ptr ex1, const ExNode ex2)
 
Ex_ptr Ex_sub (const Ex_ptr ex1, const Ex_ptr ex2)
 
Ex_ptr Ex_sub (const Ex_ptr ex1, const Ex_ptr ex2, Ex::iterator top2)
 
Ex_ptr fetch_from_python (const std::string &nm)
 
Ex_ptr fetch_from_python (const std::string &nm, pybind11::object scope)
 
std::string Ex_as_str (Ex_ptr ex)
 
std::string Ex_as_repr (Ex_ptr ex)
 
std::string Ex_as_latex (Ex_ptr ex)
 
pybind11::object Ex_as_sympy (Ex_ptr ex)
 
std::string Ex_as_sympy_string (Ex_ptr)
 Similar to Ex_to_Sympy, but only producing a string which can be parsed by Sympy, instead of a full-fledged Sympy expression. More...
 
std::string Ex_as_input (Ex_ptr ex)
 
std::string Ex_as_MMA (Ex_ptr ex, bool use_unicode)
 
std::string print_tree (Ex *ex)
 
Ex lhs (Ex_ptr ex)
 
Ex rhs (Ex_ptr ex)
 
Ex Ex_getslice (Ex_ptr ex, pybind11::slice slice)
 
Ex Ex_getitem (Ex &ex, int index)
 
void Ex_setitem (Ex_ptr ex, int index, Ex val)
 
void Ex_setitem_iterator (Ex_ptr ex, ExNode en, Ex_ptr val)
 
size_t Ex_len (Ex_ptr ex)
 
std::string Ex_head (Ex_ptr ex)
 
pybind11::object Ex_get_mult (Ex_ptr ex)
 
pybind11::list terms (Ex_ptr ex)
 
std::shared_ptr< sympy::SympyBridgeSympyBridge_init (std::shared_ptr< Ex > ex)
 
Ex_ptr Ex_from_string (const std::string &ex_, bool, Kernel *kernel)
 
Ex_ptr Ex_from_int (int num, bool)
 
void call_post_process (Kernel &kernel, Ex_ptr ex)
 
Ex_ptr map_sympy_wrapper (Ex_ptr ex, std::string head, pybind11::args args)
 
void init_ex (py::module &m)
 
std::string Ex_as_tree (Ex *ex)
 
void init_ex (pybind11::module &m)
 
py::object get_locals ()
 
py::object get_globals ()
 
bool scope_has (const py::dict &dict, const std::string &obj)
 
std::string read_manual (const char *category, const char *name)
 
bool scope_has (const pybind11::dict &dict, const std::string &obj)
 
Kernelcreate_scope ()
 
Kernelcreate_scope_from_global ()
 
Kernelcreate_empty_scope ()
 
Kernelget_kernel_from_scope ()
 
void inject_defaults (Kernel *k)
 
void init_kernel (pybind11::module &m)
 
std::string init_ipython ()
 
 PYBIND11_MODULE (cadabra2, m)
 
void compile_package (const std::string &in_name, const std::string &out_name)
 
void init_packages (pybind11::module &m)
 
py::list ProgressMonitor_totals_helper (ProgressMonitor &self)
 
ProgressMonitorget_progress_monitor ()
 
void init_progress_monitor (py::module &m)
 
void init_progress_monitor (pybind11::module &m)
 
template<typename BoundPropT >
BoundPropT::py_type def_abstract_prop (pybind11::module &m, const std::string &name)
 
template<typename BoundPropT >
BoundPropT::py_type def_prop (pybind11::module &m)
 
pybind11::list list_properties ()
 
void init_properties (py::module &m)
 
template<typename PropT >
std::string get_name ()
 
template<typename BoundPropT >
BoundPropT::py_type def_abstract_prop (pybind11::module &m)
 
void init_properties (pybind11::module &m)
 
void init_stopwatch (py::module &m)
 
void init_stopwatch (pybind11::module &m)
 
std::string tab_str (const tab_t &tab)
 
void init_tableau (pybind11::module &m)
 
std::string capitalize_first (std::string in)
 

Variables

nset_t name_set
 
rset_t rat_set
 
bool post_process_enabled = true
 

Detailed Description

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

NotebookCanvas is an actual view on the document.

See tests/components.cdb for basic samples.

Class to deal with index scanning and classification.

This module is only concerned with the exchange properties of tensors as a whole, not with index permutation symmetries (which are handled in the canonicalise class of algebra.cc).

Cadabra kernel that keeps all state information that needs to be passed around to algorithms and properties. Stores property information and global settings.

Parser module, which takes the string output of the preprocessor.hh module and turns it into an Ex expression tree. The output of preprocessor.hh is assumed to be valid and consistent, so the code here is rather simple.

Handle the entire preclean stage, which turns a parsed expression into an expression which satisfies the Cadabra conventions. This does not involve the property system.

Evaluate a tensorial expression to components, performing all dummy index sums.

Components nodes have the following structure:

\components_{a b ... n}({t,t,...r}=value, {t,t,...r}=value, ...)

        \verbatim

        \components
 _{m}            // index names/types
 _{n}
            \comma          // last child
                \equals
                    \comma   // list of index values
                r
                t
        [value]  // value of tensor for above values of indices
                \equals
            ...
                \equals
            ...


ex:= A_{m n} ( A_{m n} + B_{m n} );
crds:= m -> { t, r, \phi, \theta };
vals:= { A_{t t} -> r, A_{r r} -> r**2, A_{t \phi} -> t, B_{t t} -> 1 };
evaluate(ex, crds, vals);
tst:= r * ( r + 1 ) + r**2 * r**2 + t*t - @(ex);

The algorithm performs the following steps. First, all free and dummy indices are classified using members of Algorithm (maybe later?). For all indices, the 'crds' argument to the algorithm is scanned for a

    \verbatim

m -> { a,b,c }

type pattern.

Do a dept-first scan until the first sum or product node.

In a sum node, all terms must have the same index structure, so we can now make a map from the subtree pattern to all possible index values. For each such index value set, lookup if there is a replacement pattern, if not replace by zero. This map can be reused later for equal sub-expressions (here it is important that a normal tensor expression can be used as a pattern immediately, though I would search both on explicit iterator (for things that we have just seen) and on pattern (for things that occur again later in the tree)).

In a product node, find all dummies and free indices. Create a set of all index value sets, e.g.

    \verbatim

        {m, n, p} ->
        { {t, t, t}, {r,t,t}, {t,r,t}, ... }

For each such index value set, lookup replacement rules.

KEY: quick way to lookup, for a given set of index values on a (found) pattern/pattern pointed to by iterator, whether and what is the value of the pattern.

There can be any number of them active inside the NotebookWindow. Each DataCell in the notebook document has a corresponding VisualCell in the NotebookCanvas, which gets added by NotebookCanvas::add_cell.

Cells which contain child cells (e.g. CodeInput, which can contain child cells corresponding to the TeXView output) will also be hierarchically ordered in the visual tree. That is, any visual cell which can contain a child cell will have it stored inside a Gtk::Box inside the visual cell. Removing any cell will therefore also immediately remove the child cells.

Typedef Documentation

◆ dispatcher_t

typedef void(* cadabra::dispatcher_t) (const Kernel &k, Ex &, Ex::iterator &it)

◆ DTree

typedef tree<DataCell> cadabra::DTree

◆ Ex_ptr

using cadabra::Ex_ptr = typedef std::shared_ptr<Ex>

◆ flags_base_t

using cadabra::flags_base_t = typedef std::underlying_type_t<HashFlags>

◆ hashval_t

typedef uintptr_t cadabra::hashval_t

◆ multiplier_t

typedef mpq_class cadabra::multiplier_t

◆ nset_t

typedef std::set<std::string> cadabra::nset_t

◆ rset_t

typedef std::set<multiplier_t> cadabra::rset_t

◆ tab_t

Enumeration Type Documentation

◆ HashFlags

enum cadabra::HashFlags : unsigned int
Enumerator
HASH_DEFAULT 
HASH_IGNORE_TOP_MULTIPLIER 
HASH_IGNORE_MULTIPLIER 
HASH_IGNORE_PRODUCT_ORDER 
HASH_IGNORE_SUM_ORDER 
HASH_IGNORE_INDEX_ORDER 
HASH_IGNORE_PARENT_REL 
HASH_IGNORE_BRACKET_TYPE 
HASH_IGNORE_CHILDREN 
HASH_IGNORE_NAMES 
HASH_IGNORE_INDICES 
HASH_IGNORE_CHILD_ORDER 

Function Documentation

◆ add()

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

◆ apply_algo() [1/4]

template<class Algo , typename Arg1 , typename Arg2 , typename Arg3 >
Ex_ptr cadabra::apply_algo ( Ex_ptr  ex,
Arg1  arg1,
Arg2  arg2,
Arg3  arg3,
bool  deep,
bool  repeat,
unsigned int  depth 
)

◆ apply_algo() [2/4]

template<class Algo , typename Arg1 , typename Arg2 >
Ex_ptr cadabra::apply_algo ( Ex_ptr  ex,
Arg1  arg1,
Arg2  arg2,
bool  deep,
bool  repeat,
unsigned int  depth 
)

◆ apply_algo() [3/4]

template<class Algo , typename Arg1 >
Ex_ptr cadabra::apply_algo ( Ex_ptr  ex,
Arg1  arg1,
bool  deep,
bool  repeat,
unsigned int  depth 
)

◆ apply_algo() [4/4]

template<class Algo >
Ex_ptr cadabra::apply_algo ( Ex_ptr  ex,
bool  deep,
bool  repeat,
unsigned int  depth 
)

◆ apply_algo_preorder() [1/3]

template<class Algo , typename Arg1 , typename Arg2 >
Ex_ptr cadabra::apply_algo_preorder ( Ex_ptr  ex,
Arg1  arg1,
Arg2  arg2,
bool  deep,
bool  repeat,
unsigned int  depth 
)

◆ apply_algo_preorder() [2/3]

template<class Algo , typename Arg1 >
Ex_ptr cadabra::apply_algo_preorder ( Ex_ptr  ex,
Arg1  arg1,
bool  deep,
bool  repeat,
unsigned int  depth 
)

◆ apply_algo_preorder() [3/3]

template<class Algo >
Ex_ptr cadabra::apply_algo_preorder ( Ex_ptr  ex,
bool  deep,
bool  repeat,
unsigned int  depth 
)

◆ call_post_process()

void cadabra::call_post_process ( Kernel kernel,
Ex_ptr  ex 
)

◆ capitalize_first()

std::string cadabra::capitalize_first ( std::string  in)

◆ cdb2python_string()

std::string cadabra::cdb2python_string ( const std::string &  blk,
bool  display 
)

◆ check_index_consistency()

void cadabra::check_index_consistency ( const Kernel k,
Ex tr,
Ex::iterator  it 
)

Generic tool to check for index inconsistencies independent of running any algorithm.

◆ cleanup_components()

bool cadabra::cleanup_components ( const Kernel k,
Ex tr,
Ex::iterator &  it 
)

◆ cleanup_derivative()

bool cadabra::cleanup_derivative ( const Kernel k,
Ex tr,
Ex::iterator &  it 
)

◆ cleanup_diagonal()

bool cadabra::cleanup_diagonal ( const Kernel ,
Ex tr,
Ex::iterator &  it 
)

◆ cleanup_dispatch_deep()

void cadabra::cleanup_dispatch_deep ( const Kernel k,
Ex tr,
Ex::iterator &  ,
dispatcher_t  dispatch 
)

◆ cleanup_exterior_derivative()

bool cadabra::cleanup_exterior_derivative ( const Kernel k,
Ex tr,
Ex::iterator &  it 
)

◆ cleanup_frac()

void cadabra::cleanup_frac ( const Kernel ,
Ex tr,
Ex::iterator &  st 
)

◆ cleanup_indexbracket()

void cadabra::cleanup_indexbracket ( const Kernel ,
Ex tr,
Ex::iterator &  it 
)

Convert parser output which indicates an indexbracket to an actual indexbracket node.

◆ cleanup_kronecker()

bool cadabra::cleanup_kronecker ( const Kernel ,
Ex tr,
Ex::iterator &  it 
)

◆ cleanup_numericalflat()

bool cadabra::cleanup_numericalflat ( const Kernel ,
Ex tr,
Ex::iterator &  it 
)

◆ cleanup_partialderivative()

bool cadabra::cleanup_partialderivative ( const Kernel ,
Ex tr,
Ex::iterator &  it 
)

◆ cleanup_powlike()

bool cadabra::cleanup_powlike ( const Kernel k,
Ex ,
Ex::iterator &  it 
)

Individual node cleanup routines.

Do not call these yourself.

Once more, these algorithms clean up the tree at the current node and the first layer of child nodes, but do NOT descend deeper down the tree, except when that is necessary to ensure that the tree remains consistent. As with any algorithms, the iterator pointing to the starting node may be changed, but these functions are not allowed to modify anything except the node and nodes below (in particular, they will leave sibling nodes untouched).

◆ cleanup_productlike()

bool cadabra::cleanup_productlike ( const Kernel k,
Ex tr,
Ex::iterator &  it 
)

◆ cleanup_rational()

void cadabra::cleanup_rational ( const Kernel ,
Ex ,
Ex::iterator &  st 
)

◆ cleanup_sqrt()

void cadabra::cleanup_sqrt ( const Kernel ,
Ex tr,
Ex::iterator &  st 
)

◆ cleanup_sub()

void cadabra::cleanup_sub ( const Kernel ,
Ex tr,
Ex::iterator &  it 
)

◆ cleanup_sumlike()

bool cadabra::cleanup_sumlike ( const Kernel k,
Ex tr,
Ex::iterator &  it 
)

◆ cleanup_updown()

void cadabra::cleanup_updown ( const Kernel k,
Ex ,
Ex::iterator &  it 
)

Cleanup for individual node types.

These are not needed during any later stages of the manipulation of an expression (and are hence defined here, not in 'Cleanup.hh').

◆ create_empty_scope()

Kernel * cadabra::create_empty_scope ( )

◆ create_scope_from_global()

Kernel * cadabra::create_scope_from_global ( )

◆ def_abstract_prop() [1/2]

template<typename BoundPropT >
BoundPropT::py_type cadabra::def_abstract_prop ( pybind11::module &  m)

◆ def_abstract_prop() [2/2]

template<typename BoundPropT >
BoundPropT::py_type cadabra::def_abstract_prop ( pybind11::module &  m,
const std::string &  name 
)

◆ def_prop()

template<typename BoundPropT >
BoundPropT::py_type cadabra::def_prop ( pybind11::module &  m)

◆ escape_quotes()

std::string cadabra::escape_quotes ( const std::string &  line)

◆ Ex_add() [1/2]

Ex_ptr cadabra::Ex_add ( const Ex_ptr  ex1,
const Ex_ptr  ex2 
)

◆ Ex_add() [2/2]

Ex_ptr cadabra::Ex_add ( const Ex_ptr  ex1,
const Ex_ptr  ex2,
Ex::iterator  top2 
)

◆ Ex_as_input()

std::string cadabra::Ex_as_input ( Ex_ptr  ex)

◆ Ex_as_MMA()

std::string cadabra::Ex_as_MMA ( Ex_ptr  ex,
bool  use_unicode 
)

◆ Ex_as_repr()

std::string cadabra::Ex_as_repr ( Ex_ptr  ex)

◆ Ex_as_sympy_string()

std::string cadabra::Ex_as_sympy_string ( Ex_ptr  ex)

Similar to Ex_to_Sympy, but only producing a string which can be parsed by Sympy, instead of a full-fledged Sympy expression.

◆ Ex_as_tree()

std::string cadabra::Ex_as_tree ( Ex ex)

◆ Ex_compare()

bool cadabra::Ex_compare ( Ex_ptr  one,
int  other 
)

◆ Ex_from_int()

Ex_ptr cadabra::Ex_from_int ( int  num,
bool   
)

◆ Ex_from_string()

Ex_ptr cadabra::Ex_from_string ( const std::string &  ex_,
bool  ,
Kernel kernel 
)

◆ Ex_get_mult()

pybind11::object cadabra::Ex_get_mult ( Ex_ptr  ex)

◆ Ex_getitem()

Ex cadabra::Ex_getitem ( Ex ex,
int  index 
)

◆ Ex_getslice()

Ex cadabra::Ex_getslice ( Ex_ptr  ex,
pybind11::slice  slice 
)

◆ Ex_head()

std::string cadabra::Ex_head ( Ex_ptr  ex)

◆ Ex_len()

size_t cadabra::Ex_len ( Ex_ptr  ex)

◆ Ex_mul()

Ex_ptr cadabra::Ex_mul ( const Ex_ptr  ex1,
const Ex_ptr  ex2,
Ex::iterator  top2 
)

◆ Ex_setitem()

void cadabra::Ex_setitem ( Ex_ptr  ex,
int  index,
Ex  val 
)

◆ Ex_setitem_iterator()

void cadabra::Ex_setitem_iterator ( Ex_ptr  ex,
ExNode  en,
Ex_ptr  val 
)

◆ Ex_sub() [1/2]

Ex_ptr cadabra::Ex_sub ( const Ex_ptr  ex1,
const Ex_ptr  ex2 
)

◆ Ex_sub() [2/2]

Ex_ptr cadabra::Ex_sub ( const Ex_ptr  ex1,
const Ex_ptr  ex2,
Ex::iterator  top2 
)

◆ export_as_HTML()

std::string cadabra::export_as_HTML ( const DTree doc,
bool  for_embedding = false,
bool  strip_code = false,
std::string  title = "" 
)

Export a document to a single self-contained HTML file containing inline CSS.

◆ export_as_LaTeX()

std::string cadabra::export_as_LaTeX ( const DTree doc,
const std::string &  image_file_base 
)

Export a document to a single self-contained LaTeX file, with the exception of images which get saved as separate numbered files.

◆ export_as_python()

std::string cadabra::export_as_python ( const DTree doc)

Export a document to a python-like file (converting text cells to comments and python cells to python code, dropping output cells).

◆ fetch_from_python()

Ex_ptr cadabra::fetch_from_python ( const std::string &  nm,
pybind11::object  scope 
)

◆ flip_sign()

void cadabra::flip_sign ( rset_t::iterator &  num)

◆ get_globals()

pybind11::object cadabra::get_globals ( )

◆ get_locals()

pybind11::object cadabra::get_locals ( )

◆ get_name()

template<typename PropT >
std::string cadabra::get_name ( )

◆ get_progress_monitor()

ProgressMonitor * cadabra::get_progress_monitor ( )

◆ half()

void cadabra::half ( rset_t::iterator &  num)

◆ hash_compare()

bool cadabra::hash_compare ( Ex::iterator  lhs,
Ex::iterator  rhs,
HashFlags  flags 
)

◆ hash_ex()

Ex_hasher::result_t cadabra::hash_ex ( Ex::iterator  it,
HashFlags  flags 
)

◆ HTML_recurse()

void cadabra::HTML_recurse ( const DTree doc,
DTree::iterator  it,
std::ostringstream &  str,
const std::string &  preamble_string,
bool  for_embedding = false,
bool  strip_code = false,
std::string  title = "" 
)

◆ init_algorithms() [1/2]

void cadabra::init_algorithms ( py::module &  m)

◆ init_algorithms() [2/2]

void cadabra::init_algorithms ( pybind11::module &  m)

◆ init_ex() [1/2]

void cadabra::init_ex ( py::module &  m)

◆ init_ex() [2/2]

void cadabra::init_ex ( pybind11::module &  m)

◆ init_ipython()

std::string cadabra::init_ipython ( )

◆ init_kernel()

void cadabra::init_kernel ( pybind11::module &  m)

◆ init_packages()

void cadabra::init_packages ( pybind11::module &  m)

◆ init_progress_monitor() [1/2]

void cadabra::init_progress_monitor ( py::module &  m)

◆ init_progress_monitor() [2/2]

void cadabra::init_progress_monitor ( pybind11::module &  m)

◆ init_properties() [1/2]

void cadabra::init_properties ( py::module &  m)

◆ init_properties() [2/2]

void cadabra::init_properties ( pybind11::module &  m)

◆ init_stopwatch() [1/2]

void cadabra::init_stopwatch ( py::module &  m)

◆ init_stopwatch() [2/2]

void cadabra::init_stopwatch ( pybind11::module &  m)

◆ init_tableau()

void cadabra::init_tableau ( pybind11::module &  m)

◆ install_prefix()

std::string cadabra::install_prefix ( )

Return an absolute path to the installation path.

This is determined at runtime, to allow for binary distributions to be installed at any location.

◆ is_in()

template<typename T >
bool cadabra::is_in ( const T &  val,
const std::initializer_list< T > &  list 
)

◆ JSON_deserialise()

void cadabra::JSON_deserialise ( const std::string &  cj,
DTree doc 
)

Load a document from .cj format, i.e. the inverse of the above.

◆ JSON_in_recurse()

void cadabra::JSON_in_recurse ( DTree doc,
DTree::iterator  loc,
const Json::Value &  cells 
)

◆ JSON_recurse()

void cadabra::JSON_recurse ( const DTree doc,
DTree::iterator  it,
Json::Value &  json 
)

◆ JSON_serialise()

std::string cadabra::JSON_serialise ( const DTree doc)

Serialise a document into .cj format, which is a JSON version of the document tree.

◆ LaTeX_recurse()

void cadabra::LaTeX_recurse ( const DTree doc,
DTree::iterator  it,
std::ostringstream &  str,
const std::string &  preamble_string,
const std::string &  image_file_base,
int &  image_num 
)

◆ latex_to_html()

std::string cadabra::latex_to_html ( const std::string &  str)

Convert various LaTeX constructions to HTML-with-Mathjax, e.g.

\section{...}, \begin{verbatim}...\end{verbatim}, \verb.

◆ lhs()

cadabra::Ex cadabra::lhs ( Ex_ptr  ex)

◆ list_properties()

pybind11::list cadabra::list_properties ( )

◆ map_sympy_wrapper()

Ex_ptr cadabra::map_sympy_wrapper ( Ex_ptr  ex,
std::string  head,
pybind11::args  args 
)

◆ one()

void cadabra::one ( rset_t::iterator &  num)

◆ operator&()

HashFlags cadabra::operator& ( HashFlags  lhs,
HashFlags  rhs 
)

◆ operator&=()

HashFlags & cadabra::operator&= ( HashFlags lhs,
HashFlags  rhs 
)

◆ operator<()

bool cadabra::operator< ( const exchange::tensor_type_t one,
const exchange::tensor_type_t two 
)

◆ operator|()

HashFlags cadabra::operator| ( HashFlags  lhs,
HashFlags  rhs 
)

◆ operator|=()

HashFlags & cadabra::operator|= ( HashFlags lhs,
HashFlags  rhs 
)

◆ operator~()

HashFlags cadabra::operator~ ( HashFlags  flags)

◆ pre_clean_dispatch()

void cadabra::pre_clean_dispatch ( const Kernel kernel,
Ex ex,
Ex::iterator &  it 
)

◆ pre_clean_dispatch_deep()

void cadabra::pre_clean_dispatch_deep ( const Kernel k,
Ex tr 
)

◆ print_tree()

std::string cadabra::print_tree ( Ex ex)

◆ ProgressMonitor_totals_helper()

pybind11::list cadabra::ProgressMonitor_totals_helper ( ProgressMonitor self)

◆ push_down_multiplier()

bool cadabra::push_down_multiplier ( const Kernel k,
Ex tr,
Ex::iterator  it 
)

Given a node with a non-unit multiplier, push this multiplier down the tree if the node is not allowed to have a non-unit multiplier.

This is a recursive procedure as the node onto which the multiplier gets pushed may itself not allow for a non-unit multiplier. Note that some nodes disallow non-unit multipliers on their children, but that should be handled individually (see cleanup of product nodes for an example).

◆ PYBIND11_MODULE()

cadabra::PYBIND11_MODULE ( cadabra2  ,
 
)

◆ python_recurse()

void cadabra::python_recurse ( const DTree doc,
DTree::iterator  it,
std::ostringstream &  str 
)

◆ read_manual()

std::string cadabra::read_manual ( const char *  category,
const char *  name 
)

◆ replace_all()

std::string cadabra::replace_all ( std::string const &  original,
std::string const &  from,
std::string const &  to 
)

Replace all occurrances of 'from' with 'to', return result (does not replace in-place).

◆ rhs()

cadabra::Ex cadabra::rhs ( Ex_ptr  ex)

◆ scope_has() [1/2]

bool cadabra::scope_has ( const py::dict &  dict,
const std::string &  obj 
)

◆ scope_has() [2/2]

bool cadabra::scope_has ( const pybind11::dict &  dict,
const std::string &  obj 
)

◆ subtree_equal()

bool cadabra::subtree_equal ( const Properties properties,
Ex::iterator  one,
Ex::iterator  two,
int  mod_prel,
bool  checksets,
int  compare_multiplier 
)

◆ subtree_exact_equal()

bool cadabra::subtree_exact_equal ( const Properties properties,
Ex::iterator  one,
Ex::iterator  two,
int  mod_prel,
bool  checksets,
int  compare_multiplier,
bool  literal_wildcards 
)

◆ subtree_exact_less()

bool cadabra::subtree_exact_less ( const Properties properties,
Ex::iterator  one,
Ex::iterator  two,
int  mod_prel,
bool  checksets,
int  compare_multiplier,
bool  literal_wildcards 
)

◆ subtree_less()

bool cadabra::subtree_less ( const Properties properties,
Ex::iterator  one,
Ex::iterator  two,
int  mod_prel,
bool  checksets,
int  compare_multiplier 
)

◆ SympyBridge_init()

std::shared_ptr<sympy::SympyBridge> cadabra::SympyBridge_init ( std::shared_ptr< Ex ex)

◆ tab_str()

std::string cadabra::tab_str ( const tab_t tab)

◆ terms()

pybind11::list cadabra::terms ( Ex_ptr  ex)

◆ to_long()

long cadabra::to_long ( multiplier_t  mul)

◆ to_string()

std::string cadabra::to_string ( long  num)

◆ tree_equal()

bool cadabra::tree_equal ( const Properties properties,
const Ex one,
const Ex two,
int  mod_prel,
bool  checksets,
int  compare_multiplier 
)

◆ tree_exact_equal()

bool cadabra::tree_exact_equal ( const Properties properties,
const Ex one,
const Ex two,
int  mod_prel,
bool  checksets,
int  compare_multiplier,
bool  literal_wildcards 
)

◆ tree_exact_less()

bool cadabra::tree_exact_less ( const Properties properties,
const Ex one,
const Ex two,
int  mod_prel,
bool  checksets,
int  compare_multiplier,
bool  literal_wildcards 
)

◆ tree_less()

bool cadabra::tree_less ( const Properties properties,
const Ex one,
const Ex two,
int  mod_prel,
bool  checksets,
int  compare_multiplier 
)

Various comparison functions, some exact, some with pattern logic.

◆ unichar()

const char * cadabra::unichar ( kunichar  c)

◆ zero()

void cadabra::zero ( rset_t::iterator &  num)

Variable Documentation

◆ name_set

nset_t cadabra::name_set

◆ post_process_enabled

bool cadabra::post_process_enabled = true

◆ rat_set

rset_t cadabra::rat_set