Skip to content

Commit 78c7964

Browse files
committed
Vector.create
1 parent 988672e commit 78c7964

1 file changed

Lines changed: 17 additions & 16 deletions

File tree

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

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,30 @@ open GraphBLAS.FSharp.Backend.Vector
1515
[<RequireQualifiedAccess>]
1616
module Vector =
1717
/// <summary>
18-
/// Builds vector of given format with fixed size and fills it with the default values of desired type.
18+
/// Builds vector of given format with fixed size and fills it with the given value.
1919
/// </summary>
2020
/// <param name="clContext">OpenCL context.</param>
2121
/// <param name="workGroupSize">Should be a power of 2 and greater than 1.</param>
22-
let zeroCreate (clContext: ClContext) workGroupSize =
23-
let zeroCreate =
24-
ClArray.zeroCreate clContext workGroupSize
22+
let create (clContext: ClContext) workGroupSize =
23+
let create = ClArray.create clContext workGroupSize
2524

26-
fun (processor: MailboxProcessor<_>) allocationMode size format ->
25+
fun (processor: MailboxProcessor<_>) allocationMode size format value ->
2726
match format with
28-
| Sparse ->
29-
ClVector.Sparse
30-
{ Context = clContext
31-
Indices = clContext.CreateClArrayWithSpecificAllocationMode(allocationMode, [| 0 |])
32-
Values =
33-
clContext.CreateClArrayWithSpecificAllocationMode(
34-
allocationMode,
35-
[| Unchecked.defaultof<'a> |]
36-
) // TODO empty vector
37-
Size = size }
27+
| Sparse -> failwith "Attempting to create full sparse vector"
3828
| Dense ->
3929
ClVector.Dense
40-
<| zeroCreate processor allocationMode size
30+
<| create processor allocationMode size value
31+
32+
/// <summary>
33+
/// Builds vector of given format with fixed size and fills it with the default values of desired type.
34+
/// </summary>
35+
/// <param name="clContext">OpenCL context.</param>
36+
/// <param name="workGroupSize">Should be a power of 2 and greater than 1.</param>
37+
let zeroCreate (clContext: ClContext) workGroupSize =
38+
let create = create clContext workGroupSize
39+
40+
fun (processor: MailboxProcessor<_>) allocationMode size format ->
41+
create processor allocationMode size format None
4142

4243
/// <summary>
4344
/// Builds vector of given format with fixed size and fills it with the values from the given list.

0 commit comments

Comments
 (0)