32 virtual int size()
const = 0;
38 if ((i>=0) && (i<
size())) {
49 if ((i>=0) && (i<
size())) {
87 return i->getDomain(const_cast<MP_set*>(
this));
110 return cardinality-1;
127 template <
int nbr>
class MP_subset;
139 std::vector<int> elm(nbr);
140 for (
int i=0; i<nbr; i++) {
141 elm[i] = I[i]->evaluate();
147 std::vector<MP_index_exp> I;
170 S = makeVector<nbr,const MP_set*>(&s1,&s2,&s3,&s4,&s5);
193 int operator()(
int i1,
int i2=0,
int i3=0,
int i4=0,
int i5=0) {
194 std::map<std::vector<int>,
int>::const_iterator
pos;
195 pos = elements.find(makeVector<nbr>(i1, i2, i3, i4, i5));
196 if (
pos==elements.end()) {
215 int evaluate(
const std::vector<MP_index*>& I)
const {
217 for (
int k=0; k<nbr; k++) {
218 int temp = I[k]->evaluate();
221 std::map<std::vector<int>,
int>::const_iterator
pos;
222 pos = elements.find(vi);
223 if (
pos==elements.end()) {
230 void insert(
const std::vector<int> &args) {
232 for (
int i=0; i<nbr; i++) {
238 std::map<std::vector<int>,
int>::const_iterator
pos;
239 pos = elements.find(args);
240 if (
pos==elements.end()) {
241 const int v = static_cast<int>(elements.size());
246 void insert(
int i1,
int i2=0,
int i3=0,
int i4=0,
int i5=0) {
247 insert(makeVector<nbr>(i1, i2, i3, i4, i5));
257 return static_cast<int>(elements.size());
261 std::vector<const MP_set*> S;
262 std::map<std::vector<int>,
int> elements;
294 class SubsetRef :
public SUBSETREF {
318 makeVector<nbr>(
I1->getIndex(),
I2->getIndex(),
319 I3->getIndex(),
I4->getIndex(),
325 makeVector<nbr>(
I1->getIndex(),
I2->getIndex(),
326 I3->getIndex(),
I4->getIndex(),
336 std::vector<MP_index_exp> I = makeVector<nbr>(
I1,
I2,
I3,
I4,
I5);
338 for (
int k=0; k<nbr; k++) {
339 int temp = I[k]->evaluate();
342 std::map<std::vector<int>,
int>::const_iterator
pos;
343 pos =
S->elements.find(vi);
344 if (
pos==
S->elements.end()) {
virtual int size() const
getter for the cardinality of this MP_set.
InsertFunctor(MP_subset< nbr > *s, std::vector< MP_index_exp > i)
MP_domain such_that(const MP_boolean &b)
Special conditional creation of a subset.
void insert(int i1, int i2=0, int i3=0, int i4=0, int i5=0)
const MP_domain & operator()(const SUBSETREF &s)
Internal representation of a "set".
friend class SubsetRef< nbr >
int evaluate(const std::vector< MP_index * > &I) const
void insert(const std::vector< int > &args)
MP_subset(const MP_set &s1, const MP_set &s2=MP_set::getEmpty(), const MP_set &s3=MP_set::getEmpty(), const MP_set &s4=MP_set::getEmpty(), const MP_set &s5=MP_set::getEmpty())
MP_domain operator()(const MP_index_exp &i) const
Constructs an MP_domain on the stack given an index expression into the set.
Internal representation of a "set".
MP_subset(std::vector< const MP_set * > s)
static const MP_domain & getEmpty()
returns a reference to the "empty" set.
int checkStage(int i) const
Representation of an index.
Internal representation of a "set".
const InsertFunctor< nbr > & insert(MP_index_exp i1, MP_index_exp i2=MP_index_exp::getEmpty(), MP_index_exp i3=MP_index_exp::getEmpty(), MP_index_exp i4=MP_index_exp::getEmpty(), MP_index_exp i5=MP_index_exp::getEmpty())
virtual MP_domain operator()(const MP_index_exp &i) const =0
SubsetRef(MP_subset< nbr > *s, const MP_index_exp &i1, const MP_index_exp &i2, const MP_index_exp &i3, const MP_index_exp &i4, const MP_index_exp &i5)
int operator()(int i1, int i2=0, int i3=0, int i4=0, int i5=0)
MP_domain such_that(const MP_boolean &b)
constructs a domain by subsetting this MP_set where the MP_boolean evaluates to 'true'
static MP_set & getEmpty()
gets the distinct 'empty' MP_set.
Utility interface class for adding a string name onto a structure.
static MP_index & getEmpty()
returns a reference to the distinct "empty" index.
Representation of an expression involving an index.
Range over which some other constuct is defined.
virtual int isStage() const
Range over which some other constuct is defined.
const int outOfBound
Distinct return value on conditions where an index goes out of bounds.
All flopc++ code is contained within the flopc namespace.
void cyclic()
setter for 'cyclic' property
Reference counted class for all "boolean" types of data.
virtual int size() const =0
SubsetRef & such_that(const MP_boolean &b)
Range over which some other constuct is defined.
virtual MP_index * getIndex() const
void display(const std::string &s="") const
Constant pos(const Constant &c)
for returning non-negative value of the constant.
Representation of a set for indexing into some other construct.
virtual int isStage() const
virtual MP_domain getDomain(MP_set *s) const
virtual MP_domain getDomain(MP_set *s) const
Internal representation of a "set".
virtual int size() const
getter for the cardinality of this MP_set.
Internal representation of a index.
int mod(int a, int b)
return the strictly positive modulus of two integers
MP_index * getIndex() const
MP_set(int i=0)
constructs a set with specific cardinality.
Internal representation of a "set".
static const MP_index_exp & getEmpty()
Return the unique empty expression.
SubsetRef< nbr > & operator()(const MP_index_exp &i1, const MP_index_exp &i2=MP_index::getEmpty(), const MP_index_exp &i3=MP_index::getEmpty(), const MP_index_exp &i4=MP_index::getEmpty(), const MP_index_exp &i5=MP_index::getEmpty())