Skip to content

Commit dd9166a

Browse files
committed
Corrected memory access
1 parent 1a3bac6 commit dd9166a

1 file changed

Lines changed: 20 additions & 11 deletions

File tree

src/GraphBLAS-sharp/Implementations.fs

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -234,19 +234,28 @@ and COOMatrix<'a when 'a : struct and 'a : equality>(rowCount: int, columnCount:
234234

235235
let boundaryX = rightEdge
236236
let boundaryY = i - leftEdge
237-
let firstRow = firstRowsBuffer.[boundaryX]
238-
let firstColumn = firstColumnsBuffer.[boundaryX]
239-
let secondRow = secondRowsBuffer.[boundaryY]
240-
let secondColumn = secondColumnsBuffer.[boundaryY]
241-
242-
if boundaryX < 0 || boundaryY >= 0 && (firstRow < secondRow || firstRow = secondRow && firstColumn < secondColumn) then
243-
allRowsBuffer.[i] <- secondRow
244-
allColumnsBuffer.[i] <- secondColumn
237+
238+
if boundaryX < 0 then
239+
allRowsBuffer.[i] <- secondRowsBuffer.[boundaryY]
240+
allColumnsBuffer.[i] <- secondColumnsBuffer.[boundaryY]
245241
allValuesBuffer.[i] <- secondValuesBuffer.[boundaryY]
246-
else
247-
allRowsBuffer.[i] <- firstRow
248-
allColumnsBuffer.[i] <- firstColumn
242+
elif boundaryY < 0 then
243+
allRowsBuffer.[i] <- firstRowsBuffer.[boundaryX]
244+
allColumnsBuffer.[i] <- firstColumnsBuffer.[boundaryX]
249245
allValuesBuffer.[i] <- firstValuesBuffer.[boundaryX]
246+
else
247+
let firstRow = firstRowsBuffer.[boundaryX]
248+
let firstColumn = firstColumnsBuffer.[boundaryX]
249+
let secondRow = secondRowsBuffer.[boundaryY]
250+
let secondColumn = secondColumnsBuffer.[boundaryY]
251+
if firstRow < secondRow || firstRow = secondRow && firstColumn < secondColumn then
252+
allRowsBuffer.[i] <- secondRow
253+
allColumnsBuffer.[i] <- secondColumn
254+
allValuesBuffer.[i] <- secondValuesBuffer.[boundaryY]
255+
else
256+
allRowsBuffer.[i] <- firstRow
257+
allColumnsBuffer.[i] <- firstColumn
258+
allValuesBuffer.[i] <- firstValuesBuffer.[boundaryX]
250259
@>
251260

252261
let createSortedConcatenation =

0 commit comments

Comments
 (0)