colgreen/Redzen

MathSpanUtils: Support a wider set of types.

colgreen opened this issue · 2 comments

E.g. We have MathSpanUtils.Sum(Span), MathFSpanUtils.Sum(Span), and would be good to do the same for Int32 and other native types. E.g. see the Clamp() overloads here:

https://github.com/dotnet/runtime/blob/master/src/libraries/System.Private.CoreLib/src/System/Math.cs

Consider merging MathSpanUtils and MathFSpanUtils, and using partial classes to split the code into multiple files. Perhaps put all of the like method overloads in one file (i.e. all Clamp method in one file).

Also, consider renaming the class to MathSpan or SpanMath.

Remaining methods to implement:

MathSpan.Int32.cs
Sum(), MinMax(), MedianOfSorted(), Clip()

Done. In 9777bb0 and d3ccd83,