Changeset 1c37e0 in git


Ignore:
Timestamp:
Jul 15, 2020, 10:47:01 PM (4 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
bc9b1fc707213e0fb991294802a5ed1b2e721885
Parents:
2486f460fbcdd44c72acea7779937ed446323e1f
Message:
modulo p: npMult,nvMult, npInit -> modulop_inl.h
Location:
libpolys/coeffs
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/Makefile.am

    r2486f4 r1c37e0  
    2424libcoeffs_la_includedir  =$(includedir)/singular/coeffs
    2525libcoeffs_la_include_HEADERS = \
    26   coeffs.h numbers.h si_gmp.h gnumpc.h gnumpfl.h longrat.h modulop.h ffields.h rintegers.h rmodulo2m.h rmodulon.h \
     26  coeffs.h numbers.h si_gmp.h gnumpc.h gnumpfl.h longrat.h modulop.h modulop_inl.h \
     27  ffields.h rintegers.h rmodulo2m.h rmodulon.h \
    2728  shortfl.h mpr_complex.h mpr_global.h numstats.h ntupel.h \
    2829  bigintmat.h Enumerator.h \
  • libpolys/coeffs/modulop.cc

    r2486f4 r1c37e0  
    2525
    2626BOOLEAN npGreaterZero (number k, const coeffs r);
    27 number  npMult        (number a, number b, const coeffs r);
    28 number  npInit        (long i, const coeffs r);
    2927long    npInt         (number &n, const coeffs r);
    3028void    npPower       (number a, int i, number * result,const coeffs r);
    3129BOOLEAN npIsZero      (number a,const coeffs r);
    32 BOOLEAN npIsOne       (number a,const coeffs r);
    3330BOOLEAN npIsMOne       (number a,const coeffs r);
    3431number  npDiv         (number a, number b,const coeffs r);
     
    4744nMapFunc npSetMap(const coeffs src, const coeffs dst);
    4845
     46#include "coeffs/modulop_inl.h" // npMult, npInit
     47
    4948#ifdef NV_OPS
    50 #pragma GCC diagnostic ignored "-Wlong-long"
    51 static inline number nvMultM(number a, number b, const coeffs r)
    52 {
    53   assume( getCoeffType(r) == n_Zp );
    54 
    55 #if SIZEOF_LONG == 4
    56 #define ULONG64 (unsigned long long)(unsigned long)
    57 #else
    58 #define ULONG64 (unsigned long)
    59 #endif
    60   return (number)
    61       (unsigned long)((ULONG64 a)*(ULONG64 b) % (ULONG64 r->ch));
    62 }
    63 number  nvMult        (number a, number b, const coeffs r);
    6449number  nvDiv         (number a, number b, const coeffs r);
    6550number  nvInvers      (number c, const coeffs r);
     
    8368//}
    8469
    85 number npMult (number a,number b, const coeffs r)
    86 {
    87   n_Test(a, r);
    88   n_Test(b, r);
    89 
    90   if (((long)a == 0) || ((long)b == 0))
    91     return (number)0;
    92   number c = npMultM(a,b, r);
    93   n_Test(c, r);
    94   return c;
    95 }
    9670
    9771void npInpMult (number &a,number b, const coeffs r)
     
    10680  n_Test(a, r);
    10781}
    108 
    109 /*2
    110 * create a number from int
    111 */
    112 number npInit (long i, const coeffs r)
    113 {
    114   long ii=i % (long)r->ch;
    115   if (ii <  0L)                         ii += (long)r->ch;
    116 
    117   number c = (number)ii;
    118   n_Test(c, r);
    119   return c;
    120 }
    121 
    12282
    12383/*2
     
    692652// ----------------------------------------------------------
    693653#ifdef NV_OPS
    694 
    695 number nvMult (number a,number b, const coeffs r)
    696 {
    697   //if (((long)a == 0) || ((long)b == 0))
    698   //  return (number)0;
    699   //else
    700     return nvMultM(a,b,r);
    701 }
    702 
    703654void nvInpMult(number &a, number b, const coeffs r)
    704655{
    705   number n=nvMultM(a,b,r);
     656  number n=nvMult(a,b,r);
    706657  a=n;
    707658}
     
    725676  {
    726677    number inv=nvInversM(b,r);
    727     return nvMultM(a,inv,r);
     678    return nvMult(a,inv,r);
    728679  }
    729680}
     
    752703  {
    753704    nvPower(a,i-1,result,r);
    754     *result = nvMultM(a,*result,r);
    755   }
    756 }
    757 #endif
    758 #endif
    759 
     705    *result = nvMult(a,*result,r);
     706  }
     707}
     708#endif
     709#endif
     710
  • libpolys/coeffs/modulop.h

    r2486f4 r1c37e0  
    253253long    npInt         (number &n, const coeffs r);
    254254
    255 // The folloing is reused inside tgb*.cc
    256 number  npMult        (number a, number b, const coeffs r);
    257 
    258255#define npEqualM(A,B,r)  ((A)==(B))
    259256
    260 
    261 #endif
     257#endif
Note: See TracChangeset for help on using the changeset viewer.