Changeset 35eaf8 in git


Ignore:
Timestamp:
Feb 2, 2011, 3:55:04 PM (13 years ago)
Author:
Mohamed Barakat <mohamed.barakat@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
38500a121352523995aed31e607c914ef483f006
Parents:
c7afe579b577656daa841b5239a13f9ac087990f
git-author:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-02-02 15:55:04+01:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 11:59:27+01:00
Message:
- update the build system to build p_Procs.inc
- change macros to static inline functions in p_Numbers.h
- p_Procs_Generate was changed to add "__T" suffix for template labels
- todo: add __T to the macro-invocations in the files p_*__T.cc (cf. for_future_ref)
Location:
libpolys
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/coeffs.h

    rc7afe57 r35eaf8  
    268268{ return r->cfCopy(n, r); }
    269269static inline void   n_Delete(number* p, const coeffs r)
    270 { return r->cfDelete(p, r); }
     270{ r->cfDelete(p, r); }
    271271
    272272static inline BOOLEAN n_Equal(number a, number b, const coeffs r)
     
    323323
    324324static inline void   n_Power(number a, int b, number *res, const coeffs r)
    325 { return r->cfPower(a,b,res,r); }
     325{ r->cfPower(a,b,res,r); }
    326326
    327327static inline number n_Mult(number a, number b, const coeffs r)
     
    330330/// Inplace multiplication: a := a * b
    331331static inline void n_InpMult(number &a, number b, const coeffs r)
    332 { return r->cfInpMult(a,b,r); }
     332{ r->cfInpMult(a,b,r); }
    333333
    334334static inline number n_Sub(number a, number b, const coeffs r)
  • libpolys/coeffs/numbers.cc

    rc7afe57 r35eaf8  
    5252  a=n;
    5353}
    54 number ndInpAdd(number &a, number b, const coeffs r)
     54void ndInpAdd(number &a, number b, const coeffs r)
    5555{
    5656  number n=n_Add(a,b,r);
    5757  n_Delete(&a,r);
    5858  a=n;
    59   return a;
    6059}
    6160
  • libpolys/coeffs/numbers.h

    rc7afe57 r35eaf8  
    2828
    2929void   ndInpMult(number &a, number b, const coeffs r);
    30 number ndInpAdd(number &a, number b, const coeffs r);
     30void  ndInpAdd(number &a, number b, const coeffs r);
    3131
    3232#ifdef LDEBUG
  • libpolys/polys/Makefile.am

    rc7afe57 r35eaf8  
    1414        templates/p_Procs_Lib.cc polys.cc \
    1515        polys0.cc polys1.cc prCopy.cc prCopyTemplate.cc \
    16         sbuckets.cc
     16        sbuckets.cc templates/p_Procs.cc
     17
     18BUILT_SOURCES = templates/p_Procs.inc
    1719
    1820noinst_HEADERS =
     
    3234libpolys_g_a_SOURCES = ${SOURCES}
    3335
    34 EXTRA_libpolys_a_SOURCES = p_Procs_Dynamic.cc p_Procs_Static.cc
    35 
    3636libpolys_a_LIBADD = $(DL_KERNEL_OBJECT)
    3737libpolys_a_DEPENDENCIES = $(DL_KERNEL_OBJECT)
     
    4040libpolys_g_a_DEPENDENCIES = $(DL_KERNEL_OBJECT_DEBUG)
    4141
    42 EXTRA_PROGRAMS = p_Procs_Generate
    43 p_Procs_Generate_SOURCES = p_Procs_Generate.cc
     42EXTRA_PROGRAMS = templates/p_Procs_Generate
     43templates_p_Procs_Generate_SOURCES = templates/p_Procs_Generate.cc
    4444
    45 p_Procs.inc: p_Procs_Generate
    46         ${builddir}/p_Procs_Generate > ${builddir}/p_Procs.inc
     45templates/p_Procs.inc: templates/p_Procs_Generate
     46        ${builddir}/templates/p_Procs_Generate > ${builddir}/templates/p_Procs.inc
    4747
    4848libpolys_g_a_CXXFLAGS = -g -Wextra -Wall -pedantic -fdiagnostics-show-option -Wno-long-long
  • libpolys/polys/monomials/p_polys.cc

    rc7afe57 r35eaf8  
    30563056#undef p_Delete
    30573057#define p_Delete p_ShallowDelete
    3058 #undef n_Delete
    3059 #define n_Delete(n, r) ((void)0)
     3058#undef n_Delete__T
     3059#define n_Delete__T(n, r) ((void)0)
    30603060
    30613061#include <polys/templates/p_Delete__T.cc>
  • libpolys/polys/templates/p_Copy__T.cc

    rc7afe57 r35eaf8  
    2525    p_AllocBin(pNext(d_p), bin, r);
    2626    pIter(d_p);
    27     pSetCoeff0(d_p, n_Copy(pGetCoeff(s_p), r));
     27    pSetCoeff0(d_p, n_Copy__T(pGetCoeff(s_p), r));
    2828    // it is better to iter here,
    2929    // for MemCopy advances goes from low to high addresses
    3030    h = s_p;
    3131    s_p = pNext(s_p);
    32     p_MemCopy(d_p->exp, h->exp, length);
     32    p_MemCopy__T(d_p->exp, h->exp, length);
    3333  }
    3434  pNext(d_p) = NULL;
  • libpolys/polys/templates/p_Delete__T.cc

    rc7afe57 r35eaf8  
    1616  while (p != NULL)
    1717  {
    18     n_Delete(&(p->coef), r);
     18    n_Delete__T(&(p->coef), r);
    1919    p = p_LmFreeAndNext(p, r);
    2020  }
  • libpolys/polys/templates/p_Numbers.h

    rc7afe57 r35eaf8  
    1313
    1414#include <coeffs/coeffs.h>
    15 #define n_Copy_FieldGeneral(n, r)           (r)->cf->cfCopy(n,r)
    16 #define n_Delete_FieldGeneral(n, r)         (r)->cf->cfDelete(n,r)
    17 #define n_Mult_FieldGeneral(n1, n2, r)      (r)->cf->nMult(n1, n2)
    18 #define n_Add_FieldGeneral(n1, n2, r)       (r)->cf->nAdd(n1, n2)
    19 #define n_IsZero_FieldGeneral(n, r)         (r)->cf->nIsZero(n)
    20 #define n_Equal_FieldGeneral(n1, n2, r)     (r)->cf->nEqual(n1, n2)
    21 #define n_Neg_FieldGeneral(n, r)            (r)->cf->nNeg(n)
    22 #define n_Sub_FieldGeneral(n1, n2, r)       (r)->cf->nSub(n1, n2)
    23 //#define n_InpMult_FieldGeneral(n1, n2, r)   (r)->cf->nInpMult(n1, n2, r)
    24 #define n_InpMult_FieldGeneral(n1, n2, r)   ndInpMult(n1, n2, r)
    25 #define n_InpAdd_FieldGeneral(n1, n2, r)    n1=ndInpAdd(n1, n2, r)
     15#include <coeffs/numbers.h>
     16#include <polys/monomials/ring.h>
     17
     18static inline number n_Copy_FieldGeneral(number n,    const ring r)
     19{ return r->cf->cfCopy(n,r->cf); }
     20
     21static inline void   n_Delete_FieldGeneral(number* p, const ring r)
     22{ r->cf->cfDelete(p,r->cf); }
     23
     24static inline number n_Mult_FieldGeneral(number n1, number n2, const ring r)
     25{ return r->cf->nMult(n1, n2, r->cf); }
     26
     27static inline number n_Add_FieldGeneral(number n1, number n2, const ring r)
     28{ return r->cf->nAdd(n1, n2, r->cf); }
     29
     30static inline BOOLEAN n_IsZero_FieldGeneral(number n, const ring r)
     31{ return r->cf->nIsZero(n, r->cf); }
     32
     33static inline BOOLEAN n_Equal_FieldGeneral(number n1, number n2, const ring r)
     34{ return r->cf->nEqual(n1, n2, r->cf); }
     35
     36static inline number n_Neg_FieldGeneral(number n,     const ring r)
     37{ return r->cf->nNeg(n, r->cf); }
     38
     39static inline number n_Sub_FieldGeneral(number n1, number n2, const ring r)
     40{ return r->cf->nSub(n1, n2, r->cf); }
     41
     42static inline void n_InpMult_FieldGeneral(number &n1, number n2, const ring r)
     43{ ndInpMult(n1, n2, r->cf); }
     44
     45static inline void n_InpAdd_FieldGeneral(number &n1, number n2, const ring r)
     46{ ndInpAdd(n1, n2, r->cf); }
    2647
    2748#ifdef HAVE_RINGS
    28 #define n_Copy_RingGeneral(n, r)           (r)->cf->cfCopy(n,r)
    29 #define n_Delete_RingGeneral(n, r)         (r)->cf->cfDelete(n,r)
    30 #define n_Mult_RingGeneral(n1, n2, r)      (r)->cf->nMult(n1, n2)
    31 #define n_Add_RingGeneral(n1, n2, r)       (r)->cf->nAdd(n1, n2)
    32 #define n_IsZero_RingGeneral(n, r)         (r)->cf->nIsZero(n)
    33 #define n_Equal_RingGeneral(n1, n2, r)     (r)->cf->nEqual(n1, n2)
    34 #define n_Neg_RingGeneral(n, r)            (r)->cf->nNeg(n)
    35 #define n_Sub_RingGeneral(n1, n2, r)       (r)->cf->nSub(n1, n2)
    36 //#define n_InpMult_RingGeneral(n1, n2, r)   (r)->cf->nInpMult(n1, n2, r)
    37 #define n_InpMult_RingGeneral(n1, n2, r)   ndInpMult(n1, n2, r)
    38 #define n_InpAdd_RingGeneral(n1, n2, r)    n1=ndInpAdd(n1, n2, r)
     49#define n_Copy_RingGeneral(n, r)           r->cf->cfCopy(n,r->cf)
     50#define n_Delete_RingGeneral(n, r)         r->cf->cfDelete(n,r->cf)
     51#define n_Mult_RingGeneral(n1, n2, r)      r->cf->nMult(n1, n2, r->cf)
     52#define n_Add_RingGeneral(n1, n2, r)       r->cf->nAdd(n1, n2, r->cf)
     53#define n_IsZero_RingGeneral(n, r)         r->cf->nIsZero(n, r->cf)
     54#define n_Equal_RingGeneral(n1, n2, r)     r->cf->nEqual(n1, n2, r->cf)
     55#define n_Neg_RingGeneral(n, r)            r->cf->nNeg(n, r->cf)
     56#define n_Sub_RingGeneral(n1, n2, r)       r->cf->nSub(n1, n2, r->cf)
     57//#define n_InpMult_RingGeneral(n1, n2, r)   r->cf->nInpMult(n1, n2, r->cf)
     58#define n_InpMult_RingGeneral(n1, n2, r)   ndInpMult(n1, n2, r->cf)
     59#define n_InpAdd_RingGeneral(n1, n2, r)    n1=ndInpAdd(n1, n2, r->cf)
    3960#endif
    4061
     
    4263#define n_Copy_FieldZp(n, r)        n
    4364#define n_Delete_FieldZp(n, r)      ((void)0)
    44 #define n_Mult_FieldZp(n1, n2, r)   npMultM(n1,n2)
    45 #define n_Add_FieldZp(n1, n2, r)    npAddM(n1, n2)
    46 #define n_IsZero_FieldZp(n, r)      npIsZeroM(n)
    47 #define n_Equal_FieldZp(n1, n2, r)  npEqualM(n1, n2)
    48 #define n_Neg_FieldZp(n, r)         npNegM(n)
    49 #define n_Sub_FieldZp(n1, n2, r)    npSubM(n1, n2)
    50 #define n_InpMult_FieldZp(n1, n2, r) n1=npMultM(n1, n2)
    51 #define n_InpAdd_FieldZp(n1, n2, r)  n1=npAddM(n1, n2)
     65#define n_Mult_FieldZp(n1, n2, r)   npMultM(n1,n2, r->cf)
     66#define n_Add_FieldZp(n1, n2, r)    npAddM(n1, n2, r->cf)
     67#define n_IsZero_FieldZp(n, r)      npIsZeroM(n, r->cf)
     68#define n_Equal_FieldZp(n1, n2, r)  npEqualM(n1, n2, r->cf)
     69#define n_Neg_FieldZp(n, r)         npNegM(n, r->cf)
     70#define n_Sub_FieldZp(n1, n2, r)    npSubM(n1, n2, r->cf)
     71#define n_InpMult_FieldZp(n1, n2, r) n1=npMultM(n1, n2, r->cf)
     72
     73static inline void n_InpAdd_FieldZp(number &n1, number n2, const ring r)
     74{ n1=npAddM(n1, n2, r->cf); }
    5275
    5376#define DO_LINLINE
    5477#include "coeffs/longrat.cc"
    55 #define n_Copy_FieldQ(n, r)        nlCopy(n)
    56 #define n_Delete_FieldQ(n, r)      nlDelete(n,r)
    57 #define n_Mult_FieldQ(n1, n2, r)   nlMult(n1,n2)
    58 #define n_Add_FieldQ(n1, n2, r)    nlAdd(n1, n2)
    59 #define n_IsZero_FieldQ(n, r)      nlIsZero(n)
    60 #define n_Equal_FieldQ(n1, n2, r)  nlEqual(n1, n2)
    61 #define n_Neg_FieldQ(n, r)         nlNeg(n)
    62 #define n_Sub_FieldQ(n1, n2, r)    nlSub(n1, n2)
    63 #define n_InpMult_FieldQ(n1, n2, r) nlInpMult(n1, n2, r)
    64 #define n_InpAdd_FieldQ(n1, n2, r)  n1=nlInpAdd(n1, n2, r)
     78#define n_Copy_FieldQ(n, r)        nlCopy(n, r->cf)
     79#define n_Delete_FieldQ(n, r)      nlDelete(n,r->cf)
     80#define n_Mult_FieldQ(n1, n2, r)   nlMult(n1,n2, r->cf)
     81#define n_Add_FieldQ(n1, n2, r)    nlAdd(n1, n2, r->cf)
     82#define n_IsZero_FieldQ(n, r)      nlIsZero(n, r->cf)
     83#define n_Equal_FieldQ(n1, n2, r)  nlEqual(n1, n2, r->cf)
     84#define n_Neg_FieldQ(n, r)         nlNeg(n, r->cf)
     85#define n_Sub_FieldQ(n1, n2, r)    nlSub(n1, n2, r->cf)
     86#define n_InpMult_FieldQ(n1, n2, r) nlInpMult(n1, n2, r->cf)
     87#define n_InpAdd_FieldQ(n1, n2, r)  n1=nlInpAdd(n1, n2, r->cf)
    6588#endif
  • libpolys/polys/templates/p_Procs_Generate.cc

    rc7afe57 r35eaf8  
    2121
    2222#ifdef p_Procs_Static
    23 #include <polys/p_Procs_Static.h>
     23#include <polys/templates/p_Procs_Static.h>
    2424#else
    25 #include <polys/p_Procs_Dynamic.h>
    26 #endif
    27 
    28 #include <polys/p_Procs_Impl.h>
     25#include <polys/templates/p_Procs_Dynamic.h>
     26#endif
     27
     28#include <polys/templates/p_Procs_Impl.h>
    2929
    3030#ifndef p_Procs_Static
     
    128128  while (macros_field[i] != NULL)
    129129  {
    130     printf("#undef %s\n#define %s\t%s_%s\n",
     130    printf("#undef %s__T\n#define %s__T\t%s_%s\n",
    131131           macros_field[i], macros_field[i],  macros_field[i], s_field);
    132132    i++;
     
    135135  while (macros_length[i] != NULL)
    136136  {
    137     printf("#undef %s\n#define %s\t%s_%s\n",
     137    printf("#undef %s__T\n#define %s__T\t%s_%s\n",
    138138           macros_length[i], macros_length[i], macros_length[i], s_length);
    139139    i++;
     
    142142  while (macros_length_ord[i] != NULL)
    143143  {
    144     printf("#undef %s\n#define %s\t%s_%s_%s\n",
     144    printf("#undef %s__T\n#define %s__T\t%s_%s_%s\n",
    145145           macros_length_ord[i], macros_length_ord[i], macros_length_ord[i], s_length, s_ord);
    146146    i++;
     
    149149  // define DECLARE_LENGTH
    150150  printf("#undef DECLARE_LENGTH\n");
    151   printf("#undef p_MemAddAdjust\n");
     151  printf("#undef p_MemAddAdjust__T\n");
    152152  if (length != LengthGeneral)
    153153  {
    154154    printf("#define DECLARE_LENGTH(what) ((void)0)\n");
    155     printf("#define p_MemAddAdjust(p, r) ((void)0)\n");
     155    printf("#define p_MemAddAdjust__T(p, r) ((void)0)\n");
    156156  }
    157157  else
     
    159159    printf("#define DECLARE_LENGTH(what) what\n");
    160160    if (proc != pp_Mult_Coeff_mm_DivSelectMult_Proc)
    161       printf("#define p_MemAddAdjust(p, r) p_MemAdd_NegWeightAdjust(p, r)\n");
     161      printf("#define p_MemAddAdjust__T(p, r) p_MemAdd_NegWeightAdjust(p, r)\n");
    162162    else
    163       printf("#define p_MemAddAdjust(p, r) ((void)0)\n");
     163      printf("#define p_MemAddAdjust__T(p, r) ((void)0)\n");
    164164  }
    165165
     
    190190
    191191
    192     printf("#undef p_MemAddAdjust\n");
    193     printf("#define p_MemAddAdjust(p, r) ((void)0)\n");
    194   }
    195 
    196   printf("#undef %s\n#define %s %s\n", s_what, s_what, s_full_proc_name);
    197   printf("#include polys/1\n", s_what);
     192    printf("#undef p_MemAddAdjust__T\n");
     193    printf("#define p_MemAddAdjust__T(p, r) ((void)0)\n");
     194  }
     195
     196  printf("#undef %s\n#define %s__T %s\n", s_what, s_what, s_full_proc_name);
     197  printf("#include \"polys/templates/%s__T.cc\"\n", s_what);
    198198  printf("#undef %s\n", s_what);
    199199#ifdef HAVE_RINGS
Note: See TracChangeset for help on using the changeset viewer.