Xmipp  v3.23.11-Nereus
Public Member Functions | Public Attributes | Friends | List of all members
MultInd Class Reference

#include <MultInd.h>

Public Member Functions

unsigned * lastChanges ()
 
unsigned * indexesOfCoefInLexOrder ()
 
 MultInd (unsigned d=0)
 
 ~MultInd ()
 
void resetCounter ()
 
MultIndoperator++ ()
 
MultIndoperator++ (int)
 
 operator unsigned * () const
 
MultIndoperator= (const MultInd &P)
 
bool operator== (const MultInd &m)
 
unsigned index ()
 
unsigned len ()
 
void print ()
 

Public Attributes

unsigned dim
 
unsigned deg
 

Friends

class MultIndCache
 

Detailed Description

Definition at line 50 of file MultInd.h.

Constructor & Destructor Documentation

◆ MultInd()

MultInd::MultInd ( unsigned  d = 0)

Definition at line 75 of file MultInd.cpp.

75  : dim(d), deg(0), next(NULL)
76 {
77  standardInit();
78  resetCounter();
79 }
unsigned deg
Definition: MultInd.h:53
doublereal * d
void resetCounter()
Definition: MultInd.cpp:164
unsigned dim
Definition: MultInd.h:53

◆ ~MultInd()

MultInd::~MultInd ( )

Definition at line 81 of file MultInd.cpp.

82 {
83  if (deg==0) free(coeffDeg);
84 }
unsigned deg
Definition: MultInd.h:53
free((char *) ob)

Member Function Documentation

◆ index()

unsigned MultInd::index ( )
inline

Definition at line 68 of file MultInd.h.

68 {return indexV;};

◆ indexesOfCoefInLexOrder()

unsigned * MultInd::indexesOfCoefInLexOrder ( )

Definition at line 214 of file MultInd.cpp.

215 {
216  if (deg==0)
217  {
218  printf("use MultIndCache to instanciate MultInd");
219  getchar(); exit(252);
220  }
221  return (unsigned*)indexesOfCoefInLexOrderV.d->p;
222 }
unsigned deg
Definition: MultInd.h:53
VectorIntData * d
Definition: VectorInt.h:40

◆ lastChanges()

unsigned * MultInd::lastChanges ( )

Definition at line 204 of file MultInd.cpp.

205 {
206  if (deg==0)
207  {
208  printf("use MultIndCache to instanciate MultInd");
209  getchar(); exit(252);
210  }
211  return (unsigned*)lastChangesV.d->p;
212 }
unsigned deg
Definition: MultInd.h:53
VectorIntData * d
Definition: VectorInt.h:40

◆ len()

unsigned MultInd::len ( )

Definition at line 96 of file MultInd.cpp.

97 {
98  unsigned l=0, *ccDeg=coeffDeg, j=dim;
99  while (j--) l+=*(ccDeg++);
100  return l;
101 }
#define j
unsigned dim
Definition: MultInd.h:53

◆ operator unsigned *()

MultInd::operator unsigned * ( ) const
inline

Definition at line 65 of file MultInd.h.

65 { return coeffDeg; };

◆ operator++() [1/2]

MultInd & MultInd::operator++ ( )

Definition at line 170 of file MultInd.cpp.

171 {
172  unsigned *cc = coeffDeg;
173  int n=dim, pos, i;
174 
175  if (!n || !cc) return *this;
176 
177  for (pos = n-2; pos >= 0; pos--)
178  {
179  if (cc[pos]) // Gotcha
180  {
181  cc[pos]--;
182  cc[++pos]++;
183  for (i = pos+1; i < n;i++)
184  {
185  cc[pos] += cc[i];
186  cc[i] = 0;
187  }
188  indexV++;
189  return *this;
190  }
191  }
192 
193  (*cc)++;
194  for ( i = 1; i < n; i++)
195  {
196  *cc += cc[i];
197  cc[i] = 0;
198  }
199 
200  indexV++;
201  return *this;
202 }
#define i
unsigned dim
Definition: MultInd.h:53
int * n

◆ operator++() [2/2]

MultInd& MultInd::operator++ ( int  )
inline

Definition at line 63 of file MultInd.h.

63 { return this->operator++(); } // postfix
MultInd & operator++()
Definition: MultInd.cpp:170

◆ operator=()

MultInd & MultInd::operator= ( const MultInd P)

Definition at line 44 of file MultInd.cpp.

45 {
46  dim=p.dim; deg=p.deg; next=NULL;
47  lastChangesV=p.lastChangesV; indexesOfCoefInLexOrderV=p.indexesOfCoefInLexOrderV;
48  indexV=p.indexV;
49  standardInit();
50  if (deg==0) memcpy(coeffDeg,p.coeffDeg,dim*sizeof(unsigned));
51  return *this;
52 }
unsigned deg
Definition: MultInd.h:53
unsigned dim
Definition: MultInd.h:53

◆ operator==()

bool MultInd::operator== ( const MultInd m)

Definition at line 103 of file MultInd.cpp.

104 {
105  unsigned *p1=(*this), *p2=m, n=dim;
106  while (n--)
107  if (*(p1++)!=*(p2++)) return false;
108  return true;
109 }
int m
unsigned dim
Definition: MultInd.h:53
int * n

◆ print()

void MultInd::print ( )

Definition at line 86 of file MultInd.cpp.

87 {
88  printf("[");
89  if (!dim) { printf("]"); return; }
90 
91  unsigned N=dim,*up=coeffDeg;
92  while (--N) printf("%i,",*(up++));
93  printf("%i]",*up);
94 }
unsigned dim
Definition: MultInd.h:53

◆ resetCounter()

void MultInd::resetCounter ( )

Definition at line 164 of file MultInd.cpp.

165 {
166  indexV=0;
167  memset(coeffDeg,0,dim*sizeof(unsigned));
168 }
unsigned dim
Definition: MultInd.h:53

Friends And Related Function Documentation

◆ MultIndCache

friend class MultIndCache
friend

Definition at line 51 of file MultInd.h.

Member Data Documentation

◆ deg

unsigned MultInd::deg

Definition at line 53 of file MultInd.h.

◆ dim

unsigned MultInd::dim

Definition at line 53 of file MultInd.h.


The documentation for this class was generated from the following files: