File: eliminate_metric.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 (43 lines) | stat: -rw-r--r-- 1,204 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
35
36
37
38
39
40
41
42
43

#pragma once

#include "Algorithm.hh"
#include "IndexIterator.hh"

namespace cadabra {

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

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

		protected:
			virtual bool is_conversion_object(iterator) const=0;

		private:
			Ex          preferred;
			index_map_t ind_dummy, ind_free;
            bool        redundant;

			/// See if the conversion which turns index 'i1' into index
			/// 'i2' can be applied on the expression, so that it gets a
			/// factor in the expression closer to the 'fit' form.
			/// The two indices 'i1' and 'i2' are objects on the convertor
			/// object, so they need to appear with opposite parent rel
			/// in the expression if they are to be applied (if the index
			/// position type is 'fixed').
			bool handle_one_index(index_iterator i1, index_iterator i2, iterator fit, sibling_iterator objs);
		};


	class eliminate_metric : public eliminate_converter {
		public:
			eliminate_metric(const Kernel&, Ex&, Ex&, bool);

		protected:
			virtual bool is_conversion_object(iterator) const override;
		};

	}