Frobby  0.9.5
Projection.h
Go to the documentation of this file.
1 /* Frobby: Software for monomial ideal computations.
2  Copyright (C) 2007 Bjarke Hammersholt Roune (www.broune.com)
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see http://www.gnu.org/licenses/.
16 */
17 #ifndef PROJECTION_GUARD
18 #define PROJECTION_GUARD
19 
20 #include <vector>
21 
22 class Partition;
23 class Term;
24 
25 // Recall that a function maps elements from its domain to its
26 // range. Projection represents a function that maps variables from
27 // its range ring to its domain ring, where some variables can be
28 // mapped to zero.
29 class Projection {
30  public:
32 
33  void reset(const Partition& partition, int set);
34  void reset(const vector<size_t>& inverseProjections);
35  void setToIdentity(size_t varCount);
36 
37  size_t getRangeVarCount() const;
38 
39  size_t getDomainVar(size_t rangeVar);
40 
41  void project(Exponent* to, const Exponent* from) const;
42 
43  void inverseProject(Term& to, const Exponent* from) const;
44  size_t inverseProjectVar(size_t rangeVar) const;
45 
46  void swap(Projection& projection);
47 
48  void print(FILE* file) const;
49 
50  bool domainVarHasProjection(size_t var) const;
51 
52  private:
53  void updateHasProjections();
54 
55  vector<size_t> _offsets;
56  mutable vector<int> _domainVarHasProjection;
57 };
58 
59 #endif
void swap(Projection &projection)
Definition: Projection.cpp:111
void inverseProject(Term &to, const Exponent *from) const
Definition: Projection.cpp:78
void reset(const Partition &partition, int set)
Definition: Projection.cpp:28
void updateHasProjections()
Definition: Projection.cpp:116
size_t getDomainVar(size_t rangeVar)
Definition: Projection.cpp:67
void setToIdentity(size_t varCount)
Definition: Projection.cpp:59
vector< int > _domainVarHasProjection
Definition: Projection.h:56
bool domainVarHasProjection(size_t var) const
Definition: Projection.cpp:89
void print(FILE *file) const
Definition: Projection.cpp:104
void project(Exponent *to, const Exponent *from) const
Definition: Projection.cpp:72
size_t inverseProjectVar(size_t rangeVar) const
Definition: Projection.cpp:84
size_t getRangeVarCount() const
Definition: Projection.cpp:24
vector< size_t > _offsets
Definition: Projection.h:55
Term represents a product of variables which does not include a coefficient.
Definition: Term.h:49
unsigned int Exponent
Definition: stdinc.h:89