Cadabra
Computer algebra system for field theory problems
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 
14 namespace 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 
27  private:
28  std::shared_ptr<cadabra::Ex> ex;
29  };
30 #endif
31 
37 
38  // cadabra::Ex* map_sympy(const cadabra::Kernel&, cadabra::Ex&,
39  // const std::vector<std::string>& wrap, const std::string& args, const std::string& method);
40 
47 
48  cadabra::Ex::iterator apply(const cadabra::Kernel&, cadabra::Ex&, cadabra::Ex::iterator&,
49  const std::vector<std::string>& wrap, std::vector<std::string> args, const std::string& method);
50 
51  // /// \ingroup scalar
52  // ///
53  // /// Low-level function to feed a string to Python and read the result back in
54  // /// as a Cadabra Ex. As compared to 'apply' above, this starts from a string rather
55  // /// than an Ex, and hence gives more flexibility in constructing input.
56  //
57  // Ex python(Kernel&, Ex&, Ex::iterator&, const std::string& head, const std::string& args);
58 
59 
65 
66  void invert_matrix(const cadabra::Kernel&, cadabra::Ex& ex, cadabra::Ex& rules, const cadabra::Ex& tocompute);
67 
72 
73  void determinant(const cadabra::Kernel&, cadabra::Ex& ex, cadabra::Ex& rules, const cadabra::Ex& tocompute);
74  void trace(const cadabra::Kernel&, cadabra::Ex& ex, cadabra::Ex& rules, const cadabra::Ex& tocompute);
75 
77  // extern Stopwatch sympy_stopwatch;
78 
79 };
Class to display expressions in a format that Sympy can parse.
Definition: DisplaySympy.hh:21
Basic storage class for symbolic mathemematical expressions.
Definition: Storage.hh:142
Definition: Kernel.hh:15
Helper class to enable conversion from/to sympy.
Definition: SympyCdb.hh:19
SympyBridge(const cadabra::Kernel &, std::shared_ptr< cadabra::Ex >)
Definition: SympyCdb.cc:19
void import_ex(const std::string &)
Definition: SympyCdb.cc:45
virtual ~SympyBridge()
Definition: SympyCdb.cc:24
pybind11::object export_ex()
Definition: SympyCdb.cc:28
std::shared_ptr< cadabra::Ex > ex
Definition: SympyCdb.hh:28
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:151
void trace(const cadabra::Kernel &, cadabra::Ex &ex, cadabra::Ex &rules, const cadabra::Ex &tocompute)
Definition: SympyDummy.cc:67