version 1.80, 2003/10/10 10:07:18 |
version 1.93, 2004/03/13 07:48:30 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.79 2003/10/10 07:18:12 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.92 2004/03/13 07:43:24 noro Exp $ */ |
|
|
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
#include "ox.h" |
#include "ox.h" |
|
#include "base.h" |
#include "inline.h" |
#include "inline.h" |
#include <time.h> |
#include <time.h> |
|
|
Line 117 typedef struct oIndArray |
|
Line 118 typedef struct oIndArray |
|
int (*ndl_compare_function)(UINT *a1,UINT *a2); |
int (*ndl_compare_function)(UINT *a1,UINT *a2); |
|
|
static int ndv_alloc; |
static int ndv_alloc; |
|
#if 1 |
static int nd_f4_nsp=0x7fffffff; |
static int nd_f4_nsp=0x7fffffff; |
|
#else |
|
static int nd_f4_nsp=50; |
|
#endif |
static double nd_scale=2; |
static double nd_scale=2; |
static UINT **nd_bound; |
static UINT **nd_bound; |
static struct order_spec *nd_ord; |
static struct order_spec *nd_ord; |
Line 141 static int nd_psn,nd_pslen; |
|
Line 146 static int nd_psn,nd_pslen; |
|
static RHist *nd_red; |
static RHist *nd_red; |
|
|
static int nd_found,nd_create,nd_notfirst; |
static int nd_found,nd_create,nd_notfirst; |
static int nm_adv; |
|
static int nmv_adv; |
static int nmv_adv; |
static int nd_dcomp; |
static int nd_dcomp; |
static int nd_demand; |
static int nd_demand; |
|
|
extern struct order_spec dp_current_spec; |
extern struct order_spec *dp_current_spec; |
extern char *Demand; |
extern char *Demand; |
extern VL CO; |
extern VL CO; |
extern int Top,Reverse,DP_Print,dp_nelim,do_weyl,NoSugar; |
extern int Top,Reverse,DP_Print,dp_nelim,do_weyl,NoSugar; |
Line 174 extern int *current_weyl_weight_vector; |
|
Line 178 extern int *current_weyl_weight_vector; |
|
#define GET_EXP_OLD(d,a) (((d)[oepos[a].i]>>oepos[a].s)&omask0) |
#define GET_EXP_OLD(d,a) (((d)[oepos[a].i]>>oepos[a].s)&omask0) |
#define PUT_EXP_OLD(r,a,e) ((r)[oepos[a].i] |= ((e)<<oepos[a].s)) |
#define PUT_EXP_OLD(r,a,e) ((r)[oepos[a].i] |= ((e)<<oepos[a].s)) |
|
|
|
#define ROUND_FOR_ALIGN(s) ((((s)+sizeof(void *)-1)/sizeof(void *))*sizeof(void *)) |
|
|
/* macros for term comparison */ |
/* macros for term comparison */ |
#define TD_DL_COMPARE(d1,d2)\ |
#define TD_DL_COMPARE(d1,d2)\ |
(TD(d1)>TD(d2)?1:(TD(d1)<TD(d2)?-1:ndl_lex_compare(d1,d2))) |
(TD(d1)>TD(d2)?1:(TD(d1)<TD(d2)?-1:ndl_lex_compare(d1,d2))) |
Line 270 void nd_gr(LIST f,LIST v,int m,int f4,struct order_spe |
|
Line 276 void nd_gr(LIST f,LIST v,int m,int f4,struct order_spe |
|
void nd_gr_trace(LIST f,LIST v,int trace,int homo,struct order_spec *ord,LIST *rp); |
void nd_gr_trace(LIST f,LIST v,int trace,int homo,struct order_spec *ord,LIST *rp); |
NODE nd_f4(int m); |
NODE nd_f4(int m); |
NODE nd_gb(int m,int ishomo,int checkonly); |
NODE nd_gb(int m,int ishomo,int checkonly); |
NODE nd_gb_trace(int m); |
NODE nd_gb_trace(int m,int ishomo); |
|
|
/* ndl functions */ |
/* ndl functions */ |
int ndl_weight(UINT *d); |
int ndl_weight(UINT *d); |
Line 784 INLINE int ndl_equal(UINT *d1,UINT *d2) |
|
Line 790 INLINE int ndl_equal(UINT *d1,UINT *d2) |
|
{ |
{ |
int i; |
int i; |
|
|
for ( i = 0; i < nd_wpd; i++ ) |
switch ( nd_wpd ) { |
if ( *d1++ != *d2++ ) |
case 2: |
return 0; |
if ( TD(d2) != TD(d1) ) return 0; |
return 1; |
if ( d2[1] != d1[1] ) return 0; |
|
return 1; |
|
break; |
|
case 3: |
|
if ( TD(d2) != TD(d1) ) return 0; |
|
if ( d2[1] != d1[1] ) return 0; |
|
if ( d2[2] != d1[2] ) return 0; |
|
return 1; |
|
break; |
|
default: |
|
for ( i = 0; i < nd_wpd; i++ ) |
|
if ( *d1++ != *d2++ ) return 0; |
|
return 1; |
|
break; |
|
} |
} |
} |
|
|
INLINE void ndl_copy(UINT *d1,UINT *d2) |
INLINE void ndl_copy(UINT *d1,UINT *d2) |
Line 1744 ND normalize_pbucket(int mod,PGeoBucket g) |
|
Line 1764 ND normalize_pbucket(int mod,PGeoBucket g) |
|
return r; |
return r; |
} |
} |
|
|
|
void do_diagonalize(int sugar,int m) |
|
{ |
|
int i,nh,stat; |
|
NODE r,g,t; |
|
ND h,nf,s,head; |
|
NDV nfv; |
|
Q q,num,den; |
|
union oNDC dn; |
|
|
|
for ( i = nd_psn-1; i >= 0 && SG(nd_psh[i]) == sugar; i-- ) { |
|
if ( nd_demand ) |
|
nfv = ndv_load(i); |
|
else |
|
nfv = nd_ps[i]; |
|
s = ndvtond(m,nfv); |
|
s = nd_separate_head(s,&head); |
|
nd_nf(m,s,nd_ps,1,&dn,&nf); |
|
if ( !m ) { |
|
NTOQ(NM(dn.z),SGN(dn.z),num); |
|
mulq(HCQ(head),num,&q); HCQ(head) = q; |
|
if ( DN(dn.z) ) { |
|
NTOQ(DN(dn.z),1,den); |
|
nd_mul_c_q(nf,den); |
|
} |
|
} |
|
nf = nd_add(m,head,nf); |
|
ndv_free(nfv); |
|
nd_removecont(m,nf); |
|
nfv = ndtondv(m,nf); |
|
nd_free(nf); |
|
nd_bound[i] = ndv_compute_bound(nfv); |
|
if ( nd_demand ) { |
|
ndv_save(nfv,i); |
|
ndv_free(nfv); |
|
} else |
|
nd_ps[i] = nfv; |
|
} |
|
} |
|
|
/* return value = 0 => input is not a GB */ |
/* return value = 0 => input is not a GB */ |
|
|
NODE nd_gb(int m,int ishomo,int checkonly) |
NODE nd_gb(int m,int ishomo,int checkonly) |
Line 1754 NODE nd_gb(int m,int ishomo,int checkonly) |
|
Line 1813 NODE nd_gb(int m,int ishomo,int checkonly) |
|
ND_pairs l; |
ND_pairs l; |
ND h,nf,s,head; |
ND h,nf,s,head; |
NDV nfv; |
NDV nfv; |
Q q; |
Q q,num,den; |
union oNDC dn; |
union oNDC dn; |
|
|
g = 0; d = 0; |
g = 0; d = 0; |
Line 1767 NODE nd_gb(int m,int ishomo,int checkonly) |
|
Line 1826 NODE nd_gb(int m,int ishomo,int checkonly) |
|
again: |
again: |
l = nd_minp(d,&d); |
l = nd_minp(d,&d); |
if ( SG(l) != sugar ) { |
if ( SG(l) != sugar ) { |
if ( ishomo ) { |
if ( ishomo ) do_diagonalize(sugar,m); |
for ( i = nd_psn-1; SG(nd_ps[i]) == sugar; i-- ) { |
|
s = ndvtond(m,nd_ps[i]); |
|
s = nd_separate_head(s,&head); |
|
nd_nf(m,s,nd_ps,1,&dn,&nf); |
|
if ( !m ) { mulq(HCQ(head),dn.z,&q); HCQ(head) = q; } |
|
nf = nd_add(m,head,nf); |
|
ndv_free(nd_ps[i]); |
|
nd_removecont(m,nf); |
|
nd_ps[i] = ndtondv(m,nf); nd_free(nf); |
|
nd_bound[i] = ndv_compute_bound(nd_ps[i]); |
|
} |
|
} |
|
sugar = SG(l); |
sugar = SG(l); |
if ( DP_Print ) fprintf(asir_out,"%d",sugar); |
if ( DP_Print ) fprintf(asir_out,"%d",sugar); |
} |
} |
|
|
return g; |
return g; |
} |
} |
|
|
NODE nd_gb_trace(int m) |
void do_diagonalize_trace(int sugar,int m) |
{ |
{ |
|
int i,nh,stat; |
|
NODE r,g,t; |
|
ND h,nf,nfq,s,head; |
|
NDV nfv,nfqv; |
|
Q q,den,num; |
|
union oNDC dn; |
|
|
|
for ( i = nd_psn-1; i >= 0 && SG(nd_psh[i]) == sugar; i-- ) { |
|
/* for nd_ps */ |
|
s = ndvtond(m,nd_ps[i]); |
|
s = nd_separate_head(s,&head); |
|
nd_nf_pbucket(m,s,nd_ps,1,&nf); |
|
nf = nd_add(m,head,nf); |
|
ndv_free(nd_ps[i]); |
|
nd_ps[i] = ndtondv(m,nf); |
|
nd_free(nf); |
|
|
|
/* for nd_ps_trace */ |
|
if ( nd_demand ) |
|
nfv = ndv_load(i); |
|
else |
|
nfv = nd_ps_trace[i]; |
|
s = ndvtond(0,nfv); |
|
s = nd_separate_head(s,&head); |
|
nd_nf(0,s,nd_ps_trace,1,&dn,&nf); |
|
NTOQ(NM(dn.z),SGN(dn.z),num); |
|
mulq(HCQ(head),num,&q); HCQ(head) = q; |
|
if ( DN(dn.z) ) { |
|
NTOQ(DN(dn.z),1,den); |
|
nd_mul_c_q(nf,den); |
|
} |
|
nf = nd_add(0,head,nf); |
|
ndv_free(nfv); |
|
nd_removecont(0,nf); |
|
nfv = ndtondv(0,nf); |
|
nd_free(nf); |
|
nd_bound[i] = ndv_compute_bound(nfv); |
|
if ( nd_demand ) { |
|
ndv_save(nfv,i); |
|
ndv_free(nfv); |
|
} else |
|
nd_ps_trace[i] = nfv; |
|
} |
|
} |
|
|
|
NODE nd_gb_trace(int m,int ishomo) |
|
{ |
int i,nh,sugar,stat; |
int i,nh,sugar,stat; |
NODE r,g,t; |
NODE r,g,t; |
ND_pairs d; |
ND_pairs d; |
ND_pairs l; |
ND_pairs l; |
ND h,nf,nfq; |
ND h,nf,nfq,s,head; |
NDV nfv,nfqv; |
NDV nfv,nfqv; |
|
Q q,den,num; |
union oNDC dn; |
union oNDC dn; |
|
|
g = 0; d = 0; |
g = 0; d = 0; |
Line 1841 NODE nd_gb_trace(int m) |
|
Line 1937 NODE nd_gb_trace(int m) |
|
again: |
again: |
l = nd_minp(d,&d); |
l = nd_minp(d,&d); |
if ( SG(l) != sugar ) { |
if ( SG(l) != sugar ) { |
|
if ( ishomo ) do_diagonalize_trace(sugar,m); |
sugar = SG(l); |
sugar = SG(l); |
if ( DP_Print ) fprintf(asir_out,"%d",sugar); |
if ( DP_Print ) fprintf(asir_out,"%d",sugar); |
} |
} |
Line 1916 NODE ndv_reduceall(int m,NODE f) |
|
Line 2013 NODE ndv_reduceall(int m,NODE f) |
|
NODE t,a0,a; |
NODE t,a0,a; |
union oNDC dn; |
union oNDC dn; |
NDV *w; |
NDV *w; |
Q q; |
Q q,num,den; |
|
|
n = length(f); |
n = length(f); |
#if 0 |
#if 0 |
Line 1935 NODE ndv_reduceall(int m,NODE f) |
|
Line 2032 NODE ndv_reduceall(int m,NODE f) |
|
nd_reconstruct(m,0,0); |
nd_reconstruct(m,0,0); |
else { |
else { |
if ( DP_Print ) { printf("."); fflush(stdout); } |
if ( DP_Print ) { printf("."); fflush(stdout); } |
if ( !m ) { mulq(HCQ(head),dn.z,&q); HCQ(head) = q; } |
if ( !m ) { |
|
NTOQ(NM(dn.z),SGN(dn.z),num); |
|
mulq(HCQ(head),num,&q); HCQ(head) = q; |
|
if ( DN(dn.z) ) { |
|
NTOQ(DN(dn.z),1,den); |
|
nd_mul_c_q(nf,den); |
|
} |
|
} |
nf = nd_add(m,head,nf); |
nf = nd_add(m,head,nf); |
ndv_free(nd_ps[i]); |
ndv_free(nd_ps[i]); |
nd_removecont(m,nf); |
nd_removecont(m,nf); |
Line 2324 void nd_gr(LIST f,LIST v,int m,int f4,struct order_spe |
|
Line 2428 void nd_gr(LIST f,LIST v,int m,int f4,struct order_spe |
|
ndv_alloc = 0; |
ndv_alloc = 0; |
get_vars((Obj)f,&fv); pltovl(v,&vv); |
get_vars((Obj)f,&fv); pltovl(v,&vv); |
for ( nvar = 0, tv = vv; tv; tv = NEXT(tv), nvar++ ); |
for ( nvar = 0, tv = vv; tv; tv = NEXT(tv), nvar++ ); |
|
switch ( ord->id ) { |
|
case 1: |
|
if ( ord->nv != nvar ) |
|
error("nd_{gr,f4} : invalid order specification"); |
|
break; |
|
default: |
|
break; |
|
} |
nd_init_ord(ord); |
nd_init_ord(ord); |
for ( t = BDY(f), max = 0; t; t = NEXT(t) ) |
for ( t = BDY(f), max = 0; t; t = NEXT(t) ) |
for ( tv = vv; tv; tv = NEXT(tv) ) { |
for ( tv = vv; tv; tv = NEXT(tv) ) { |
Line 2342 void nd_gr(LIST f,LIST v,int m,int f4,struct order_spe |
|
Line 2454 void nd_gr(LIST f,LIST v,int m,int f4,struct order_spe |
|
if ( fd0 ) NEXT(fd) = 0; |
if ( fd0 ) NEXT(fd) = 0; |
ndv_setup(m,0,fd0); |
ndv_setup(m,0,fd0); |
x = f4?nd_f4(m):nd_gb(m,ishomo,0); |
x = f4?nd_f4(m):nd_gb(m,ishomo,0); |
|
nd_demand = 0; |
x = ndv_reducebase(x); |
x = ndv_reducebase(x); |
x = ndv_reduceall(m,x); |
x = ndv_reduceall(m,x); |
for ( r0 = 0, t = x; t; t = NEXT(t) ) { |
for ( r0 = 0, t = x; t; t = NEXT(t) ) { |
Line 2355 void nd_gr(LIST f,LIST v,int m,int f4,struct order_spe |
|
Line 2468 void nd_gr(LIST f,LIST v,int m,int f4,struct order_spe |
|
|
|
void nd_gr_trace(LIST f,LIST v,int trace,int homo,struct order_spec *ord,LIST *rp) |
void nd_gr_trace(LIST f,LIST v,int trace,int homo,struct order_spec *ord,LIST *rp) |
{ |
{ |
struct order_spec ord1; |
struct order_spec *ord1; |
VL tv,fv,vv,vc; |
VL tv,fv,vv,vc; |
NODE fd,fd0,in0,in,r,r0,t,s,cand; |
NODE fd,fd0,in0,in,r,r0,t,s,cand; |
int m,nocheck,nvar,mindex,e,max; |
int m,nocheck,nvar,mindex,e,max; |
Line 2363 void nd_gr_trace(LIST f,LIST v,int trace,int homo,stru |
|
Line 2476 void nd_gr_trace(LIST f,LIST v,int trace,int homo,stru |
|
NMV a; |
NMV a; |
P p; |
P p; |
EPOS oepos; |
EPOS oepos; |
int obpe,oadv,wmax,i,len,cbpe; |
int obpe,oadv,wmax,i,len,cbpe,ishomo; |
|
|
get_vars((Obj)f,&fv); pltovl(v,&vv); |
get_vars((Obj)f,&fv); pltovl(v,&vv); |
for ( nvar = 0, tv = vv; tv; tv = NEXT(tv), nvar++ ); |
for ( nvar = 0, tv = vv; tv; tv = NEXT(tv), nvar++ ); |
|
switch ( ord->id ) { |
|
case 1: |
|
if ( ord->nv != nvar ) |
|
error("nd_gr_trace : invalid order specification"); |
|
break; |
|
default: |
|
break; |
|
} |
nocheck = 0; |
nocheck = 0; |
mindex = 0; |
mindex = 0; |
|
|
Line 2387 void nd_gr_trace(LIST f,LIST v,int trace,int homo,stru |
|
Line 2508 void nd_gr_trace(LIST f,LIST v,int trace,int homo,stru |
|
nd_init_ord(ord); |
nd_init_ord(ord); |
nd_setup_parameters(nvar,max); |
nd_setup_parameters(nvar,max); |
obpe = nd_bpe; oadv = nmv_adv; oepos = nd_epos; |
obpe = nd_bpe; oadv = nmv_adv; oepos = nd_epos; |
|
ishomo = 1; |
for ( in0 = 0, fd0 = 0, t = BDY(f); t; t = NEXT(t) ) { |
for ( in0 = 0, fd0 = 0, t = BDY(f); t; t = NEXT(t) ) { |
c = ptondv(CO,vv,(P)BDY(t)); |
c = ptondv(CO,vv,(P)BDY(t)); |
|
if ( ishomo ) |
|
ishomo = ishomo && ndv_ishomo(c); |
if ( c ) { |
if ( c ) { |
NEXTNODE(in0,in); BDY(in) = (pointer)c; |
NEXTNODE(in0,in); BDY(in) = (pointer)c; |
NEXTNODE(fd0,fd); BDY(fd) = (pointer)ndv_dup(0,c); |
NEXTNODE(fd0,fd); BDY(fd) = (pointer)ndv_dup(0,c); |
Line 2396 void nd_gr_trace(LIST f,LIST v,int trace,int homo,stru |
|
Line 2520 void nd_gr_trace(LIST f,LIST v,int trace,int homo,stru |
|
} |
} |
if ( in0 ) NEXT(in) = 0; |
if ( in0 ) NEXT(in) = 0; |
if ( fd0 ) NEXT(fd) = 0; |
if ( fd0 ) NEXT(fd) = 0; |
if ( homo ) { |
if ( !ishomo && homo ) { |
for ( t = in0, wmax = 0; t; t = NEXT(t) ) { |
for ( t = in0, wmax = 0; t; t = NEXT(t) ) { |
c = (NDV)BDY(t); len = LEN(c); |
c = (NDV)BDY(t); len = LEN(c); |
for ( a = BDY(c), i = 0; i < len; i++, NMV_ADV(a) ) |
for ( a = BDY(c), i = 0; i < len; i++, NMV_ADV(a) ) |
wmax = MAX(TD(DL(a)),wmax); |
wmax = MAX(TD(DL(a)),wmax); |
} |
} |
homogenize_order(ord,nvar,&ord1); |
homogenize_order(ord,nvar,&ord1); |
nd_init_ord(&ord1); |
nd_init_ord(ord1); |
nd_setup_parameters(nvar+1,wmax); |
nd_setup_parameters(nvar+1,wmax); |
for ( t = fd0; t; t = NEXT(t) ) |
for ( t = fd0; t; t = NEXT(t) ) |
ndv_homogenize((NDV)BDY(t),obpe,oadv,oepos); |
ndv_homogenize((NDV)BDY(t),obpe,oadv,oepos); |
Line 2412 void nd_gr_trace(LIST f,LIST v,int trace,int homo,stru |
|
Line 2536 void nd_gr_trace(LIST f,LIST v,int trace,int homo,stru |
|
if ( Demand ) |
if ( Demand ) |
nd_demand = 1; |
nd_demand = 1; |
ndv_setup(m,1,fd0); |
ndv_setup(m,1,fd0); |
cand = nd_gb_trace(m); |
cand = nd_gb_trace(m,ishomo || homo); |
if ( !cand ) { |
if ( !cand ) { |
/* failure */ |
/* failure */ |
if ( trace > 1 ) { *rp = 0; return; } |
if ( trace > 1 ) { *rp = 0; return; } |
else m = get_lprime(++mindex); |
else m = get_lprime(++mindex); |
continue; |
continue; |
} |
} |
if ( homo ) { |
if ( !ishomo && homo ) { |
/* dehomogenization */ |
/* dehomogenization */ |
for ( t = cand; t; t = NEXT(t) ) ndv_dehomogenize((NDV)BDY(t),ord); |
for ( t = cand; t; t = NEXT(t) ) ndv_dehomogenize((NDV)BDY(t),ord); |
nd_init_ord(ord); |
nd_init_ord(ord); |
Line 2441 void nd_gr_trace(LIST f,LIST v,int trace,int homo,stru |
|
Line 2565 void nd_gr_trace(LIST f,LIST v,int trace,int homo,stru |
|
/* try the next modulus */ |
/* try the next modulus */ |
m = get_lprime(++mindex); |
m = get_lprime(++mindex); |
/* reset the parameters */ |
/* reset the parameters */ |
if ( homo ) { |
if ( !ishomo && homo ) { |
nd_init_ord(&ord1); |
nd_init_ord(ord1); |
nd_setup_parameters(nvar+1,wmax); |
nd_setup_parameters(nvar+1,wmax); |
} else { |
} else { |
nd_init_ord(ord); |
nd_init_ord(ord); |
Line 2673 void ndv_dehomogenize(NDV p,struct order_spec *ord) |
|
Line 2797 void ndv_dehomogenize(NDV p,struct order_spec *ord) |
|
for ( m = BDY(p), i = 0; i < len; NMV_ADV(m), i++ ) |
for ( m = BDY(p), i = 0; i < len; NMV_ADV(m), i++ ) |
ndl_dehomogenize(DL(m)); |
ndl_dehomogenize(DL(m)); |
if ( newwpd != nd_wpd ) { |
if ( newwpd != nd_wpd ) { |
newadv = sizeof(struct oNMV)+(newwpd-1)*sizeof(UINT); |
newadv = ROUND_FOR_ALIGN(sizeof(struct oNMV)+(newwpd-1)*sizeof(UINT)); |
for ( m = r = BDY(p), i = 0; i < len; NMV_ADV(m), NDV_NADV(r), i++ ) { |
for ( m = r = BDY(p), i = 0; i < len; NMV_ADV(m), NDV_NADV(r), i++ ) { |
CQ(r) = CQ(m); |
CQ(r) = CQ(m); |
for ( j = 0; j < newexporigin; j++ ) DL(r)[j] = DL(m)[j]; |
for ( j = 0; j < newexporigin; j++ ) DL(r)[j] = DL(m)[j]; |
Line 2837 void nd_setup_parameters(int nvar,int max) { |
|
Line 2961 void nd_setup_parameters(int nvar,int max) { |
|
|
|
nd_nvar = nvar; |
nd_nvar = nvar; |
if ( max ) { |
if ( max ) { |
if ( max < 2 ) nd_bpe = 1; |
/* XXX */ |
|
if ( do_weyl ) nd_bpe = 32; |
|
else if ( max < 2 ) nd_bpe = 1; |
else if ( max < 4 ) nd_bpe = 2; |
else if ( max < 4 ) nd_bpe = 2; |
else if ( max < 8 ) nd_bpe = 3; |
else if ( max < 8 ) nd_bpe = 3; |
else if ( max < 16 ) nd_bpe = 4; |
else if ( max < 16 ) nd_bpe = 4; |
Line 2867 void nd_setup_parameters(int nvar,int max) { |
|
Line 2993 void nd_setup_parameters(int nvar,int max) { |
|
nd_mask[nd_epw-i-1] = (nd_mask0<<(i*nd_bpe)); |
nd_mask[nd_epw-i-1] = (nd_mask0<<(i*nd_bpe)); |
nd_mask1 |= (1<<(nd_bpe-1))<<(i*nd_bpe); |
nd_mask1 |= (1<<(nd_bpe-1))<<(i*nd_bpe); |
} |
} |
nm_adv = sizeof(struct oNM)+(nd_wpd-1)*sizeof(UINT); |
nmv_adv = ROUND_FOR_ALIGN(sizeof(struct oNMV)+(nd_wpd-1)*sizeof(UINT)); |
nmv_adv = sizeof(struct oNMV)+(nd_wpd-1)*sizeof(UINT); |
|
nd_epos = nd_create_epos(nd_ord); |
nd_epos = nd_create_epos(nd_ord); |
nd_blockmask = nd_create_blockmask(nd_ord); |
nd_blockmask = nd_create_blockmask(nd_ord); |
} |
} |
Line 3823 IndArray nm_ind_pair_to_vect_compress(int mod,UINT *s0 |
|
Line 3948 IndArray nm_ind_pair_to_vect_compress(int mod,UINT *s0 |
|
NDV p; |
NDV p; |
unsigned char *ivc; |
unsigned char *ivc; |
unsigned short *ivs; |
unsigned short *ivs; |
UINT *v,*ivi; |
UINT *v,*ivi,*s0v; |
int i,j,len,prev,diff,cdiff; |
int i,j,len,prev,diff,cdiff; |
IndArray r; |
IndArray r; |
|
|
Line 3832 IndArray nm_ind_pair_to_vect_compress(int mod,UINT *s0 |
|
Line 3957 IndArray nm_ind_pair_to_vect_compress(int mod,UINT *s0 |
|
p = nd_ps[pair->index]; |
p = nd_ps[pair->index]; |
len = LEN(p); |
len = LEN(p); |
t = (UINT *)ALLOCA(nd_wpd*sizeof(UINT)); |
t = (UINT *)ALLOCA(nd_wpd*sizeof(UINT)); |
r = (IndArray)MALLOC(sizeof(struct oIndArray)); |
|
v = (unsigned int *)ALLOCA(len*sizeof(unsigned int)); |
v = (unsigned int *)ALLOCA(len*sizeof(unsigned int)); |
for ( i = j = 0, s = s0, mr = BDY(p); j < len; j++, NMV_ADV(mr) ) { |
for ( i = j = 0, s = s0, mr = BDY(p); j < len; j++, NMV_ADV(mr) ) { |
ndl_add(d,DL(mr),t); |
ndl_add(d,DL(mr),t); |
for ( ; !ndl_equal(t,s); s += nd_wpd, i++ ); |
for ( ; !ndl_equal(t,s); s += nd_wpd, i++ ); |
v[j] = i; |
v[j] = i; |
} |
} |
|
r = (IndArray)MALLOC(sizeof(struct oIndArray)); |
r->head = v[0]; |
r->head = v[0]; |
diff = 0; |
diff = 0; |
for ( i = 1; i < len; i++ ) { |
for ( i = 1; i < len; i++ ) { |
Line 4067 NODE nd_f4(int m) |
|
Line 4192 NODE nd_f4(int m) |
|
ND spol,red; |
ND spol,red; |
NDV nf,redv; |
NDV nf,redv; |
NM s0,s; |
NM s0,s; |
NODE rp0,sp0,srp0,nflist; |
NODE rp0,srp0,nflist; |
int nsp,nred,col,rank,len,k,j,a; |
int nsp,nred,col,rank,len,k,j,a; |
UINT c; |
UINT c; |
UINT **spmat; |
UINT **spmat; |
Line 4100 NODE nd_f4(int m) |
|
Line 4225 NODE nd_f4(int m) |
|
d = nd_reconstruct(m,0,d); |
d = nd_reconstruct(m,0,d); |
continue; |
continue; |
} |
} |
if ( !sp0 ) continue; |
if ( bucket->m < 0 ) continue; |
col = nd_symbolic_preproc(bucket,&s0vect,&rp0); |
col = nd_symbolic_preproc(bucket,&s0vect,&rp0); |
if ( !col ) { |
if ( !col ) { |
for ( t = l; NEXT(t); t = NEXT(t) ); |
for ( t = l; NEXT(t); t = NEXT(t) ); |
Line 4329 NODE nd_f4_red_dist(int m,ND_pairs sp0,UINT *s0vect,in |
|
Line 4454 NODE nd_f4_red_dist(int m,ND_pairs sp0,UINT *s0vect,in |
|
nd_send_int(nd_wpd); |
nd_send_int(nd_wpd); |
nd_send_int(nmv_adv); |
nd_send_int(nmv_adv); |
|
|
saveobj(nd_write,dp_current_spec.obj); fflush(nd_write); |
saveobj(nd_write,dp_current_spec->obj); fflush(nd_write); |
|
|
nd_send_int(nd_psn); |
nd_send_int(nd_psn); |
for ( i = 0; i < nd_psn; i++ ) nd_send_ndv(nd_ps[i]); |
for ( i = 0; i < nd_psn; i++ ) nd_send_ndv(nd_ps[i]); |
Line 4375 void nd_exec_f4_red_dist() |
|
Line 4500 void nd_exec_f4_red_dist() |
|
ND_pairs *sp0; |
ND_pairs *sp0; |
int *colstat; |
int *colstat; |
int a,sprow,rank; |
int a,sprow,rank; |
struct order_spec ord; |
struct order_spec *ord; |
Obj ordspec; |
Obj ordspec; |
ND spol; |
ND spol; |
int maxrs; |
int maxrs; |
Line 4390 void nd_exec_f4_red_dist() |
|
Line 4515 void nd_exec_f4_red_dist() |
|
nmv_adv = nd_recv_int(); |
nmv_adv = nd_recv_int(); |
|
|
loadobj(nd_read,&ordspec); |
loadobj(nd_read,&ordspec); |
create_order_spec(ordspec,&ord); |
create_order_spec(0,ordspec,&ord); |
nd_init_ord(&ord); |
nd_init_ord(ord); |
nd_setup_parameters(nd_nvar,0); |
nd_setup_parameters(nd_nvar,0); |
|
|
nd_psn = nd_recv_int(); |
nd_psn = nd_recv_int(); |