Changeset 837062d in git


Ignore:
Timestamp:
Mar 14, 2019, 4:47:34 PM (5 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
b0e0160986d9991e7d5712943e2779967a201ecc
Parents:
34ee120584348ffdd171335e368f086111c83d06
Message:
add: more flint<->singular conversions (QQ,ZZ)
Location:
libpolys/polys
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/flintconv.cc

    r34ee12 r837062d  
    1515#if __FLINT_RELEASE >= 20500
    1616#include "coeffs/coeffs.h"
     17#include "coeffs/longrat.h"
    1718#include "polys/monomials/p_polys.h"
    1819
     
    4344}
    4445
    45 void convSingNFlintN(fmpz_t f, mpz_t z)
     46number convFlintNSingN (fmpz_t f)
     47{
     48  mpz_t z;
     49  mpz_init(z);
     50  fmpz_get_mpz(z,f);
     51  number n;
     52  nlMPZ(z,n,NULL);
     53  return n;
     54}
     55number convFlintNSingN (fmpq_t f)
     56{
     57  number z=ALLOC_RNUMBER();
     58#if defined(LDEBUG)
     59  z->debug=123456;
     60#endif
     61  fmpz_get_mpz_frac(z->z,z->n,f);
     62  nlNormalize(z,NULL);
     63  return z;
     64}
     65
     66void convSingNFlintN(fmpz_t f, mpz_t n)
    4667{
    4768  fmpz_init(f);
    48   fmpz_set_mpz(f,z);
     69  fmpz_set_mpz(f,n);
     70}
     71
     72void convSingNFlintN(fmpz_t f, number n)
     73{
     74  fmpz_init(f);
     75  fmpz_set_mpz(f,(mpz_ptr)n);
     76}
     77
     78void convSingNFlintN(fmpq_t f, number n)
     79{
     80  fmpq_init(f);
     81  if (SR_HDL(n)&SR_INT)
     82    fmpq_set_si(f,SR_TO_INT(n),1);
     83  else if (n->s<3)
     84  {
     85    fmpz_set_mpz(fmpq_numref(f), n->z);
     86    fmpz_set_mpz(fmpq_denref(f), n->n);
     87  }
     88  else
     89  {
     90    mpz_t one;
     91    mpz_init_set_si(one,1);
     92    fmpz_set_mpz(fmpq_numref(f), n->z);
     93    fmpz_set_mpz(fmpq_denref(f), one);
     94    mpz_clear(one);
     95  }
    4996}
    5097
  • libpolys/polys/flintconv.h

    r34ee12 r837062d  
    4141void convFlintNSingN (mpz_t z, fmpz_t f);
    4242void convSingNFlintN(fmpz_t f, mpz_t z);
     43void convSingNFlintN(fmpz_t f, number n);
     44void convSingNFlintN(fmpq_t f, number n);
     45number convFlintNSingN (fmpz_t f);
     46number convFlintNSingN (fmpq_t f);
     47
    4348bigintmat*  singflint_LLL(bigintmat* A, bigintmat* T);
    4449intvec* singflint_LLL(intvec* A, intvec* T);
Note: See TracChangeset for help on using the changeset viewer.