@@ -329,6 +329,7 @@ if the reduction hits the end, returns u as the "true" value, otherwise returns
329329"""
330330function reducechain_costachunks (u,g,m,S,f,pseudoInverseMat,p,Ruvs,explookup,A,B,temp,g_temp,params)
331331 # p = Int64(characteristic(parent(f)))
332+ verbose = params. verbose
332333 n = nvars (parent (f)) - 1
333334 d = total_degree (f)
334335 PR = parent (f)
@@ -342,13 +343,13 @@ function reducechain_costachunks(u,g,m,S,f,pseudoInverseMat,p,Ruvs,explookup,A,B
342343 if params. vars_reversed == false
343344 reverse! (I) # parity issue due to Costa's code being reverse from ours
344345 end
345- # println("Expanded I: $I")
346+ ( 4 < verbose) && println (" Expanded I: $I " )
346347
347348 gMat = g
348349 # println(gMat)
349350 # chain = 0
350351 # I_edgar = [x//7 for x in I]
351- # verbose && println("This is I: $I_edgar")
352+ ( 4 < verbose) && println (" This is I: $I_edgar " )
352353 J = copy (I)
353354
354355 # TODO ?
@@ -357,8 +358,7 @@ function reducechain_costachunks(u,g,m,S,f,pseudoInverseMat,p,Ruvs,explookup,A,B
357358 else
358359 V = chooseV (Array {Int} (divexact .(I,p)),d)
359360 end
360- # println("V: $V")
361- # verbose && println("LOOK! I=$I, V = $V")
361+ (4 < verbose) && println (" LOOK! I=$I , V = $V " )
362362
363363
364364 if params. vars_reversed == true
@@ -392,8 +392,8 @@ function reducechain_costachunks(u,g,m,S,f,pseudoInverseMat,p,Ruvs,explookup,A,B
392392 i = 1
393393
394394
395- # verbose && println("Before reduction chunk: $(convert.(Int,gMat))")
396- # verbose && println("Before reduction chunk, I is $I")
395+ # (9 < verbose) && println("Before reduction chunk: $(convert.(Int,gMat))")
396+ ( 4 < verbose) && println (" Before reduction chunk, I is $I " )
397397 if params. fastevaluation && 1 ≤ nend- (d* n- n)
398398 gMat = finitediff_prodeval_linear! (B,A,0 ,nend- (d* n- n)- 1 ,gMat,temp,ui)
399399 i = nend- (d* n- n) + 1
@@ -405,7 +405,7 @@ function reducechain_costachunks(u,g,m,S,f,pseudoInverseMat,p,Ruvs,explookup,A,B
405405
406406 # gMat = (A+B*(nend-(d*n-n)-i))*gMat
407407
408- # verbose && println("After step $i: $(convert.(Int,gMat))")
408+ # (9 < verbose) && println("After step $i: $(convert.(Int,gMat))")
409409
410410 i = i+ 1
411411 # println(gMat)
@@ -417,17 +417,16 @@ function reducechain_costachunks(u,g,m,S,f,pseudoInverseMat,p,Ruvs,explookup,A,B
417417 # UPDATE: I think the problem with fastevaluation is fixed... right?
418418 @. I = I - (nend- (d* n- n))* V
419419 end
420- # verbose && println("After steps 1-$i, I is $I")
420+ ( 4 < verbose) && println (" After steps 1-$i , I is $I " )
421421 i = i- 1
422422 while i <= nend- 1
423423 if params. vars_reversed == true
424424 y = rev_tweak (J - i* V,d* n- n) .- rev_tweak (J - (i+ 1 )* V,d* n- n)
425425 else
426426 y = tweak (J - i* V,d* n- n) .- tweak (J - (i+ 1 )* V,d* n- n)
427427 end
428- # println("V: $y")
429- # verbose &&
430- # println("Getting y direction reduction matrix for V = $(y)")
428+ (4 < verbose) && println (" Getting y direction reduction matrix for V = $(y) " )
429+
431430 # there's some sort of parity issue between our code and Costa's
432431 # A,B = computeRPoly_LAOneVar(y,rev_tweak(J - (i+1)*V,d*n-n) - y,S,n,d,f,pseudoInverseMat,R,PR,termorder)
433432
@@ -446,13 +445,12 @@ function reducechain_costachunks(u,g,m,S,f,pseudoInverseMat,p,Ruvs,explookup,A,B
446445
447446 # gMat = (A+B)*gMat
448447
449- # verbose &&
450- # println("After step $(i+1): $(gMat))")
448+ ( 4 < verbose) && println ( " After step $(i + 1 ) : $(gMat) ) " )
449+
451450
452451 i = i+ 1
453452 @. I = I - y
454- # verbose &&
455- # println("After step $(i+1), I is $I")
453+ (4 < verbose) && println (" After step $(i+ 1 ) , I is $I " )
456454 end
457455
458456 # U = I - V
@@ -476,7 +474,6 @@ function reducechain_costachunks(u,g,m,S,f,pseudoInverseMat,p,Ruvs,explookup,A,B
476474 end
477475 =#
478476
479- # verbose && println("Getting reduction matrix for V = $V")
480477
481478 # A,B = computeRPoly_LAOneVar(V,I - Int64((nend-(d*n-n)))*V,S,n,d,f,pseudoInverseMat,R,PR,termorder)
482479 #=
@@ -662,7 +659,7 @@ only be used at the beginning of reduction
662659"""
663660function costadata_of_initial_term! (term,g,n,d,p,termorder)
664661
665- # verbose && println("p: $p")
662+ # (9 < verbose) && println("p: $p")
666663
667664 R = base_ring (parent (term[1 ]))
668665 i = term
@@ -686,7 +683,7 @@ function costadata_of_initial_term!(term,g,n,d,p,termorder)
686683 end
687684
688685
689- # verbose && println("creation: u is type $(typeof(II))")
686+ # (9 < verbose) && println("creation: u is type $(typeof(II))")
690687 return (II,g)
691688end
692689
@@ -719,7 +716,7 @@ function incorporate_initial_term!(costadata_arr,costadata)
719716
720717 # otherwise, push on a new term
721718 if ! ind_already
722- # verbose && println("incorporation: u has type $(typeof(costadata[1]))")
719+ # (9 < verbose) && println("incorporation: u has type $(typeof(costadata[1]))")
723720 push! (costadata_arr,costadata)
724721 end
725722end
@@ -822,7 +819,7 @@ function reducepoly_costachunks(pol,S,f,pseudoInverseMat,p,Ruvs,explookup,A,B,te
822819 d = total_degree (f)
823820 PR = parent (f)
824821 R = coefficient_ring (parent (f))
825- # verbose && println(pol)
822+ # (9 < verbose) && println(pol)
826823 g_length = binomial (d* n,d* n- n)
827824
828825 i = pol
@@ -833,28 +830,28 @@ function reducepoly_costachunks(pol,S,f,pseudoInverseMat,p,Ruvs,explookup,A,B,te
833830
834831 poleorder = highpoleorder
835832 while n < poleorder
836- params. verbose && println (" pole order is $poleorder " )
833+ ( 9 < params. verbose) && println (" pole order is $poleorder " )
837834 # this is an array of polynomials
838835 ωₑ = termsoforder (pol,poleorder)
839836
840- # verbose && println("ωₑ: $ωₑ")
837+ # (9 < verbose) && println("ωₑ: $ωₑ")
841838
842839
843840
844841 for term in ωₑ
845- # verbose && println("term: $term")
842+ # (9 < verbose) && println("term: $term")
846843 g = zeros (UInt,g_length)
847844 term_costadata = costadata_of_initial_term! (term,g,n,d,p,params. termorder)
848- # verbose && println("term, in Costa's format: $term_costadata")
845+ # (9 < verbose) && println("term, in Costa's format: $term_costadata")
849846 # ω = ω + ωₑ
850847 incorporate_initial_term! (ω,term_costadata)
851848 end
852849
853- # verbose && println("ω: $ω")
850+ # (9 < verbose) && println("ω: $ω")
854851 # ω = reducepoly_LA(ω,n,d,p,S,f,pseudoInverseMat,R,PR)
855852 for i in eachindex (ω)
856853 # ω[i] = reducechain...
857- # verbose && println("u is type $(typeof(ω[i][1]))")
854+ # (9 < verbose) && println("u is type $(typeof(ω[i][1]))")
858855 g_temp = similar (ω[i][2 ])
859856 ω[i] = reducechain_costachunks (ω[i]. .. ,poleorder,S,f,pseudoInverseMat,p,Ruvs,explookup,A,B,temp,g_temp,params)
860857 end
@@ -863,7 +860,7 @@ function reducepoly_costachunks(pol,S,f,pseudoInverseMat,p,Ruvs,explookup,A,B,te
863860 end
864861
865862 # println("ω: $ω")
866- # verbose && println(poly_of_end_costadatas(ω,PR,p,d,n,S,termorder))
863+ # (9 < verbose) && println(poly_of_end_costadatas(ω,PR,p,d,n,S,termorder))
867864
868865 # println(gen_exp_vec(n,n*d-n-1,termorder))
869866
@@ -921,12 +918,17 @@ function reducetransform_costachunks(FT,N_m,S,f,pseudoInverseMat,p,params)
921918 result = []
922919 i = 1
923920 for pol in FT
924- println (" Reducing vector $i " )
921+ ( 0 < params . verbose) && println (" Reducing vector $i " )
925922 i += 1
926- @time reduction = reducepoly_costachunks (pol,S,f,pseudoInverseMat,p,Ruvs,explookup,A,B,temp,params)
923+ if (0 < params. verbose)
924+ @time reduction = reducepoly_costachunks (pol,S,f,pseudoInverseMat,p,Ruvs,explookup,A,B,temp,params)
925+ else
926+ reduction = reducepoly_costachunks (pol,S,f,pseudoInverseMat,p,Ruvs,explookup,A,B,temp,params)
927+ end
928+
927929 push! (result, reduction)
928930 end
929- println (result)
931+
930932 return result
931933end
932934
@@ -944,7 +946,13 @@ function reducetransform_naive(FT,N_m,S,f,pseudoInverseMat,p,params)
944946 for i in 1 : length (ev1)
945947 get! (explookup,ev1[i],i)
946948 end
947- @time precomputeRuvs (S,f,pseudoInverseMat,Ruvs,explookup,params)
949+
950+ if (0 < params. verbose)
951+ @time precomputeRuvs (S,f,pseudoInverseMat,Ruvs,explookup,params)
952+ else
953+ precomputeRuvs (S,f,pseudoInverseMat,Ruvs,explookup,params)
954+ end
955+
948956
949957 contexts = OscarReductionContext[]
950958
@@ -965,12 +973,16 @@ function reducetransform_naive(FT,N_m,S,f,pseudoInverseMat,p,params)
965973 Threads. @threads for i in 1 : length (FT) # pol in FT
966974 context = contexts[i]
967975 pol = FT[i]
968- println (" Reducing vector $i " )
969- @time reduction = reducepoly_naive (pol,S,f,pseudoInverseMat,p,context,explookup,params)
976+ (0 < params. verbose) && println (" Reducing vector $i " )
977+ if (0 < params. verbose)
978+ @time reduction = reducepoly_naive (pol,S,f,pseudoInverseMat,p,context,explookup,params)
979+ else
980+ reduction = reducepoly_naive (pol,S,f,pseudoInverseMat,p,context,explookup,params)
981+ end
970982 result[i] = reduction
971983 # push!(result, reduction)
972984 end
973- println (result)
985+
974986 return result
975987end
976988
@@ -1032,7 +1044,7 @@ function computeRuv(V,S,f,pseudoInverseMat,Ruvs,explookup,params)
10321044 if haskey (Ruvs, V)
10331045 return get (Ruvs, V, 0 )
10341046 else
1035- println (" New key: $V " )
1047+ ( 4 < params . verbose) && println (" New key: $V " )
10361048 end
10371049 ev1 = gen_exp_vec (n+ 1 ,n* d- n,params. termorder)
10381050 ev2 = gen_exp_vec (n+ 1 ,n* d- n+ d- length (S),params. termorder)
0 commit comments