Closed soufianekhiat closed 3 months ago
Thanks for the suggestion. While your use of arbitrary types certainly has merit, this would require too many changes for me to consider. Maybe in Clipper3 😁.
The point of this PR is not to support all type permutation. Just "preparing the work". Currently for each update of Clipper I do the same thing again multiple time: hiding "double" behind a typedef, same for int64_t. But the rename is maybe an extra too much. Would you consider the PR is the only had a typedef without renaming the struct/class?
First step to have Clipper2 compiling on arbitrary type. The point of the PR is to prepare the future work to have Clipper2 working with various precision. Open to comment. Suffix of "I" (for integer) instead of "64" (for int64_t) and "S" (for Scalar) instead of "D" (for double).
Performance Impact: {double, int64_t}:
{float, int32_t}:
{float, int16_t}:
The idea the prepare future work to have Clipper2 independant of data type storage. Scalar could be = { double, float, float16_t } Integer could be = { int64_t, int32_t, int16_t }
Currently all the test pass for { double, int64_t } pair. For { float, int32_t } Currently we can accept that Clipper2 only support { double, int64_t } version. Default test (and Z-version):
For { float, int16_t }
Results for Benchmark with fixed seed srand( 97 ):
{ double, int64_t }:
{ double, int32_t }:
{ double, int16_t }:
{ float, int64_t }:
{ float, int32_t }:
{ float, int16_t }: