@@ -53,9 +53,9 @@ function graph_polynomial(gp::GraphProblem, ::Val{:laurent}; usecuda=false, T=Fl
53
53
contractx (gp:: GraphProblem , LaurentPolynomial (T[1 ], 1 ))
54
54
end
55
55
56
- function _polynomial_single (gp :: GraphProblem , :: Type{T} ; usecuda, maxorder) where T
56
+ function _polynomial_fit (f , :: Type{T} ; maxorder) where T
57
57
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
59
59
res = fill (T[], size (ys[1 ])) # contraction result can be a tensor
60
60
for ci in 1 : length (ys[1 ])
61
61
A = zeros (T, maxorder+ 1 , maxorder+ 1 )
@@ -68,9 +68,10 @@ function _polynomial_single(gp::GraphProblem, ::Type{T}; usecuda, maxorder) wher
68
68
end
69
69
70
70
# 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))
74
75
end
75
76
76
77
function big_integer_solve (f, :: Type{TI} , max_iter:: Int = 100 ) where TI
102
103
function improved_counting (ys:: AbstractArray... )
103
104
map (yi-> improved_counting (yi... ), zip (ys... ))
104
105
end
105
- improved_counting (ys:: Mod... ) = Mods. CRT (ys... )
106
+ improved_counting (ys:: Mod... ) = Mods. CRT (ys... )
0 commit comments