version 1.11, 2019/03/03 05:21:17 |
version 1.12, 2019/03/17 02:48:13 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2018/engine/Q.c,v 1.10 2018/12/10 22:24:42 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2018/engine/Q.c,v 1.11 2019/03/03 05:21:17 noro Exp $ */ |
#include "ca.h" |
#include "ca.h" |
#include "gmp.h" |
#include "gmp.h" |
#include "base.h" |
#include "base.h" |
Line 1369 int inttorat(Z c,Z m,Z b,Z *nmp,Z *dnp) |
|
Line 1369 int inttorat(Z c,Z m,Z b,Z *nmp,Z *dnp) |
|
|
|
extern int f4_nocheck; |
extern int f4_nocheck; |
|
|
int mpz_gensolve_check(MAT mat,mpz_t **nm,mpz_t dn,int rank,int *rind,int *cind) |
int mpz_gensolve_check(MAT mat,mpz_t **nm,mpz_t dn,int rank,int clen,int *rind,int *cind) |
{ |
{ |
int row,col,clen,i,j,k,l; |
int row,col,i,j,k,l; |
mpz_t t; |
mpz_t t; |
mpz_t *w; |
mpz_t *w; |
Z *mati; |
Z *mati; |
mpz_t *nmk; |
mpz_t *nmk; |
|
|
if ( f4_nocheck ) return 1; |
if ( f4_nocheck ) return 1; |
row = mat->row; col = mat->col; clen = col-rank; |
row = mat->row; col = mat->col; |
w = (mpz_t *)MALLOC(clen*sizeof(mpz_t)); |
w = (mpz_t *)MALLOC(clen*sizeof(mpz_t)); |
mpz_init(t); |
mpz_init(t); |
for ( i = 0; i < clen; i++ ) mpz_init(w[i]); |
for ( i = 0; i < clen; i++ ) mpz_init(w[i]); |
|
|
for ( j = k = l = 0; j < col; j++ ) |
for ( j = k = l = 0; j < col; j++ ) |
if ( colstat[j] ) rind[k++] = j; |
if ( colstat[j] ) rind[k++] = j; |
else cind[l++] = j; |
else cind[l++] = j; |
if ( mpz_gensolve_check(mat,num,den,rank,rind,cind) ) { |
if ( mpz_gensolve_check(mat,num,den,rank,col-rank,rind,cind) ) { |
MKMAT(r,rank,col-rank); *nm = r; |
MKMAT(r,rank,col-rank); *nm = r; |
for ( i = 0; i < rank; i++ ) |
for ( i = 0; i < rank; i++ ) |
for ( j = 0; j < col-rank; j++ ) { |
for ( j = 0; j < col-rank; j++ ) { |
Line 2274 int generic_gauss_elim_hensel64(MAT mat,MAT *nmmat,Z * |
|
Line 2274 int generic_gauss_elim_hensel64(MAT mat,MAT *nmmat,Z * |
|
rind[k++] = j; |
rind[k++] = j; |
else if ( !cinfo[j] ) |
else if ( !cinfo[j] ) |
cind[l++] = j; |
cind[l++] = j; |
ret = mpz_gensolve_check(mat,nm,den,rank,rind,cind); |
ret = mpz_gensolve_check(mat,nm,den,rank,ri,rind,cind); |
if ( ret ) { |
if ( ret ) { |
*rindp = rind; |
*rindp = rind; |
*cindp = cind; |
*cindp = cind; |