Skip to content

Commit c9b07f2

Browse files
committed
Change semiring parameters count from 3 to 1
1 parent 4dd3fb5 commit c9b07f2

4 files changed

Lines changed: 22 additions & 24 deletions

File tree

src/GraphBLAS-sharp/Abstracts.fs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@ type Matrix<'a when 'a : struct and 'a : equality>(nrow: int, ncol: int) =
1818
abstract Fill: Mask1D option * int -> Scalar<'a> with set
1919
abstract Fill: int * Mask1D option -> Scalar<'a> with set
2020

21-
abstract Mxm: Matrix<'b> -> Mask2D option -> Semiring<'a, 'b, 'c> -> Matrix<'c>
22-
abstract Mxv: Vector<'b> -> Mask1D option -> Semiring<'a, 'b, 'c> -> Vector<'c>
23-
abstract EWiseAdd: Matrix<'b> -> Mask2D option -> Semiring<'a, 'b, 'c> -> Matrix<'c>
24-
abstract EWiseMult: Matrix<'b> -> Mask2D option -> Semiring<'a, 'b, 'c> -> Matrix<'c>
21+
abstract Mxm: Matrix<'a> -> Mask2D option -> Semiring<'a> -> Matrix<'a>
22+
abstract Mxv: Vector<'a> -> Mask1D option -> Semiring<'a> -> Vector<'a>
23+
abstract EWiseAdd: Matrix<'a> -> Mask2D option -> Monoid<'a> -> Matrix<'a>
24+
abstract EWiseMult: Matrix<'a> -> Mask2D option -> Monoid<'a> -> Matrix<'a>
2525
abstract Apply: Mask1D option -> UnaryOp<'a, 'b> -> Matrix<'b>
2626
abstract ReduceIn: Mask1D option -> Monoid<'a> -> Vector<'a>
2727
abstract ReduceOut: Mask1D option -> Monoid<'a> -> Vector<'a>
2828
abstract Reduce: Monoid<'a> -> Scalar<'a>
2929
abstract T: Matrix<'a>
3030

31-
static member inline (+) (x: Matrix<'a>, y: Matrix<'b>) = x.EWiseAdd y
32-
static member inline (*) (x: Matrix<'a>, y: Matrix<'b>) = x.EWiseMult y
33-
static member inline (@.) (x: Matrix<'a>, y: Matrix<'b>) = x.Mxm y
34-
static member inline (@.) (x: Matrix<'a>, y: Vector<'b>) = x.Mxv y
31+
static member inline (+) (x: Matrix<'a>, y: Matrix<'a>) = x.EWiseAdd y
32+
static member inline (*) (x: Matrix<'a>, y: Matrix<'a>) = x.EWiseMult y
33+
static member inline (@.) (x: Matrix<'a>, y: Matrix<'a>) = x.Mxm y
34+
static member inline (@.) (x: Matrix<'a>, y: Vector<'a>) = x.Mxv y
3535

3636
and [<AbstractClass>] Vector<'a when 'a : struct and 'a : equality>(length: int) =
3737
abstract Length: int
@@ -47,15 +47,15 @@ and [<AbstractClass>] Vector<'a when 'a : struct and 'a : equality>(length: int)
4747
abstract Item: int -> Scalar<'a> with get, set
4848
abstract Fill: Mask1D option -> Scalar<'a> with set
4949

50-
abstract Vxm: Matrix<'b> -> Mask1D option -> Semiring<'a, 'b, 'c> -> Vector<'c>
51-
abstract EWiseAdd: Vector<'b> -> Mask1D option -> Semiring<'a, 'b, 'c> -> Vector<'c>
52-
abstract EWiseMult: Vector<'b> -> Mask1D option -> Semiring<'a, 'b, 'c> -> Vector<'c>
50+
abstract Vxm: Matrix<'a> -> Mask1D option -> Semiring<'a> -> Vector<'a>
51+
abstract EWiseAdd: Vector<'a> -> Mask1D option -> Monoid<'a> -> Vector<'a>
52+
abstract EWiseMult: Vector<'a> -> Mask1D option -> Monoid<'a> -> Vector<'a>
5353
abstract Apply: Mask1D option -> UnaryOp<'a, 'b> -> Vector<'b>
5454
abstract Reduce: Monoid<'a> -> Scalar<'a>
5555

56-
static member inline (+) (x: Vector<'a>, y: Vector<'b>) = x.EWiseAdd y
57-
static member inline (*) (x: Vector<'a>, y: Vector<'b>) = x.EWiseMult y
58-
static member inline (@.) (x: Vector<'a>, y: Matrix<'b>) = x.Vxm y
56+
static member inline (+) (x: Vector<'a>, y: Vector<'a>) = x.EWiseAdd y
57+
static member inline (*) (x: Vector<'a>, y: Vector<'a>) = x.EWiseMult y
58+
static member inline (@.) (x: Vector<'a>, y: Matrix<'a>) = x.Vxm y
5959

6060
and Mask1D(indices: int[], length: int, isComplemented: bool) =
6161
member this.Indices = indices

src/GraphBLAS-sharp/Implementations.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ and SparseVector<'a when 'a : struct and 'a : equality>(size: int, listOfNonzero
132132
override this.Fill
133133
with set (mask: Mask1D option) (value: Scalar<'a>) = failwith "Not Implemented"
134134

135-
override this.Vxm (matrix: Matrix<'b>) (mask: Mask1D option) (semiring: Semiring<'a, 'b, 'c>) : Vector<'c> = failwith "Not Implemented"
135+
override this.Vxm (matrix: Matrix<'a>) (mask: Mask1D option) (semiring: Semiring<'a>) : Vector<'a> = failwith "Not Implemented"
136136
override this.EWiseAdd a b c = failwith "Not Implemented"
137137
override this.EWiseMult a b c = failwith "Not Implemented"
138138
override this.Apply a b = failwith "Not Implemented"

src/GraphBLAS-sharp/Predefined/Integer.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module IntegerSemiring =
1919
Times = BinaryOp <@ ( * ) @>
2020
}
2121

22-
let minFirst<'b> : Semiring<int, 'b, int> = {
23-
PlusMonoid = IntegerMonoid.min
24-
Times = BinaryOp <@ fun x y -> x @>
25-
}
22+
// let minFirst<'b> : Semiring<int, 'b, int> = {
23+
// PlusMonoid = IntegerMonoid.min
24+
// Times = BinaryOp <@ fun x y -> x @>
25+
// }

src/GraphBLAS-sharp/Semiring.fs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
namespace GraphBLAS.FSharp
22

3-
type Semiring<'T1, 'T2, 'TOut> = {
4-
PlusMonoid: Monoid<'TOut>
5-
Times: BinaryOp<'T1, 'T2, 'TOut>
3+
type Semiring<'T> = {
4+
PlusMonoid: Monoid<'T>
5+
Times: BinaryOp<'T, 'T, 'T>
66
}
7-
8-
type Semiring<'T> = Semiring<'T, 'T, 'T>

0 commit comments

Comments
 (0)