Nestedsums library
hash_entry.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_hash_entry_H__
27#define __NESTEDSUMS_hash_entry_H__
28
29#include "ginac/ginac.h"
30
31namespace nestedsums {
32
34
70 class hash_entry : public GiNaC::basic
71 {
72 GINAC_DECLARE_REGISTERED_CLASS(hash_entry, GiNaC::basic)
73
74 // ctors
75 public:
76 hash_entry(const GiNaC::ex & cd, const GiNaC::ex & sd, const GiNaC::ex & rd, unsigned rkey);
77
78 // functions overriding virtual functions from bases classes
79 public:
80 void archive(GiNaC::archive_node &node) const override;
81 void read_archive(const GiNaC::archive_node &node, GiNaC::lst &sym_lst) override;
82
83 unsigned return_type(void) const override { return GiNaC::return_types::noncommutative; }
84
85 void print(const GiNaC::print_context & c, unsigned level = 0) const override;
86 unsigned precedence(void) const override {return 60;}
87 GiNaC::ex eval() const override;
88 GiNaC::ex subs(const GiNaC::exmap & m, unsigned options = 0) const override;
89
90 protected:
91 GiNaC::ex eval_ncmul(const GiNaC::exvector & v) const override;
92 GiNaC::ex derivative(const GiNaC::symbol & s) const override;
93 unsigned calchash(void) const override;
94
95 // new virtual functions which can be overridden by derived classes
96
97 // non-virtual functions
98 public :
99 GiNaC::ex return_value(const GiNaC::ex & obj_data) const;
100 GiNaC::ex hash_data(void) const;
101 GiNaC::ex subst_data(void) const;
102
103 protected:
104
105 // member variables :
106
107 protected:
108
109 GiNaC::ex compare_data;
110 GiNaC::ex replace_data;
111 GiNaC::ex return_data;
112 unsigned rtti_key;
113 };
114
115GINAC_DECLARE_UNARCHIVER(hash_entry);
116
122inline GiNaC::ex create_hash_entry(const GiNaC::ex & cd, const GiNaC::ex & sd, const GiNaC::ex & rd, unsigned rkey)
123 {
124 return (new hash_entry(cd,sd,rd,rkey))->setflag(GiNaC::status_flags::dynallocated);
125 }
126
127} // namespace nestedsums
128
129#endif // ndef __NESTEDSUMS_hash_entry_H__
This class provides a container for expressions to be stored in hash tables.
Definition hash_entry.h:71
GiNaC::ex eval_ncmul(const GiNaC::exvector &v) const override
Definition hash_entry.cc:168
GiNaC::ex return_value(const GiNaC::ex &obj_data) const
Definition hash_entry.cc:204
GiNaC::ex eval() const override
Definition hash_entry.cc:158
GiNaC::ex hash_data(void) const
Definition hash_entry.cc:219
GiNaC::ex subst_data(void) const
Definition hash_entry.cc:229
Definition basic_letter.cc:35
GiNaC::ex create_hash_entry(const GiNaC::ex &cd, const GiNaC::ex &sd, const GiNaC::ex &rd, unsigned rkey)
Definition hash_entry.h:122