Skip to content

Commit 1f9d687

Browse files
committed
refactor: formatting
1 parent 3b5a5e6 commit 1f9d687

3 files changed

Lines changed: 17 additions & 21 deletions

File tree

src/GraphBLAS-sharp.Backend/Vector/SparseVector/Map2.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ module Map2 =
7070
resultIndices.[gid] <- gid
7171

7272
resultBitmap.[gid] <- 1
73-
| None -> resultBitmap.[gid] <- 0 @>
73+
| None -> resultBitmap.[gid] <- 0 @>
7474

7575
let merge workGroupSize =
7676
<@ fun (ndRange: Range1D) (firstSide: int) (secondSide: int) (sumOfSides: int) (firstIndicesBuffer: ClArray<int>) (firstValuesBuffer: ClArray<'a>) (secondIndicesBuffer: ClArray<int>) (secondValuesBuffer: ClArray<'b>) (allIndicesBuffer: ClArray<int>) (firstResultValues: ClArray<'a>) (secondResultValues: ClArray<'b>) (isLeftBitMap: ClArray<int>) ->

src/GraphBLAS-sharp.Backend/Vector/SparseVector/SparseVector.fs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ module SparseVector =
260260
let kernel =
261261
clContext.Compile(Map2.prepareFillGeneral op)
262262

263-
fun (processor: MailboxProcessor<_>) (vectorLenght: int) (leftValues: ClArray<'a>) (leftIndices: ClArray<int>) (rightValues: ClArray<'b>) (rightIndices: ClArray<int>) (value: ClCell<'a>)->
263+
fun (processor: MailboxProcessor<_>) (vectorLenght: int) (leftValues: ClArray<'a>) (leftIndices: ClArray<int>) (rightValues: ClArray<'b>) (rightIndices: ClArray<int>) (value: ClCell<'a>) ->
264264

265265
let resultBitmap =
266266
clContext.CreateClArrayWithSpecificAllocationMode<int>(DeviceOnly, vectorLenght)
@@ -301,11 +301,7 @@ module SparseVector =
301301
///<param name="clContext">.</param>
302302
///<param name="op">.</param>
303303
///<param name="workGroupSize">Should be a power of 2 and greater than 1.</param>
304-
let fillSubVector<'a, 'b when 'a: struct and 'b: struct>
305-
(clContext: ClContext)
306-
op
307-
workGroupSize
308-
=
304+
let fillSubVector<'a, 'b when 'a: struct and 'b: struct> (clContext: ClContext) op workGroupSize =
309305

310306
let prepare =
311307
preparePositionsFillSubVector clContext op workGroupSize
@@ -315,7 +311,14 @@ module SparseVector =
315311
fun (processor: MailboxProcessor<_>) allocationMode (leftVector: ClVector.Sparse<'a>) (rightVector: ClVector.Sparse<'b>) (value: ClCell<'a>) ->
316312

317313
let bitmap, values, indices =
318-
prepare processor leftVector.Size leftVector.Values leftVector.Indices rightVector.Values rightVector.Indices value
314+
prepare
315+
processor
316+
leftVector.Size
317+
leftVector.Values
318+
leftVector.Indices
319+
rightVector.Values
320+
rightVector.Indices
321+
value
319322

320323
let resultValues, resultIndices =
321324
setPositions processor allocationMode values indices bitmap

tests/GraphBLAS-sharp.Tests/Vector/FillSubVector.fs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,14 @@ let alwaysTrue _ = true
2020

2121
let notNane x = not <| Double.IsNaN x
2222

23-
let checkResult
24-
isZero
25-
isComplemented
26-
(actual: Vector<'a>)
27-
(vector: 'a [])
28-
(mask: 'a [])
29-
(value: 'a)
30-
=
23+
let checkResult isZero isComplemented (actual: Vector<'a>) (vector: 'a []) (mask: 'a []) (value: 'a) =
3124

3225
let expectedArray = Array.zeroCreate vector.Length
3326

3427
let (Vector.Dense vector) =
3528
createVectorFromArray Dense vector isZero
3629

37-
let (Vector.Dense mask) =
38-
createVectorFromArray Dense mask isZero
30+
let (Vector.Dense mask) = createVectorFromArray Dense mask isZero
3931

4032
for i in 0 .. vector.Length - 1 do
4133
expectedArray.[i] <-
@@ -52,7 +44,7 @@ let checkResult
5244
| Vector.Dense actual -> Expect.equal actual expectedArray "Arrays must be equals"
5345
| _ -> failwith "Vector format must be Dense."
5446

55-
let makeTest<'a when 'a: struct and 'a : equality>
47+
let makeTest<'a when 'a: struct and 'a: equality>
5648
(isZero: 'a -> bool)
5749
isValueCompatible
5850
(toDense: MailboxProcessor<_> -> AllocationFlag -> ClVector<'a> -> ClVector<'a>)
@@ -106,7 +98,8 @@ let testFixtures case =
10698
let context = case.TestContext.ClContext
10799

108100
let floatIsEqual x y =
109-
abs (x - y) < Accuracy.medium.absolute || x.Equals(y)
101+
abs (x - y) < Accuracy.medium.absolute
102+
|| x.Equals(y)
110103

111104
let isComplemented = false
112105

@@ -196,7 +189,7 @@ let testFixturesComplemented case =
196189
let boolToCoo = Vector.toDense context wgSize
197190

198191
case
199-
|> makeTest ((=) false) alwaysTrue boolToCoo boolFill isComplemented
192+
|> makeTest ((=) false) alwaysTrue boolToCoo boolFill isComplemented
200193
|> testPropertyWithConfig config (getCorrectnessTestName "bool") ]
201194

202195
let complementedTests =

0 commit comments

Comments
 (0)