@@ -656,102 +656,121 @@ function random_information_set_minimum_distance_bound!(::HasGauges, ::IsCSS, ::
656656 S:: AbstractSubsystemCode , which:: Symbol , dressed:: Bool , max_iters:: Int , verbose:: Bool )
657657 # this is a CSS subsystem code
658658
659+ n = S. n
659660 if dressed
660661 if which == :full
661662 verbose && println (" Bounding the full dressed distance" )
662- stabs = _remove_empty (_rref_no_col_swap! (_Flint_matrix_to_Julia_T_matrix (
663- stabilizers (S), UInt8)), :rows )
664- gauges = _Flint_matrix_to_Julia_T_matrix (gauges_matrix (S), UInt8)
665- logs = _Flint_matrix_to_Julia_T_matrix (logicals_matrix (S), UInt8)
663+ stabs = _Flint_matrix_to_Julia_T_matrix (stabilizers (S), Int)
664+ _rref_no_col_swap! (stabs)
665+ stabs = _remove_empty (stabs, :rows )
666+ gauges = _Flint_matrix_to_Julia_T_matrix (gauges_matrix (S), Int)
667+ logs = _Flint_matrix_to_Julia_T_matrix (logicals_matrix (S), Int)
666668 operators_to_reduce = vcat (stabs, gauges, logs)
667669 check_against = permutedims (logs[:, [n + 1 : 2 n; 1 : n]])
668670 curr_l_bound = S. l_bound_dressed
671+ verbose && println (" Starting lower bound: $curr_l_bound " )
669672
670673 # this is done in the constructor but the logical is not stored at the time
671674 # so must redo here
672- _, mat = _rref_no_col_swap! (operators_to_reduce)
675+ mat = _rref_no_col_swap (operators_to_reduce)
673676 anti = mat * check_against
674- curr_u_bound, index = findmin (row_wts_symplectic (mat[findall (! iszero (anti[i: i , :]) for i in axes (anti, 1 )), :]))
677+ curr_u_bound, index = findmin (row_wts_symplectic (mat[findall (! iszero (anti[i, :]) for i in axes (anti, 1 )), :]))
675678 found = operators_to_reduce[index, :]
679+ verbose && println (" Starting upper bound: $curr_u_bound " )
676680 elseif which == :X
677681 verbose && println (" Bounding the dressed X-distance" )
678- stabs = _remove_empty (_rref_no_col_swap! (_Flint_matrix_to_Julia_T_matrix (
679- X_stabilizers (S), UInt8)), :rows )
680- gauges = _Flint_matrix_to_Julia_T_matrix (reduce (vcat, [log[1 ][:, 1 : n] for log in S. gauge_ops]), UInt8)
681- logs = _Flint_matrix_to_Julia_T_matrix (reduce (vcat, [log[1 ][:, 1 : n] for log in S. logicals]), UInt8)
682+ stabs = _Flint_matrix_to_Julia_T_matrix (stabilizers (S), Int)
683+ _rref_no_col_swap! (stabs)
684+ stabs = _remove_empty (stabs, :rows )
685+ gauges = _Flint_matrix_to_Julia_T_matrix (reduce (vcat, [log[1 ][:, 1 : n] for log in S. gauge_ops]), Int)
686+ logs = _Flint_matrix_to_Julia_T_matrix (reduce (vcat, [log[1 ][:, 1 : n] for log in S. logicals]), Int)
682687 operators_to_reduce = vcat (stabs, gauges, logs)
683688 check_against = permutedims (reduce (vcat, [log[2 ][:, n + 1 : end ] for log in S. logicals])[:, [n + 1 : 2 n; 1 : n]])
684689 curr_l_bound = S. l_bound_dx_dressed
690+ verbose && println (" Starting lower bound: $curr_l_bound " )
685691
686692 # this is done in the constructor but the logical is not stored at the time
687693 # so must redo here
688- _, mat = _rref_no_col_swap! (operators_to_reduce)
694+ mat = _rref_no_col_swap (operators_to_reduce)
689695 anti = mat * check_against
690- curr_u_bound, index = findmin (row_wts (mat[findall (! iszero (anti[i : i, :]) for i in axes (anti, 1 )), :]))
696+ curr_u_bound, index = findmin (row_wts_symplectic (mat[findall (! iszero (anti[i, :]) for i in axes (anti, 1 )), :]))
691697 found = operators_to_reduce[index, :]
698+ verbose && println (" Starting upper bound: $curr_u_bound " )
692699 else
693700 verbose && println (" Bounding the dressed Z-distance" )
694- stabs = _remove_empty (_rref_no_col_swap! (_Flint_matrix_to_Julia_T_matrix (
695- Z_stabilizers (S), UInt8)), :rows )
696- gauges = _Flint_matrix_to_Julia_T_matrix (reduce (vcat, [log[2 ][:, n + 1 : end ] for log in S. gauge_ops]), UInt8)
697- logs = _Flint_matrix_to_Julia_T_matrix (reduce (vcat, [log[2 ][:, n + 1 : end ] for log in S. logicals]), UInt8)
701+ stabs = _Flint_matrix_to_Julia_T_matrix (stabilizers (S), Int)
702+ _rref_no_col_swap! (stabs)
703+ stabs = _remove_empty (stabs, :rows )
704+ gauges = _Flint_matrix_to_Julia_T_matrix (reduce (vcat, [log[2 ][:, n + 1 : end ] for log in S. gauge_ops]), Int)
705+ logs = _Flint_matrix_to_Julia_T_matrix (reduce (vcat, [log[2 ][:, n + 1 : end ] for log in S. logicals]), Int)
698706 operators_to_reduce = vcat (stabs, gauges, logs)
699707 check_against = permutedims (reduce (vcat, [log[1 ][:, 1 : n] for log in S. logicals]))
700708 curr_l_bound = S. l_bound_dz_dressed
709+ verbose && println (" Starting lower bound: $curr_l_bound " )
701710
702711 # this is done in the constructor but the logical is not stored at the time
703712 # so must redo here
704- _, mat = _rref_no_col_swap! (operators_to_reduce)
713+ mat = _rref_no_col_swap (operators_to_reduce)
705714 anti = mat * check_against
706- curr_u_bound, index = findmin (row_wts (mat[findall (! iszero (anti[i : i, :]) for i in axes (anti, 1 )), :]))
715+ curr_u_bound, index = findmin (row_wts_symplectic (mat[findall (! iszero (anti[i, :]) for i in axes (anti, 1 )), :]))
707716 found = operators_to_reduce[index, :]
717+ verbose && println (" Starting upper bound: $curr_u_bound " )
708718 end
709719 else
710720 if which == :full
711721 verbose && println (" Bounding the full bare distance" )
712- stabs = _remove_empty (_rref_no_col_swap! (_Flint_matrix_to_Julia_T_matrix (
713- stabilizers (S), UInt8)), :rows )
714- logs = _Flint_matrix_to_Julia_T_matrix (logicals_matrix (S), UInt8)
722+ stabs = _Flint_matrix_to_Julia_T_matrix (stabilizers (S), Int)
723+ _rref_no_col_swap! (stabs)
724+ stabs = _remove_empty (stabs, :rows )
725+ logs = _Flint_matrix_to_Julia_T_matrix (logicals_matrix (S), Int)
715726 operators_to_reduce = vcat (stabs, logs)
716727 check_against = permutedims (logs[:, [n + 1 : 2 n; 1 : n]])
717728 curr_l_bound = S. l_bound_bare
729+ verbose && println (" Starting lower bound: $curr_l_bound " )
718730
719731 # this is done in the constructor but the logical is not stored at the time
720732 # so must redo here
721- _, mat = _rref_no_col_swap! (operators_to_reduce)
733+ mat = _rref_no_col_swap (operators_to_reduce)
722734 anti = mat * check_against
723- curr_u_bound, index = findmin (row_wts_symplectic (mat[findall (! iszero (anti[i: i , :]) for i in axes (anti, 1 )), :]))
735+ curr_u_bound, index = findmin (row_wts_symplectic (mat[findall (! iszero (anti[i, :]) for i in axes (anti, 1 )), :]))
724736 found = operators_to_reduce[index, :]
737+ verbose && println (" Starting upper bound: $curr_u_bound " )
725738 elseif which == :X
726739 verbose && println (" Bounding the bare X-distance" )
727- stabs = _remove_empty (_rref_no_col_swap! (_Flint_matrix_to_Julia_T_matrix (
728- X_stabilizers (S), UInt8)), :rows )
729- logs = _Flint_matrix_to_Julia_T_matrix (reduce (vcat, [log[1 ][:, 1 : n] for log in S. logicals]), UInt8)
740+ stabs = _Flint_matrix_to_Julia_T_matrix (stabilizers (S), Int)
741+ _rref_no_col_swap! (stabs)
742+ stabs = _remove_empty (stabs, :rows )
743+ logs = _Flint_matrix_to_Julia_T_matrix (reduce (vcat, [log[1 ][:, 1 : n] for log in S. logicals]), Int)
730744 operators_to_reduce = vcat (stabs, logs)
731745 check_against = permutedims (reduce (vcat, [log[2 ][:, n + 1 : end ] for log in S. logicals])[:, [n + 1 : 2 n; 1 : n]])
732746 curr_l_bound = S. l_bound_dx_bare
747+ verbose && println (" Starting lower bound: $curr_l_bound " )
733748
734749 # this is done in the constructor but the logical is not stored at the time
735750 # so must redo here
736- _, mat = _rref_no_col_swap! (operators_to_reduce)
751+ mat = _rref_no_col_swap (operators_to_reduce)
737752 anti = mat * check_against
738- curr_u_bound, index = findmin (row_wts (mat[findall (! iszero (anti[i : i, :]) for i in axes (anti, 1 )), :]))
753+ curr_u_bound, index = findmin (row_wts_symplectic (mat[findall (! iszero (anti[i, :]) for i in axes (anti, 1 )), :]))
739754 found = operators_to_reduce[index, :]
755+ verbose && println (" Starting upper bound: $curr_u_bound " )
740756 else
741757 verbose && println (" Bounding the bare Z-distance" )
742- stabs = _remove_empty (_rref_no_col_swap! (_Flint_matrix_to_Julia_T_matrix (
743- Z_stabilizers (S), UInt8)), :rows )
744- logs = _Flint_matrix_to_Julia_T_matrix (reduce (vcat, [log[2 ][:, n + 1 : end ] for log in S. logicals]), UInt8)
758+ stabs = _Flint_matrix_to_Julia_T_matrix (stabilizers (S), Int)
759+ _rref_no_col_swap! (stabs)
760+ stabs = _remove_empty (stabs, :rows )
761+ logs = _Flint_matrix_to_Julia_T_matrix (reduce (vcat, [log[2 ][:, n + 1 : end ] for log in S. logicals]), Int)
745762 operators_to_reduce = vcat (stabs, logs)
746763 check_against = permutedims (reduce (vcat, [log[1 ][:, 1 : n] for log in S. logicals]))
747764 curr_l_bound = S. l_bound_dx_bare
765+ verbose && println (" Starting lower bound: $curr_l_bound " )
748766
749767 # this is done in the constructor but the logical is not stored at the time
750768 # so must redo here
751- _, mat = _rref_no_col_swap! (operators_to_reduce)
769+ mat = _rref_no_col_swap (operators_to_reduce)
752770 anti = mat * check_against
753- curr_u_bound, index = findmin (row_wts (mat[findall (! iszero (anti[i : i, :]) for i in axes (anti, 1 )), :]))
771+ curr_u_bound, index = findmin (row_wts_symplectic (mat[findall (! iszero (anti[i, :]) for i in axes (anti, 1 )), :]))
754772 found = operators_to_reduce[index, :]
773+ verbose && println (" Starting upper bound: $curr_u_bound " )
755774 end
756775 end
757776
@@ -804,34 +823,40 @@ function random_information_set_minimum_distance_bound!(::HasNoGauges, ::IsCSS,
804823 verbose && println (" Starting upper bound: $curr_u_bound " )
805824 elseif which == :X
806825 verbose && println (" Bounding the X-distance" )
807- stabs = _remove_empty (_rref_no_col_swap! (_Flint_matrix_to_Julia_T_matrix (
808- X_stabilizers (S), UInt8)), :rows )
809- logs = _Flint_matrix_to_Julia_T_matrix (reduce (vcat, [log[1 ][:, 1 : n] for log in S. logicals]), UInt8)
826+ stabs = _Flint_matrix_to_Julia_T_matrix (stabilizers (S), Int)
827+ _rref_no_col_swap! (stabs)
828+ stabs = _remove_empty (stabs, :rows )
829+ logs = _Flint_matrix_to_Julia_T_matrix (reduce (vcat, [log[1 ][:, 1 : n] for log in S. logicals]), Int)
810830 operators_to_reduce = vcat (stabs, logs)
811831 check_against = permutedims (reduce (vcat, [log[2 ][:, n + 1 : end ] for log in S. logicals])[:, [n + 1 : 2 n; 1 : n]])
812832 curr_l_bound = S. l_bound_dx
833+ verbose && println (" Starting lower bound: $curr_l_bound " )
813834
814835 # this is done in the constructor but the logical is not stored at the time
815836 # so must redo here
816- _, mat = _rref_no_col_swap! (operators_to_reduce)
837+ mat = _rref_no_col_swap (operators_to_reduce)
817838 anti = mat * check_against
818- curr_u_bound, index = findmin (row_wts (mat[findall (! iszero (anti[i : i, :]) for i in axes (anti, 1 )), :]))
839+ curr_u_bound, index = findmin (row_wts_symplectic (mat[findall (! iszero (anti[i, :]) for i in axes (anti, 1 )), :]))
819840 found = operators_to_reduce[index, :]
841+ verbose && println (" Starting upper bound: $curr_u_bound " )
820842 else
821843 verbose && println (" Bounding the Z-distance" )
822- stabs = _remove_empty (_rref_no_col_swap! (_Flint_matrix_to_Julia_T_matrix (
823- Z_stabilizers (S), UInt8)), :rows )
824- logs = _Flint_matrix_to_Julia_T_matrix (reduce (vcat, [log[2 ][:, n + 1 : end ] for log in S. logicals]), UInt8)
844+ stabs = _Flint_matrix_to_Julia_T_matrix (stabilizers (S), Int)
845+ _rref_no_col_swap! (stabs)
846+ stabs = _remove_empty (stabs, :rows )
847+ logs = _Flint_matrix_to_Julia_T_matrix (reduce (vcat, [log[2 ][:, n + 1 : end ] for log in S. logicals]), Int)
825848 operators_to_reduce = vcat (stabs, logs)
826849 check_against = permutedims (reduce (vcat, [log[1 ][:, 1 : n] for log in S. logicals]))
827850 curr_l_bound = S. l_bound_dx
851+ verbose && println (" Starting lower bound: $curr_l_bound " )
828852
829853 # this is done in the constructor but the logical is not stored at the time
830854 # so must redo here
831- _, mat = _rref_no_col_swap! (operators_to_reduce)
855+ mat = _rref_no_col_swap (operators_to_reduce)
832856 anti = mat * check_against
833- curr_u_bound, index = findmin (row_wts (mat[findall (! iszero (anti[i : i, :]) for i in axes (anti, 1 )), :]))
857+ curr_u_bound, index = findmin (row_wts_symplectic (mat[findall (! iszero (anti[i, :]) for i in axes (anti, 1 )), :]))
834858 found = operators_to_reduce[index, :]
859+ verbose && println (" Starting upper bound: $curr_u_bound " )
835860 end
836861
837862 uppers, founds = _RIS_bound_loop! (operators_to_reduce, check_against, curr_l_bound,
@@ -853,37 +878,44 @@ function random_information_set_minimum_distance_bound!(::HasGauges, ::IsNotCSS,
853878
854879 which == :full || throw (ArguementError (which, " Parameter is not valid for non-CSS codes." ))
855880
881+ n = S. n
856882 if dressed
857883 verbose && println (" Bounding the full dressed distance" )
858- stabs = _remove_empty (_rref_no_col_swap! (_Flint_matrix_to_Julia_T_matrix (
859- stabilizers (S), UInt8)), :rows )
860- gauges = _Flint_matrix_to_Julia_T_matrix (gauges_matrix (S), UInt8)
861- logs = _Flint_matrix_to_Julia_T_matrix (logicals_matrix (S), UInt8)
884+ stabs = _Flint_matrix_to_Julia_T_matrix (stabilizers (S), Int)
885+ _rref_no_col_swap! (stabs)
886+ stabs = _remove_empty (stabs, :rows )
887+ gauges = _Flint_matrix_to_Julia_T_matrix (gauges_matrix (S), Int)
888+ logs = _Flint_matrix_to_Julia_T_matrix (logicals_matrix (S), Int)
862889 operators_to_reduce = vcat (stabs, gauges, logs)
863890 check_against = permutedims (logs[:, [n + 1 : 2 n; 1 : n]])
864891 curr_l_bound = S. l_bound_dressed
892+ verbose && println (" Starting lower bound: $curr_l_bound " )
865893
866894 # this is done in the constructor but the logical is not stored at the time
867895 # so must redo here
868- _, mat = _rref_no_col_swap! (operators_to_reduce)
896+ mat = _rref_no_col_swap (operators_to_reduce)
869897 anti = mat * check_against
870898 curr_u_bound, index = findmin (row_wts_symplectic (mat[findall (! iszero (anti[i, :]) for i in axes (anti, 1 )), :]))
871899 found = operators_to_reduce[index, :]
900+ verbose && println (" Starting upper bound: $curr_u_bound " )
872901 else
873902 verbose && println (" Bounding the full bare distance" )
874- stabs = _remove_empty (_rref_no_col_swap! (_Flint_matrix_to_Julia_T_matrix (
875- stabilizers (S), UInt8)), :rows )
876- logs = _Flint_matrix_to_Julia_T_matrix (logicals_matrix (S), UInt8)
903+ stabs = _Flint_matrix_to_Julia_T_matrix (stabilizers (S), Int)
904+ _rref_no_col_swap! (stabs)
905+ stabs = _remove_empty (stabs, :rows )
906+ logs = _Flint_matrix_to_Julia_T_matrix (logicals_matrix (S), Int)
877907 operators_to_reduce = vcat (stabs, logs)
878908 check_against = permutedims (logs[:, [n + 1 : 2 n; 1 : n]])
879909 curr_l_bound = S. l_bound_bare
910+ verbose && println (" Starting lower bound: $curr_l_bound " )
880911
881912 # this is done in the constructor but the logical is not stored at the time
882913 # so must redo here
883- _, mat = _rref_no_col_swap! (operators_to_reduce)
914+ mat = _rref_no_col_swap (operators_to_reduce)
884915 anti = mat * check_against
885916 curr_u_bound, index = findmin (row_wts_symplectic (mat[findall (! iszero (anti[i, :]) for i in axes (anti, 1 )), :]))
886917 found = operators_to_reduce[index, :]
918+ verbose && println (" Starting upper bound: $curr_u_bound " )
887919 end
888920
889921 uppers, founds = _RIS_bound_loop! (operators_to_reduce, check_against, curr_l_bound,
@@ -903,20 +935,22 @@ function random_information_set_minimum_distance_bound!(::HasNoGauges, ::IsNotCS
903935
904936 which == :full || throw (ArguementError (which, " Parameter is not valid for non-CSS codes." ))
905937
938+ n = S. n
906939 verbose && println (" Bounding the full distance" )
907- stabs = _remove_empty (_rref_no_col_swap! (_Flint_matrix_to_Julia_T_matrix (
908- stabilizers (S), UInt8)), :rows )
909- logs = _Flint_matrix_to_Julia_T_matrix (logicals_matrix (S), UInt8)
940+ stabs = _Flint_matrix_to_Julia_T_matrix (stabilizers (S), Int)
941+ _rref_no_col_swap! (stabs)
942+ stabs = _remove_empty (stabs, :rows )
943+ logs = _Flint_matrix_to_Julia_T_matrix (logicals_matrix (S), Int)
910944 operators_to_reduce = vcat (stabs, logs)
911945 check_against = permutedims (logs[:, [n + 1 : 2 n; 1 : n]])
912946 curr_l_bound = S. l_bound
913947 verbose && println (" Starting lower bound: $curr_l_bound " )
914948
915949 # this is done in the constructor but the logical is not stored at the time
916950 # so must redo here
917- _, mat = _rref_no_col_swap! (operators_to_reduce)
951+ mat = _rref_no_col_swap (operators_to_reduce)
918952 anti = mat * check_against
919- curr_u_bound, index = findmin (row_wts_symplectic (mat[findall (! iszero (anti[i: i , :]) for i in axes (anti, 1 )), :]))
953+ curr_u_bound, index = findmin (row_wts_symplectic (mat[findall (! iszero (anti[i, :]) for i in axes (anti, 1 )), :]))
920954 found = operators_to_reduce[index, :]
921955 verbose && println (" Starting upper bound: $curr_u_bound " )
922956
0 commit comments