| version 1.7, 2018/10/01 05:49:06 |
version 1.9, 2018/10/02 09:06:15 |
|
|
| /* $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.8 2018/10/01 07:48:01 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 ) { |