Skip to content

Commit d25fd60

Browse files
committed
Merge branch 'semiring-impl' into master
2 parents 0514bee + 3b52b27 commit d25fd60

17 files changed

Lines changed: 66 additions & 319 deletions

paket.dependencies

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,8 @@ nuget Expecto 8.13.1
99
nuget YoloDev.Expecto.TestSdk 0.8.0
1010
nuget Microsoft.NET.Test.Sdk 15.7.2
1111
nuget altcover ~> 6
12+
1213
nuget Brahma.FSharp
13-
nuget FsUnit.xUnit
14-
nuget FsCheck.Xunit
15-
nuget xunit
16-
nuget xunit.runner.visualstudio
17-
nuget coverlet.collector
1814
nuget FSharpx.Collections 1.15.1
1915

2016
// [ FAKE GROUP ]

paket.lock

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ NUGET
1313
Chessie (0.6) - restriction: >= netcoreapp1.0
1414
FSharp.Core (>= 4.0.1.7-alpha) - restriction: >= netstandard1.6
1515
NETStandard.Library (>= 1.6) - restriction: >= netstandard1.6
16-
coverlet.collector (1.3)
1716
dotnet-mono (0.5.2) - clitool: true
1817
Argu (>= 3.7) - restriction: >= netcoreapp1.0
1918
Chessie (>= 0.6) - restriction: >= netcoreapp1.0
@@ -27,12 +26,6 @@ NUGET
2726
Expecto (8.13.1)
2827
FSharp.Core (>= 4.3.4) - restriction: || (>= net461) (>= netstandard2.0)
2928
Mono.Cecil (>= 0.11) - restriction: || (>= net461) (>= netstandard2.0)
30-
FsCheck (2.14.3)
31-
FSharp.Core (>= 4.0.0.1) - restriction: && (< net452) (>= netstandard1.0) (< netstandard1.6)
32-
FSharp.Core (>= 4.2.3) - restriction: || (>= net452) (>= netstandard1.6)
33-
FsCheck.Xunit (2.14.3)
34-
FsCheck (2.14.3)
35-
xunit.extensibility.execution (>= 2.2 < 3.0)
3629
FSharp.Core (4.3.4)
3730
System.Collections (>= 4.0.11) - restriction: && (< net45) (>= netstandard1.6) (< netstandard2.0)
3831
System.Console (>= 4.0) - restriction: && (< net45) (>= netstandard1.6) (< netstandard2.0)
@@ -61,11 +54,6 @@ NUGET
6154
FSharp.Core (>= 4.3.1) - restriction: >= netstandard2.0
6255
FSharpx.Collections (1.15.1)
6356
FSharp.Core
64-
FsUnit.xUnit (4.0.1)
65-
FSharp.Core (>= 4.3.4) - restriction: >= netstandard2.0
66-
NETStandard.Library (>= 2.0.3) - restriction: >= netstandard2.0
67-
NHamcrest (>= 2.0.1 < 2.1) - restriction: >= netstandard2.0
68-
xunit (>= 2.4.1 < 2.5) - restriction: >= netstandard2.0
6957
Microsoft.Build (16.3) - restriction: >= netcoreapp1.0
7058
Microsoft.Build.Framework (>= 16.3) - restriction: || (>= net472) (>= netcoreapp2.1)
7159
Microsoft.Win32.Registry (>= 4.3) - restriction: >= netcoreapp2.1
@@ -106,7 +94,7 @@ NUGET
10694
Microsoft.NETCore.DotNetHostResolver (>= 3.0.1)
10795
Microsoft.NETCore.DotNetHostResolver (3.0.1) - restriction: >= netcoreapp2.2
10896
Microsoft.NETCore.DotNetAppHost (>= 3.0.1)
109-
Microsoft.NETCore.Platforms (3.0) - restriction: || (&& (< monoandroid) (< monotouch) (< net45) (>= netstandard1.6) (< netstandard2.0) (< win8) (< wpa81) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< net45) (< netstandard1.2) (>= netstandard1.6) (< win8)) (&& (< monoandroid) (< net45) (< netstandard1.3) (>= netstandard1.6) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.5) (>= netstandard1.6) (< win8) (< wpa81)) (&& (>= net45) (< netstandard1.3) (>= netstandard2.0)) (&& (< net45) (>= netstandard2.0)) (&& (>= net46) (< netstandard1.4) (>= netstandard2.0)) (&& (>= net461) (>= netstandard2.0)) (>= netcoreapp2.0) (&& (>= netcoreapp5.0) (< netstandard2.0)) (&& (< netstandard1.0) (>= netstandard2.0) (< portable-net45+win8)) (&& (< netstandard1.0) (>= netstandard2.0) (>= win8)) (&& (< netstandard1.0) (>= netstandard2.0) (< win8)) (&& (< netstandard1.3) (>= netstandard2.0) (< win8) (>= wpa81)) (&& (< netstandard1.5) (>= netstandard2.0) (>= uap10.0)) (&& (>= netstandard2.0) (< portable-net45+win8+wpa81)) (&& (>= netstandard2.0) (>= uap10.1)) (&& (>= netstandard2.0) (>= wp8))
97+
Microsoft.NETCore.Platforms (3.0) - restriction: || (&& (< monoandroid) (< monotouch) (< net45) (>= netstandard1.6) (< netstandard2.0) (< win8) (< wpa81) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< net45) (< netstandard1.2) (>= netstandard1.6) (< win8)) (&& (< monoandroid) (< net45) (< netstandard1.3) (>= netstandard1.6) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.5) (>= netstandard1.6) (< win8) (< wpa81)) (>= netcoreapp2.1) (&& (>= netcoreapp5.0) (< netstandard2.0))
11098
Microsoft.NETCore.Targets (3.0) - restriction: || (&& (< monoandroid) (< monotouch) (< net45) (>= netstandard1.6) (< netstandard2.0) (< win8) (< wpa81) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< net45) (< netstandard1.2) (>= netstandard1.6) (< win8)) (&& (< monoandroid) (< net45) (< netstandard1.3) (>= netstandard1.6) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.5) (>= netstandard1.6) (< win8) (< wpa81)) (>= netcoreapp2.1) (&& (>= netcoreapp5.0) (< netstandard2.0))
11199
Microsoft.NETFramework.ReferenceAssemblies (1.0) - copy_local: true
112100
Microsoft.NETFramework.ReferenceAssemblies.net20 (>= 1.0) - restriction: && (>= net20) (< net40)
@@ -148,7 +136,7 @@ NUGET
148136
Microsoft.Win32.SystemEvents (4.6) - restriction: >= netcoreapp3.0
149137
Microsoft.NETCore.Platforms (>= 3.0) - restriction: >= netcoreapp2.0
150138
Mono.Cecil (0.11.1) - restriction: || (>= net461) (>= netstandard2.0)
151-
NETStandard.Library (2.0.3) - restriction: || (&& (< net35) (>= netstandard1.1)) (&& (< net452) (>= netstandard1.1)) (>= netcoreapp1.0) (>= netstandard2.0) (>= uap10.0)
139+
NETStandard.Library (2.0.3) - restriction: || (>= netcoreapp1.0) (&& (< netstandard1.3) (>= uap10.0)) (&& (< netstandard2.0) (>= uap10.0))
152140
Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (>= net45) (< netstandard1.3)) (&& (< net45) (>= netstandard1.1) (< netstandard1.2) (< win8)) (&& (< net45) (>= netstandard1.2) (< netstandard1.3) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.4) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.4) (< netstandard1.5) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< netstandard1.6) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.6) (< netstandard2.0) (< win8) (< wpa81)) (&& (< net45) (>= netstandard2.0)) (&& (>= net46) (< netstandard1.4)) (>= net461) (>= netcoreapp2.0) (&& (>= netstandard1.0) (< portable-net45+win8+wpa81)) (&& (< netstandard1.0) (>= portable-net45+win8) (< win8)) (&& (< netstandard1.0) (< portable-net45+win8) (>= portable-net45+win8+wpa81)) (&& (< netstandard1.0) (>= portable-net45+win8+wp8+wpa81) (< portable-net45+win8+wpa81)) (&& (< netstandard1.0) (>= win8)) (&& (< netstandard1.3) (< win8) (>= wpa81)) (&& (< netstandard1.5) (>= uap10.0)) (>= uap10.1) (>= wp8)
153141
Newtonsoft.Json (12.0.3) - restriction: || (>= netcoreapp2.1) (>= uap10.0)
154142
Microsoft.CSharp (>= 4.3) - restriction: || (&& (< net20) (>= netstandard1.0) (< netstandard1.3)) (&& (< net20) (>= netstandard1.3) (< netstandard2.0))
@@ -157,8 +145,6 @@ NUGET
157145
System.Runtime.Serialization.Formatters (>= 4.3) - restriction: && (< net20) (>= netstandard1.3) (< netstandard2.0)
158146
System.Runtime.Serialization.Primitives (>= 4.3) - restriction: || (&& (< net20) (>= netstandard1.0) (< netstandard1.3)) (&& (< net20) (>= netstandard1.3) (< netstandard2.0))
159147
System.Xml.XmlDocument (>= 4.3) - restriction: && (< net20) (>= netstandard1.3) (< netstandard2.0)
160-
NHamcrest (2.0.1) - restriction: >= netstandard2.0
161-
NETStandard.Library (>= 1.6.1) - restriction: && (< net451) (>= netstandard1.5)
162148
NuGet.Frameworks (5.3.1) - restriction: || (&& (>= net451) (>= netcoreapp1.0) (>= uap10.0)) (&& (>= netcoreapp1.0) (>= netstandard2.0) (>= uap10.0)) (>= netcoreapp2.1)
163149
OpenCL.Net (2.2.9)
164150
runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - restriction: || (&& (< monoandroid) (< monotouch) (< net45) (>= netstandard1.6) (< netstandard2.0) (< win8) (< wpa81) (< xamarintvos) (< xamarinwatchos)) (&& (>= netcoreapp5.0) (< netstandard2.0))
@@ -639,25 +625,6 @@ NUGET
639625
System.Text.Encoding (>= 4.3) - restriction: && (< monoandroid) (< monotouch) (< net46) (>= netstandard1.3) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)
640626
System.Threading (>= 4.3) - restriction: && (< monoandroid) (< monotouch) (< net46) (>= netstandard1.3) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)
641627
System.Xml.ReaderWriter (>= 4.3) - restriction: && (< monoandroid) (< monotouch) (< net46) (>= netstandard1.3) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)
642-
xunit (2.4.1)
643-
xunit.analyzers (>= 0.10)
644-
xunit.assert (2.4.1)
645-
xunit.core (2.4.1)
646-
xunit.abstractions (2.0.3) - restriction: >= netstandard1.1
647-
NETStandard.Library (>= 1.6) - restriction: && (< net35) (>= netstandard1.0) (< netstandard2.0)
648-
xunit.analyzers (0.10)
649-
xunit.assert (2.4.1)
650-
NETStandard.Library (>= 1.6.1) - restriction: && (< net452) (>= netstandard1.1)
651-
xunit.core (2.4.1)
652-
xunit.extensibility.core (2.4.1)
653-
xunit.extensibility.execution (2.4.1)
654-
xunit.extensibility.core (2.4.1)
655-
NETStandard.Library (>= 1.6.1) - restriction: && (< net452) (>= netstandard1.1)
656-
xunit.abstractions (>= 2.0.3) - restriction: >= netstandard1.1
657-
xunit.extensibility.execution (2.4.1)
658-
NETStandard.Library (>= 1.6.1) - restriction: && (< net452) (>= netstandard1.1)
659-
xunit.extensibility.core (2.4.1) - restriction: >= netstandard1.1
660-
xunit.runner.visualstudio (2.4.3)
661628
YC.PrettyPrinter (0.0.5)
662629
FSharp.Core
663630
YoloDev.Expecto.TestSdk (0.8)

src/GraphBLAS-sharp/CSRMatrix.fs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ type CSRMatrix<'a when 'a : struct and 'a : equality>(csrTuples: CSRFormat<'a>)
3434
"vector"
3535
(sprintf "Argument has invalid dimension. Need %i, but given %i" csrMatrixColumnCount vectorLength)
3636

37-
// let (BinaryOp op) = context.Times
38-
let plus = !> context.PlusMonoid.Append
39-
let mult = !> context.Times
37+
let (BinaryOp plus) = context.PlusMonoid.Append
38+
let (BinaryOp mult) = context.Times
4039

4140
let resultVector = Array.zeroCreate<'a> csrMatrixRowCount
4241
let command =
@@ -71,8 +70,6 @@ type CSRMatrix<'a when 'a : struct and 'a : equality>(csrTuples: CSRFormat<'a>)
7170

7271
upcast DenseVector(resultVector)
7372

74-
new() = CSRMatrix(CSRFormat.ZeroCreate())
75-
7673
member this.Values = csrTuples.Values
7774
member this.Columns = csrTuples.Columns
7875
member this.RowPointers = csrTuples.RowPointers

src/GraphBLAS-sharp/ComputationalContext.fs

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/GraphBLAS-sharp/DenseVector.fs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ namespace GraphBLAS.FSharp
33
type DenseVector<'a when 'a : struct and 'a : equality>(vector: 'a[]) =
44
inherit Vector<'a>()
55

6-
new() = DenseVector(Array.zeroCreate<'a> 0)
7-
new(listOfIndices: int list) = DenseVector(Array.zeroCreate<'a> 0)
8-
96
override this.Length = failwith "Not Implemented"
107
override this.AsArray = failwith "Not Implemented"
118

src/GraphBLAS-sharp/GraphBLAS-sharp.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Compile Include="Operators.fs" />
1212
<Compile Include="Monoid.fs" />
1313
<Compile Include="Semiring.fs" />
14-
<Compile Include="ComputationalContext.fs" />
14+
<Compile Include="OpenCLContext.fs" />
1515
<Compile Include="Scalar.fs" />
1616
<Compile Include="MatrixAndVector.fs" />
1717
<Compile Include="DenseVector.fs" />

src/GraphBLAS-sharp/Monoid.fs

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

3-
type Monoid<'a> = {
4-
Zero: 'a
5-
Append: BinaryOp<'a, 'a, 'a>
3+
type Monoid<'T> = {
4+
Zero: 'T
5+
Append: BinaryOp<'T, 'T, 'T>
66
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
namespace GraphBLAS.FSharp
2+
3+
open Brahma.OpenCL
4+
open OpenCL.Net
5+
open Brahma.OpenCL
6+
7+
type OpenCLContext = {
8+
Provider: ComputeProvider
9+
CommandQueue: CommandQueue
10+
}
11+
12+
module OpenCLContext =
13+
14+
let private defaultProvider =
15+
try ComputeProvider.Create("*", DeviceType.Default)
16+
with
17+
| ex -> failwith ex.Message
18+
19+
let private defaultQueue =
20+
new CommandQueue(defaultProvider, defaultProvider.Devices |> Seq.head)
21+
22+
let currentContext = {
23+
Provider = defaultProvider
24+
CommandQueue = defaultQueue
25+
}

src/GraphBLAS-sharp/Operators.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ namespace GraphBLAS.FSharp
22

33
open Microsoft.FSharp.Quotations
44

5-
type UnaryOp<'a, 'b> = UnaryOp of Expr<'a -> 'b>
5+
type UnaryOp<'TIn, 'TOut> = UnaryOp of Expr<'TIn -> 'TOut>
66
with
77
static member op_Implicit (UnaryOp source) = source
88

99

10-
type BinaryOp<'a, 'b, 'c> = BinaryOp of Expr<'a -> 'b -> 'c>
10+
type BinaryOp<'T1, 'T2, 'TOut> = BinaryOp of Expr<'T1 -> 'T2 -> 'TOut>
1111
with
1212
static member op_Implicit (BinaryOp source) = source

src/GraphBLAS-sharp/Semiring.fs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
namespace GraphBLAS.FSharp
22

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

8+
type Semiring<'T> = Semiring<'T, 'T, 'T>
9+
810
module Semiring =
9-
let create<'a> (zero: 'a) (plus: BinaryOp<'a, 'a, 'a>) (times: BinaryOp<'a, 'a, 'a>) =
11+
let create<'a> (zero: 'a) (plus: BinaryOp<'a, 'a, 'a>) (times: BinaryOp<'a, 'a, 'a>) : Semiring<'a> =
1012
{
1113
PlusMonoid = {
1214
Zero = zero

0 commit comments

Comments
 (0)