Nestedsums library
root_of_unity.h
Go to the documentation of this file.
1
8/*
9 * Copyright (C) 2001-2017 Stefan Weinzierl
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25
26#ifndef __NESTEDSUMS_ROOT_OF_UNITY_H__
27#define __NESTEDSUMS_ROOT_OF_UNITY_H__
28
29#include "ginac/ginac.h"
30
31namespace nestedsums {
32
41 class root_of_unity : public GiNaC::basic
42 {
43 GINAC_DECLARE_REGISTERED_CLASS(root_of_unity, GiNaC::basic)
44
45 // ctors
46 public:
47 root_of_unity(unsigned l, unsigned k);
48
49 // functions overriding virtual functions from base classes
50 public:
51 void archive(GiNaC::archive_node &node) const override;
52 void read_archive(const GiNaC::archive_node &node, GiNaC::lst &sym_lst) override;
53
54 unsigned return_type(void) const override { return GiNaC::return_types::noncommutative; }
55
56 void print(const GiNaC::print_context & c, unsigned level = 0) const override;
57 unsigned precedence(void) const override {return 50;}
58 GiNaC::ex eval() const override;
59 GiNaC::ex subs(const GiNaC::exmap & m, unsigned options = 0) const override;
60
61 protected:
62 GiNaC::ex eval_ncmul(const GiNaC::exvector & v) const override;
63 GiNaC::ex derivative(const GiNaC::symbol & s) const override;
64 unsigned calchash(void) const override;
65
66 // new virtual functions which can be overridden by derived classes
67
68 // non-virtual functions
69
70 // friends :
71
72 // member variables :
73
74 protected:
75
76 unsigned l;
77 unsigned k;
78 };
79
80GINAC_DECLARE_UNARCHIVER(root_of_unity);
81
82 // utility functions
83
89inline GiNaC::ex create_root_of_unity(unsigned l ,unsigned k)
90 {
91 return (new root_of_unity(l,k))->setflag(GiNaC::status_flags::dynallocated);
92 }
93
94} // namespace nestedsums
95
96#endif // ndef __NESTEDSUMS_ROOT_OF_UNITY_H__
Definition root_of_unity.h:42
GiNaC::ex eval_ncmul(const GiNaC::exvector &v) const override
Definition root_of_unity.cc:171
GiNaC::ex eval() const override
Definition root_of_unity.cc:148
Definition basic_letter.cc:35
GiNaC::ex create_root_of_unity(unsigned l, unsigned k)
Definition root_of_unity.h:89