# Changeset a88bbe in git

Ignore:
Timestamp:
Sep 7, 2016, 2:21:41 PM (7 years ago)
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
5600a4f5be2705b151d6d42fac572d137ff0924b
Parents:
af7c4768f3e8796ec97be6a476aa97989adfb24b
Message:
`chg: make chinrem() and farey() work for lists in modular.lib`
File:
1 edited

Unmodified
Added
Removed
• ## Singular/LIB/modular.lib

 raf7c47 // lift result if (N == 1) { result_lift = chinrem(modresults, primes); result_lift = chinrem_recursive(modresults, primes); } else { result_lift = chinrem(list(result_lift)+modresults, result_lift = chinrem_recursive(list(result_lift)+modresults, list(N)+primes); } ideal I = x9y2+x10, x2y7-y8; modular("std", list(I)); } static proc chinrem_recursive(list modresults, list moduli) { if (typeof(modresults[1]) != "list") { return(chinrem(modresults, moduli)); } // if typeof(modresults[1]) == "list", then we assume // size(modresults[1]) == size(modresults[k]) // for k = 2, ..., size(modresults) int n_sublists = size(modresults[1]); int i, j; list modresults_sublists; for (j = n_sublists; j > 0; j--) { modresults_sublists[j] = list(); for (i = size(modresults); i > 0; i--) { modresults_sublists[j][i] = modresults[i][j]; } task t(j) = "Modular::chinrem_recursive", list(modresults_sublists[j], moduli); } startTasks(t(1..n_sublists)); waitAllTasks(t(1..n_sublists)); list result; for (j = n_sublists; j > 0; j--) { result[j] = getResult(t(j)); killTask(t(j)); } return(result); } { arg_type = typeof(farey_arg); if (arg_type != "bigint" && arg_type != "ideal" && arg_type != "module" && arg_type != "matrix") { if (arg_type != "bigint" && arg_type != "ideal" && arg_type != "module" && arg_type != "matrix" && arg_type != "list") { ERROR("wrong input type"); } int i; if (arg_type == "list") { int size_farey_arg = size(farey_arg); for (i = size_farey_arg; i > 0; i--) { task t(i) = "Modular::farey_parallel", list(farey_arg[i], farey_N); } startTasks(t(1..size_farey_arg)); waitAllTasks(t(1..size_farey_arg)); list result; for (i = size_farey_arg; i > 0; i--) { result[i] = getResult(t(i)); killTask(t(i)); } return(result); } if (arg_type == "bigint" || arg_type == "matrix") { int chunks = par_range(size_arg); intvec range; int i; for (i = chunks; i > 0; i--) { range = par_range(size_arg, i);
Note: See TracChangeset for help on using the changeset viewer.