You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Besides grabbing the lowest hanging fruit ( #82 ), I actually have a criticism of the design of the math library. The majority of the library are functions that output multiple values, and but there are a few that output single values from multiple inputs (min, max, sum, etc). Especially given that this is a parallel math library, I'd argue that these single output functions are wasting valuable names better given to fully parallel operations.
For example, min and max. Presently, these functions are returning a single min or max value for all values in the input array. This contradicts other functions like abs, add, mul, and many other functions that output multiple values.
I'd recommend instead naming functions like p_min_f32 to p_min_value_f32 or p_minv_f32. That way you know from the name that it's outputting a single value instead of many.
This will then free up p_min_f32 and p_max_f32 to operate on two arrays of input, and output an array of min or max values, consistent with the rest of the functions. This also means the namespace is more open to adding other useful functions like clamp, sign, floor, and ceil to name a few.
The text was updated successfully, but these errors were encountered:
Good comment. Agree that it would be good if the functions had easy to recognize functionality based on name. Note that MPI for example has a "complete" set of global reduction operations as a starting point.
MPI_MAX maximum
MPI_MIN minimum
MPI_SUM sum
MPI_PROD product
MPI_LAND logical and
MPI_BAND bit-wise and
MPI_LOR logical or
MPI_BOR bit-wise or
MPI_LXOR logical exclusive or (xor)
MPI_BXOR bit-wise exclusive or (xor)
MPI_MAXLOC max value and location
MPI_MINLOC min value and location
OpenGL also uses the function name to indicate how many values are expected in the parameter array and their type. For example:
glVertex3f - Expects 3 floats
glVertex2u - Expects 2 unsigned ints
Besides grabbing the lowest hanging fruit ( #82 ), I actually have a criticism of the design of the math library. The majority of the library are functions that output multiple values, and but there are a few that output single values from multiple inputs (min, max, sum, etc). Especially given that this is a parallel math library, I'd argue that these single output functions are wasting valuable names better given to fully parallel operations.
For example, min and max. Presently, these functions are returning a single min or max value for all values in the input array. This contradicts other functions like abs, add, mul, and many other functions that output multiple values.
I'd recommend instead naming functions like
p_min_f32
top_min_value_f32
orp_minv_f32
. That way you know from the name that it's outputting a single value instead of many.This will then free up
p_min_f32
andp_max_f32
to operate on two arrays of input, and output an array of min or max values, consistent with the rest of the functions. This also means the namespace is more open to adding other useful functions like clamp, sign, floor, and ceil to name a few.The text was updated successfully, but these errors were encountered: