Nestedsums library
Ssum.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_SSUM_H__
27#define __NESTEDSUMS_SSUM_H__
28
29#include "ginac/ginac.h"
30
31namespace nestedsums {
32
34
55 class Ssum : public GiNaC::basic
56 {
57 // Csum accesses the methods
58 // multiply_last_letter
59 // increases_las_letter
60 // append_letter
61 friend class Csum;
62
63 GINAC_DECLARE_REGISTERED_CLASS(Ssum, GiNaC::basic)
64
65 // ctors
66 public:
67 explicit Ssum(const GiNaC::ex & nc);
68 Ssum(const GiNaC::ex & nc, const GiNaC::ex & llc);
69
70 // functions overriding virtual functions from bases classes
71 public:
72 void archive(GiNaC::archive_node &node) const override;
73 void read_archive(const GiNaC::archive_node &node, GiNaC::lst &sym_lst) override;
74
75 unsigned return_type(void) const override { return GiNaC::return_types::noncommutative; }
76
77 void print(const GiNaC::print_context & c, unsigned level = 0) const override;
78 unsigned precedence(void) const override {return 60;}
79 GiNaC::ex eval() const override;
80 GiNaC::ex subs(const GiNaC::exmap & m, unsigned options = 0) const override;
81
82 protected:
83 GiNaC::ex eval_ncmul(const GiNaC::exvector & v) const override;
84 GiNaC::ex derivative(const GiNaC::symbol & s) const override;
85 unsigned calchash(void) const override;
86
87 // new virtual functions which can be overridden by derived classes
88 public :
89 virtual GiNaC::ex convert_to_Zsum_exvector(const GiNaC::exvector & Z0, const GiNaC::exvector & Z1) const;
90 virtual GiNaC::ex shuffle_exvector(const GiNaC::exvector & Z0, const GiNaC::exvector & Z1, const GiNaC::exvector & Z2) const;
91
92 virtual GiNaC::ex refine_exvector(unsigned q, const GiNaC::exvector & Z0, const GiNaC::exvector & Z1) const;
93 virtual GiNaC::ex refine(unsigned q) const;
94
95 virtual GiNaC::ex set_index(const GiNaC::ex & i) const;
96 virtual GiNaC::ex shift_plus_one(void) const;
97 virtual GiNaC::ex shift_minus_one(void) const;
98 virtual GiNaC::ex adjust_upper_limit_downwards(const GiNaC::ex & i) const;
99 virtual GiNaC::ex adjust_upper_limit_upwards(const GiNaC::ex & i) const;
100 virtual GiNaC::ex adjust_upper_limit_plus_one(void) const;
101 virtual GiNaC::ex index_eq_one(void) const;
102
103 virtual GiNaC::ex get_head(int k) const;
104 virtual GiNaC::ex get_tail(int k) const;
105 virtual int flag_remove_negative_degrees(void) const;
106 virtual GiNaC::ex remove_negative_degrees(void) const;
107
108 virtual GiNaC::ex expand_members(int level = 0) const;
109 virtual GiNaC::ex eval_explicit() const;
110
111 virtual GiNaC::ex get_first_letter(void) const;
112 virtual GiNaC::ex remove_first_letter(void) const;
113 virtual GiNaC::ex remove_first_letter(const GiNaC::ex & nc) const;
114 virtual GiNaC::ex prepend_letter(const GiNaC::ex & lc) const;
115 virtual GiNaC::ex prepend_letter(const GiNaC::ex & nc, const GiNaC::ex & lc) const;
116 virtual GiNaC::ex append_letter(const GiNaC::ex & lc) const;
117 virtual GiNaC::ex append_letter_list(const GiNaC::ex & lc) const;
118
119 protected:
120 virtual GiNaC::ex cast_to_Zsum(void) const;
121
122 virtual GiNaC::ex multiply_letter_with_last_letter(const GiNaC::ex & lc) const;
123 virtual GiNaC::ex multiply_letter_with_first_letter(const GiNaC::ex & lc) const;
124 virtual GiNaC::ex concat_two_sums(const GiNaC::ex & Z1, const GiNaC::ex & Z2) const;
125
126 // non-virtual functions
127 public :
128 GiNaC::ex get_index(void) const;
129 GiNaC::ex get_letter_list(void) const;
130 unsigned get_depth(void) const;
131 GiNaC::ex get_weight(void) const;
132
133 // friends :
134 friend GiNaC::ex shuffle_Ssum(const GiNaC::ex & Z1, const GiNaC::ex & Z2);
135 friend GiNaC::ex convert_Ssum_to_Zsum(const GiNaC::ex & Z1);
136 friend GiNaC::ex remove_trivial_Ssum(const GiNaC::ex & expr);
137
138 // member variables :
139
140 protected:
141
142 GiNaC::ex n;
143 GiNaC::ex letter_list;
144 };
145
146GINAC_DECLARE_UNARCHIVER(Ssum);
147
148 // inline functions
149
155inline GiNaC::ex Ssum::get_index(void) const
156 {
157 return n;
158 }
159
165inline GiNaC::ex Ssum::get_letter_list(void) const
166 {
167 return letter_list;
168 }
169
175inline unsigned Ssum::get_depth(void) const
176 {
177 return letter_list.nops();
178 }
179
185inline GiNaC::ex create_Ssum(const GiNaC::ex & nc, const GiNaC::ex & llc)
186 {
187 return (new Ssum(nc,llc))->setflag(GiNaC::status_flags::dynallocated);
188 }
189
190 GiNaC::ex shuffle_Ssum(const GiNaC::ex & Z1, const GiNaC::ex & Z2);
191
192 GiNaC::ex convert_Ssum_to_Zsum(const GiNaC::ex & Z1);
193
194 GiNaC::ex create_Ssum_from_exvector(const GiNaC::ex & nc, const GiNaC::exvector & v);
195
196 GiNaC::ex Ssum_to_Zsum(const GiNaC::ex & expr);
197
198 GiNaC::ex shift_upper_limit_plus_one_for_Ssum(const GiNaC::ex & expr);
199
200 GiNaC::ex remove_negative_degrees_from_Ssum(const GiNaC::ex & expr);
201
202 GiNaC::ex remove_trivial_Ssum(const GiNaC::ex & expr);
203
204 GiNaC::ex refine_Ssum(const GiNaC::ex & expr, unsigned q);
205
206} // namespace nestedsums
207
208#endif // ndef __NESTEDSUMS_SSUM_H__
Csums involve a conjugation.
Definition Csum.h:88
Ssums form an algebra.
Definition Ssum.h:56
unsigned get_depth(void) const
Definition Ssum.h:175
virtual GiNaC::ex get_first_letter(void) const
Definition Ssum.cc:472
GiNaC::ex get_weight(void) const
Definition Ssum.cc:1130
virtual GiNaC::ex get_tail(int k) const
Definition Ssum.cc:808
virtual GiNaC::ex cast_to_Zsum(void) const
Definition Ssum.cc:632
GiNaC::ex eval_ncmul(const GiNaC::exvector &v) const override
Definition Ssum.cc:206
GiNaC::ex get_letter_list(void) const
Definition Ssum.h:165
virtual GiNaC::ex remove_first_letter(void) const
Definition Ssum.cc:485
virtual GiNaC::ex append_letter_list(const GiNaC::ex &lc) const
Definition Ssum.cc:605
virtual GiNaC::ex eval_explicit() const
Definition Ssum.cc:1095
virtual GiNaC::ex index_eq_one(void) const
Definition Ssum.cc:772
virtual GiNaC::ex concat_two_sums(const GiNaC::ex &Z1, const GiNaC::ex &Z2) const
Definition Ssum.cc:886
virtual GiNaC::ex multiply_letter_with_first_letter(const GiNaC::ex &lc) const
Definition Ssum.cc:861
virtual GiNaC::ex remove_negative_degrees(void) const
Definition Ssum.cc:947
virtual GiNaC::ex shuffle_exvector(const GiNaC::exvector &Z0, const GiNaC::exvector &Z1, const GiNaC::exvector &Z2) const
Definition Ssum.cc:350
virtual GiNaC::ex refine(unsigned q) const
Definition Ssum.cc:461
virtual GiNaC::ex adjust_upper_limit_plus_one(void) const
Definition Ssum.cc:752
virtual GiNaC::ex append_letter(const GiNaC::ex &lc) const
Definition Ssum.cc:581
virtual int flag_remove_negative_degrees(void) const
Definition Ssum.cc:903
GiNaC::ex eval() const override
Definition Ssum.cc:173
GiNaC::ex get_index(void) const
Definition Ssum.h:155
virtual GiNaC::ex shift_plus_one(void) const
Definition Ssum.cc:652
virtual GiNaC::ex shift_minus_one(void) const
Definition Ssum.cc:662
virtual GiNaC::ex set_index(const GiNaC::ex &i) const
Definition Ssum.cc:642
virtual GiNaC::ex refine_exvector(unsigned q, const GiNaC::exvector &Z0, const GiNaC::exvector &Z1) const
Definition Ssum.cc:414
virtual GiNaC::ex get_head(int k) const
Definition Ssum.cc:784
virtual GiNaC::ex adjust_upper_limit_upwards(const GiNaC::ex &i) const
Definition Ssum.cc:723
virtual GiNaC::ex convert_to_Zsum_exvector(const GiNaC::exvector &Z0, const GiNaC::exvector &Z1) const
Definition Ssum.cc:293
virtual GiNaC::ex adjust_upper_limit_downwards(const GiNaC::ex &i) const
Definition Ssum.cc:684
virtual GiNaC::ex multiply_letter_with_last_letter(const GiNaC::ex &lc) const
Definition Ssum.cc:834
Definition basic_letter.cc:35
ex refine_Ssum(const ex &expr, unsigned q)
Definition Ssum.cc:1400
GiNaC::ex create_Ssum(const GiNaC::ex &nc, const GiNaC::ex &llc)
Definition Ssum.h:185
ex remove_negative_degrees_from_Ssum(const ex &expr)
Definition Ssum.cc:1316
ex convert_Ssum_to_Zsum(const ex &Z1)
Definition Ssum.cc:1196
ex remove_trivial_Ssum(const ex &expr)
Definition Ssum.cc:1360
ex create_Ssum_from_exvector(const ex &nc, const exvector &v)
Definition Ssum.cc:1227
ex shift_upper_limit_plus_one_for_Ssum(const ex &expr)
Definition Ssum.cc:1280
ex shuffle_Ssum(const ex &Z1, const ex &Z2)
Definition Ssum.cc:1156
ex Ssum_to_Zsum(const ex &expr)
Definition Ssum.cc:1244