@@ -53,9 +53,9 @@ function graph_polynomial(gp::GraphProblem, ::Val{:laurent}; usecuda=false, T=Fl
5353 contractx (gp:: GraphProblem , LaurentPolynomial (T[1 ], 1 ))
5454end
5555
56- function _polynomial_single (gp :: GraphProblem , :: Type{T} ; usecuda, maxorder) where T
56+ function _polynomial_fit (f , :: Type{T} ; maxorder) where T
5757 xs = 0 : maxorder
58- ys = [Array ( contractx (gp, T (x); usecuda = usecuda )) for x in xs] # download to CPU
58+ ys = [f ( T (x)) for x in xs] # download to CPU
5959 res = fill (T[], size (ys[1 ])) # contraction result can be a tensor
6060 for ci in 1 : length (ys[1 ])
6161 A = zeros (T, maxorder+ 1 , maxorder+ 1 )
@@ -68,9 +68,10 @@ function _polynomial_single(gp::GraphProblem, ::Type{T}; usecuda, maxorder) wher
6868end
6969
7070# T is not used in finitefield approach
71- function graph_polynomial (gp:: GraphProblem , :: Val{:finitefield} ; usecuda= false , T= Float64,
72- maxorder= max_size (gp; usecuda= usecuda), max_iter= 100 )
73- return map (Polynomial, big_integer_solve (T-> _polynomial_single (gp, T; usecuda= usecuda, maxorder= maxorder), Int32, max_iter))
71+ function graph_polynomial (gp:: GraphProblem , :: Val{:finitefield} ; usecuda= false , T= BigInt,
72+ maxorder= max_size (gp; usecuda), max_iter= 100 )
73+ f = T-> _polynomial_fit (x-> Array (contractx (gp, x; usecuda)), T; maxorder)
74+ return map (Polynomial, big_integer_solve (f, Int32, max_iter))
7475end
7576
7677function big_integer_solve (f, :: Type{TI} , max_iter:: Int = 100 ) where TI
102103function improved_counting (ys:: AbstractArray... )
103104 map (yi-> improved_counting (yi... ), zip (ys... ))
104105end
105- improved_counting (ys:: Mod... ) = Mods. CRT (ys... )
106+ improved_counting (ys:: Mod... ) = Mods. CRT (ys... )
0 commit comments