Skip to content

Commit f6b5614

Browse files
committed
Added naive implementation of matrix and vector in coordinate format
1 parent 0f7f9e1 commit f6b5614

2 files changed

Lines changed: 1529 additions & 19 deletions

File tree

src/GraphBLAS-sharp/Abstracts.fs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ type Matrix<'a when 'a : struct and 'a : equality>(nrow: int, ncol: int) =
2020

2121
abstract Mxm: Matrix<'a> -> Mask2D option -> Semiring<'a> -> Matrix<'a>
2222
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>
25-
abstract Apply: Mask1D option -> UnaryOp<'a, 'b> -> Matrix<'b>
23+
abstract EWiseAdd: Matrix<'a> -> Mask2D option -> Semiring<'a> -> Matrix<'a>
24+
abstract EWiseMult: Matrix<'a> -> Mask2D option -> Semiring<'a> -> Matrix<'a>
25+
abstract Apply: Mask2D 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>
@@ -48,8 +48,8 @@ and [<AbstractClass>] Vector<'a when 'a : struct and 'a : equality>(length: int)
4848
abstract Fill: Mask1D option -> Scalar<'a> with set
4949

5050
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>
51+
abstract EWiseAdd: Vector<'a> -> Mask1D option -> Semiring<'a> -> Vector<'a>
52+
abstract EWiseMult: Vector<'a> -> Mask1D option -> Semiring<'a> -> Vector<'a>
5353
abstract Apply: Mask1D option -> UnaryOp<'a, 'b> -> Vector<'b>
5454
abstract Reduce: Monoid<'a> -> Scalar<'a>
5555

@@ -65,7 +65,7 @@ and Mask1D(indices: int[], length: int, isComplemented: bool) =
6565
member this.Item
6666
with get (idx: int) : bool =
6767
this.Indices
68-
|> Array.exists ((=) idx)
68+
|> Array.contains idx
6969
|> (<>) this.IsComplemented
7070

7171
and Mask2D(indices: (int * int)[], rowCount: int, columnCount: int, isComplemented: bool) =
@@ -79,5 +79,5 @@ and Mask2D(indices: (int * int)[], rowCount: int, columnCount: int, isComplement
7979
with get (rowIdx: int, colIdx: int) : bool =
8080
(this.Rows, this.Columns)
8181
||> Array.zip
82-
|> Array.exists ((=) (rowIdx, colIdx))
82+
|> Array.contains (rowIdx, colIdx)
8383
|> (<>) this.IsComplemented

0 commit comments

Comments
 (0)