@@ -285,13 +285,13 @@ module Matrix =
285285 let CSRElementwise =
286286 CSRMatrix.elementwiseToCOO clContext opAdd workGroupSize
287287
288- let toCSRInplace =
289- toCSRInplace clContext workGroupSize
288+ let transposeCOOInplace =
289+ COOMatrix.transposeInplace clContext workGroupSize
290290
291291 fun ( processor : MailboxProcessor < _ >) matrix1 matrix2 ->
292292 match matrix1, matrix2 with
293293 | MatrixCOO m1, MatrixCOO m2 -> COOElementwise processor m1 m2 |> MatrixCOO
294- | MatrixCSR m1, MatrixCSR m2 -> CSRElementwise processor m1 m2 |> MatrixCSR
294+ | MatrixCSR m1, MatrixCSR m2 -> CSRElementwise processor m1 m2 |> MatrixCOO
295295 | MatrixCSC m1, MatrixCSC m2 ->
296296 let csrT1 =
297297 { Context = m1.Context
@@ -310,15 +310,7 @@ module Matrix =
310310 Values = m2.Values }
311311
312312 let resT = CSRElementwise processor csrT1 csrT2
313- let resCSRT = toCSRInplace procesor resT
314-
315- { Context = resCSRT.Context
316- RowCount = resCSRT.ColumnCount
317- ColumnCount = resCSRT.RowCount
318- Rows = resCSRT.Columns
319- ColumnPointers = resCSRT.RowPointers
320- Values = resCSRT.Values }
321- |> MatrixCSC
313+ MatrixCOO <| transposeCOOInplace processor resT
322314 | _ -> failwith " Matrix formats are not matching"
323315
324316 let elementwiseAtLeastOne ( clContext : ClContext ) ( opAdd : Expr < AtLeastOne < 'a , 'b > -> 'c option >) workGroupSize =
@@ -367,10 +359,13 @@ module Matrix =
367359 let CSRElementwise =
368360 CSRMatrix.elementwiseAtLeastOneToCOO clContext opAdd workGroupSize
369361
362+ let transposeCOOInplace =
363+ COOMatrix.transposeInplace clContext workGroupSize
364+
370365 fun ( processor : MailboxProcessor < _ >) matrix1 matrix2 ->
371366 match matrix1, matrix2 with
372367 | MatrixCOO m1, MatrixCOO m2 -> COOElementwise processor m1 m2 |> MatrixCOO
373- | MatrixCSR m1, MatrixCSR m2 -> CSRElementwise processor m1 m2 |> MatrixCSR
368+ | MatrixCSR m1, MatrixCSR m2 -> CSRElementwise processor m1 m2 |> MatrixCOO
374369 | MatrixCSC m1, MatrixCSC m2 ->
375370 let csrT1 =
376371 { Context = m1.Context
@@ -389,15 +384,7 @@ module Matrix =
389384 Values = m2.Values }
390385
391386 let resT = CSRElementwise processor csrT1 csrT2
392- let resCSRT = toCSRInplace procesor resT
393-
394- { Context = resCSRT.Context
395- RowCount = resCSRT.ColumnCount
396- ColumnCount = resCSRT.RowCount
397- Rows = resCSRT.Columns
398- ColumnPointers = resCSRT.RowPointers
399- Values = resCSRT.Values }
400- |> MatrixCSC
387+ MatrixCOO <| transposeCOOInplace processor resT
401388 | _ -> failwith " Matrix formats are not matching"
402389
403390 /// <summary >
0 commit comments