Cadabra
Computer algebra system for field theory problems
Classes | Functions
PythonCdb.hh File Reference
#include <cmath>
#include <pybind11/pybind11.h>
#include <stdexcept>
#include "Storage.hh"
#include "Kernel.hh"
#include "Algorithm.hh"

Go to the source code of this file.

Classes

class  BaseProperty
 Helper class to ensure that all Python property objects derive from the same base class. More...
 
class  Property< T >
 Property is a templated wrapper around a C++ property object. More...
 

Functions

bool __eq__Ex_Ex (std::shared_ptr< cadabra::Ex >, std::shared_ptr< cadabra::Ex >)
 Comparison operator for Ex objects in Python. More...
 
bool __eq__Ex_int (std::shared_ptr< cadabra::Ex >, int)
 Comparison operator for Ex objects in Python. More...
 
std::shared_ptr< cadabra::Exfetch_from_python (const std::string &nm)
 Fetch an Ex object from the Python side using its Python identifier. More...
 
std::string Ex_str_ (std::shared_ptr< cadabra::Ex >)
 Generate the Python str() and repr() representation of the Ex object. More...
 
std::string Ex_repr_ (std::shared_ptr< cadabra::Ex >)
 
std::string Ex_latex_ (std::shared_ptr< cadabra::Ex >)
 The Python 'print' function always calls the 'str' member on objects to be printed. More...
 
pybind11::object Ex_to_Sympy (std::shared_ptr< cadabra::Ex >)
 Outputs a Cadabra 'Ex' as a Sympy expression. More...
 
std::string Ex_to_Sympy_string (std::shared_ptr< cadabra::Ex >)
 Similar to Ex_to_Sympy, but only producing a string which can be parsed by Sympy, instead of a full-fledged Sympy expression. More...
 
cadabra::Ex operator+ (std::shared_ptr< cadabra::Ex > ex1, std::shared_ptr< cadabra::Ex > ex2)
 Add two expressions, adding a top-level node if required. More...
 
cadabra::Ex operator- (std::shared_ptr< cadabra::Ex > ex1, std::shared_ptr< cadabra::Ex > ex2)
 Subtract two expressions, adding a top-level node if required. More...
 
cadabra::Kernelcreate_scope ()
 Setup of kernels in current scope, callable from Python. More...
 
cadabra::Kernelcreate_scope_from_global ()
 
cadabra::Kernelcreate_empty_scope ()
 
void inject_defaults (cadabra::Kernel *)
 Inject properties directly into the Kernel, even if the kernel is not yet on the Python stack (needed when we create a new local scope: in this case we create the kernel and pass it back to be turned into local cdbkernel by Python, but we want to populate the kernel with defaults before we hand it back). More...
 
cadabra::Kernelget_kernel_from_scope ()
 Get a pointer to the currently visible kernel. More...
 
void call_post_process (cadabra::Kernel &, std::shared_ptr< cadabra::Ex > ex)
 Run the post-process Python function (if defined) on the given expression. More...
 
std::string replace_all (std::string, const std::string &old, const std::string &nw)
 Replace all occurrences of a substring in the original string. More...
 

Function Documentation

◆ create_empty_scope()

cadabra::Kernel* create_empty_scope ( )

◆ create_scope_from_global()

cadabra::Kernel* create_scope_from_global ( )

◆ Ex_repr_()

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

◆ Ex_to_Sympy_string()

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

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

◆ fetch_from_python()

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

Fetch an Ex object from the Python side using its Python identifier.

◆ replace_all()

std::string replace_all ( std::string  ,
const std::string &  old,
const std::string &  nw 
)

Replace all occurrences of a substring in the original string.