Skip to content

Commit 9a138db

Browse files
committed
Change predefined monoid and semiring names
1 parent c3f8f55 commit 9a138db

6 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/GraphBLAS-sharp/Algorithms/BFS.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ open GraphBLAS.FSharp
88
module BFS =
99
let levelBFS (matrix: Matrix<bool>) (source: int) : Vector<int> =
1010
let vertexCount = matrix.RowCount
11-
let levels = DenseVector(Array.zeroCreate vertexCount, IntegerMonoid.plus)
11+
let levels = DenseVector(Array.zeroCreate vertexCount, IntegerMonoid.add)
1212

1313
let frontier = SparseVector(vertexCount, [source, true])
1414

src/GraphBLAS-sharp/Algorithms/SSSP.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ module SSSP =
1010
let distance = SparseVector(vertexCount, [source, 0.])
1111

1212
for _ in 1 .. vertexCount - 1 do
13-
distance.[Mask1D.none] <- (distance .@ matrix) Mask1D.none FloatSemiring.minPlus
13+
distance.[Mask1D.none] <- (distance .@ matrix) Mask1D.none FloatSemiring.addMult
1414

1515
upcast distance

src/GraphBLAS-sharp/GraphBLAS-sharp.fsproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
<Compile Include="Vector.fs" />
2222
<Compile Include="Masks.fs" />
2323
<Compile Include="Predefined/Float.fs" />
24-
<Compile Include="Predefined/Boolean.fs" />
2524
<Compile Include="Predefined/Integer.fs" />
25+
<Compile Include="Predefined/Boolean.fs" />
2626
<Compile Include="Algorithms/BFS.fs" />
2727
<Compile Include="Algorithms/SSSP.fs" />
2828
<Compile Include="Algorithms/TriangleCounting.fs" />
2929
</ItemGroup>
3030
<Import Project="..\..\.paket\Paket.Restore.targets" />
31-
</Project>
31+
</Project>

src/GraphBLAS-sharp/Predefined/Float.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ namespace GraphBLAS.FSharp.Predefined
33
open GraphBLAS.FSharp
44

55
module FloatMonoid =
6-
let plus: Monoid<float> = {
6+
let add: Monoid<float> = {
77
Zero = 0.
88
Append = BinaryOp <@ ( + ) @>
99
}
@@ -14,12 +14,12 @@ module FloatMonoid =
1414
}
1515

1616
module FloatSemiring =
17-
let plusTimes: Semiring<float> = {
18-
PlusMonoid = FloatMonoid.plus
17+
let addMult: Semiring<float> = {
18+
PlusMonoid = FloatMonoid.add
1919
Times = BinaryOp <@ ( * ) @>
2020
}
2121

22-
let minPlus: Semiring<float> = {
22+
let minAdd: Semiring<float> = {
2323
PlusMonoid = FloatMonoid.min
2424
Times = BinaryOp <@ ( + ) @>
2525
}

src/GraphBLAS-sharp/Predefined/Integer.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ namespace GraphBLAS.FSharp.Predefined
33
open GraphBLAS.FSharp
44

55
module IntegerMonoid =
6-
let plus: Monoid<int> = {
6+
let add: Monoid<int> = {
77
Zero = 0
88
Append = BinaryOp <@ ( + ) @>
99
}

tests/GraphBLAS-sharp.Tests/OperationsTests/VxmTests.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ module VxmTests =
8888
// тут просто размерности генерить и создавать пустые объекты
8989
fun m n k ->
9090
let emptyMatrix = Matrix.ZeroCreate(m, n, matrixBackend)
91-
let emptyVector = Vector.Dense(Predefined.FloatMonoid.plus)
91+
let emptyVector = Vector.Dense(Predefined.FloatMonoid.add)
9292

9393
Expect.throwsT
94-
(fun () -> (emptyVector .@ emptyMatrix) Mask1D.none Predefined.FloatSemiring.plusTimes |> ignore)
94+
(fun () -> (emptyVector .@ emptyMatrix) Mask1D.none Predefined.FloatSemiring.addMult |> ignore)
9595
(sprintf "Argument has invalid dimension. Need %i, but given %i" k m )
9696

9797
testPropertyWithConfig config "Operation should have correct semantic" <|

0 commit comments

Comments
 (0)