@@ -11,14 +11,17 @@ type MatrixTuples<'a> =
1111 Values: 'a []
1212 }
1313
14- member this.ToHost () =
14+ // ждём тайпклассов чтобы можно было вызывать synchronize для всех объектов,
15+ // для которых он реализован, не привязывая реализацию к классу (как стратегия)
16+ module MatrixTuples =
17+ let synchronize ( matrixTuples : MatrixTuples < 'a >) =
1518 opencl {
16- let! _ = ToHost this.RowIndices
17- let! _ = ToHost this.ColumnIndices
18- let! _ = ToHost this.Values
19-
20- return this
19+ let! _ = ToHost matrixTuples.RowIndices
20+ let! _ = ToHost matrixTuples.ColumnIndices
21+ let! _ = ToHost matrixTuples.Values
22+ return ()
2123 }
24+ |> EvalGB.fromCl
2225
2326[<CompilationRepresentation( CompilationRepresentationFlags.ModuleSuffix) >]
2427module Matrix =
@@ -30,7 +33,7 @@ module Matrix =
3033 let build ( rowCount : int ) ( columnCount : int ) ( rows : int []) ( columns : int []) ( values : 'a []) : Matrix < 'a > =
3134 failwith " Not Implemented yet"
3235
33- let ofArray2D ( array : 'a [,] ) ( isZero : 'a -> bool ) : Matrix < 'a > =
36+ let ofArray2D ( isZero : 'a -> bool ) ( array : 'a [,] ) : Matrix < 'a > =
3437 failwith " Not Implemented yet"
3538
3639 let fromFile ( pathToMatrix : string ) : Matrix < 'a > =
@@ -55,7 +58,7 @@ module Matrix =
5558 let tuples ( matrix : Matrix < 'a >) : GraphblasEvaluation < MatrixTuples < 'a >> = failwith " Not Implemented yet"
5659 let mask ( matrix : Matrix < 'a >) : GraphblasEvaluation < Mask2D option > = failwith " Not Implemented yet"
5760 let complemented ( matrix : Matrix < 'a >) : GraphblasEvaluation < Mask2D option > = failwith " Not Implemented yet"
58- // let finish \ eval \ toHost
61+ let synchronize ( matrix : Matrix < 'a >) : GraphblasEvaluation < unit > = failwith " Not Implemented yet "
5962
6063 (*
6164 assignment, extraction and filling
@@ -90,7 +93,7 @@ module Matrix =
9093 }
9194 | _ -> failwith " Not Implemented"
9295
93- graphblas { return ! EvalGB.liftCl operationResult }
96+ graphblas { return ! EvalGB.fromCl operationResult }
9497
9598 let eWiseMult ( semiring : ISemiring < 'a >) ( mask : Mask2D option ) ( leftMatrix : Matrix < 'a >) ( rightMatrix : Matrix < 'a >) : GraphblasEvaluation < Matrix < 'a >> = failwith " Not Implemented yet"
9699 let apply ( mapper : UnaryOp < 'a , 'b >) ( mask : Mask2D option ) ( matrix : Matrix < 'a >) : GraphblasEvaluation < Matrix < 'b >> = failwith " Not Implemented yet"
0 commit comments