Cadabra
Computer algebra system for field theory problems
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions
Scalar algebra

Module Description

Functionality to make Cadabra interface with the SymPy computer algebra system.

Functions

boost::python::object Ex_to_Sympy (const cadabra::Ex &)
 Convert a Cadabra 'Ex' to a Sympy expression. More...
 
cadabra::Ex * sympy::map_sympy (const cadabra::Kernel &, cadabra::Ex &, const std::vector< std::string > &wrap, const std::string &args, const std::string &method)
 Functionality to act with Sympy on all scalar parts of an expression, and keep the result in-place. More...
 
cadabra::Ex::iterator sympy::apply (const cadabra::Kernel &, cadabra::Ex &, cadabra::Ex::iterator &, const std::vector< std::string > &wrap, const std::string &args, const std::string &method)
 Functionality to act with Sympy functions on (parts of) Cadabra Ex expressions and read the result back into the same Ex. More...
 
cadabra::Ex sympy::invert_matrix (const cadabra::Kernel &, cadabra::Ex &ex, cadabra::Ex &rules)
 Use Sympy to invert a matrix, given a set of rules determining its sparse components. More...
 

Function Documentation

cadabra::Ex::iterator sympy::apply ( const cadabra::Kernel &  ,
cadabra::Ex &  ,
cadabra::Ex::iterator &  ,
const std::vector< std::string > &  wrap,
const std::string &  args,
const std::string &  method 
)

Functionality to act with Sympy functions on (parts of) Cadabra Ex expressions and read the result back into the same Ex.

This duplicates some of the logic in PythonCdb.hh, in particular make_Ex_from_string, but it is best to keep these two completely separate.

boost::python::object Ex_to_Sympy ( const cadabra::Ex &  )

Convert a Cadabra 'Ex' to a Sympy expression.

This first converts the Cadabra expression to a string, and then reads that back in by calling sympy.parsing.sympy_parser.parse_expr. Is mapped to a 'sympy()' function on each Ex object. When you feed an Ex object to a Sympy function, the Ex gets converted to a Sympy object in 'sympy.sympify' because the latter attempts to call sympy on every object that you feed it.

Ex sympy::invert_matrix ( const cadabra::Kernel &  kernel,
cadabra::Ex &  ex,
cadabra::Ex &  rules 
)

Use Sympy to invert a matrix, given a set of rules determining its sparse components.

Will return a set of Cadabra rules for the inverse matrix.

cadabra::Ex* sympy::map_sympy ( const cadabra::Kernel &  ,
cadabra::Ex &  ,
const std::vector< std::string > &  wrap,
const std::string &  args,
const std::string &  method 
)

Functionality to act with Sympy on all scalar parts of an expression, and keep the result in-place.

This is a higher-level function than 'apply' below.