File: py_module.cc

package info (click to toggle)
cadabra2 2.4.3.2-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 78,732 kB
  • sloc: ansic: 133,450; cpp: 92,064; python: 1,530; javascript: 203; sh: 184; xml: 182; objc: 53; makefile: 51
file content (45 lines) | stat: -rw-r--r-- 917 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <pybind11/pybind11.h>
#include <pybind11/embed.h>

#include "py_algorithms.hh"
#include "py_ex.hh"
#include "py_kernel.hh"
#include "py_packages.hh"
#include "py_progress.hh"
#include "py_properties.hh"
#include "py_stopwatch.hh"
#include "py_tableau.hh"
#include "py_ntensor.hh"

#include "Kernel.hh"

namespace cadabra {
	namespace py = pybind11;

	std::string init_ipython()
		{
		py::exec("from IPython.display import Math");
		return "Cadabra typeset output for IPython notebook initialised.";
		}

	PYBIND11_MODULE(cadabra2, m)
		{
		py::options options;
		options.disable_function_signatures();

		m.def("init_ipython", &init_ipython);

		// These must be initialized in the order of which
		// symbols appear
		init_packages(m);
		init_kernel(m);
		init_progress_monitor(m);
		init_ntensor(m);
		init_stopwatch(m);
		init_ex(m);
		init_tableau(m);
		init_algorithms(m);
		init_properties(m);
		}

	}