Cadabra
Computer algebra system for field theory problems
Functions | Variables
PythonCdb.cc File Reference
#include <memory>
#include "Config.hh"
#include "PythonCdb.hh"
#include "ExNode.hh"
#include "SympyCdb.hh"
#include "json/json.h"
#include "CdbPython.hh"
#include "Parser.hh"
#include "Bridge.hh"
#include "Exceptions.hh"
#include "DisplayMMA.hh"
#include "DisplayTeX.hh"
#include "DisplaySympy.hh"
#include "DisplayTerminal.hh"
#include "Cleanup.hh"
#include "PreClean.hh"
#include "PythonException.hh"
#include "ProgressMonitor.hh"
#include <pybind11/pybind11.h>
#include <pybind11/embed.h>
#include <pybind11/operators.h>
#include <pybind11/stl.h>
#include <boost/algorithm/string/replace.hpp>
#include <sstream>
#include <regex>
#include "properties/Accent.hh"
#include "properties/AntiCommuting.hh"
#include "properties/AntiSymmetric.hh"
#include "properties/Commuting.hh"
#include "properties/Coordinate.hh"
#include "properties/Depends.hh"
#include "properties/DependsInherit.hh"
#include "properties/Derivative.hh"
#include "properties/Determinant.hh"
#include "properties/DifferentialForm.hh"
#include "properties/DiracBar.hh"
#include "properties/GammaMatrix.hh"
#include "properties/CommutingAsProduct.hh"
#include "properties/CommutingAsSum.hh"
#include "properties/DAntiSymmetric.hh"
#include "properties/Diagonal.hh"
#include "properties/Distributable.hh"
#include "properties/EpsilonTensor.hh"
#include "properties/ExteriorDerivative.hh"
#include "properties/FilledTableau.hh"
#include "properties/ImaginaryI.hh"
#include "properties/ImplicitIndex.hh"
#include "properties/Indices.hh"
#include "properties/IndexInherit.hh"
#include "properties/Integer.hh"
#include "properties/InverseMetric.hh"
#include "properties/KroneckerDelta.hh"
#include "properties/LaTeXForm.hh"
#include "properties/Matrix.hh"
#include "properties/Metric.hh"
#include "properties/NonCommuting.hh"
#include "properties/NumericalFlat.hh"
#include "properties/PartialDerivative.hh"
#include "properties/RiemannTensor.hh"
#include "properties/SatisfiesBianchi.hh"
#include "properties/SelfAntiCommuting.hh"
#include "properties/SelfCommuting.hh"
#include "properties/SelfNonCommuting.hh"
#include "properties/SortOrder.hh"
#include "properties/Spinor.hh"
#include "properties/Symbol.hh"
#include "properties/Symmetric.hh"
#include "properties/Tableau.hh"
#include "properties/TableauSymmetry.hh"
#include "properties/Trace.hh"
#include "properties/Traceless.hh"
#include "properties/Vielbein.hh"
#include "properties/Weight.hh"
#include "properties/WeightInherit.hh"
#include "properties/WeylTensor.hh"
#include "algorithms/canonicalise.hh"
#include "algorithms/collect_components.hh"
#include "algorithms/collect_factors.hh"
#include "algorithms/collect_terms.hh"
#include "algorithms/combine.hh"
#include "algorithms/complete.hh"
#include "algorithms/decompose.hh"
#include "algorithms/decompose_product.hh"
#include "algorithms/distribute.hh"
#include "algorithms/drop_weight.hh"
#include "algorithms/einsteinify.hh"
#include "algorithms/eliminate_kronecker.hh"
#include "algorithms/eliminate_metric.hh"
#include "algorithms/epsilon_to_delta.hh"
#include "algorithms/evaluate.hh"
#include "algorithms/expand.hh"
#include "algorithms/expand_delta.hh"
#include "algorithms/expand_diracbar.hh"
#include "algorithms/expand_power.hh"
#include "algorithms/factor_in.hh"
#include "algorithms/factor_out.hh"
#include "algorithms/fierz.hh"
#include "algorithms/flatten_sum.hh"
#include "algorithms/indexsort.hh"
#include "algorithms/integrate_by_parts.hh"
#include "algorithms/join_gamma.hh"
#include "algorithms/keep_terms.hh"
#include "algorithms/lower_free_indices.hh"
#include "algorithms/lr_tensor.hh"
#include "algorithms/map_sympy.hh"
#include "algorithms/order.hh"
#include "algorithms/product_rule.hh"
#include "algorithms/reduce_delta.hh"
#include "algorithms/rename_dummies.hh"
#include "algorithms/simplify.hh"
#include "algorithms/sort_product.hh"
#include "algorithms/sort_spinors.hh"
#include "algorithms/sort_sum.hh"
#include "algorithms/split_gamma.hh"
#include "algorithms/split_index.hh"
#include "algorithms/substitute.hh"
#include "algorithms/sym.hh"
#include "algorithms/tab_dimension.hh"
#include "algorithms/take_match.hh"
#include "algorithms/replace_match.hh"
#include "algorithms/rewrite_indices.hh"
#include "algorithms/unwrap.hh"
#include "algorithms/unzoom.hh"
#include "algorithms/vary.hh"
#include "algorithms/young_project.hh"
#include "algorithms/young_project_product.hh"
#include "algorithms/young_project_tensor.hh"
#include "algorithms/young_reduce.hh"
#include "algorithms/zoom.hh"
#include <cstdarg>

Functions

pybind11::list ProgressMonitor_totals_helper (ProgressMonitor &self)
 
pybind11::list terms (std::shared_ptr< Ex > ex)
 
Ex lhs (std::shared_ptr< Ex > ex)
 
Ex rhs (std::shared_ptr< Ex > ex)
 
Ex Ex_getslice (std::shared_ptr< Ex > ex, pybind11::slice slice)
 
Ex Ex_getitem (Ex &ex, int index)
 
void Ex_setitem (std::shared_ptr< Ex > ex, int index, Ex val)
 
void Ex_setitem_iterator (std::shared_ptr< Ex > ex, ExNode en, std::shared_ptr< Ex > val)
 
size_t Ex_len (std::shared_ptr< Ex > ex)
 
std::string Ex_head (std::shared_ptr< Ex > ex)
 
pybind11::object Ex_mult (std::shared_ptr< Ex > ex)
 
std::string Ex_str_ (std::shared_ptr< Ex > ex)
 
std::string Ex_to_input (std::shared_ptr< Ex > ex)
 
std::string Ex_latex_ (std::shared_ptr< Ex > ex)
 
std::string Ex_repr_ (std::shared_ptr< Ex > ex)
 
std::string Ex_to_Sympy_string (std::shared_ptr< Ex > ex)
 
pybind11::object Ex_to_Sympy (std::shared_ptr< Ex > ex)
 
std::string Ex_to_MMA (std::shared_ptr< Ex > ex, bool use_unicode)
 
pybind11::object get_locals ()
 
pybind11::object get_globals ()
 
std::shared_ptr< Exfetch_from_python (const std::string &nm)
 
std::shared_ptr< Exfetch_from_python (const std::string &nm, pybind11::object scope)
 
bool __eq__Ex_Ex (std::shared_ptr< Ex > one, std::shared_ptr< Ex > other)
 
bool __eq__Ex_int (std::shared_ptr< Ex > one, int other)
 
std::shared_ptr< Exmake_Ex_from_string (const std::string &ex_, bool make_ref, Kernel *kernel)
 
std::shared_ptr< Exconstruct_Ex_from_string (const std::string &ex_)
 
std::shared_ptr< Exconstruct_Ex_from_string_2 (const std::string &ex_, bool add_ref)
 
std::shared_ptr< Exmake_Ex_from_int (int num, bool make_ref=true)
 
std::shared_ptr< Exconstruct_Ex_from_int (int num)
 
std::shared_ptr< Exconstruct_Ex_from_int_2 (int num, bool add_ref)
 
std::shared_ptr< Exoperator+ (const std::shared_ptr< Ex > ex1, const ExNode ex2)
 
std::shared_ptr< Exoperator+ (const std::shared_ptr< Ex > ex1, const std::shared_ptr< Ex > ex2)
 
std::shared_ptr< Exadd_ex (const std::shared_ptr< Ex > ex1, const std::shared_ptr< Ex > ex2, Ex::iterator top2)
 
std::shared_ptr< Exoperator* (const std::shared_ptr< Ex > ex1, const std::shared_ptr< Ex > ex2)
 
std::shared_ptr< Exmult_ex (const std::shared_ptr< Ex > ex1, const std::shared_ptr< Ex > ex2, Ex::iterator top2)
 
std::shared_ptr< Exoperator- (const std::shared_ptr< Ex > ex1, const ExNode ex2)
 
std::shared_ptr< Exoperator- (const std::shared_ptr< Ex > ex1, const std::shared_ptr< Ex > ex2)
 
std::shared_ptr< Exsub_ex (const std::shared_ptr< Ex > ex1, const std::shared_ptr< Ex > ex2, Ex::iterator top2)
 
std::string init_ipython ()
 
pybind11::list list_properties ()
 
std::string print_tree (Ex *ex)
 
bool scope_has (const pybind11::dict &dict, const std::string &obj)
 
Kernelget_kernel_from_scope ()
 
ProgressMonitorget_progress_monitor ()
 
Kernelcreate_scope ()
 
Kernelcreate_scope_from_global ()
 
Kernelcreate_empty_scope ()
 
void inject_defaults (Kernel *k)
 
template<class F >
std::shared_ptr< Exdispatch_base (std::shared_ptr< Ex > ex, F &algo, bool deep, bool repeat, unsigned int depth, bool pre_order)
 
std::shared_ptr< Exmap_sympy_wrapper (std::shared_ptr< Ex > ex, std::string head, pybind11::args args)
 
void call_post_process (Kernel &kernel, std::shared_ptr< Ex > ex)
 
template<class F >
std::shared_ptr< Exdispatch_ex (std::shared_ptr< Ex > ex, bool deep, bool repeat, unsigned int depth)
 
template<class F , typename Arg1 >
std::shared_ptr< Exdispatch_ex (std::shared_ptr< Ex > ex, Arg1 arg, bool deep, bool repeat, unsigned int depth)
 
template<class F , typename Arg1 >
std::shared_ptr< Exdispatch_ex_preorder (std::shared_ptr< Ex > ex, Arg1 arg, bool deep, bool repeat, unsigned int depth)
 
template<class F , typename Arg1 , typename Arg2 >
std::shared_ptr< Exdispatch_ex (std::shared_ptr< Ex > ex, Arg1 arg1, Arg2 arg2, bool deep, bool repeat, unsigned int depth)
 
template<class F , typename Arg1 , typename Arg2 , typename Arg3 >
std::shared_ptr< Exdispatch_ex (std::shared_ptr< Ex > ex, Arg1 arg1, Arg2 arg2, Arg3 arg3, bool deep, bool repeat, unsigned int depth)
 
template<class F >
void def_algo_1 (const std::string &name, pybind11::module &m)
 
template<class P >
void def_prop (pybind11::module &m)
 
void compile_package (const std::string &in_name, const std::string &out_name)
 
 PYBIND11_MODULE (cadabra2, m)
 

Variables

bool output_ipython = false
 
bool post_process_enabled = true
 

Function Documentation

◆ __eq__Ex_Ex()

bool __eq__Ex_Ex ( std::shared_ptr< Ex one,
std::shared_ptr< Ex other 
)

◆ __eq__Ex_int()

bool __eq__Ex_int ( std::shared_ptr< Ex one,
int  other 
)

◆ add_ex()

std::shared_ptr<Ex> add_ex ( const std::shared_ptr< Ex ex1,
const std::shared_ptr< Ex ex2,
Ex::iterator  top2 
)

◆ call_post_process()

void call_post_process ( Kernel kernel,
std::shared_ptr< Ex ex 
)

◆ compile_package()

void compile_package ( const std::string &  in_name,
const std::string &  out_name 
)

◆ construct_Ex_from_int()

std::shared_ptr<Ex> construct_Ex_from_int ( int  num)

◆ construct_Ex_from_int_2()

std::shared_ptr<Ex> construct_Ex_from_int_2 ( int  num,
bool  add_ref 
)

◆ construct_Ex_from_string()

std::shared_ptr<Ex> construct_Ex_from_string ( const std::string &  ex_)

◆ construct_Ex_from_string_2()

std::shared_ptr<Ex> construct_Ex_from_string_2 ( const std::string &  ex_,
bool  add_ref 
)

◆ create_empty_scope()

Kernel* create_empty_scope ( )

◆ create_scope()

Kernel* create_scope ( )

◆ create_scope_from_global()

Kernel* create_scope_from_global ( )

◆ def_algo_1()

template<class F >
void def_algo_1 ( const std::string &  name,
pybind11::module &  m 
)

◆ def_prop()

template<class P >
void def_prop ( pybind11::module &  m)

◆ dispatch_base()

template<class F >
std::shared_ptr<Ex> dispatch_base ( std::shared_ptr< Ex ex,
F &  algo,
bool  deep,
bool  repeat,
unsigned int  depth,
bool  pre_order 
)

◆ dispatch_ex() [1/4]

template<class F >
std::shared_ptr<Ex> dispatch_ex ( std::shared_ptr< Ex ex,
bool  deep,
bool  repeat,
unsigned int  depth 
)

◆ dispatch_ex() [2/4]

template<class F , typename Arg1 >
std::shared_ptr<Ex> dispatch_ex ( std::shared_ptr< Ex ex,
Arg1  arg,
bool  deep,
bool  repeat,
unsigned int  depth 
)

◆ dispatch_ex() [3/4]

template<class F , typename Arg1 , typename Arg2 >
std::shared_ptr<Ex> dispatch_ex ( std::shared_ptr< Ex ex,
Arg1  arg1,
Arg2  arg2,
bool  deep,
bool  repeat,
unsigned int  depth 
)

◆ dispatch_ex() [4/4]

template<class F , typename Arg1 , typename Arg2 , typename Arg3 >
std::shared_ptr<Ex> dispatch_ex ( std::shared_ptr< Ex ex,
Arg1  arg1,
Arg2  arg2,
Arg3  arg3,
bool  deep,
bool  repeat,
unsigned int  depth 
)

◆ dispatch_ex_preorder()

template<class F , typename Arg1 >
std::shared_ptr<Ex> dispatch_ex_preorder ( std::shared_ptr< Ex ex,
Arg1  arg,
bool  deep,
bool  repeat,
unsigned int  depth 
)

◆ Ex_getitem()

Ex Ex_getitem ( Ex ex,
int  index 
)

◆ Ex_getslice()

Ex Ex_getslice ( std::shared_ptr< Ex ex,
pybind11::slice  slice 
)

◆ Ex_head()

std::string Ex_head ( std::shared_ptr< Ex ex)

◆ Ex_latex_()

std::string Ex_latex_ ( std::shared_ptr< Ex ex)

◆ Ex_len()

size_t Ex_len ( std::shared_ptr< Ex ex)

◆ Ex_mult()

pybind11::object Ex_mult ( std::shared_ptr< Ex ex)

◆ Ex_repr_()

std::string Ex_repr_ ( std::shared_ptr< Ex ex)

◆ Ex_setitem()

void Ex_setitem ( std::shared_ptr< Ex ex,
int  index,
Ex  val 
)

◆ Ex_setitem_iterator()

void Ex_setitem_iterator ( std::shared_ptr< Ex ex,
ExNode  en,
std::shared_ptr< Ex val 
)

◆ Ex_str_()

std::string Ex_str_ ( std::shared_ptr< Ex ex)

◆ Ex_to_input()

std::string Ex_to_input ( std::shared_ptr< Ex ex)

◆ Ex_to_MMA()

std::string Ex_to_MMA ( std::shared_ptr< Ex ex,
bool  use_unicode 
)

◆ Ex_to_Sympy()

pybind11::object Ex_to_Sympy ( std::shared_ptr< Ex ex)

◆ Ex_to_Sympy_string()

std::string Ex_to_Sympy_string ( std::shared_ptr< Ex ex)

◆ fetch_from_python() [1/2]

std::shared_ptr<Ex> fetch_from_python ( const std::string &  nm)

◆ fetch_from_python() [2/2]

std::shared_ptr<Ex> fetch_from_python ( const std::string &  nm,
pybind11::object  scope 
)

◆ get_globals()

pybind11::object get_globals ( )

◆ get_kernel_from_scope()

Kernel* get_kernel_from_scope ( )

◆ get_locals()

pybind11::object get_locals ( )

◆ get_progress_monitor()

ProgressMonitor* get_progress_monitor ( )

◆ init_ipython()

std::string init_ipython ( )

◆ inject_defaults()

void inject_defaults ( Kernel k)

◆ lhs()

Ex lhs ( std::shared_ptr< Ex ex)

◆ list_properties()

pybind11::list list_properties ( )

◆ make_Ex_from_int()

std::shared_ptr<Ex> make_Ex_from_int ( int  num,
bool  make_ref = true 
)

◆ make_Ex_from_string()

std::shared_ptr<Ex> make_Ex_from_string ( const std::string &  ex_,
bool  make_ref,
Kernel kernel 
)

◆ map_sympy_wrapper()

std::shared_ptr<Ex> map_sympy_wrapper ( std::shared_ptr< Ex ex,
std::string  head,
pybind11::args  args 
)

◆ mult_ex()

std::shared_ptr<Ex> mult_ex ( const std::shared_ptr< Ex ex1,
const std::shared_ptr< Ex ex2,
Ex::iterator  top2 
)

◆ operator*()

std::shared_ptr<Ex> operator* ( const std::shared_ptr< Ex ex1,
const std::shared_ptr< Ex ex2 
)

◆ operator+() [1/2]

std::shared_ptr<Ex> operator+ ( const std::shared_ptr< Ex ex1,
const ExNode  ex2 
)

◆ operator+() [2/2]

std::shared_ptr<Ex> operator+ ( const std::shared_ptr< Ex ex1,
const std::shared_ptr< Ex ex2 
)

◆ operator-() [1/2]

std::shared_ptr<Ex> operator- ( const std::shared_ptr< Ex ex1,
const ExNode  ex2 
)

◆ operator-() [2/2]

std::shared_ptr<Ex> operator- ( const std::shared_ptr< Ex ex1,
const std::shared_ptr< Ex ex2 
)

◆ print_tree()

std::string print_tree ( Ex ex)

◆ ProgressMonitor_totals_helper()

pybind11::list ProgressMonitor_totals_helper ( ProgressMonitor self)

◆ PYBIND11_MODULE()

PYBIND11_MODULE ( cadabra2  ,
 
)

◆ rhs()

Ex rhs ( std::shared_ptr< Ex ex)

◆ scope_has()

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

◆ sub_ex()

std::shared_ptr<Ex> sub_ex ( const std::shared_ptr< Ex ex1,
const std::shared_ptr< Ex ex2,
Ex::iterator  top2 
)

◆ terms()

pybind11::list terms ( std::shared_ptr< Ex ex)

Variable Documentation

◆ output_ipython

bool output_ipython = false

◆ post_process_enabled

bool post_process_enabled = true