Skip to content

Commit ca2c687

Browse files
committed
Added documentation for converting and transposing
1 parent 654043f commit ca2c687

1 file changed

Lines changed: 33 additions & 2 deletions

File tree

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

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ module Matrix =
3636

3737
MatrixCSR res
3838

39+
/// <summary>
40+
/// Creates a new matrix, represented in CSR format, that is equal to the given one.
41+
/// </summary>
42+
///<param name="clContext">OpenCL context.</param>
43+
///<param name="workGroupSize">Should be a power of 2 and greater than 1.</param>
3944
let toCSR (clContext: ClContext) workGroupSize =
4045
let toCSR = COOMatrix.toCSR clContext workGroupSize
4146
let copy = copy clContext workGroupSize
@@ -45,6 +50,12 @@ module Matrix =
4550
| MatrixCOO m -> toCSR processor m |> MatrixCSR
4651
| MatrixCSR _ -> copy processor matrix
4752

53+
/// <summary>
54+
/// Returns the matrix, represented in CSR format, that is equal to the given one.
55+
/// The given matrix should neither be used afterwards nor be disposed.
56+
/// </summary>
57+
///<param name="clContext">OpenCL context.</param>
58+
///<param name="workGroupSize">Should be a power of 2 and greater than 1.</param>
4859
let toCSRInplace (clContext: ClContext) workGroupSize =
4960
let toCSRInplace =
5061
COOMatrix.toCSRInplace clContext workGroupSize
@@ -54,6 +65,11 @@ module Matrix =
5465
| MatrixCOO m -> toCSRInplace processor m |> MatrixCSR
5566
| MatrixCSR _ -> matrix
5667

68+
/// <summary>
69+
/// Creates a new matrix, represented in COO format, that is equal to the given one.
70+
/// </summary>
71+
///<param name="clContext">OpenCL context.</param>
72+
///<param name="workGroupSize">Should be a power of 2 and greater than 1.</param>
5773
let toCOO (clContext: ClContext) workGroupSize =
5874
let toCOO = CSRMatrix.toCOO clContext workGroupSize
5975
let copy = copy clContext workGroupSize
@@ -63,6 +79,12 @@ module Matrix =
6379
| MatrixCOO _ -> copy processor matrix
6480
| MatrixCSR m -> toCOO processor m |> MatrixCOO
6581

82+
/// <summary>
83+
/// Returns the matrix, represented in COO format, that is equal to the given one.
84+
/// The given matrix should neither be used afterwards nor be disposed.
85+
/// </summary>
86+
///<param name="clContext">OpenCL context.</param>
87+
///<param name="workGroupSize">Should be a power of 2 and greater than 1.</param>
6688
let toCOOInplace (clContext: ClContext) workGroupSize =
6789
let toCOOInplace =
6890
CSRMatrix.toCOOInplace clContext workGroupSize
@@ -98,7 +120,12 @@ module Matrix =
98120
| MatrixCSR m1, MatrixCSR m2 -> CSReWiseAdd processor m1 m2 |> MatrixCSR
99121
| _ -> failwith "Matrix formats are not matching"
100122

101-
123+
/// <summary>
124+
/// Transposes the given matrix and returns result. The storage format is preserved.
125+
/// The given matrix should neither be used afterwards nor be disposed.
126+
/// </summary>
127+
///<param name="clContext">OpenCL context.</param>
128+
///<param name="workGroupSize">Should be a power of 2 and greater than 1.</param>
102129
let transposeInplace (clContext: ClContext) workGroupSize =
103130
let COOtransposeInplace =
104131
COOMatrix.transposeInplace clContext workGroupSize
@@ -111,7 +138,11 @@ module Matrix =
111138
| MatrixCOO m -> COOtransposeInplace processor m |> MatrixCOO
112139
| MatrixCSR m -> CSRtransposeInplace processor m |> MatrixCSR
113140

114-
141+
/// <summary>
142+
/// Transposes the given matrix and returns result as a new matrix. The storage format is preserved.
143+
/// </summary>
144+
///<param name="clContext">OpenCL context.</param>
145+
///<param name="workGroupSize">Should be a power of 2 and greater than 1.</param>
115146
let transpose (clContext: ClContext) workGroupSize =
116147
let COOtranspose =
117148
COOMatrix.transpose clContext workGroupSize

0 commit comments

Comments
 (0)