[BACK]Return to D.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2018 / engine

Diff for /OpenXM_contrib2/asir2018/engine/D.c between version 1.1 and 1.2

version 1.1, 2018/09/19 05:45:06 version 1.2, 2018/09/28 08:20:28
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: OpenXM_contrib2/asir2018/engine/D.c,v 1.1 2018/09/19 05:45:06 noro Exp $
 */  */
 #include "ca.h"  #include "ca.h"
   
Line 126  void dtestsql(P f,ML list,struct oDUM *dc,DCP *dcp)
Line 126  void dtestsql(P f,ML list,struct oDUM *dc,DCP *dcp)
     }      }
   }    }
   for ( t = f, j = 0; j < n; j++ ) {    for ( t = f, j = 0; j < n; j++ ) {
     STOQ(dc[j].n,tq); pwrp(CO,true[j],tq,&s); udivpz(t,s,&fq,&fr);      STOZ(dc[j].n,tq); pwrp(CO,true[j],tq,&s); udivpz(t,s,&fq,&fr);
     if ( fq && !fr )      if ( fq && !fr )
       t = fq;        t = fq;
     else {      else {
Line 135  void dtestsql(P f,ML list,struct oDUM *dc,DCP *dcp)
Line 135  void dtestsql(P f,ML list,struct oDUM *dc,DCP *dcp)
     }      }
   }    }
   for ( j = 0, dcr = dcr0 = 0; j < n; j++ ) {    for ( j = 0, dcr = dcr0 = 0; j < n; j++ ) {
     NEXTDC(dcr0,dcr); STOQ(dc[j].n,DEG(dcr)); COEF(dcr) = true[j];      NEXTDC(dcr0,dcr); STOZ(dc[j].n,DEG(dcr)); COEF(dcr) = true[j];
   }    }
   NEXT(dcr) = 0; *dcp = dcr0;    NEXT(dcr) = 0; *dcp = dcr0;
 }  }
Line 170  void dtestroot(int m,int b,P f,LUM fl,struct oDUM *dc,
Line 170  void dtestroot(int m,int b,P f,LUM fl,struct oDUM *dc,
     *dcp = 0;      *dcp = 0;
     return;      return;
   }    }
   STOQ(dc[0].n,q); pwrp(CO,t,q,&s); subp(CO,s,f,&u);    STOZ(dc[0].n,q); pwrp(CO,t,q,&s); subp(CO,s,f,&u);
   if ( u )    if ( u )
     *dcp = 0;      *dcp = 0;
   else {    else {
     NEWDC(dcr); STOQ(dc[0].n,DEG(dcr));      NEWDC(dcr); STOZ(dc[0].n,DEG(dcr));
     COEF(dcr) = t; NEXT(dcr) = 0; *dcp = dcr;      COEF(dcr) = t; NEXT(dcr) = 0; *dcp = dcr;
   }    }
 }  }
Line 299  void nthrootz(Z number,int n,Z *root)
Line 299  void nthrootz(Z number,int n,Z *root)
   int sgn,index,p,i,tmp,tp,mlr,num0;    int sgn,index,p,i,tmp,tp,mlr,num0;
   
   for (  i = 0; !(n % 2); n /= 2, i++ );    for (  i = 0; !(n % 2); n /= 2, i++ );
   STOQ(n,z);    STOZ(n,z);
   for ( index = 0, num = number; ; index++ ) {    for ( index = 0, num = number; ; index++ ) {
     if ( n == 1 )      if ( n == 1 )
       goto TAIL;        goto TAIL;
     p = get_lprime(index);      p = get_lprime(index);
     if ( !(num0 = remqi((Q)num,p)) )      if ( !(num0 = remqi((Q)num,p)) )
       continue;        continue;
     STOQ(n,n1); STOQ(p-1,n2); gcdz(n1,n2,&gcd);      STOZ(n,n1); STOZ(p-1,n2); gcdz(n1,n2,&gcd);
     if ( !UNIQ(gcd) )      if ( !UNIQ(gcd) )
       continue;        continue;
     tp = pwrm(p,num0,invm(n,p-1)); STOQ(tp,s);      tp = pwrm(p,num0,invm(n,p-1)); STOZ(tp,s);
     mlr = invm(dmb(p,n,pwrm(p,tp,n-1),&tmp),p);      mlr = invm(dmb(p,n,pwrm(p,tp,n-1),&tmp),p);
     STOQ(p,base); STOQ(p,pn);      STOZ(p,base); STOZ(p,pn);
     while ( 1 ) {      while ( 1 ) {
       pwrz(s,z,&t); subz(num,t,&u);        pwrz(s,z,&t); subz(num,t,&u);
       if ( !u ) {        if ( !u ) {
Line 327  void nthrootz(Z number,int n,Z *root)
Line 327  void nthrootz(Z number,int n,Z *root)
         *root = 0;          *root = 0;
         return;          return;
       }        }
       STOQ(dmb(p,mlr,remqi((Q)q,p),&tmp),t);        STOZ(dmb(p,mlr,remqi((Q)q,p),&tmp),t);
       mulz(t,base,&u); addz(u,s,&t); s = t;        mulz(t,base,&u); addz(u,s,&t); s = t;
       mulz(base,pn,&t); base = t;        mulz(base,pn,&t); base = t;
     }      }
Line 366  void sqrtz(Z number,Z *root)
Line 366  void sqrtz(Z number,Z *root)
         *root = 0;          *root = 0;
         return;          return;
       } else {        } else {
         STOQ(2,two);          STOZ(2,two);
         divqrz(sa,two,&q,&r);          divqrz(sa,two,&q,&r);
         if ( sgn > 0 )          if ( sgn > 0 )
           addz(a,q,&r);            addz(a,q,&r);
Line 390  void lumtop(V v,int mod,int bound,LUM f,P *g)
Line 390  void lumtop(V v,int mod,int bound,LUM f,P *g)
     if ( q ) {      if ( q ) {
       NEXTDC(dc0,dc);        NEXTDC(dc0,dc);
       if ( i )        if ( i )
         STOQ(i,DEG(dc));          STOZ(i,DEG(dc));
       else        else
         DEG(dc) = 0;          DEG(dc) = 0;
       COEF(dc) = (P)q;        COEF(dc) = (P)q;
Line 449  void lumtop_unsigned(V v,int mod,int bound,LUM f,P *g)
Line 449  void lumtop_unsigned(V v,int mod,int bound,LUM f,P *g)
     if ( q ) {      if ( q ) {
       NEXTDC(dc0,dc);        NEXTDC(dc0,dc);
       if ( i )        if ( i )
         STOQ(i,DEG(dc));          STOZ(i,DEG(dc));
       else        else
         DEG(dc) = 0;          DEG(dc) = 0;
       COEF(dc) = (P)q;        COEF(dc) = (P)q;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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