@@ -3,25 +3,6 @@ namespace GraphBLAS.FSharp
33open Brahma.FSharp .OpenCL .WorkflowBuilder .Basic
44open GraphBLAS.FSharp .Backend
55
6- type MatrixTuples < 'a > =
7- {
8- RowIndices: int []
9- ColumnIndices: int []
10- Values: 'a []
11- }
12-
13- // ждём тайпклассов чтобы можно было вызывать synchronize для всех объектов,
14- // для которых он реализован, не привязывая реализацию к классу (как стратегия)
15- module MatrixTuples =
16- let synchronize ( matrixTuples : MatrixTuples < 'a >) =
17- opencl {
18- let! _ = ToHost matrixTuples.RowIndices
19- let! _ = ToHost matrixTuples.ColumnIndices
20- let! _ = ToHost matrixTuples.Values
21- return ()
22- }
23- |> EvalGB.fromCl
24-
256[<CompilationRepresentation( CompilationRepresentationFlags.ModuleSuffix) >]
267module Matrix =
278
@@ -54,7 +35,15 @@ module Matrix =
5435 let copy ( matrix : Matrix < 'a >) : GraphblasEvaluation < Matrix < 'a >> = failwith " Not Implemented yet"
5536 let resize ( rowCount : int ) ( columnCount : int ) ( matrix : Matrix < 'a >) : GraphblasEvaluation < Matrix < 'a >> = failwith " Not Implemented yet"
5637 let nnz ( matrix : Matrix < 'a >) : GraphblasEvaluation < int > = failwith " Not Implemented yet"
57- let tuples ( matrix : Matrix < 'a >) : GraphblasEvaluation < MatrixTuples < 'a >> = failwith " Not Implemented yet"
38+
39+ let tuples ( matrix : Matrix < 'a >) : GraphblasEvaluation < MatrixTuples < 'a >> =
40+ let matrixTuples =
41+ match matrix with
42+ | MatrixCOO coo -> COOMatrix.GetTuples.from coo
43+ | _ -> failwith " Not Implemented"
44+
45+ graphblas { return ! EvalGB.fromCl matrixTuples }
46+
5847 let mask ( matrix : Matrix < 'a >) : GraphblasEvaluation < Mask2D > = failwith " Not Implemented yet"
5948 let complemented ( matrix : Matrix < 'a >) : GraphblasEvaluation < Mask2D > = failwith " Not Implemented yet"
6049 let synchronize ( matrix : Matrix < 'a >) : GraphblasEvaluation < unit > = failwith " Not Implemented yet"
0 commit comments