Skip to content

Commit 7b2ca81

Browse files
committed
refactor: comments in search module
1 parent 24cb165 commit 7b2ca81

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/GraphBLAS-sharp.Backend/Quotes/Search.fs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ open Brahma.FSharp
44

55
module Search =
66
module Bin =
7+
/// <summary>
8+
/// Searches value in array by key.
9+
/// In case there is a value at the given key position, it is returned.
10+
/// </summary>
711
let byKey<'a> =
8-
<@ fun lenght sourceIndex (indices: ClArray<int>) (values: ClArray<'a>) ->
12+
<@ fun lenght sourceIndex (keys: ClArray<int>) (values: ClArray<'a>) ->
913

1014
let mutable leftEdge = 0
1115
let mutable rightEdge = lenght - 1
@@ -14,7 +18,7 @@ module Search =
1418

1519
while leftEdge <= rightEdge do
1620
let middleIdx = (leftEdge + rightEdge) / 2
17-
let currentIndex = indices.[middleIdx]
21+
let currentIndex = keys.[middleIdx]
1822

1923
if sourceIndex = currentIndex then
2024
result <- Some values.[middleIdx]
@@ -27,6 +31,10 @@ module Search =
2731

2832
result @>
2933

34+
/// <summary>
35+
/// Searches value in array by two keys.
36+
/// In case there is a value at the given keys position, it is returned.
37+
/// </summary>
3038
let byKey2<'a> =
3139
<@ fun lenght sourceIndex (rowIndices: ClArray<int>) (columnIndices: ClArray<int>) (values: ClArray<'a>) ->
3240

0 commit comments

Comments
 (0)