Nestedsums library
basic_letter.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_BASIC_LETTER_H__
27#define __NESTEDSUMS_BASIC_LETTER_H__
28
29#include "ginac/ginac.h"
30
31namespace nestedsums {
32
34
49 class basic_letter : public GiNaC::basic
50 {
51 GINAC_DECLARE_REGISTERED_CLASS(basic_letter, GiNaC::basic)
52
53 // ctors
54 public:
55 basic_letter(const GiNaC::ex & l, const GiNaC::ex & d, const GiNaC::ex & o);
56 basic_letter(const GiNaC::ex & l, const GiNaC::ex & d, const GiNaC::ex & o, const GiNaC::ex & i);
57
58 // functions overriding virtual functions from base classes
59 public:
60 void archive(GiNaC::archive_node &node) const override;
61 void read_archive(const GiNaC::archive_node &node, GiNaC::lst &sym_lst) override;
62
63 unsigned return_type(void) const override { return GiNaC::return_types::noncommutative; }
64
65 void print(const GiNaC::print_context & c, unsigned level = 0) const override;
66 unsigned precedence(void) const override {return 50;}
67 GiNaC::ex eval() const override;
68 GiNaC::ex subs(const GiNaC::exmap & m, unsigned options = 0) const override;
69
70 protected:
71 GiNaC::ex eval_ncmul(const GiNaC::exvector & v) const override;
72 GiNaC::ex derivative(const GiNaC::symbol & s) const override;
73 unsigned calchash(void) const override;
74
75 // new virtual functions which can be overridden by derived classes
76 public:
77 virtual GiNaC::ex concat(const GiNaC::ex & l) const;
78 virtual GiNaC::ex eval_explicit() const;
79 virtual GiNaC::ex expand_members(int level = 0) const;
80
81 protected:
82 virtual GiNaC::ex concat_speedy(const GiNaC::ex & l) const;
83
84 // non-virtual functions
85 public:
86 GiNaC::ex get_scale(void) const;
87 GiNaC::ex get_degree(void) const;
88 GiNaC::ex get_offset(void) const;
89 GiNaC::ex get_index(void) const;
90
91 GiNaC::ex set_index(const GiNaC::ex & i) const;
92 GiNaC::ex forget_index(void) const;
93 GiNaC::ex shift_index(const GiNaC::ex & new_index) const;
94 GiNaC::ex index_eq_one(void) const;
95
96 GiNaC::ex shift_plus_one(void) const;
97 GiNaC::ex shift_minus_one(void) const;
98 GiNaC::ex degree_minus_one(void) const;
99 GiNaC::ex degree_plus_one(void) const;
100
101 protected:
102
103 // friends :
104 friend GiNaC::ex concat(const basic_letter & l1, const basic_letter & l2);
105
106 // member variables :
107
108 protected:
109
110 GiNaC::ex scale;
111 GiNaC::ex degree;
112 GiNaC::ex offset;
113 GiNaC::ex index;
114 };
115
116GINAC_DECLARE_UNARCHIVER(basic_letter);
117
118 // inline functions
119
125inline GiNaC::ex basic_letter::get_scale(void) const
126 {
127 return scale;
128 }
129
135inline GiNaC::ex basic_letter::get_degree(void) const
136 {
137 return degree;
138 }
139
145inline GiNaC::ex basic_letter::get_offset(void) const
146 {
147 return offset;
148 }
149
155inline GiNaC::ex basic_letter::get_index(void) const
156 {
157 return index;
158 }
159
165inline GiNaC::ex create_basic_letter(const GiNaC::ex & l, const GiNaC::ex & d, const GiNaC::ex & o)
166 {
167 return (new basic_letter(l,d,o))->setflag(GiNaC::status_flags::dynallocated);
168 }
169
175inline GiNaC::ex create_basic_letter(const GiNaC::ex & l, const GiNaC::ex & d, const GiNaC::ex & o, const GiNaC::ex & i)
176 {
177 return (new basic_letter(l,d,o,i))->setflag(GiNaC::status_flags::dynallocated);
178 }
179
180 GiNaC::ex concat(const basic_letter & l1, const basic_letter & l2);
181
182} // namespace nestedsums
183
184#endif // ndef __NESTEDSUMS_BASIC_LETTER_H__
A basic_letter is an element of an alphabet.
Definition basic_letter.h:50
GiNaC::ex eval_ncmul(const GiNaC::exvector &v) const override
Definition basic_letter.cc:211
GiNaC::ex get_offset(void) const
Definition basic_letter.h:145
GiNaC::ex degree_minus_one(void) const
Definition basic_letter.cc:562
virtual GiNaC::ex eval_explicit() const
Definition basic_letter.cc:479
GiNaC::ex index_eq_one(void) const
Definition basic_letter.cc:515
GiNaC::ex shift_index(const GiNaC::ex &new_index) const
Definition basic_letter.cc:529
GiNaC::ex eval() const override
Definition basic_letter.cc:184
GiNaC::ex degree_plus_one(void) const
Definition basic_letter.cc:572
GiNaC::ex get_scale(void) const
Definition basic_letter.h:125
GiNaC::ex get_index(void) const
Definition basic_letter.h:155
GiNaC::ex get_degree(void) const
Definition basic_letter.h:135
GiNaC::ex forget_index(void) const
Definition basic_letter.cc:501
GiNaC::ex shift_plus_one(void) const
Definition basic_letter.cc:542
virtual GiNaC::ex concat_speedy(const GiNaC::ex &l) const
Definition basic_letter.cc:367
GiNaC::ex shift_minus_one(void) const
Definition basic_letter.cc:552
friend GiNaC::ex concat(const basic_letter &l1, const basic_letter &l2)
Definition basic_letter.cc:592
GiNaC::ex set_index(const GiNaC::ex &i) const
Definition basic_letter.cc:491
Definition basic_letter.cc:35
GiNaC::ex create_basic_letter(const GiNaC::ex &l, const GiNaC::ex &d, const GiNaC::ex &o)
Definition basic_letter.h:165
GiNaC::ex concat(const basic_letter &l1, const basic_letter &l2)
Definition basic_letter.cc:592