Changeset 371bc5f in git


Ignore:
Timestamp:
May 5, 2010, 4:48:16 PM (13 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
1039061756503fcd51dbb38bc4aabb902c4933c7
Parents:
d0a51ee4394b5f223004bd691b3fd91403cea0a1
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2010-05-05 16:48:16+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 11:51:41+01:00
Message:
maps for Q
Location:
coeffs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • coeffs/longrat.cc

    rd0a51ee r371bc5f  
    140140#endif
    141141
    142 static coeffs nlMapRing;
    143 static number nlMapP(number from, const coeffs r)
     142static number nlMapP(number from, const coeffs src, const coeffs r)
    144143{
    145144  number to;
    146   to = nlInit(npInt(from,nlMapRing), r);
     145  to = nlInit(npInt(from,src), r);
    147146  return to;
    148147}
     
    184183#endif
    185184
    186 nMapFunc nlSetMap(const coeffs src, const coeffs dst)
    187 {
    188   if (rField_is_Q(src))
    189   {
    190     return nlCopy;
    191   }
    192   nlMapRing=src;
    193   if (rField_is_Zp(src))
    194   {
    195     return nlMapP;
    196   }
    197   if (rField_is_R(src))
    198   {
    199     return nlMapR;
    200   }
    201   if (rField_is_long_R(src))
    202   {
    203     return nlMapLongR; /* long R -> Q */
    204   }
    205 #ifdef HAVE_RINGS
    206   if (rField_is_Ring_Z(src) || rField_is_Ring_PtoM(src) || rField_is_Ring_ModN(src))
    207   {
    208     return nlMapGMP;
    209   }
    210   if (rField_is_Ring_2toM(src))
    211   {
    212     return nlMapMachineInt;
    213   }
    214 #endif
    215   return NULL;
    216 }
    217185
    218186#ifdef LDEBUG
     
    297265number nlRInit (long i);
    298266
    299 static number nlMapR(number from, const coeffs r)
     267static number nlMapR(number from, const coeffs src, const coeffs dst)
    300268{
    301269  double f=nrFloat(from);
     
    320288  memcpy(&(re->n),&h1,sizeof(h1));
    321289  re->s=0; /* not normalized */
    322   if(f_sign==-1) re=nlNeg(re,r);
    323   nlNormalize(re,r);
     290  if(f_sign==-1) re=nlNeg(re,dst);
     291  nlNormalize(re,dst);
    324292  return re;
    325293}
    326294
    327 static number nlMapLongR(number from, const coeffs r)
     295static number nlMapLongR(number from, const coeffs src, const coeffs dst)
    328296{
    329297  gmp_float *ff=(gmp_float*)from;
     
    390358
    391359  if (res->s==0)
    392     nlNormalize(res,r);
     360    nlNormalize(res,dst);
    393361  else if (mpz_size1(&res->z)<=MP_SMALL)
    394362  {
     
    12211189    int in=mpz_fdiv_ui(n->n,(unsigned long)p);
    12221190    #ifdef NV_OPS
    1223     if (npPrimeM>NV_MAX_PRIME)
     1191    if (p>NV_MAX_PRIME)
    12241192    return (int)((long)nvDiv((number)iz,(number)in,(const coeffs)r));
    12251193    #endif
     
    19231891
    19241892/*2
     1893* copy a to b for ampping
     1894*/
     1895number nlCopyMap(number a, const coeffs rc, const coeffs r)
     1896{
     1897  if ((SR_HDL(a) & SR_INT)||(a==NULL))
     1898  {
     1899    return a;
     1900  }
     1901  return _nlCopy_NoImm(a);
     1902}
     1903nMapFunc nlSetMap(const coeffs src, const coeffs dst)
     1904{
     1905  if (nField_is_Q(src))
     1906  {
     1907    return nlCopyMap;
     1908  }
     1909  if (nField_is_Zp(src))
     1910  {
     1911    return nlMapP;
     1912  }
     1913  if (nField_is_R(src))
     1914  {
     1915    return nlMapR;
     1916  }
     1917  if (nField_is_long_R(src))
     1918  {
     1919    return nlMapLongR; /* long R -> Q */
     1920  }
     1921#ifdef HAVE_RINGS
     1922  if (nField_is_Ring_Z(src) || nField_is_Ring_PtoM(src) || nField_is_Ring_ModN(src))
     1923  {
     1924    return nlMapGMP;
     1925  }
     1926  if (nField_is_Ring_2toM(src))
     1927  {
     1928    return nlMapMachineInt;
     1929  }
     1930#endif
     1931  return NULL;
     1932}
     1933/*2
    19251934* z := i
    19261935*/
  • coeffs/numbers.cc

    rd0a51ee r371bc5f  
    1111#include <stdlib.h>
    1212#include "coeffs.h"
     13#include "output.h"
     14#include "omalloc.h"
    1315#include "numbers.h"
    1416#include "longrat.h"
    15 #include "longalg.h"
    1617#include "modulop.h"
    1718#include "gnumpfl.h"
Note: See TracChangeset for help on using the changeset viewer.