Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/bpdecoderplus/batch_osd.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,13 @@ def _evaluate_candidates_gpu(self, candidates: torch.Tensor, augmented: np.ndarr
# Set pivot variables based on target syndromes (vectorized)
# Build pivot row mapping
augmented_torch = torch.from_numpy(augmented[:, :self.num_errors]).to(self.device)
pivot_cols_set = set(pivot_cols)
for r in range(augmented.shape[0]):
# Find pivot column in this row
row_pivots = torch.where(augmented_torch[r, :] == 1)[0]
if len(row_pivots) > 0:
pivot_c = row_pivots[0].item()
if pivot_c in pivot_cols:
if pivot_c in pivot_cols_set:
# Set this pivot variable for all candidates
cand_solutions[:, pivot_c] = target_syndromes[:, r]

Expand Down Expand Up @@ -176,11 +177,12 @@ def solve(self, syndrome: np.ndarray, error_probs: np.ndarray,

# Build the row mapping: the pivot column c corresponds to which row r
pivot_row_map = {}
pivot_cols_set = set(pivot_cols)
for r in range(augmented.shape[0]):
row_pivots = np.where(augmented[r, :self.num_errors] == 1)[0]
if len(row_pivots) > 0:
col = row_pivots[0]
if col in pivot_cols:
if col in pivot_cols_set:
pivot_row_map[col] = r
solution_base[col] = augmented[r, -1]

Expand Down