@@ -647,7 +647,7 @@ function random_information_set_minimum_distance_bound!(S::T, which::Symbol = :f
647647 return random_information_set_minimum_distance_bound! (GaugeTrait (T), CSSTrait (T),
648648 LogicalTrait (T), S, which, dressed, max_iters, verbose)
649649end
650- QDistRand ! (S:: T , which:: Symbol = :full ; dressed:: Bool = true , max_iters:: Int = 10000 ,
650+ QDistRnd ! (S:: T , which:: Symbol = :full ; dressed:: Bool = true , max_iters:: Int = 10000 ,
651651 verbose:: Bool = false ) where T <: AbstractSubsystemCode =
652652 random_information_set_minimum_distance_bound! (S, which; dressed = dressed, max_iters =
653653 max_iters, verbose = verbose)
@@ -775,7 +775,7 @@ function random_information_set_minimum_distance_bound!(::HasGauges, ::IsCSS, ::
775775 end
776776
777777 uppers, founds = _RIS_bound_loop! (operators_to_reduce, check_against, curr_l_bound,
778- curr_u_bound, found, max_iterst , n, verbose)
778+ curr_u_bound, found, max_iters , n, verbose)
779779 loc = argmin (uppers)
780780 if dressed
781781 if which == :full
@@ -794,6 +794,7 @@ function random_information_set_minimum_distance_bound!(::HasGauges, ::IsCSS, ::
794794 S. u_bound_dz_bare = uppers[loc]
795795 end
796796 end
797+ verbose && println (" Ending $max_iters iterations with an upper bound of $(uppers[loc]) " )
797798 return uppers[loc], founds[loc]
798799end
799800
@@ -870,6 +871,7 @@ function random_information_set_minimum_distance_bound!(::HasNoGauges, ::IsCSS,
870871 else
871872 S. u_bound_dz = uppers[loc]
872873 end
874+ verbose && println (" Ending $max_iters iterations with an upper bound of $(uppers[loc]) " )
873875 return uppers[loc], founds[loc]
874876end
875877
@@ -920,13 +922,14 @@ function random_information_set_minimum_distance_bound!(::HasGauges, ::IsNotCSS,
920922 end
921923
922924 uppers, founds = _RIS_bound_loop! (operators_to_reduce, check_against, curr_l_bound,
923- curr_u_bound, found, max_iterst , n, verbose)
925+ curr_u_bound, found, max_iters , n, verbose)
924926 loc = argmin (uppers)
925927 if dressed
926928 S. u_bound_dressed = uppers[loc]
927929 else
928930 S. u_bound_bare = uppers[loc]
929931 end
932+ verbose && println (" Ending $max_iters iterations with an upper bound of $(uppers[loc]) " )
930933 return uppers[loc], founds[loc]
931934end
932935
@@ -959,6 +962,7 @@ function random_information_set_minimum_distance_bound!(::HasNoGauges, ::IsNotCS
959962 curr_u_bound, found, max_iters, n, verbose)
960963 loc = argmin (uppers)
961964 S. u_bound = uppers[loc]
965+ verbose && println (" Ending $max_iters iterations with an upper bound of $(uppers[loc]) " )
962966 return uppers[loc], founds[loc]
963967end
964968
@@ -977,15 +981,15 @@ function _RIS_bound_loop!(operators_to_reduce, check_against, curr_l_bound::Int,
977981 uppers = [curr_u_bound for _ in 1 : num_thrds]
978982 founds = [found for _ in 1 : num_thrds]
979983 thread_load = Int (floor (max_iters / num_thrds))
980- # Threads.@threads for t in 1:num_thrds
981- for t in 1 : num_thrds
984+ Threads. @threads for t in 1 : num_thrds
982985 log_test = zeros (Int, size (operators_to_reduce, 1 ), size (check_against, 2 ))
983986 for _ in 1 : thread_load
984987 if flag[]
985988 perm = shuffle (1 : n)
986989 perm2 = [perm; perm .+ n]
987990 perm_ops = operators_to_reduce[:, perm2]
988- _rref_no_col_swap_binary! (perm_ops)
991+ # modifying this in place is not thread safe (apparently)
992+ perm_ops = _rref_no_col_swap_binary (perm_ops)
989993 ops = perm_ops[:, invperm (perm2)]
990994 LinearAlgebra. mul! (log_test, ops, check_against)
991995 for i in axes (log_test, 1 )
@@ -998,12 +1002,11 @@ function _RIS_bound_loop!(operators_to_reduce, check_against, curr_l_bound::Int,
9981002
9991003 if uppers[t] > w
10001004 uppers[t] = w
1001- # maybe use invpermute! here?
10021005 founds[t] .= ops[i, :]
1003- verbose && println (" Adjusting upper bound: $w " )
1006+ verbose && println (" Adjusting (thread's local) upper bound: $w " )
10041007 if curr_l_bound == w
10051008 verbose && println (" Found a logical that matched the lower bound of $curr_l_bound " )
1006- # Threads.atomic_cas!(flag, true, false)
1009+ Threads. atomic_cas! (flag, true , false )
10071010 break
10081011 end
10091012 end
@@ -1039,7 +1042,7 @@ function _RIS_bound_loop!(operators_to_reduce, check_against, curr_l_bound::Int,
10391042 if upper_temp > w
10401043 upper_temp = w
10411044 found_temp .= ops[i, :]
1042- verbose && println (" Adjusting upper bound: $w " )
1045+ verbose && println (" Adjusting (thread's local) upper bound: $w " )
10431046 if curr_l_bound == w
10441047 verbose && println (" Found a logical that matched the lower bound of $curr_l_bound " )
10451048 flag = false
0 commit comments