Background:
Functions with constexpr and __device__ signal the use of the function on the GPU side. Since CHECK() is not GPU-interoperable, this function should not be used in any function on the GPU side.
Inverse:
Originally the special edge case of the inverse of 0 was to be checked in the innermost inverse functions using CHECK(), yet this was not possible due to the reasoning above. To accommodate this possible error, a mixture of bool returns with output parameters and std::optional returns was adopted such that the upper hierarchical calls of inverse functions (aka in tests and non-(constexpr/__device__) functions) must check the outcome of the inverse and kill the program if the return is invalid.
Div:
Div functions follow the same changes as dictated for the inverse functions above with regards to the divide by 0 edge case.
Background: Functions with
constexpr
and__device__
signal the use of the function on the GPU side. SinceCHECK()
is not GPU-interoperable, this function should not be used in any function on the GPU side.Inverse: Originally the special edge case of the inverse of 0 was to be checked in the innermost inverse functions using
CHECK()
, yet this was not possible due to the reasoning above. To accommodate this possible error, a mixture ofbool
returns with output parameters andstd::optional
returns was adopted such that the upper hierarchical calls of inverse functions (aka in tests and non-(constexpr
/__device__
) functions) must check the outcome of the inverse and kill the program if the return is invalid.Div: Div functions follow the same changes as dictated for the inverse functions above with regards to the divide by 0 edge case.
This PR should be merged after #422
Resolves #76