File: factor_in.hh

package info (click to toggle)
cadabra2 2.4.3.2-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 78,732 kB
  • sloc: ansic: 133,450; cpp: 92,064; python: 1,530; javascript: 203; sh: 184; xml: 182; objc: 53; makefile: 51
file content (34 lines) | stat: -rw-r--r-- 923 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

#pragma once

#include "Algorithm.hh"

namespace cadabra {

	/// \ingroup algorithms

	class factor_in : public Algorithm {
		public:
			factor_in(const Kernel&, Ex&, Ex&);

			virtual bool     can_apply(iterator) override;
			virtual result_t apply(iterator&) override;

		protected:
			Ex& factors;
			std::set<Ex, tree_exact_less_for_indexmap_obj> factnodes; // objects to be taken in brackets;
			// FIXME: use patterns
			bool      compare_restricted(iterator one, iterator two) const;
			bool      compare_prod_nonprod(iterator prod, iterator nonprod) const;

			// Calculate the hash value excluding factors given in the argument list
			hashval_t calc_restricted_hash(iterator it) const;
			void      fill_hash_map(iterator);

			typedef std::multimap<hashval_t, Ex::sibling_iterator> term_hash_t;
			typedef term_hash_t::iterator                          term_hash_iterator_t;

			term_hash_t term_hash;
		};

	}