Skip to content

Commit 1af566d

Browse files
committed
Removed odd memory access for vectors
1 parent 8ae46f3 commit 1af566d

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/GraphBLAS-sharp/Implementations.fs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,12 +477,14 @@ and SparseVector<'a when 'a : struct and 'a : equality>(size: int, indices: int[
477477
if firstIndicesBuffer.[middleIdx] < secondIndicesBuffer.[i - middleIdx] then leftEdge <- middleIdx + 1 else rightEdge <- middleIdx - 1
478478

479479
let boundaryX, boundaryY = rightEdge, i - leftEdge
480+
let firstIndex = firstIndicesBuffer.[boundaryX]
481+
let secondIndex = secondIndicesBuffer.[boundaryY]
480482

481-
if boundaryX < 0 || boundaryY >= 0 && firstIndicesBuffer.[boundaryX] < secondIndicesBuffer.[boundaryY] then
482-
allIndicesBuffer.[i] <- secondIndicesBuffer.[boundaryY]
483+
if boundaryX < 0 || boundaryY >= 0 && firstIndex < secondIndex then
484+
allIndicesBuffer.[i] <- secondIndex
483485
allValuesBuffer.[i] <- secondValuesBuffer.[boundaryY]
484486
else
485-
allIndicesBuffer.[i] <- firstIndicesBuffer.[boundaryX]
487+
allIndicesBuffer.[i] <- firstIndex
486488
allValuesBuffer.[i] <- firstValuesBuffer.[boundaryX]
487489
@>
488490

0 commit comments

Comments
 (0)