Skip to content

Commit 5b1b3cd

Browse files
committed
add: Search.Bin.lowerBound comments
1 parent 5551c57 commit 5b1b3cd

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,23 @@ module Search =
121121

122122
resultPosition @>
123123

124+
/// <summary>
125+
/// lowerBound is a version of binary search: it attempts to find the element value in an ordered range [first, last).
126+
/// Specifically, it returns the last position where value could be inserted without violating the ordering.
127+
/// </summary>
128+
/// <example>
129+
/// <code>
130+
/// let array = [ 0; 2; 5; 7; 8; ]
131+
///
132+
/// lowerBound array 0 // return 1
133+
/// lowerBound array 1 // return 1
134+
/// lowerBound array 2 // return 2
135+
/// lowerBound array 3 // return 2
136+
/// lowerBound array 8 // return array.Length - 1
137+
/// lowerBound array 9 // return array.Length - 1
138+
/// </code>
139+
/// </example>
140+
/// <param name="startValue">Position value before search.</param>
124141
let lowerBound<'a when 'a: comparison> startValue =
125142
<@ fun lenght sourceItem (keys: ClArray<'a>) ->
126143

tests/GraphBLAS-sharp.Tests/Backend/Common/ClArray/UpperBound.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ let makeTest testFun (array: 'a [], value: 'a) =
4747
let createTest<'a when 'a : equality and 'a : comparison> =
4848
ClArray.upperBound<'a> context Utils.defaultWorkGroupSize
4949
|> makeTest
50-
|> testPropertyWithConfig { config with endSize = 10 } $"test on %A{typeof<'a>}"
50+
|> testPropertyWithConfig config $"test on %A{typeof<'a>}"
5151

5252
let tests =
5353
[ createTest<int>

0 commit comments

Comments
 (0)