Changeset 54fc4e in git


Ignore:
Timestamp:
Oct 26, 2013, 5:03:16 PM (9 years ago)
Author:
Yue Ren <ren@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
ea3c090b559b31abca294f2172ec7d3304bd4ab7
Parents:
2a2ba4fcd246395ea2e5d241d8945e66d030c103
git-author:
Yue Ren <ren@mathematik.uni-kl.de>2013-10-26 17:03:16+02:00
git-committer:
Yue Ren <ren@mathematik.uni-kl.de>2014-07-22 12:24:18+02:00
Message:
new: division and gcd of integer polynomials via factory

added conversion functions between integer polynomials in Singular and Factory
extended the singclap_gcd and singclap_pdivide functions to cover the case where
ground ring is integer
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • Singular/table.h

    r2a2ba4 r54fc4e  
    516516,{D(jjGCD_N),     GCD_CMD,        NUMBER_CMD,     NUMBER_CMD, NUMBER_CMD, ALLOW_PLURAL |ALLOW_RING}
    517517,{D(jjGCD_BI),    GCD_CMD,        BIGINT_CMD,     BIGINT_CMD, BIGINT_CMD, ALLOW_PLURAL |ALLOW_RING}
    518 ,{D(jjGCD_P),     GCD_CMD,        POLY_CMD,       POLY_CMD,   POLY_CMD, NO_PLURAL |NO_RING}
     518,{D(jjGCD_P),     GCD_CMD,        POLY_CMD,       POLY_CMD,   POLY_CMD, NO_PLURAL |ALLOW_RING}
    519519,{D(jjHILBERT2),  HILBERT_CMD,    INTVEC_CMD,     IDEAL_CMD,  INT_CMD, NO_PLURAL | ALLOW_RING | NO_ZERODIVISOR}
    520520,{D(jjHILBERT2),  HILBERT_CMD,    INTVEC_CMD,     MODUL_CMD,  INT_CMD, NO_PLURAL | ALLOW_RING | NO_ZERODIVISOR}
  • libpolys/coeffs/rintegers.cc

    r2a2ba4 r54fc4e  
    2323#include <coeffs/rmodulon.h>
    2424#include "si_gmp.h"
     25
     26#ifdef HAVE_FACTORY
     27#include <factory/factory.h>
     28#endif
    2529
    2630/// Our Type!
     
    368372  return s;
    369373}
     374
     375
     376#ifdef HAVE_FACTORY
     377CanonicalForm nrzConvSingNFactoryN(number n, BOOLEAN setChar, const coeffs /*r*/)
     378{
     379  if (setChar) setCharacteristic( 0 );
     380
     381  CanonicalForm term;
     382  mpz_t num;
     383  mpz_init_set(num, *((mpz_t*)n));
     384  term = make_cf(num);
     385  return term;
     386}
     387
     388number nrzConvFactoryNSingN(const CanonicalForm n, const coeffs r)
     389{
     390  if (n.isImm())
     391    return nrzInit(n.intval(),r);
     392  else
     393  {
     394    int_number m = (int_number) omAllocBin(gmp_nrz_bin);
     395    gmp_numerator(n,m);
     396    return (number) m;
     397  }
     398}
     399#endif // HAVE_FACTORY
    370400
    371401const char * nrzRead (const char *s, number *a, const coeffs)
     
    447477  r->cfSetMap = nrzSetMap;
    448478  r->cfCoeffWrite = nrzCoeffWrite;
    449   r->cfQuot1 = nrzQuot1;
     479  r->cfQuot1 = nrzQuot1; 
     480#ifdef HAVE_FACTORY
     481  r->convSingNFactoryN=nrzConvSingNFactoryN;
     482  r->convFactoryNSingN=nrzConvFactoryNSingN;
     483#endif
    450484  // debug stuff
    451485
  • libpolys/coeffs/rintegers.h

    r2a2ba4 r54fc4e  
    5454coeffs  nrzQuot1(number c, const coeffs r);
    5555
     56#ifdef HAVE_FACTORY
     57CanonicalForm nrzConvSingNFactoryN(number n, BOOLEAN setChar, const coeffs /*r*/);
     58number nrzConvFactoryNSingN(const CanonicalForm n, const coeffs r);
     59#endif // HAVE_FACTORY
     60
    5661number nrzMapQ(number from, const coeffs src, const coeffs dst);
    5762#endif
  • libpolys/polys/clapsing.cc

    r2a2ba4 r54fc4e  
    100100
    101101  Off(SW_RATIONAL);
    102   if (rField_is_Q(r) || (rField_is_Zp(r)))
     102  if (rField_is_Q(r) || rField_is_Zp(r) || rField_is_Ring_Z(r))
    103103  {
    104104    setCharacteristic( rChar(r) );
     
    279279  poly res=NULL;
    280280
    281   if (f!=NULL) p_Cleardenom(f, r);             
     281  if (f!=NULL) p_Cleardenom(f, r);
    282282  if (g!=NULL) p_Cleardenom(g, r);
    283283  else         return f; // g==0 => gcd=f (but do a p_Cleardenom)
     
    545545    res = convFactoryPSingP( F / G,r );
    546546  }
     547  else if (rField_is_Ring_Z(r))
     548  {
     549    Off(SW_RATIONAL);
     550    setCharacteristic( rChar(r) );
     551    CanonicalForm F( convSingPFactoryP( f,r ) ), G( convSingPFactoryP( g,r ) );
     552    res = convFactoryPSingP( F / G,r );
     553  }
    547554  else if (r->cf->extRing!=NULL)
    548555  {
     
    669676        //number cn=(number)c;
    670677        //StringSetS(""); nWrite(nt); StringAppend(" ==> ");
    671         //nWrite(cn);PrintS(StringEndS("\n")); // NOTE/TODO: use StringAppendS("\n"); omFree(s); 
     678        //nWrite(cn);PrintS(StringEndS("\n")); // NOTE/TODO: use StringAppendS("\n"); omFree(s);
    672679        //#endif
    673680      }
     
    15861593{
    15871594//  assume( r == currRing ); // Anything else is not guaranted to work!
    1588    
     1595
    15891596  setCharacteristic( 0 ); // ?
    15901597  CFMatrix M(m->rows(),m->cols());
     
    16291636    return NULL;
    16301637  }
    1631    
     1638
    16321639  matrix res=mp_New(r,r);
    1633    
     1640
    16341641  if (rField_is_Q(s))
    16351642  {
Note: See TracChangeset for help on using the changeset viewer.