Changeset e4ac9d in git
- Timestamp:
- Sep 7, 2016, 6:16:35 PM (7 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a657104b677b4c461d018cbf3204d72d34ad66a9')
- Children:
- bebd5a0361ed499fa0769cad9424e1bb193acd7c
- Parents:
- e1ccd6716e34657f35d7ef3c0a08f29295742d935600a4f5be2705b151d6d42fac572d137ff0924b
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/modular.lib
re1ccd67 re4ac9d 40 40 "; 41 41 42 LIB "general.lib"; 42 43 LIB "resources.lib"; 43 44 LIB "tasks.lib"; … … 157 158 // delete unlucky primes 158 159 indices = deleteUnluckyPrimes(modresults); 160 indices = sort(indices)[1]; 161 for (i = size(indices); i > 1; i--) { 162 if (indices[i] == indices[i-1]) { 163 indices = delete(indices, i); 164 } 165 } 159 166 for (i = size(indices); i > 0; i--) { 160 167 modresults = delete(modresults, indices[i]); … … 164 171 // lift result 165 172 if (N == 1) { 166 result_lift = chinrem (modresults, primes);173 result_lift = chinrem_recursive(modresults, primes); 167 174 } 168 175 else { 169 result_lift = chinrem (list(result_lift)+modresults,176 result_lift = chinrem_recursive(list(result_lift)+modresults, 170 177 list(N)+primes); 171 178 } … … 211 218 ideal I = x9y2+x10, x2y7-y8; 212 219 modular("std", list(I)); 220 } 221 222 static proc chinrem_recursive(list modresults, list moduli) 223 { 224 if (typeof(modresults[1]) != "list") { 225 return(chinrem(modresults, moduli)); 226 } 227 // if typeof(modresults[1]) == "list", then we assume 228 // size(modresults[1]) == size(modresults[k]) 229 // for k = 2, ..., size(modresults) 230 int n_sublists = size(modresults[1]); 231 int i, j; 232 list modresults_sublists; 233 for (j = n_sublists; j > 0; j--) { 234 modresults_sublists[j] = list(); 235 for (i = size(modresults); i > 0; i--) { 236 modresults_sublists[j][i] = modresults[i][j]; 237 } 238 task t(j) = "Modular::chinrem_recursive", 239 list(modresults_sublists[j], moduli); 240 } 241 startTasks(t(1..n_sublists)); 242 waitAllTasks(t(1..n_sublists)); 243 list result; 244 for (j = n_sublists; j > 0; j--) { 245 result[j] = getResult(t(j)); 246 killTask(t(j)); 247 } 248 return(result); 213 249 } 214 250 … … 290 326 { 291 327 arg_type = typeof(farey_arg); 292 if (arg_type != "bigint" && arg_type != "ideal" 293 && arg_type != "m odule" && arg_type != "matrix") {328 if (arg_type != "bigint" && arg_type != "ideal" && arg_type != "module" 329 && arg_type != "matrix" && arg_type != "list") { 294 330 ERROR("wrong input type"); 331 } 332 int i; 333 if (arg_type == "list") { 334 int size_farey_arg = size(farey_arg); 335 for (i = size_farey_arg; i > 0; i--) { 336 task t(i) = "Modular::farey_parallel", list(farey_arg[i], farey_N); 337 } 338 startTasks(t(1..size_farey_arg)); 339 waitAllTasks(t(1..size_farey_arg)); 340 list result; 341 for (i = size_farey_arg; i > 0; i--) { 342 result[i] = getResult(t(i)); 343 killTask(t(i)); 344 } 345 return(result); 295 346 } 296 347 if (arg_type == "bigint" || arg_type == "matrix") { … … 302 353 int chunks = par_range(size_arg); 303 354 intvec range; 304 int i;305 355 for (i = chunks; i > 0; i--) { 306 356 range = par_range(size_arg, i); -
kernel/GBEngine/kInline.h
r5600a4 re4ac9d 739 739 } 740 740 741 KINLINE poly sLObject::CopyGetP()742 {743 if (bucket != NULL)744 {745 int i = kBucketCanonicalize(bucket);746 poly bp = p_Copy(bucket->buckets[i], tailRing);747 pLength = bucket->buckets_length[i] + 1;748 if (bp != NULL)749 {750 assume(t_p != NULL || p != NULL);751 if (t_p != NULL) pNext(t_p) = bp;752 else pNext(p) = bp;753 }754 bucket = NULL;755 }756 return sLObject::GetP();757 }758 759 760 741 KINLINE long sLObject::pLDeg() 761 742 { -
kernel/GBEngine/kutil.h
r5600a4 re4ac9d 230 230 // makes a copy of the poly of L 231 231 KINLINE void Copy(); 232 // gets the poly and makes a copy of it233 KINLINE poly CopyGetP();234 232 235 233 KINLINE int GetpLength();
Note: See TracChangeset
for help on using the changeset viewer.