Open MichalBrylka opened 1 year ago
Tagging subscribers to this area: @dotnet/area-system-numerics See info in area-owners.md if you want to be subscribed.
Author: | MichalBrylka |
---|---|
Assignees: | - |
Labels: | `api-suggestion`, `area-System.Numerics` |
Milestone: | - |
class Matrix<TNumber> : ..., IAdditionOperators<Matrix<TNumber>, TNumber, Matrix<TNumber>>
You mean IMultiplyOperators<Matrix<TNumber>, TNumber, Matrix<TNumber>>
?
where TNumber : struct, IComparisonOperators<TNumber, TNumber, bool>, INumberBase
Why TNumber : struct, IComparisonOperators<TNumber, TNumber, bool>
? Does TNumber
really have to be a struct
? Does TNumber
really have to be comparable? What about finite fields or complex numbers?
Maybe also worth discussing is the practical use of it. It's conceivably hard to apply techniques like vectorization to optimize the type, as TNumber
and the dimensions are variable, unlike the pre-existing types.
You mean
IMultiplyOperators<Matrix<TNumber>, TNumber, Matrix<TNumber>>
?
yes, INumber<> or INumberBase<> seem to be not relevant here
Why TNumber : struct, IComparisonOperators<TNumber, TNumber, bool>?
No, this can be dropped
Maybe also worth discussing is the practical use of it. It's conceivably hard to apply techniques like vectorization to optimize the type, as TNumber and the dimensions are variable, unlike the pre-existing types.
I'm not sure if we need to optimize internal structure/operations with vectorization. I guess it would not hurt for standard number types. As for use cases - that can be a generic type for all places where matrices are used without limiting oneselves to hardcoded double/Complex types
Background and motivation
In .NET there already exist specialized matrix types MatrixXxX and VectorX (these are mainly for vectorization). It seems that we could provide a robust implementation for matrix and vector that could also be a showcase for newly introduced generic math.
API Proposal
API Usage
Alternative Designs
No response
Risks
No response