version 1.45, 2003/08/25 08:57:31 |
version 1.48, 2003/08/26 01:42:12 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.44 2003/08/22 08:32:51 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.47 2003/08/25 09:19:43 noro Exp $ */ |
|
|
#include "ca.h" |
#include "ca.h" |
#include "inline.h" |
#include "inline.h" |
Line 271 void nd_reconstruct_direct(int mod,NDV *ps,int len); |
|
Line 271 void nd_reconstruct_direct(int mod,NDV *ps,int len); |
|
void nd_setup(int mod,int trace,NODE f); |
void nd_setup(int mod,int trace,NODE f); |
void nd_setup_parameters(); |
void nd_setup_parameters(); |
BlockMask nd_create_blockmask(struct order_spec *ord); |
BlockMask nd_create_blockmask(struct order_spec *ord); |
|
int nd_get_exporigin(struct order_spec *ord); |
|
|
/* ND functions */ |
/* ND functions */ |
int nd_check_candidate(NODE input,NODE cand); |
int nd_check_candidate(NODE input,NODE cand); |
|
|
} else if ( nf ) { |
} else if ( nf ) { |
if ( checkonly ) return 0; |
if ( checkonly ) return 0; |
printf("+"); fflush(stdout); |
printf("+"); fflush(stdout); |
|
ndl_print(HDL(nf)); |
nh = m?nd_newps(m,nf,0):nd_newps(m,0,nf); |
nh = m?nd_newps(m,nf,0):nd_newps(m,0,nf); |
d = update_pairs(d,g,nh); |
d = update_pairs(d,g,nh); |
g = update_base(g,nh); |
g = update_base(g,nh); |
Line 1906 int nd_newps(int mod,ND a,ND aq) |
|
Line 1908 int nd_newps(int mod,ND a,ND aq) |
|
} |
} |
if ( a && aq ) { |
if ( a && aq ) { |
/* trace lifting */ |
/* trace lifting */ |
if ( !rem(NM(HCQ(aq)),mod) ) return -1; |
if ( !rem(NM(HCQ(aq)),mod) ) |
|
return -1; |
} |
} |
NEWRHist(r); nd_psh[nd_psn] = r; |
NEWRHist(r); nd_psh[nd_psn] = r; |
if ( aq ) { |
if ( aq ) { |
Line 2346 void ndv_dehomogenize(NDV p,struct order_spec *ord) |
|
Line 2349 void ndv_dehomogenize(NDV p,struct order_spec *ord) |
|
|
|
len = p->len; |
len = p->len; |
newnvar = nd_nvar-1; |
newnvar = nd_nvar-1; |
newexporigin = ord->ord.block.length+1; |
newexporigin = nd_get_exporigin(ord); |
newwpd = newnvar/nd_epw+(newnvar%nd_epw?1:0)+newexporigin; |
newwpd = newnvar/nd_epw+(newnvar%nd_epw?1:0)+newexporigin; |
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)); |
Line 2502 unsigned int *ndv_compute_bound(NDV p) |
|
Line 2505 unsigned int *ndv_compute_bound(NDV p) |
|
return t; |
return t; |
} |
} |
|
|
void nd_setup_parameters() { |
int nd_get_exporigin(struct order_spec *ord) |
int i,n,elen; |
{ |
|
|
nd_epw = (sizeof(unsigned int)*8)/nd_bpe; |
|
elen = nd_nvar/nd_epw+(nd_nvar%nd_epw?1:0); |
|
|
|
switch ( nd_ord->id ) { |
switch ( nd_ord->id ) { |
case 0: |
case 0: |
nd_exporigin = 1; |
return 1; |
break; |
|
case 1: |
case 1: |
/* block order */ |
/* block order */ |
/* d[0]:weight d[1]:w0,...,d[nd_exporigin-1]:w(n-1) */ |
/* d[0]:weight d[1]:w0,...,d[nd_exporigin-1]:w(n-1) */ |
nd_exporigin = nd_ord->ord.block.length+1; |
return ord->ord.block.length+1; |
break; |
|
case 2: |
case 2: |
error("nd_setup_parameters : matrix order is not supported yet."); |
error("nd_setup_parameters : matrix order is not supported yet."); |
break; |
|
} |
} |
|
} |
|
|
|
void nd_setup_parameters() { |
|
int i,n,elen; |
|
|
|
nd_epw = (sizeof(unsigned int)*8)/nd_bpe; |
|
elen = nd_nvar/nd_epw+(nd_nvar%nd_epw?1:0); |
|
|
|
nd_exporigin = nd_get_exporigin(nd_ord); |
nd_wpd = nd_exporigin+elen; |
nd_wpd = nd_exporigin+elen; |
nd_epos = (EPOS)MALLOC_ATOMIC(nd_nvar*sizeof(struct oEPOS)); |
nd_epos = (EPOS)MALLOC_ATOMIC(nd_nvar*sizeof(struct oEPOS)); |
for ( i = 0; i < nd_nvar; i++ ) { |
for ( i = 0; i < nd_nvar; i++ ) { |
Line 2878 NDV dptondv(int mod,DP p) |
|
Line 2883 NDV dptondv(int mod,DP p) |
|
DP q; |
DP q; |
int l,i,n; |
int l,i,n; |
|
|
if ( !p ) return 0; |
|
for ( t = BDY(p), l = 0; t; t = NEXT(t), l++ ); |
|
if ( mod ) { |
if ( mod ) { |
_dp_mod(p,mod,0,&q); p = q; |
_dp_mod(p,mod,0,&q); p = q; |
|
} |
|
if ( !p ) return 0; |
|
for ( t = BDY(p), l = 0; t; t = NEXT(t), l++ ); |
|
if ( mod ) |
m0 = m = (NMV)MALLOC_ATOMIC(l*nmv_adv); |
m0 = m = (NMV)MALLOC_ATOMIC(l*nmv_adv); |
} else |
else |
m0 = m = (NMV)MALLOC(l*nmv_adv); |
m0 = m = (NMV)MALLOC(l*nmv_adv); |
n = NV(p); |
n = NV(p); |
for ( t = BDY(p); t; i++, t = NEXT(t), NMV_ADV(m) ) { |
for ( t = BDY(p); t; t = NEXT(t), NMV_ADV(m) ) { |
if ( mod ) CM(m) = ITOS(C(t)); |
if ( mod ) CM(m) = ITOS(C(t)); |
else CQ(m) = (Q)C(t); |
else CQ(m) = (Q)C(t); |
dltondl(n,DL(t),DL(m)); |
dltondl(n,DL(t),DL(m)); |