Changeset 85e36d in git
- Timestamp:
- Dec 7, 2000, 5:25:19 PM (23 years ago)
- Branches:
- (u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
- Children:
- 4d688465cef2d21563e211d3a815944e412b94db
- Parents:
- a4f307a99ef35df8d18781c23cf3f7ad97cb4d4b
- Location:
- Singular
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/longalg.h
ra4f307a r85e36d 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: longalg.h,v 1.1 8 2000-12-07 15:21:07Singular Exp $ */6 /* $Id: longalg.h,v 1.19 2000-12-07 16:25:18 Singular Exp $ */ 7 7 /* 8 8 * ABSTRACT: algebraic numbers … … 40 40 void naSetChar(int p, BOOLEAN complete, ring r); 41 41 #define napAddExp(p,i,e) ((p)->e[i-1]+=(e)) 42 #define napLength(p) (pLength((poly)p)) 42 43 #ifdef LDEBUG 43 44 void naDBDelete (number *p,char *f, int l); … … 90 91 #define napVariables naNumbOfPar 91 92 #define napNext(p) (p->ne) 93 #define napIter(p) ((p) = (p)->ne) 92 94 #define napGetCoeff(p) (p->ko) 93 #define napGetExp(p,i) (p->e[(i)-1]) 95 #define napGetExp(p,i) ((p)->e[(i)-1]) 96 #define napSetExp(p,i,ee) ((p)->e[(i)-1]=ee) 94 97 #define napNew() ((alg)omAlloc0(napMonomSize)) 95 98 #define nanumber lnumber -
Singular/mpsr_GetPoly.cc
ra4f307a r85e36d 3 3 ****************************************/ 4 4 5 /* $Id: mpsr_GetPoly.cc,v 1.3 0 2000-10-19 15:00:18 obachmanExp $ */5 /* $Id: mpsr_GetPoly.cc,v 1.31 2000-12-07 16:25:19 Singular Exp $ */ 6 6 7 7 /*************************************************************** … … 252 252 *x = (number) omAlloc0Bin(rnumber_bin); 253 253 y = (number) *x; 254 #if defined(LDEBUG) 254 #if defined(LDEBUG) 255 255 y->debug = 123456; 256 256 #endif … … 277 277 *x = (number) omAlloc0Bin(rnumber_bin); 278 278 y = (number) *x; 279 #if defined(LDEBUG) 279 #if defined(LDEBUG) 280 280 y->debug = 123456; 281 281 #endif … … 301 301 * 302 302 ***************************************************************/ 303 static inline mpsr_Status_t GetAlgPoly(MP_Link_pt link, alg*p)303 static inline mpsr_Status_t GetAlgPoly(MP_Link_pt link, napoly *p) 304 304 { 305 305 MP_Uint32_t j, nm; 306 306 int i; 307 alg a; 308 #if SIZEOF_INT == SIZEOF_PARAMETER 309 Exponent_t *exp; 310 #else 307 napoly a; 311 308 int *exp; 312 #endif313 309 314 310 IMP_GetUint32(link, &nm); … … 322 318 *p = a; 323 319 324 failr(GetAlgNumberNumber(link, &(a->ko))); 325 #if SIZEOF_INT == SIZEOF_PARAMETER 326 exp = &(a->e[0]); 327 mp_failr(IMP_GetSint32Vector(link, (MP_Sint32_t **) &exp, naNumbOfPar)); 328 #else 320 failr(GetAlgNumberNumber(link, &(napGetCoeff(a)))); 329 321 mp_failr(IMP_GetSint32Vector(link, (MP_Sint32_t **) &gTa, naNumbOfPar)); 330 322 for (i=0; i<naNumbOfPar; i++) 331 a->e[i] = (PARAMETER_TYPE) gTa[i]; 332 #endif 323 napSetExp(a,i+1,gTa[i]); 333 324 334 325 for (j=1; j<nm; j++) 335 326 { 336 a->ne = napNew(); 337 a = a->ne; 338 failr(GetAlgNumberNumber(link, &(a->ko))); 339 #if SIZEOF_INT == SIZEOF_PARAMETER 340 exp = &(a->e[0]); 341 mp_failr(IMP_GetSint32Vector(link, (MP_Sint32_t **) &exp, naNumbOfPar)); 342 #else 343 mp_failr(IMP_GetSint32Vector(link, (MP_Sint32_t **) &gTa, naNumbOfPar)); 344 for (i=0; i<naNumbOfPar; i++) 345 a->e[i] = (PARAMETER_TYPE) gTa[i]; 346 #endif 347 } 348 a->ne = NULL; 327 napNext(a) = napNew(); 328 napIter(a); 329 failr(GetAlgNumberNumber(link, &(napGetCoeff(a)))); 330 mp_failr(IMP_GetSint32Vector(link, (MP_Sint32_t **) &gTa, naNumbOfPar)); 331 for (i=0; i<naNumbOfPar; i++) 332 napSetExp(a,i+1,gTa[i]); 333 } 334 napNext(a) = NULL; 349 335 350 336 return mpsr_Success; … … 1024 1010 return mpsr_Success; 1025 1011 } 1026 1027 1012 #endif -
Singular/mpsr_PutPoly.cc
ra4f307a r85e36d 3 3 ****************************************/ 4 4 5 /* $Id: mpsr_PutPoly.cc,v 1.2 0 2000-09-18 09:19:22 obachmanExp $ */5 /* $Id: mpsr_PutPoly.cc,v 1.21 2000-12-07 16:25:19 Singular Exp $ */ 6 6 7 7 /*************************************************************** … … 67 67 static mpsr_Status_t PutFloatNumber(MP_Link_pt link, number a); 68 68 static mpsr_Status_t PutRationalNumber(MP_Link_pt link, number a); 69 static mpsr_Status_t PutAlgPoly(MP_Link_pt link, alga);69 static mpsr_Status_t PutAlgPoly(MP_Link_pt link, napoly a); 70 70 static mpsr_Status_t PutAlgNumber(MP_Link_pt link, number a); 71 71 … … 177 177 * 178 178 ***************************************************************/ 179 inline MP_Uint32_t GetPlength(alg a) 180 { 181 MP_Uint32_t i = 0; 182 while (a != NULL) 183 { 184 i++; 185 a = a->ne; 186 } 179 inline MP_Uint32_t GetPlength(napoly a) 180 { 181 MP_Uint32_t i = napLength(a); 187 182 return i; 188 183 } … … 201 196 mp_failr(IMP_PutUint32(link, 1)); 202 197 mp_failr(IMP_PutUint32(link, GetPlength(b->z))); 203 return PutAlgPoly(link, (alg) (b->z));198 return PutAlgPoly(link, b->z); 204 199 } 205 200 else … … 208 203 mp_failr(IMP_PutUint32(link, 2)); 209 204 mp_failr(IMP_PutUint32(link, GetPlength(b->z))); 210 failr(PutAlgPoly(link, (alg) (b->z)));205 failr(PutAlgPoly(link, b->z)); 211 206 mp_failr(IMP_PutUint32(link, GetPlength(b->n))); 212 return PutAlgPoly(link, (alg) (b->n));207 return PutAlgPoly(link, b->n); 213 208 } 214 209 } 215 210 216 211 // this is very similar to putting a Poly 217 static mpsr_Status_t PutAlgPoly(MP_Link_pt link, alga)212 static mpsr_Status_t PutAlgPoly(MP_Link_pt link, napoly a) 218 213 { 219 214 unsigned int i; … … 223 218 while (a != NULL) 224 219 { 225 failr(PutAlgAlgNumber(link, a->ko)); 226 #if (SIZEOF_INT == SIZEOF_PARAMETER) 227 mp_failr(IMP_PutSint32Vector(link, (MP_Sint32_t *) a->e, gNalgvars)); 228 #else 220 failr(PutAlgAlgNumber(link, napGetCoeff(a))); 229 221 for (i=0; i<gNalgvars; i++) 230 gTa[i] = a->e[i];222 gTa[i] = napGetExp(a,i+1); 231 223 mp_failr(IMP_PutSint32Vector(link, gTa, gNalgvars)); 232 #endif 233 a = a->ne; 224 napIter(a); 234 225 } 235 226 else … … 237 228 while (a != NULL) 238 229 { 239 failr(PutAlgAlgNumber(link, a->ko));240 IMP_PutSint32(link, (MP_Sint32_t) a->e[0]);241 a = a->ne;230 failr(PutAlgAlgNumber(link, napGetCoeff(a))); 231 IMP_PutSint32(link, (MP_Sint32_t) napGetExp(a,1)); 232 napIter(a); 242 233 } 243 234 }
Note: See TracChangeset
for help on using the changeset viewer.