version 1.17, 2003/07/23 01:22:50 |
version 1.19, 2012/12/17 07:20:44 |
|
|
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* |
* |
* $OpenXM: OpenXM_contrib2/asir2000/engine/distm.c,v 1.16 2003/07/22 10:11:43 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/engine/distm.c,v 1.18 2003/12/26 02:38:10 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "inline.h" |
#include "inline.h" |
Line 102 void mptomd(VL vl,int mod,VL dvl,P p,DP *pr) |
|
Line 102 void mptomd(VL vl,int mod,VL dvl,P p,DP *pr) |
|
} |
} |
} |
} |
|
|
|
void mdtodp(DP p,DP *pr) |
|
{ |
|
MP m,mr0,mr; |
|
|
|
if ( !p ) |
|
*pr = 0; |
|
else { |
|
for ( m = BDY(p), mr0 = 0; m; m = NEXT(m) ) { |
|
NEXTMP(mr0,mr); mr->dl = m->dl; |
|
mptop(C(m),&C(mr)); |
|
} |
|
NEXT(mr) = 0; |
|
MKDP(NV(p),mr0,*pr); |
|
(*pr)->sugar = p->sugar; |
|
} |
|
} |
|
|
|
void _mdtodp(DP p,DP *pr) |
|
{ |
|
MP m,mr0,mr; |
|
int i; |
|
Q q; |
|
|
|
if ( !p ) |
|
*pr = 0; |
|
else { |
|
for ( m = BDY(p), mr0 = 0; m; m = NEXT(m) ) { |
|
NEXTMP(mr0,mr); mr->dl = m->dl; |
|
i = ITOS(m->c); STOQ(i,q); C(mr) = (P)q; |
|
} |
|
NEXT(mr) = 0; |
|
MKDP(NV(p),mr0,*pr); |
|
(*pr)->sugar = p->sugar; |
|
} |
|
} |
|
|
void mdtop(VL vl,int mod,VL dvl,DP p,P *pr) |
void mdtop(VL vl,int mod,VL dvl,DP p,P *pr) |
{ |
{ |
int n,i; |
int n,i; |
Line 241 void comm_mulmd(VL vl,int mod,DP p1,DP p2,DP *pr) |
|
Line 277 void comm_mulmd(VL vl,int mod,DP p1,DP p2,DP *pr) |
|
l = l1; |
l = l1; |
} |
} |
if ( l > wlen ) { |
if ( l > wlen ) { |
if ( w ) GC_free(w); |
if ( w ) GCFREE(w); |
w = (MP *)MALLOC(l*sizeof(MP)); |
w = (MP *)MALLOC(l*sizeof(MP)); |
wlen = l; |
wlen = l; |
} |
} |
Line 272 void weyl_mulmd(VL vl,int mod,DP p1,DP p2,DP *pr) |
|
Line 308 void weyl_mulmd(VL vl,int mod,DP p1,DP p2,DP *pr) |
|
else { |
else { |
for ( m = BDY(p2), l = 0; m; m = NEXT(m), l++ ); |
for ( m = BDY(p2), l = 0; m; m = NEXT(m), l++ ); |
if ( l > wlen ) { |
if ( l > wlen ) { |
if ( w ) GC_free(w); |
if ( w ) GCFREE(w); |
w = (MP *)MALLOC(l*sizeof(MP)); |
w = (MP *)MALLOC(l*sizeof(MP)); |
wlen = l; |
wlen = l; |
} |
} |
Line 326 void weyl_mulmdm(VL vl,int mod,DP p,MP m0,DP *pr) |
|
Line 362 void weyl_mulmdm(VL vl,int mod,DP p,MP m0,DP *pr) |
|
else { |
else { |
for ( m = BDY(p), l = 0; m; m = NEXT(m), l++ ); |
for ( m = BDY(p), l = 0; m; m = NEXT(m), l++ ); |
if ( l > wlen ) { |
if ( l > wlen ) { |
if ( w ) GC_free(w); |
if ( w ) GCFREE(w); |
w = (MP *)MALLOC(l*sizeof(MP)); |
w = (MP *)MALLOC(l*sizeof(MP)); |
wlen = l; |
wlen = l; |
} |
} |
Line 385 void weyl_mulmmm(VL vl,int mod,MP m0,MP m1,int n,DP *p |
|
Line 421 void weyl_mulmmm(VL vl,int mod,MP m0,MP m1,int n,DP *p |
|
min = MIN(k,l); |
min = MIN(k,l); |
|
|
if ( min+1 > tablen ) { |
if ( min+1 > tablen ) { |
if ( tab ) GC_free(tab); |
if ( tab ) GCFREE(tab); |
tab = (int *)MALLOC((min+1)*sizeof(int)); |
tab = (int *)MALLOC((min+1)*sizeof(int)); |
tablen = min+1; |
tablen = min+1; |
} |
} |
Line 627 void comm_mulmd_dup(int mod,DP p1,DP p2,DP *pr) |
|
Line 663 void comm_mulmd_dup(int mod,DP p1,DP p2,DP *pr) |
|
l = l1; |
l = l1; |
} |
} |
if ( l > wlen ) { |
if ( l > wlen ) { |
if ( w ) GC_free(w); |
if ( w ) GCFREE(w); |
w = (MP *)MALLOC(l*sizeof(MP)); |
w = (MP *)MALLOC(l*sizeof(MP)); |
wlen = l; |
wlen = l; |
} |
} |
Line 654 void weyl_mulmd_dup(int mod,DP p1,DP p2,DP *pr) |
|
Line 690 void weyl_mulmd_dup(int mod,DP p1,DP p2,DP *pr) |
|
else { |
else { |
for ( m = BDY(p1), l = 0; m; m = NEXT(m), l++ ); |
for ( m = BDY(p1), l = 0; m; m = NEXT(m), l++ ); |
if ( l > wlen ) { |
if ( l > wlen ) { |
if ( w ) GC_free(w); |
if ( w ) GCFREE(w); |
w = (MP *)MALLOC(l*sizeof(MP)); |
w = (MP *)MALLOC(l*sizeof(MP)); |
wlen = l; |
wlen = l; |
} |
} |
Line 710 void weyl_mulmdm_dup(int mod,MP m0,DP p,DP *pr) |
|
Line 746 void weyl_mulmdm_dup(int mod,MP m0,DP p,DP *pr) |
|
else { |
else { |
for ( m = BDY(p), l = 0; m; m = NEXT(m), l++ ); |
for ( m = BDY(p), l = 0; m; m = NEXT(m), l++ ); |
if ( l > wlen ) { |
if ( l > wlen ) { |
if ( w ) GC_free(w); |
if ( w ) GCFREE(w); |
w = (MP *)MALLOC(l*sizeof(MP)); |
w = (MP *)MALLOC(l*sizeof(MP)); |
wlen = l; |
wlen = l; |
} |
} |
Line 722 void weyl_mulmdm_dup(int mod,MP m0,DP p,DP *pr) |
|
Line 758 void weyl_mulmdm_dup(int mod,MP m0,DP p,DP *pr) |
|
for ( i = 0, tlen = 1; i < n2; i++ ) |
for ( i = 0, tlen = 1; i < n2; i++ ) |
tlen *= d0->d[n2+i]+1; |
tlen *= d0->d[n2+i]+1; |
if ( tlen > rtlen ) { |
if ( tlen > rtlen ) { |
if ( tab ) GC_free(tab); |
if ( tab ) GCFREE(tab); |
if ( psum ) GC_free(psum); |
if ( psum ) GCFREE(psum); |
rtlen = tlen; |
rtlen = tlen; |
tab = (struct cdlm *)MALLOC(rtlen*sizeof(struct cdlm)); |
tab = (struct cdlm *)MALLOC(rtlen*sizeof(struct cdlm)); |
psum = (MP *)MALLOC(rtlen*sizeof(MP)); |
psum = (MP *)MALLOC(rtlen*sizeof(MP)); |
Line 785 void weyl_mulmmm_dup(int mod,MP m0,MP m1,int n,struct |
|
Line 821 void weyl_mulmmm_dup(int mod,MP m0,MP m1,int n,struct |
|
rtab[0].d = d; |
rtab[0].d = d; |
|
|
if ( rtablen > tmptablen ) { |
if ( rtablen > tmptablen ) { |
if ( tmptab ) GC_free(tmptab); |
if ( tmptab ) GCFREE(tmptab); |
tmptab = (struct cdlm *)MALLOC(rtablen*sizeof(struct cdlm)); |
tmptab = (struct cdlm *)MALLOC(rtablen*sizeof(struct cdlm)); |
tmptablen = rtablen; |
tmptablen = rtablen; |
} |
} |
Line 812 void weyl_mulmmm_dup(int mod,MP m0,MP m1,int n,struct |
|
Line 848 void weyl_mulmmm_dup(int mod,MP m0,MP m1,int n,struct |
|
continue; |
continue; |
} |
} |
if ( k+1 > tablen ) { |
if ( k+1 > tablen ) { |
if ( tab ) GC_free(tab); |
if ( tab ) GCFREE(tab); |
if ( ctab ) GC_free(ctab); |
if ( ctab ) GCFREE(ctab); |
tablen = k+1; |
tablen = k+1; |
tab = (struct cdlm *)MALLOC(tablen*sizeof(struct cdlm)); |
tab = (struct cdlm *)MALLOC(tablen*sizeof(struct cdlm)); |
ctab = (int *)MALLOC(tablen*sizeof(int)); |
ctab = (int *)MALLOC(tablen*sizeof(int)); |