Skip to content

Commit d6fbeda

Browse files
random: revise comments
1 parent e743113 commit d6fbeda

File tree

3 files changed

+32
-32
lines changed

3 files changed

+32
-32
lines changed

config/LAGraph.h.in

+10-10
Original file line numberDiff line numberDiff line change
@@ -2025,7 +2025,7 @@ int LAGraph_Vector_IsEqualOp
20252025
// Random number generator
20262026
//------------------------------------------------------------------------------
20272027

2028-
// FIXME: rename these methods? Rename the vector "Seed" to "State".
2028+
// FIXME: rename these methods?
20292029

20302030
/** LAGraph_Random_Seed creates a random vector. On input, its values are
20312031
* ignored but its structure is used. On output, all entries that were in
@@ -2034,20 +2034,20 @@ int LAGraph_Vector_IsEqualOp
20342034
* with the overall seed value being revised for each entry in the vector,
20352035
* depending on their index in the vector.
20362036
*
2037-
* @param[out,out] Seed vector to initialize with random numbers.
2038-
* @param[in] seed scalar seed value.
2039-
* @param[in,out] msg any error messages.
2037+
* @param[out,out] State vector to initialize with random numbers.
2038+
* @param[in] seed scalar seed value.
2039+
* @param[in,out] msg any error messages.
20402040
*
20412041
* @retval GrB_SUCCESS if successful.
2042-
* @retval GrB_NULL_POINTER if Seed is NULL.
2042+
* @retval GrB_NULL_POINTER if State is NULL.
20432043
* @returns any GraphBLAS errors that may have been encountered.
20442044
*/
20452045

20462046
LAGRAPH_PUBLIC
2047-
int LAGraph_Random_Seed // construct a random seed vector
2047+
int LAGraph_Random_Seed // construct a random State vector
20482048
(
20492049
// input/output:
2050-
GrB_Vector Seed, // vector of random number seeds, normally GrB_UINT64
2050+
GrB_Vector State, // vector of random number States, normally GrB_UINT64
20512051
// input:
20522052
uint64_t seed, // scalar input seed
20532053
char *msg
@@ -2057,19 +2057,19 @@ int LAGraph_Random_Seed // construct a random seed vector
20572057
* LAGraph_Random_Seed, and modifies all of them so that they take on their
20582058
* next value in its pseudo-random number stream.
20592059
*
2060-
* @param[out,out] Seed vector with random numbers to be advanced.
2060+
* @param[out,out] State vector with random numbers to be advanced.
20612061
* @param[in,out] msg any error messages.
20622062
*
20632063
* @retval GrB_SUCCESS if successful.
2064-
* @retval GrB_NULL_POINTER if Seed is NULL.
2064+
* @retval GrB_NULL_POINTER if State is NULL.
20652065
* @returns any GraphBLAS errors that may have been encountered.
20662066
*/
20672067

20682068
LAGRAPH_PUBLIC
20692069
int LAGraph_Random_Next // advance to next random vector
20702070
(
20712071
// input/output:
2072-
GrB_Vector Seed,
2072+
GrB_Vector State, // vector of random number States, normally GrB_UINT64
20732073
char *msg
20742074
) ;
20752075

include/LAGraph.h

+15-13
Original file line numberDiff line numberDiff line change
@@ -2030,23 +2030,25 @@ int LAGraph_Vector_IsEqualOp
20302030
/** LAGraph_Random_Seed creates a random vector. On input, its values are
20312031
* ignored but its structure is used. On output, all entries that were in
20322032
* the original structure are assigned random values, depending on the scalar
2033-
* seed value. Each entry is considered its own pseudo-random number stream.
2033+
* seed value. Each entry is considered its own pseudo-random number stream,
2034+
* with the overall seed value being revised for each entry in the vector,
2035+
* depending on their index in the vector.
20342036
*
2035-
* @param[out,out] Seed vector to initialize with random numbers.
2036-
* @param[in] seed scalar seed value.
2037-
* @param[in,out] msg any error messages.
2037+
* @param[out,out] State vector to initialize with random numbers.
2038+
* @param[in] seed scalar seed value.
2039+
* @param[in,out] msg any error messages.
20382040
*
20392041
* @retval GrB_SUCCESS if successful.
2040-
* @retval GrB_NULL_POINTER if Seed is NULL.
2042+
* @retval GrB_NULL_POINTER if State is NULL.
20412043
* @returns any GraphBLAS errors that may have been encountered.
20422044
*/
20432045

20442046
LAGRAPH_PUBLIC
2045-
int LAGraph_Random_Seed // construct a random seed vector
2047+
int LAGraph_Random_Seed // construct a random State vector
20462048
(
2047-
// input/output
2048-
GrB_Vector Seed, // vector of random number seeds, normally GrB_UINT64
2049-
// input
2049+
// input/output:
2050+
GrB_Vector State, // vector of random number States, normally GrB_UINT64
2051+
// input:
20502052
uint64_t seed, // scalar input seed
20512053
char *msg
20522054
) ;
@@ -2055,19 +2057,19 @@ int LAGraph_Random_Seed // construct a random seed vector
20552057
* LAGraph_Random_Seed, and modifies all of them so that they take on their
20562058
* next value in its pseudo-random number stream.
20572059
*
2058-
* @param[out,out] Seed vector with random numbers to be advanced.
2060+
* @param[out,out] State vector with random numbers to be advanced.
20592061
* @param[in,out] msg any error messages.
20602062
*
20612063
* @retval GrB_SUCCESS if successful.
2062-
* @retval GrB_NULL_POINTER if Seed is NULL.
2064+
* @retval GrB_NULL_POINTER if State is NULL.
20632065
* @returns any GraphBLAS errors that may have been encountered.
20642066
*/
20652067

20662068
LAGRAPH_PUBLIC
20672069
int LAGraph_Random_Next // advance to next random vector
20682070
(
2069-
// input/output
2070-
GrB_Vector Seed,
2071+
// input/output:
2072+
GrB_Vector State, // vector of random number States, normally GrB_UINT64
20712073
char *msg
20722074
) ;
20732075

src/utility/LAGraph_Random.c

+7-9
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,12 @@ int LAGraph_Random_Finalize (char *msg) // FIXME: remove this method
226226
bool random_hack = false ;
227227
#endif
228228

229-
// FIXME: should this method allow the user to pass in the init and next ops?
230-
231-
// FIXME: rename this method:
232-
int LAGraph_Random_Seed // construct a random state vector
229+
// FIXME: rename this method?
230+
int LAGraph_Random_Seed // construct a random State vector
233231
(
234-
// input/output
235-
GrB_Vector State, // GrB_UINT64 vector of random number states
236-
// input
232+
// input/output:
233+
GrB_Vector State, // vector of random number States, normally GrB_UINT64
234+
// input:
237235
uint64_t seed, // scalar input seed
238236
char *msg
239237
)
@@ -271,8 +269,8 @@ int LAGraph_Random_Seed // construct a random state vector
271269

272270
int LAGraph_Random_Next // advance to next random vector
273271
(
274-
// input/output
275-
GrB_Vector State, // the sparsity pattern of State is preserved
272+
// input/output:
273+
GrB_Vector State, // vector of random number States, normally GrB_UINT64
276274
char *msg
277275
)
278276
{

0 commit comments

Comments
 (0)