version 1.7, 2018/10/01 05:49:06 |
version 1.10, 2018/10/19 23:27:38 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2018/engine/nd.c,v 1.6 2018/09/28 08:20:28 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2018/engine/nd.c,v 1.9 2018/10/02 09:06:15 noro Exp $ */ |
|
|
#include "nd.h" |
#include "nd.h" |
|
|
Line 5962 void expand_array(Z *svect,Z *cvect,int n) |
|
Line 5962 void expand_array(Z *svect,Z *cvect,int n) |
|
if ( svect[i] ) svect[i] = cvect[j++]; |
if ( svect[i] ) svect[i] = cvect[j++]; |
} |
} |
|
|
#if 1 |
#if 0 |
int ndv_reduce_vect_q(Z *svect,int trace,int col,IndArray *imat,NM_ind_pair *rp0,int nred) |
int ndv_reduce_vect_q(Z *svect,int trace,int col,IndArray *imat,NM_ind_pair *rp0,int nred) |
{ |
{ |
int i,j,k,len,pos,prev,nz; |
int i,j,k,len,pos,prev,nz; |
Line 6042 int ndv_reduce_vect_q(Z *svect,int trace,int col,IndAr |
|
Line 6042 int ndv_reduce_vect_q(Z *svect,int trace,int col,IndAr |
|
return maxrs; |
return maxrs; |
} |
} |
#else |
#else |
|
|
/* direct mpz version */ |
/* direct mpz version */ |
int ndv_reduce_vect_q(Z *svect0,int trace,int col,IndArray *imat,NM_ind_pair *rp0,int nred) |
int ndv_reduce_vect_q(Z *svect0,int trace,int col,IndArray *imat,NM_ind_pair *rp0,int nred) |
{ |
{ |
Line 6084 int ndv_reduce_vect_q(Z *svect0,int trace,int col,IndA |
|
Line 6085 int ndv_reduce_vect_q(Z *svect0,int trace,int col,IndA |
|
mpz_div(cs,svect[k],gcd); |
mpz_div(cs,svect[k],gcd); |
mpz_div(cr,BDY(CZ(mr)),gcd); |
mpz_div(cr,BDY(CZ(mr)),gcd); |
mpz_neg(cs,cs); |
mpz_neg(cs,cs); |
for ( j = 0; j < col; j++ ) |
if ( MUNIMPZ(cr) ) |
mpz_mul(svect[j],svect[j],cr); |
for ( j = 0; j < col; j++ ) mpz_neg(svect[j],svect[j]); |
|
else if ( !UNIMPZ(cr) ) |
|
for ( j = 0; j < col; j++ ) { |
|
if ( mpz_sgn(svect[j]) ) mpz_mul(svect[j],svect[j],cr); |
|
} |
mpz_set_ui(svect[k],0); |
mpz_set_ui(svect[k],0); |
prev = k; |
prev = k; |
switch ( ivect->width ) { |
switch ( ivect->width ) { |
Line 8196 P ndc_div(int mod,union oNDC a,union oNDC b) |
|
Line 8201 P ndc_div(int mod,union oNDC a,union oNDC b) |
|
int inv,t; |
int inv,t; |
|
|
if ( mod == -1 ) c.m = _mulsf(a.m,_invsf(b.m)); |
if ( mod == -1 ) c.m = _mulsf(a.m,_invsf(b.m)); |
else if ( mod == -2 ) divlf(a.gz,b.gz,&c.gz); |
else if ( mod == -2 ) divlf(a.z,b.z,&c.z); |
else if ( mod ) { |
else if ( mod ) { |
inv = invm(b.m,mod); |
inv = invm(b.m,mod); |
DMAR(a.m,inv,0,mod,t); c.m = t; |
DMAR(a.m,inv,0,mod,t); c.m = t; |
Line 8216 P ndctop(int mod,union oNDC c) |
|
Line 8221 P ndctop(int mod,union oNDC c) |
|
if ( mod == -1 ) { |
if ( mod == -1 ) { |
e = IFTOF(c.m); MKGFS(e,gfs); return (P)gfs; |
e = IFTOF(c.m); MKGFS(e,gfs); return (P)gfs; |
} else if ( mod == -2 ) { |
} else if ( mod == -2 ) { |
q = c.gz; return (P)q; |
q = c.z; return (P)q; |
} else if ( mod > 0 ) { |
} else if ( mod > 0 ) { |
STOZ(c.m,q); return (P)q; |
STOZ(c.m,q); return (P)q; |
} else |
} else |