Skip to content

Commit 7f3cb90

Browse files
committed
refactor: SpGeMM.expand
1 parent 655fe67 commit 7f3cb90

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

  • src/GraphBLAS-sharp.Backend/Matrix/SpGeMM

src/GraphBLAS-sharp.Backend/Matrix/SpGeMM/Expand.fs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ open GraphBLAS.FSharp.Backend.Objects.ArraysExtensions
1010
open GraphBLAS.FSharp.Backend.Objects
1111
open GraphBLAS.FSharp.Backend.Objects.ClCell
1212
open FSharp.Quotations
13-
open GraphBLAS.FSharp.Backend.Vector.Sparse
1413
open GraphBLAS.FSharp.Backend.Objects.ClVector
1514
open GraphBLAS.FSharp.Backend.Objects.ClMatrix
1615

@@ -145,6 +144,8 @@ module Expand =
145144
.ToHostAndFree(processor)
146145

147146
if resultLength = 0 then
147+
positions.Free processor
148+
148149
None
149150
else
150151
let resultIndices =
@@ -157,6 +158,8 @@ module Expand =
157158

158159
assignValues processor firstValues secondValues positions resultValues
159160

161+
positions.Free processor
162+
160163
Some(resultValues, resultIndices)
161164

162165
let sortByColumns (clContext: ClContext) workGroupSize =
@@ -268,13 +271,12 @@ module Expand =
268271

269272
// create sparse vector (TODO(empty vector))
270273
reduceResult
271-
|> Option.bind
274+
|> Option.map
272275
(fun (values, columns) ->
273276
{ Context = clContext
274277
Indices = columns
275278
Values = values
276-
Size = rightMatrix.ColumnCount }
277-
|> Some)))
279+
Size = rightMatrix.ColumnCount })))
278280

279281
let run<'a, 'b, 'c when 'a: struct and 'b: struct and 'c: struct>
280282
(clContext: ClContext)

0 commit comments

Comments
 (0)