Cadabra
Computer algebra system for field theory problems
Loading...
Searching...
No Matches
SympyCdb.hh
Go to the documentation of this file.
1
2#pragma once
3
4#include "Props.hh"
5#include "Storage.hh"
6#include "Kernel.hh"
7#include "Stopwatch.hh"
8#include "DisplaySympy.hh"
9
10#ifndef NO_SYMPY
11#include <pybind11/pybind11.h>
12#endif
13
14namespace sympy {
15
16#ifndef NO_SYMPY
18
20 public:
21 SympyBridge(const cadabra::Kernel&, std::shared_ptr<cadabra::Ex>);
22 virtual ~SympyBridge();
23
24 pybind11::object export_ex();
25// void import_ex(const std::string&);
26 void import_ex(pybind11::object obj);
27
28 private:
29 std::shared_ptr<cadabra::Ex> ex;
30
31 cadabra::Ex convert(pybind11::handle obj);
32 };
33#endif
34
40
41 // cadabra::Ex* map_sympy(const cadabra::Kernel&, cadabra::Ex&,
42 // const std::vector<std::string>& wrap, const std::string& args, const std::string& method);
43
50
51 cadabra::Ex::iterator apply(const cadabra::Kernel&, cadabra::Ex&, cadabra::Ex::iterator&,
52 const std::vector<std::string>& wrap, std::vector<std::string> args, const std::string& method);
53
54 // /// \ingroup scalar
55 // ///
56 // /// Low-level function to feed a string to Python and read the result back in
57 // /// as a Cadabra Ex. As compared to 'apply' above, this starts from a string rather
58 // /// than an Ex, and hence gives more flexibility in constructing input.
59 //
60 // Ex python(Kernel&, Ex&, Ex::iterator&, const std::string& head, const std::string& args);
61
62
68
69 void invert_matrix(const cadabra::Kernel&, cadabra::Ex& ex, cadabra::Ex& rules, const cadabra::Ex& tocompute);
70
75
76 void determinant(const cadabra::Kernel&, cadabra::Ex& ex, cadabra::Ex& rules, const cadabra::Ex& tocompute);
77 void trace(const cadabra::Kernel&, cadabra::Ex& ex, cadabra::Ex& rules, const cadabra::Ex& tocompute);
78
80 // extern Stopwatch sympy_stopwatch;
81
82};
Class to display expressions in a format that Sympy can parse.
Definition DisplaySympy.hh:23
Definition Storage.hh:170
Definition Kernel.hh:15
Helper class to enable conversion from/to sympy.
Definition SympyCdb.hh:19
virtual ~SympyBridge()
Definition SympyCdb.cc:41
pybind11::object export_ex()
Definition SympyCdb.cc:45
void import_ex(pybind11::object obj)
Definition SympyCdb.cc:332
std::shared_ptr< cadabra::Ex > ex
Definition SympyCdb.hh:29
cadabra::Ex convert(pybind11::handle obj)
Definition SympyCdb.cc:62
cadabra::Ex::iterator apply(const cadabra::Kernel &, cadabra::Ex &, cadabra::Ex::iterator &, const std::vector< std::string > &wrap, std::vector< 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.
Definition SympyDummy.cc:12
void invert_matrix(const cadabra::Kernel &, cadabra::Ex &ex, cadabra::Ex &rules, const cadabra::Ex &tocompute)
Use Sympy to invert a matrix, given a set of rules determining its sparse components.
Definition SympyDummy.cc:56
void determinant(const cadabra::Kernel &, cadabra::Ex &ex, cadabra::Ex &rules, const cadabra::Ex &tocompute)
Use Sympy to compute the determinant of a matrix, given a set of rules determining its sparse compone...
Definition SympyDummy.cc:62
Definition SympyCdb.hh:14
cadabra::Ex fill_matrix(const cadabra::Kernel &, cadabra::Ex &ex, cadabra::Ex &rules)
Definition SympyCdb.cc:466
void trace(const cadabra::Kernel &, cadabra::Ex &ex, cadabra::Ex &rules, const cadabra::Ex &tocompute)
Definition SympyDummy.cc:67