3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-01 11:43:47 +01:00
dft_tools/pytriqs/operators/operators2_desc.py
Olivier Parcollet 4e9460bc1c Wrapper : clean and document.
- clean the c_name.
- add more refined signature (with c_name optionally in it).
- add some autodoc.
- clean code : move class in nested, remove useless dict call, etc...
- operator2 : move unary - and unit in algebra in general wrapper.
- various name change to make private function start with _, for
  autodoc.
2014-05-31 16:10:07 +02:00

35 lines
1.1 KiB
Python

from wrap_generator import *
# The operator class
op = class_(
py_type = "Operator",
c_type = "many_body_operator<double>",
is_printable= True,
arithmetic = ("algebra","with_unit","with_unary_minus","double")
)
op.add_constructor(signature="()", doc="create zero operator")
# The many_body_operators module
module = module_(full_name = "operators2", doc = "Doc to be written")
module.add_include("<triqs/operators/many_body_operator.hpp>")
module.add_include("<triqs/arrays.hpp>")
module.add_using("namespace triqs::utility")
module.add_class(op)
# Add various overload of c, c_dag to the module Annihilation & Creation operators
for name, doc in [ ("c","annihilation operator"), ("c_dag","creation operator")] :
for sign in [
"",
"std::string ind1",
"std::string ind1, std::string ind2",
"int i, std::string ind1",
"int i, int j"
]:
module.add_function(name = name, signature="many_body_operator<double>(%s)"%sign, doc=doc)
# to generate the module code
if __name__ == '__main__' :
module.generate_code()