Nestedsums library
harmonic_sum.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_HARMONIC_SUM_H__
27#define __NESTEDSUMS_HARMONIC_SUM_H__
28
29#include "ginac/ginac.h"
30
31namespace nestedsums {
32
34
48 class harmonic_sum : public virtual Ssum
49 {
50 GINAC_DECLARE_REGISTERED_CLASS(harmonic_sum, Ssum)
51
52 // ctors
53 public:
54 explicit harmonic_sum(const GiNaC::ex & nc);
55 harmonic_sum(const GiNaC::ex & nc, const GiNaC::ex & llc);
56
57 // functions overriding virtual functions from bases classes
58 public:
59 void archive(GiNaC::archive_node &node) const override;
60 void read_archive(const GiNaC::archive_node &node, GiNaC::lst &sym_lst) override;
61
62 GiNaC::return_type_t return_type_tinfo() const override;
63
64 void print(const GiNaC::print_context & c, unsigned level = 0) const override;
65 GiNaC::ex eval() const override;
66
67 GiNaC::ex convert_to_Zsum_exvector(const GiNaC::exvector & Z0, const GiNaC::exvector & Z1) const override;
68 GiNaC::ex shuffle_exvector(const GiNaC::exvector & Z0, const GiNaC::exvector & Z1, const GiNaC::exvector & Z2) const override;
69
70 GiNaC::ex set_index(const GiNaC::ex & i) const override;
71 GiNaC::ex shift_plus_one(void) const override;
72 GiNaC::ex shift_minus_one(void) const override;
73 GiNaC::ex adjust_upper_limit_downwards(const GiNaC::ex & i) const override;
74 GiNaC::ex adjust_upper_limit_upwards(const GiNaC::ex & i) const override;
75 GiNaC::ex adjust_upper_limit_plus_one(void) const override;
76 GiNaC::ex remove_first_letter(void) const override;
77 GiNaC::ex remove_first_letter(const GiNaC::ex & nc) const override;
78 };
79
80GINAC_DECLARE_UNARCHIVER(harmonic_sum);
81
87inline GiNaC::ex create_harmonic_sum(const GiNaC::ex & nc, const GiNaC::ex & llc)
88 {
89 return (new harmonic_sum(nc,llc))->setflag(GiNaC::status_flags::dynallocated);
90 }
91
92 GiNaC::ex create_harmonic_sum_with_ones(const GiNaC::ex &n, const int &k);
93
94 GiNaC::ex create_harmonic_sum_from_exvector(const GiNaC::ex & nc, const GiNaC::exvector & v);
95
96} // namespace nestedsums
97
98namespace GiNaC {
99
100 // template specialization
101template<> inline const nestedsums::harmonic_sum &ex_to<nestedsums::harmonic_sum>(const ex &e)
102 {
103 return dynamic_cast<const nestedsums::harmonic_sum &>(*e.bp);
104 }
105
106} // end namespace GiNaC
107
108#endif // ndef __NESTEDSUMS_HARMONIC_SUM_H__
Ssums form an algebra.
Definition Ssum.h:56
A harmonic sum is a special case of a Ssum.
Definition harmonic_sum.h:49
GiNaC::ex shift_plus_one(void) const override
Definition harmonic_sum.cc:284
GiNaC::ex shift_minus_one(void) const override
Definition harmonic_sum.cc:294
GiNaC::ex remove_first_letter(void) const override
Definition harmonic_sum.cc:393
GiNaC::ex adjust_upper_limit_upwards(const GiNaC::ex &i) const override
Definition harmonic_sum.cc:352
GiNaC::ex eval() const override
Definition harmonic_sum.cc:157
GiNaC::ex adjust_upper_limit_downwards(const GiNaC::ex &i) const override
Definition harmonic_sum.cc:316
GiNaC::ex set_index(const GiNaC::ex &i) const override
Definition harmonic_sum.cc:274
GiNaC::ex shuffle_exvector(const GiNaC::exvector &Z0, const GiNaC::exvector &Z1, const GiNaC::exvector &Z2) const override
Definition harmonic_sum.cc:223
GiNaC::ex convert_to_Zsum_exvector(const GiNaC::exvector &Z0, const GiNaC::exvector &Z1) const override
Definition harmonic_sum.cc:178
GiNaC::ex adjust_upper_limit_plus_one(void) const override
Definition harmonic_sum.cc:378
Definition basic_letter.cc:35
ex create_harmonic_sum_with_ones(const ex &n, const int &k)
Definition harmonic_sum.cc:443
ex create_harmonic_sum_from_exvector(const ex &nc, const exvector &v)
Definition harmonic_sum.cc:462
GiNaC::ex create_harmonic_sum(const GiNaC::ex &nc, const GiNaC::ex &llc)
Definition harmonic_sum.h:87