Changeset 4b5b36 in git


Ignore:
Timestamp:
Jul 9, 2018, 3:45:56 PM (6 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
Children:
e5ddd4bbb0c30d53b6ebc1f1a4d963405f91c7f6
Parents:
113a802e445da6c564286206f2eb02f93a3167a3
Message:
add: ssi for poly over Z/n
Location:
libpolys/coeffs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/rintegers.cc

    r113a80 r4b5b36  
    133133}
    134134
    135 static void nrzDelete(number *a, const coeffs)
     135void nrzDelete(number *a, const coeffs)
    136136{
    137137  if (*a != NULL)
     
    158158#endif
    159159
    160 static int nrzSize(number a, const coeffs)
     160int nrzSize(number a, const coeffs)
    161161{
    162162  mpz_ptr p=(mpz_ptr)a;
  • libpolys/coeffs/rintegers.h

    r113a80 r4b5b36  
    2626
    2727void    nrzWrite       (number a, const coeffs r); /*for rmodulon.cc*/
     28void    nrzDelete      (number *a, const coeffs);  /*for rmodulon.cc*/
     29int     nrzSize        (number a, const coeffs);   /*for rmodulon.cc*/
     30void nrzWriteFd(number n, const ssiInfo* d, const coeffs); /*for rmodulon.cc*/
     31number nrzReadFd(const ssiInfo *d, const coeffs);  /*for rmodulon.cc*/
    2832
    2933number  nrzInit        (long i, const coeffs r); /*for SAGE, better: n_Init*/
  • libpolys/coeffs/rmodulon.cc

    r113a80 r4b5b36  
    1515#include "coeffs/coeffs.h"
    1616#include "coeffs/modulop.h"
     17#include "coeffs/rintegers.h"
    1718#include "coeffs/numbers.h"
    1819
     
    8788  if(nrnCoeffName_buff!=NULL) omFree(nrnCoeffName_buff);
    8889  size_t l = (size_t)mpz_sizeinbase(r->modBase, 10) + 2;
    89   nrnCoeffName_buff=(char*)omAlloc(l+12);
    9090  char* s = (char*) omAlloc(l);
     91  l+=22;
     92  nrnCoeffName_buff=(char*)omAlloc(l);
    9193  s= mpz_get_str (s, 10, r->modBase);
     94  int ll;
    9295  if (nCoeff_is_Ring_ModN(r))
    93     snprintf(nrnCoeffName_buff,l+6,"ZZ/bigint(%s)",s);
     96    ll=snprintf(nrnCoeffName_buff,l,"ZZ/bigint(%s)",s);
    9497  else if (nCoeff_is_Ring_PtoM(r))
    95     snprintf(nrnCoeffName_buff,l+6,"ZZ/bigint(%s)^%lu",s,r->modExponent);
    96   omFreeSize((ADDRESS)s, l);
     98    ll=snprintf(nrnCoeffName_buff,l,"ZZ/bigint(%s)^%lu",s,r->modExponent);
     99  assume(ll<(int)l); // otherwise nrnCoeffName_buff too small
     100  omFreeSize((ADDRESS)s, l-22);
    97101  return nrnCoeffName_buff;
    98102}
    99 
    100103
    101104static BOOLEAN nrnCoeffIsEqual(const coeffs r, n_coeffType n, void * parameter)
     
    190193}
    191194
     195/*
     196 * convert a number to int
     197 */
     198static long nrnInt(number &n, const coeffs)
     199{
     200  return mpz_get_si((mpz_ptr) n);
     201}
     202
     203#if SI_INTEGER_VARIANT==2
     204#define nrnDelete nrzDelete
     205#define nrnSize   nrzSize
     206#else
    192207static void nrnDelete(number *a, const coeffs)
    193208{
     
    199214  }
    200215}
    201 
    202216static int nrnSize(number a, const coeffs)
    203217{
     
    207221  return s;
    208222}
    209 
    210 /*
    211  * convert a number to int
    212  */
    213 static long nrnInt(number &n, const coeffs)
    214 {
    215   return mpz_get_si((mpz_ptr) n);
    216 }
    217 
     223#endif
    218224/*
    219225 * Multiply two numbers
     
    10501056  r->cfKillChar    = nrnKillChar;
    10511057  r->cfQuot1       = nrnQuot1;
     1058#if SI_INTEGER_VARIANT==2
     1059  r->cfWriteFd     = nrzWriteFd;
     1060  r->cfReadFd      = nrzReadFd;
     1061#endif
     1062
    10521063#ifdef LDEBUG
    10531064  r->cfDBTest      = nrnDBTest;
Note: See TracChangeset for help on using the changeset viewer.