Skip to content

Commit 48e3758

Browse files
committed
Fix bug in bigints
1 parent 1798763 commit 48e3758

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

src/ControlledReduction.jl

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function my_sub!(A,B,C)
142142
end
143143

144144
function my_sub!(A::ZZModMatrix,B::ZZModMatrix,C::ZZModMatrix)
145-
@ccall Oscar.Nemo.libflint.fmpz_mod_mat_add(A::Ref{ZZModMatrix},
145+
@ccall Oscar.Nemo.libflint.fmpz_mod_mat_sub(A::Ref{ZZModMatrix},
146146
B::Ref{ZZModMatrix},
147147
C::Ref{ZZModMatrix},
148148
base_ring(B).ninv::Ref{Oscar.Nemo.fmpz_mod_ctx_struct})::Nothing
@@ -610,7 +610,13 @@ function reducechain_naive(u,g,m,S,f,pseudoInverseMat,p,context,cache,params)
610610
mins = similar(J)
611611
tempv = similar(J)
612612
(4 < params.verbose) && println("Starting: J = $J")
613-
(5 < params.verbose) && println("Starting: g = $((gMat))")
613+
(5 < params.verbose) && begin
614+
if params.always_use_bigints
615+
println("Starting: g = $((gMat))")
616+
else
617+
println("Strting: g = $(Int.(gMat))")
618+
end
619+
end
614620

615621
firsttime = true
616622

@@ -655,7 +661,7 @@ function reducechain_naive(u,g,m,S,f,pseudoInverseMat,p,context,cache,params)
655661
# println(matrices[i][:,end])
656662
# end
657663
#end
658-
(6 < params.verbose && V == [1,2,0] && firsttime) && begin println(matrices); firsttime=false end
664+
(6 < params.verbose && V == [1,1,2] && firsttime) && begin println(matrices); firsttime=false end
659665

660666
computeRPoly_LAOneVar2!(context.B,context.A,matrices,reverse(mins),reverse(V),R,context.temp)
661667
#(5 < params.verbose && firsttime) && begin
@@ -679,7 +685,11 @@ function reducechain_naive(u,g,m,S,f,pseudoInverseMat,p,context,cache,params)
679685
(4 < params.verbose) && println("J = $J")
680686
if (5 < params.verbose)
681687
g = vector_to_polynomial(gMat,n,d*n-n,PR,params.termorder)
682-
println("g = $((gMat)) = $g")
688+
if params.always_use_bigints
689+
println("g = $((gMat)) = $g")
690+
else
691+
println("g = $(Int.(gMat)) = $g")
692+
end
683693
end
684694

685695
end
@@ -1124,8 +1134,8 @@ function reducetransform_naive(FT,N_m,S,f,pseudoInverseMat,p,cache,params)
11241134
#TODO: can reduce allocations by changing this for loop
11251135
# to a nested while inside for. Then only allocate one context
11261136
# thread, instead of one per reduction vector.
1127-
Threads.@threads for i in 1:length(FT) #pol in FT
1128-
#for i in 1:length(FT) #pol in FT
1137+
#Threads.@threads for i in 1:length(FT) #pol in FT
1138+
for i in 1:length(FT) #pol in FT
11291139
context = contexts[i]
11301140
pol = FT[i]
11311141
(0 < params.verbose) && println("Reducing vector $i")
@@ -1192,10 +1202,10 @@ function precomputeRuvs(S,f,pseudoInverseMat,Ruvs,cache,params)
11921202
end
11931203

11941204

1195-
(6 < params.verbose) && begin
1196-
println("V = [1,2,0] : $(Ruvs[[1,2,0]])")
1197-
println("V = [0,2,1] : $(Ruvs[[0,2,1]])")
1198-
end
1205+
#(6 < params.verbose) && begin
1206+
# println("V = [1,2,0] : $(Ruvs[[1,2,0]])")
1207+
# println("V = [0,2,1] : $(Ruvs[[0,2,1]])")
1208+
#end
11991209
end
12001210

12011211
function computeRuvOld(V,S,f,pseudoInverseMat,Ruvs,cache,params)

0 commit comments

Comments
 (0)