[BACK]Return to array.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / builtin

Diff for /OpenXM_contrib2/asir2000/builtin/array.c between version 1.35 and 1.40

version 1.35, 2004/06/30 20:01:36 version 1.40, 2004/12/02 13:53:31
Line 45 
Line 45 
  * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,   * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
  * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.   * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
  *   *
  * $OpenXM: OpenXM_contrib2/asir2000/builtin/array.c,v 1.34 2003/11/27 02:20:51 noro Exp $   * $OpenXM: OpenXM_contrib2/asir2000/builtin/array.c,v 1.39 2004/12/01 12:55:19 noro Exp $
 */  */
 #include "ca.h"  #include "ca.h"
 #include "base.h"  #include "base.h"
 #include "parse.h"  #include "parse.h"
 #include "inline.h"  #include "inline.h"
   
   #define F4_INTRAT_PERIOD 8
   
 #if 0  #if 0
 #undef DMAR  #undef DMAR
 #define DMAR(a1,a2,a3,d,r) (r)=dmar(a1,a2,a3,d);  #define DMAR(a1,a2,a3,d,r) (r)=dmar(a1,a2,a3,d);
Line 87  void Pmat_swap_col_destructive();
Line 89  void Pmat_swap_col_destructive();
 void Pvect();  void Pvect();
 void Pmat();  void Pmat();
 void Pmatc();  void Pmatc();
   void Pnd_det();
   
 struct ftab array_tab[] = {  struct ftab array_tab[] = {
         {"solve_by_lu_gfmmat",Psolve_by_lu_gfmmat,4},          {"solve_by_lu_gfmmat",Psolve_by_lu_gfmmat,4},
Line 111  struct ftab array_tab[] = {
Line 114  struct ftab array_tab[] = {
         {"ltov",Pltov,1},          {"ltov",Pltov,1},
         {"size",Psize,1},          {"size",Psize,1},
         {"det",Pdet,-2},          {"det",Pdet,-2},
           {"nd_det",Pnd_det,-2},
         {"invmat",Pinvmat,-2},          {"invmat",Pinvmat,-2},
         {"leqm",Pleqm,2},          {"leqm",Pleqm,2},
         {"leqm1",Pleqm1,2},          {"leqm1",Pleqm1,2},
Line 1116  RESET:
Line 1120  RESET:
                         add_eg(&eg_chrem_split,&tmp0,&tmp1);                          add_eg(&eg_chrem_split,&tmp0,&tmp1);
   
                         get_eg(&tmp0);                          get_eg(&tmp0);
                         if ( ind % 16 )                          if ( ind % F4_INTRAT_PERIOD )
                                 ret = 0;                                  ret = 0;
                         else                          else
                                 ret = intmtoratm(crmat,m1,*nm,dn);                                  ret = intmtoratm(crmat,m1,*nm,dn);
Line 1168  int generic_gauss_elim_hensel(MAT mat,MAT *nmmat,Q *dn
Line 1172  int generic_gauss_elim_hensel(MAT mat,MAT *nmmat,Q *dn
         int *rind,*cind;          int *rind,*cind;
         int count;          int count;
         struct oEGT eg_mul,eg_inv,tmp0,tmp1;          struct oEGT eg_mul,eg_inv,tmp0,tmp1;
           int period;
   
         a0 = (Q **)mat->body;          a0 = (Q **)mat->body;
         row = mat->row; col = mat->col;          row = mat->row; col = mat->col;
Line 1215  int generic_gauss_elim_hensel(MAT mat,MAT *nmmat,Q *dn
Line 1220  int generic_gauss_elim_hensel(MAT mat,MAT *nmmat,Q *dn
                         *cindp = cind = (int *)MALLOC_ATOMIC((ri)*sizeof(int));                          *cindp = cind = (int *)MALLOC_ATOMIC((ri)*sizeof(int));
   
                         init_eg(&eg_mul); init_eg(&eg_inv);                          init_eg(&eg_mul); init_eg(&eg_inv);
                           period = F4_INTRAT_PERIOD;
                         for ( q = ONE, count = 0; ; count++ ) {                          for ( q = ONE, count = 0; ; count++ ) {
                                 fprintf(stderr,".");                                  if ( DP_Print )
                                           fprintf(stderr,".");
                                 /* wc = -b mod md */                                  /* wc = -b mod md */
                                 for ( i = 0; i < rank; i++ )                                  for ( i = 0; i < rank; i++ )
                                         for ( j = 0, bi = b[i], wi = wc[i]; j < ri; j++ )                                          for ( j = 0, bi = b[i], wi = wc[i]; j < ri; j++ )
Line 1255  int generic_gauss_elim_hensel(MAT mat,MAT *nmmat,Q *dn
Line 1262  int generic_gauss_elim_hensel(MAT mat,MAT *nmmat,Q *dn
                                 add_eg(&eg_mul,&tmp0,&tmp1);                                  add_eg(&eg_mul,&tmp0,&tmp1);
                                 /* q = q*md */                                  /* q = q*md */
                                 mulq(q,mdq,&u); q = u;                                  mulq(q,mdq,&u); q = u;
                                 if ( !(count % 16) && intmtoratm_q(xmat,NM(q),*nmmat,dn) ) {                                  if ( !(count % period) )
                                         for ( j = k = l = 0; j < col; j++ )                                          if ( intmtoratm_q(xmat,NM(q),*nmmat,dn) ) {
                                                 if ( cinfo[j] )                                                  for ( j = k = l = 0; j < col; j++ )
                                                         rind[k++] = j;                                                          if ( cinfo[j] )
                                                 else                                                                  rind[k++] = j;
                                                         cind[l++] = j;                                                          else
                                         if ( gensolve_check(mat,*nmmat,*dn,rind,cind) ) {                                                                  cind[l++] = j;
                                                 fprintf(stderr,"\n");                                                  if ( gensolve_check(mat,*nmmat,*dn,rind,cind) ) {
                                                 print_eg("INV",&eg_inv);                                                          if ( DP_Print ) {
                                                 print_eg("MUL",&eg_mul);                                                                  fprintf(stderr,"\n");
                                                 fflush(asir_out);                                                                  print_eg("INV",&eg_inv);
                                                 return rank;                                                                  print_eg("MUL",&eg_mul);
                                         }                                                                  fflush(asir_out);
                                 }                                                          }
                                                           return rank;
                                                   }
                                           } else
                                                   period *=2;
                         }                          }
         }          }
 }  }
Line 2913  void printimat(int **mat,int row,int col)
Line 2924  void printimat(int **mat,int row,int col)
                 }                  }
                 printf("\n");                  printf("\n");
         }          }
   }
   
   void Pnd_det(NODE arg,P *rp)
   {
           if ( argc(arg) == 1 )
                   nd_det(0,ARG0(arg),rp);
           else
                   nd_det(QTOS((Q)ARG1(arg)),ARG0(arg),rp);
 }  }

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.40

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>