Cadabra
Computer algebra system for field theory problems
Hash.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Storage.hh"
4 
5 namespace cadabra
6 {
7  enum HashFlags : unsigned int
8  {
9  HASH_DEFAULT = 0x0,
21  };
22 
23  class Ex_hasher
24  {
25  public:
26  using result_t = size_t;
27  Ex_hasher();
29 
30  result_t operator () (const Ex& ex) const;
31  result_t operator () (Ex::iterator it) const;
32 
34  HashFlags get_flags() const;
37 
38  private:
39  result_t hash(Ex::iterator it, bool toplevel) const;
40  bool flag_set(HashFlags flag) const;
41 
43  };
44 
50 
51  Ex_hasher::result_t hash_ex(Ex::iterator it, HashFlags flags = HASH_DEFAULT);
52  bool hash_compare(Ex::iterator lhs, Ex::iterator rhs, HashFlags flags = HASH_DEFAULT);
53 }
cadabra::Ex_hasher::add_flags
void add_flags(HashFlags flags)
cadabra::HASH_IGNORE_PARENT_REL
@ HASH_IGNORE_PARENT_REL
Definition: Hash.hh:15
cadabra::Ex_hasher::remove_flags
void remove_flags(HashFlags flags)
cadabra::HASH_IGNORE_INDICES
@ HASH_IGNORE_INDICES
Definition: Hash.hh:19
cadabra::HASH_IGNORE_SUM_ORDER
@ HASH_IGNORE_SUM_ORDER
Definition: Hash.hh:13
cadabra::Ex_hasher::set_flags
void set_flags(HashFlags flags)
cadabra::HASH_DEFAULT
@ HASH_DEFAULT
Definition: Hash.hh:9
cadabra::HASH_IGNORE_BRACKET_TYPE
@ HASH_IGNORE_BRACKET_TYPE
Definition: Hash.hh:16
cadabra::HASH_IGNORE_PRODUCT_ORDER
@ HASH_IGNORE_PRODUCT_ORDER
Definition: Hash.hh:12
cadabra::HASH_IGNORE_CHILDREN
@ HASH_IGNORE_CHILDREN
Definition: Hash.hh:17
cadabra::operator|=
HashFlags & operator|=(HashFlags &lhs, HashFlags rhs)
Definition: Hash.cc:121
cadabra::Ex_hasher::result_t
size_t result_t
Definition: Hash.hh:26
cadabra::HASH_IGNORE_CHILD_ORDER
@ HASH_IGNORE_CHILD_ORDER
Definition: Hash.hh:20
cadabra::Ex_hasher::flags
HashFlags flags
Definition: Hash.hh:42
cadabra::Ex_hasher::get_flags
HashFlags get_flags() const
cadabra::operator~
HashFlags operator~(HashFlags flags)
Definition: Hash.cc:106
cadabra::Ex_hasher::hash
result_t hash(Ex::iterator it, bool toplevel) const
Definition: Hash.cc:41
cadabra::operator&=
HashFlags & operator&=(HashFlags &lhs, HashFlags rhs)
Definition: Hash.cc:126
cadabra::rhs
Ex rhs(Ex_ptr ex)
Definition: py_ex.cc:318
Storage.hh
cadabra::hash_ex
Ex_hasher::result_t hash_ex(Ex::iterator it, HashFlags flags)
Definition: Hash.cc:131
cadabra::Ex_hasher::flag_set
bool flag_set(HashFlags flag) const
Definition: Hash.cc:99
cadabra::operator|
HashFlags operator|(HashFlags lhs, HashFlags rhs)
Definition: Hash.cc:111
cadabra::HashFlags
HashFlags
Definition: Hash.hh:7
cadabra::Ex_hasher::operator()
result_t operator()(const Ex &ex) const
Definition: Hash.cc:31
cadabra::hash_compare
bool hash_compare(Ex::iterator lhs, Ex::iterator rhs, HashFlags flags)
Definition: Hash.cc:137
cadabra::HASH_IGNORE_MULTIPLIER
@ HASH_IGNORE_MULTIPLIER
Definition: Hash.hh:11
cadabra
Functions to handle the exchange properties of two or more symbols in a product.
Definition: Adjform.cc:83
cadabra::HASH_IGNORE_NAMES
@ HASH_IGNORE_NAMES
Definition: Hash.hh:18
cadabra::Ex
Definition: Storage.hh:140
cadabra::operator&
HashFlags operator&(HashFlags lhs, HashFlags rhs)
Definition: Hash.cc:116
cadabra::lhs
Ex lhs(Ex_ptr ex)
Definition: py_ex.cc:306
cadabra::HASH_IGNORE_TOP_MULTIPLIER
@ HASH_IGNORE_TOP_MULTIPLIER
Definition: Hash.hh:10
cadabra::Ex_hasher::Ex_hasher
Ex_hasher()
Definition: Hash.cc:19
cadabra::Ex_hasher
Definition: Hash.hh:23
cadabra::HASH_IGNORE_INDEX_ORDER
@ HASH_IGNORE_INDEX_ORDER
Definition: Hash.hh:14