Changeset 371bc5f in git
- Timestamp:
- May 5, 2010, 4:48:16 PM (13 years ago)
- 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
- Location:
- coeffs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
coeffs/longrat.cc
rd0a51ee r371bc5f 140 140 #endif 141 141 142 static coeffs nlMapRing; 143 static number nlMapP(number from, const coeffs r) 142 static number nlMapP(number from, const coeffs src, const coeffs r) 144 143 { 145 144 number to; 146 to = nlInit(npInt(from, nlMapRing), r);145 to = nlInit(npInt(from,src), r); 147 146 return to; 148 147 } … … 184 183 #endif 185 184 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_RINGS206 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 #endif215 return NULL;216 }217 185 218 186 #ifdef LDEBUG … … 297 265 number nlRInit (long i); 298 266 299 static number nlMapR(number from, const coeffs r)267 static number nlMapR(number from, const coeffs src, const coeffs dst) 300 268 { 301 269 double f=nrFloat(from); … … 320 288 memcpy(&(re->n),&h1,sizeof(h1)); 321 289 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); 324 292 return re; 325 293 } 326 294 327 static number nlMapLongR(number from, const coeffs r)295 static number nlMapLongR(number from, const coeffs src, const coeffs dst) 328 296 { 329 297 gmp_float *ff=(gmp_float*)from; … … 390 358 391 359 if (res->s==0) 392 nlNormalize(res, r);360 nlNormalize(res,dst); 393 361 else if (mpz_size1(&res->z)<=MP_SMALL) 394 362 { … … 1221 1189 int in=mpz_fdiv_ui(n->n,(unsigned long)p); 1222 1190 #ifdef NV_OPS 1223 if ( npPrimeM>NV_MAX_PRIME)1191 if (p>NV_MAX_PRIME) 1224 1192 return (int)((long)nvDiv((number)iz,(number)in,(const coeffs)r)); 1225 1193 #endif … … 1923 1891 1924 1892 /*2 1893 * copy a to b for ampping 1894 */ 1895 number 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 } 1903 nMapFunc 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 1925 1934 * z := i 1926 1935 */ -
coeffs/numbers.cc
rd0a51ee r371bc5f 11 11 #include <stdlib.h> 12 12 #include "coeffs.h" 13 #include "output.h" 14 #include "omalloc.h" 13 15 #include "numbers.h" 14 16 #include "longrat.h" 15 #include "longalg.h"16 17 #include "modulop.h" 17 18 #include "gnumpfl.h"
Note: See TracChangeset
for help on using the changeset viewer.