Changeset 9f033f in git


Ignore:
Timestamp:
Jul 30, 2014, 2:54:08 PM (10 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '8c6038b526213d378981739e978a9f7b485dab94')
Children:
98148c7263409c3b3ec3de55b6ac6e9b992aa2f0
Parents:
29c93e5a134d849ec5f04de5a24549ae9eb1332e
git-author:
Martin Lee <martinlee84@web.de>2014-07-30 14:54:08+02:00
git-committer:
Martin Lee <martinlee84@web.de>2014-07-31 12:08:29+02:00
Message:
fix: conversion to FLINT over Q
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/FLINTconvert.cc

    r29c93e r9f033f  
    177177CanonicalForm convertFmpq_t2CF (const fmpq_t q)
    178178{
    179   //ASSERT (isOn (SW_RATIONAL), "expected rational");
     179  bool isRat= isOn (SW_RATIONAL);
     180  if (!isRat)
     181    On (SW_RATIONAL);
    180182
    181183  CanonicalForm num, den;
     
    186188  fmpz_get_mpz (nden, fmpq_denref (q));
    187189
     190  CanonicalForm result;
    188191  if (mpz_is_imm (nnum) && mpz_is_imm (nden))
    189192  {
     
    192195    mpz_clear (nnum);
    193196    mpz_clear (nden);
    194     return num/den;
     197    result= num/den;
     198    if (!isRat)
     199      Off (SW_RATIONAL);
     200    return result;
    195201  }
    196202  else
    197     return make_cf (nnum, nden, false);
     203  {
     204    result= make_cf (nnum, nden, false);
     205    if (!isRat)
     206      Off (SW_RATIONAL);
     207    return result;
     208  }
    198209}
    199210
     
    227238void convertFacCF2Fmpq_poly_t (fmpq_poly_t result, const CanonicalForm& f)
    228239{
    229   //ASSERT (isOn (SW_RATIONAL), "expected poly over Q");
     240  bool isRat= isOn (SW_RATIONAL);
     241  if (!isRat)
     242    On (SW_RATIONAL);
    230243
    231244  fmpq_poly_init2 (result, degree (f)+1);
     
    234247  convertFacCF2Fmpz_array (fmpq_poly_numref (result), f*den);
    235248  convertCF2Fmpz (fmpq_poly_denref (result), den);
     249
     250  if (!isRat)
     251    Off (SW_RATIONAL);
    236252}
    237253
Note: See TracChangeset for help on using the changeset viewer.