34 #define __INSIDE_MULTIND_CPP__ 36 #undef __INSIDE_MULTIND_CPP__ 40 unsigned MultInd::maxDim;
41 unsigned *MultInd::buffer;
47 lastChangesV=p.lastChangesV; indexesOfCoefInLexOrderV=p.indexesOfCoefInLexOrderV;
50 if (
deg==0) memcpy(coeffDeg,p.coeffDeg,
dim*
sizeof(
unsigned));
54 void MultInd::standardInit()
58 coeffDeg=(
unsigned*)malloc(
dim*
sizeof(
unsigned));
68 dim(_dim),
deg(_deg), next(NULL)
89 if (!
dim) { printf(
"]");
return; }
91 unsigned N=
dim,*up=coeffDeg;
92 while (--N) printf(
"%i,",*(up++));
98 unsigned l=0, *ccDeg=coeffDeg,
j=
dim;
99 while (j--) l+=*(ccDeg++);
105 unsigned *p1=(*this), *p2=
m,
n=
dim;
107 if (*(p1++)!=*(p2++))
return false;
111 void MultInd::fullInit()
117 indexesOfCoefInLexOrderV.
setSize(n);
119 memset(coeffLex+1,0,d*
sizeof(
int));
124 sum=0; ccLex=coeffLex; j=
dim;
125 while (j--) sum+=*(ccLex++);
126 if (sum) k=
choose( sum+d,
dim );
else k=0;
133 ccLex=coeffLex; ccDeg=coeffDeg;
134 for ( j=d; j>0 ; j--, ccLex++, ccDeg++ )
if (*ccLex != *ccDeg)
break;
135 if (*ccLex >= *ccDeg)
break;
139 indexesOfCoefInLexOrderV[
i]=
k;
149 for (j=d-1; j>=0; j--)
155 for (k=0; k<(unsigned)j; k++) sum+=coeffLex[k];
156 coeffLex[++
j]=degree-sum;
157 for (k=j+1; k<=
d; k++) coeffLex[k]=0;
167 memset(coeffDeg,0,
dim*
sizeof(
unsigned));
172 unsigned *cc = coeffDeg;
175 if (!n || !cc)
return *
this;
177 for (pos = n-2; pos >= 0; pos--)
183 for (i = pos+1; i <
n;i++)
194 for ( i = 1; i <
n; i++)
208 printf(
"use MultIndCache to instanciate MultInd");
209 getchar(); exit(252);
211 return (
unsigned*)lastChangesV.
d->
p;
218 printf(
"use MultIndCache to instanciate MultInd");
219 getchar(); exit(252);
221 return (
unsigned*)indexesOfCoefInLexOrderV.
d->
p;
227 MultInd::buffer=(
unsigned*)malloc(MultInd::maxDim*2*
sizeof(
unsigned));
239 free(MultInd::buffer);
246 printf(
"use normal constructor of MultiInd");
247 getchar(); exit(252);
249 if (_dim>MultInd::maxDim)
251 free(MultInd::buffer);
252 MultInd::maxDim=_dim;
253 MultInd::buffer=(
unsigned*)malloc(_dim*2*
sizeof(
unsigned));
258 if ((_dim==d->
dim)&&(_deg==d->
deg))
return d;
unsigned long choose(unsigned n, unsigned k)
MultIndCache cacheMultInd
MultInd * get(unsigned _dim, unsigned _deg)
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
bool operator==(const MultInd &m)
unsigned * indexesOfCoefInLexOrder()
MultInd & operator=(const MultInd &P)