@@ -94,7 +94,7 @@ module Matrix =
9494 ///<param name =" workGroupSize " >Should be a power of 2 and greater than 1.</param >
9595 let toCSRInPlace ( clContext : ClContext ) workGroupSize =
9696 let toCSRInPlace =
97- COO.Matrix.toCSRInplace clContext workGroupSize
97+ COO.Matrix.toCSRInPlace clContext workGroupSize
9898
9999 let transposeInPlace =
100100 CSR.Matrix.transposeInPlace clContext workGroupSize
@@ -121,11 +121,11 @@ module Matrix =
121121
122122 let copy = copy clContext workGroupSize
123123
124- let transposeInplace =
125- COO.Matrix.transposeInplace clContext workGroupSize
124+ let transposeInPlace =
125+ COO.Matrix.transposeInPlace clContext workGroupSize
126126
127- let rowsToCOO =
128- Rows.Matrix.toCOO clContext workGroupSize
127+ let rowsToCSR =
128+ Rows.Matrix.toCSR clContext workGroupSize
129129
130130 fun ( processor : MailboxProcessor < _ >) allocationMode ( matrix : ClMatrix < 'a >) ->
131131 match matrix with
@@ -134,10 +134,11 @@ module Matrix =
134134 | ClMatrix.CSC m ->
135135 m.ToCSR
136136 |> toCOO processor allocationMode
137- |> transposeInplace processor
137+ |> transposeInPlace processor
138138 |> ClMatrix.COO
139139 | ClMatrix.Rows m ->
140- rowsToCOO processor allocationMode m
140+ rowsToCSR processor allocationMode m
141+ |> toCOO processor allocationMode
141142 |> ClMatrix.COO
142143
143144 /// <summary >
@@ -151,7 +152,7 @@ module Matrix =
151152 CSR.Matrix.toCOOInPlace clContext workGroupSize
152153
153154 let transposeInPlace =
154- COO.Matrix.transposeInplace clContext workGroupSize
155+ COO.Matrix.transposeInPlace clContext workGroupSize
155156
156157 fun ( processor : MailboxProcessor < _ >) allocationMode ( matrix : ClMatrix < 'a >) ->
157158 match matrix with
@@ -182,6 +183,8 @@ module Matrix =
182183 let transposeCOO =
183184 COO.Matrix.transpose clContext workGroupSize
184185
186+ let rowsToCSR = Rows.Matrix.toCSR clContext workGroupSize
187+
185188 fun ( processor : MailboxProcessor < _ >) allocationMode ( matrix : ClMatrix < 'a >) ->
186189 match matrix with
187190 | ClMatrix.CSC _ -> copy processor allocationMode matrix
@@ -193,37 +196,68 @@ module Matrix =
193196 |> COOtoCSR processor allocationMode)
194197 .ToCSC
195198 |> ClMatrix.CSC
196- | _ -> failwith " Not yet implemented"
199+ | ClMatrix.Rows m ->
200+ rowsToCSR processor allocationMode m
201+ |> transposeCSR processor allocationMode
202+ |> fun m -> m.ToCSC
203+ |> ClMatrix.CSC
197204
198205 /// <summary >
199206 /// Returns the matrix, represented in CSC format, that is equal to the given one.
200207 /// The given matrix should neither be used afterwards nor be disposed.
201208 /// </summary >
202209 ///<param name =" clContext " >OpenCL context.</param >
203210 ///<param name =" workGroupSize " >Should be a power of 2 and greater than 1.</param >
204- let toCSCInplace ( clContext : ClContext ) workGroupSize =
205- let toCSRInplace =
206- COO.Matrix.toCSRInplace clContext workGroupSize
211+ let toCSCInPlace ( clContext : ClContext ) workGroupSize =
212+ let toCSRInPlace =
213+ COO.Matrix.toCSRInPlace clContext workGroupSize
207214
208- let transposeCSRInplace =
215+ let transposeCSRInPlace =
209216 CSR.Matrix.transposeInPlace clContext workGroupSize
210217
211- let transposeCOOInplace =
212- COO.Matrix.transposeInplace clContext workGroupSize
218+ let transposeCOOInPlace =
219+ COO.Matrix.transposeInPlace clContext workGroupSize
213220
214221 fun ( processor : MailboxProcessor < _ >) allocationMode ( matrix : ClMatrix < 'a >) ->
215222 match matrix with
216223 | ClMatrix.CSC _ -> matrix
217224 | ClMatrix.CSR m ->
218- ( transposeCSRInplace processor allocationMode m)
225+ ( transposeCSRInPlace processor allocationMode m)
219226 .ToCSC
220227 |> ClMatrix.CSC
221228 | ClMatrix.COO m ->
222- ( transposeCOOInplace processor m
223- |> toCSRInplace processor allocationMode)
229+ ( transposeCOOInPlace processor m
230+ |> toCSRInPlace processor allocationMode)
224231 .ToCSC
225232 |> ClMatrix.CSC
226- | _ -> failwith " not yet supported"
233+ | _ -> failwith " Not yet implemented"
234+
235+ let toRows ( clContext : ClContext ) workGroupSize =
236+
237+ let copy = copy clContext workGroupSize
238+
239+ let COOToCSR = COO.Matrix.toCSR clContext workGroupSize
240+
241+ let transposeCSR =
242+ CSR.Matrix.transposeInPlace clContext workGroupSize
243+
244+ let CSRToRows = CSR.Matrix.toRows clContext workGroupSize
245+
246+ fun ( processor : MailboxProcessor < _ >) allocationMode ( matrix : ClMatrix < 'a >) ->
247+ match matrix with
248+ | ClMatrix.CSC m ->
249+ m.ToCSR
250+ |> transposeCSR processor allocationMode
251+ |> CSRToRows processor allocationMode
252+ |> ClMatrix.Rows
253+ | ClMatrix.CSR m ->
254+ CSRToRows processor allocationMode m
255+ |> ClMatrix.Rows
256+ | ClMatrix.COO m ->
257+ COOToCSR processor allocationMode m
258+ |> CSRToRows processor allocationMode
259+ |> ClMatrix.Rows
260+ | ClMatrix.Rows _ -> copy processor allocationMode matrix
227261
228262 let map ( clContext : ClContext ) ( opAdd : Expr < 'a option -> 'b option >) workGroupSize =
229263 let mapCOO =
@@ -241,7 +275,7 @@ module Matrix =
241275 |> ClMatrix.CSC
242276 | _ -> failwith " Not yet implemented"
243277
244- let map2 ( clContext : ClContext ) ( opAdd : Expr < 'a option -> 'b option -> 'c option >) workGroupSize = // TODO()
278+ let map2 ( clContext : ClContext ) ( opAdd : Expr < 'a option -> 'b option -> 'c option >) workGroupSize =
245279 let map2COO =
246280 COO.Matrix.map2 clContext opAdd workGroupSize
247281
@@ -291,7 +325,7 @@ module Matrix =
291325 CSR.Matrix.map2AtLeastOneToCOO clContext opAdd workGroupSize
292326
293327 let transposeCOOInPlace =
294- COO.Matrix.transposeInplace clContext workGroupSize
328+ COO.Matrix.transposeInPlace clContext workGroupSize
295329
296330 fun ( processor : MailboxProcessor < _ >) allocationMode matrix1 matrix2 ->
297331 match matrix1, matrix2 with
@@ -322,14 +356,14 @@ module Matrix =
322356 ///<param name =" workGroupSize " >Should be a power of 2 and greater than 1.</param >
323357 let transposeInPlace ( clContext : ClContext ) workGroupSize =
324358 let COOTransposeInPlace =
325- COO.Matrix.transposeInplace clContext workGroupSize
359+ COO.Matrix.transposeInPlace clContext workGroupSize
326360
327361 fun ( processor : MailboxProcessor < _ >) matrix ->
328362 match matrix with
329363 | ClMatrix.COO m -> COOTransposeInPlace processor m |> ClMatrix.COO
330364 | ClMatrix.CSR m -> ClMatrix.CSC m.ToCSC
331365 | ClMatrix.CSC m -> ClMatrix.CSR m.ToCSR
332- | ClMatrix.Rows _ -> failwith " not yet supported "
366+ | ClMatrix.Rows _ -> failwith " Not yet implemented "
333367
334368 /// <summary >
335369 /// Transposes the given matrix and returns result as a new matrix.
@@ -344,7 +378,7 @@ module Matrix =
344378 ///<param name =" clContext " >OpenCL context.</param >
345379 ///<param name =" workGroupSize " >Should be a power of 2 and greater than 1.</param >
346380 let transpose ( clContext : ClContext ) workGroupSize =
347- let COOtranspose =
381+ let COOTranspose =
348382 COO.Matrix.transpose clContext workGroupSize
349383
350384 let copy = ClArray.copy clContext workGroupSize
@@ -354,7 +388,7 @@ module Matrix =
354388 fun ( processor : MailboxProcessor < _ >) allocationMode matrix ->
355389 match matrix with
356390 | ClMatrix.COO m ->
357- COOtranspose processor allocationMode m
391+ COOTranspose processor allocationMode m
358392 |> ClMatrix.COO
359393 | ClMatrix.CSR m ->
360394 { Context = m.Context
@@ -372,7 +406,7 @@ module Matrix =
372406 Columns = copy processor allocationMode m.Rows
373407 Values = copyData processor allocationMode m.Values }
374408 |> ClMatrix.CSR
375- | ClMatrix.Rows _ -> failwith " not yet supported "
409+ | ClMatrix.Rows _ -> failwith " Not yet implemented "
376410
377411 module SpGeMM =
378412 let masked
0 commit comments