예제 #1
0
    def points_modulo_primes(X, primes):
        r"""
		Return a list of rational points modulo all p in primes
		parallel implementation
		"""
        normalized_input = []
        for p in primes:
            normalized_input.append(((
                X,
                p,
            ), {}))
        p_iter = p_iter_fork(ncpus())

        points_pair = list(p_iter(parallel_function, normalized_input))
        points_pair.sort()
        modulo_points = []
        for pair in points_pair:
            modulo_points.append(pair[1])

        return modulo_points
예제 #2
0
    def lift_all_points():
        r"""
        Return list of all rational points lifted parallelly.
        """
        normalized_input = []
        points = modulo_points.pop(
        )  # remove the list of points corresponding to largest prime
        len_modulo_points.pop()

        for point in points:
            normalized_input.append(((point, ), {}))
        p_iter = p_iter_fork(ncpus())
        points_satisfying = list(
            p_iter(parallel_function_combination, normalized_input))

        lifted_points = set()
        for pair in points_satisfying:
            L = pair[1]
            for point in L:
                lifted_points.add(X(tuple(point)))

        return list(lifted_points)
예제 #3
0
def func(Z, p):
    Xp = Z.change_ring(GF(p))
    L = Xp.rational_points()
    return [list(t) for t in L]


%time

from sage.parallel.ncpus import ncpus
from sage.parallel.use_fork import p_iter_fork

P.<x,y,z,q>=ProjectiveSpace(QQ,3)
Y=P.subscheme([x^2-3^2*y^2+z*q,x+z+4*q])
    
normalized_input = []

for q in primes(1,30):
    normalized_input.append(((Y, q, ), {}))
#    LL = func(Y,q)
    
p_iter = p_iter_fork(ncpus())

points_pair = list(p_iter(func, normalized_input))
points_pair.sort()

#print points_pair
modulo_points = []

for pair in points_pair:
    modulo_points.append(pair[1])
#print modulo_points