Skip to content

Commit f9e7476

Browse files
committed
Functions are wrapped to lambdas
1 parent 8666552 commit f9e7476

1 file changed

Lines changed: 20 additions & 19 deletions

File tree

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

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,31 @@ open Brahma.FSharp.OpenCL
44
open Microsoft.FSharp.Quotations
55

66
module Matrix =
7-
let toCSR (clContext: ClContext) workGroupSize processor matrix =
8-
let toCSR =
9-
COOMatrix.toCSR clContext workGroupSize processor
7+
let toCSR (clContext: ClContext) workGroupSize =
8+
let toCSR = COOMatrix.toCSR clContext workGroupSize
109

11-
match matrix with
12-
| MatrixCOO m -> toCSR m |> MatrixCSR
13-
| MatrixCSR _ -> matrix
10+
fun (processor: MailboxProcessor<_>) (matrix: Matrix<'a>) ->
11+
match matrix with
12+
| MatrixCOO m -> toCSR processor m |> MatrixCSR
13+
| MatrixCSR _ -> matrix
1414

15-
let toCOO (clContext: ClContext) workGroupSize processor matrix =
16-
let toCOO =
17-
CSRMatrix.toCOO clContext processor workGroupSize
15+
let toCOO (clContext: ClContext) workGroupSize =
16+
let toCOO = CSRMatrix.toCOO clContext
1817

19-
match matrix with
20-
| MatrixCOO _ -> matrix
21-
| MatrixCSR m -> toCOO m |> MatrixCOO
18+
fun (processor: MailboxProcessor<_>) (matrix: Matrix<'a>) ->
19+
match matrix with
20+
| MatrixCOO _ -> matrix
21+
| MatrixCSR m -> toCOO processor workGroupSize m |> MatrixCOO
2222

23-
let eWiseAdd (clContext: ClContext) (opAdd: Expr<'a -> 'a -> 'a>) workGroupSize processor matrix1 matrix2 =
23+
let eWiseAdd (clContext: ClContext) (opAdd: Expr<'a -> 'a -> 'a>) workGroupSize =
2424
let COOeWiseAdd =
25-
COOMatrix.eWiseAdd clContext opAdd workGroupSize processor
25+
COOMatrix.eWiseAdd clContext opAdd workGroupSize
2626

2727
let CSReWiseAdd =
28-
CSRMatrix.eWiseAdd clContext opAdd workGroupSize processor
28+
CSRMatrix.eWiseAdd clContext opAdd workGroupSize
2929

30-
match matrix1, matrix2 with
31-
| MatrixCOO m1, MatrixCOO m2 -> COOeWiseAdd m1 m2 |> MatrixCOO
32-
| MatrixCSR m1, MatrixCSR m2 -> CSReWiseAdd m1 m2 |> MatrixCSR
33-
| _ -> failwith "Matrix formats are not matching"
30+
fun (processor: MailboxProcessor<_>) matrix1 matrix2 ->
31+
match matrix1, matrix2 with
32+
| MatrixCOO m1, MatrixCOO m2 -> COOeWiseAdd processor m1 m2 |> MatrixCOO
33+
| MatrixCSR m1, MatrixCSR m2 -> CSReWiseAdd processor m1 m2 |> MatrixCSR
34+
| _ -> failwith "Matrix formats are not matching"

0 commit comments

Comments
 (0)