-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RealField/ComplexField traits #71
Comments
Thank you for your feedback!
The
As long as we only accept
That's something we would like to do eventually, yes. This is not the case currently because the corresponding traits in |
@sebcrozet Thank you. However the main reason I was suggesting removing Also note that in terms of the |
I agree However However allowing structs containing non-'static references is a much much more difficult topic since there is no way of creating such a struct from nothing. Even fundamental traits like In the end |
Thank you all so much for adding in complex support! It makes my project 100x easier now that I can use existing matrix functions with complex numbers. I have just a few lingering concerns about the traits.
First of all, would it be possible to remove the
Bounded
requirement ofRealField
? Although this would be a breaking change, it would allow using arbitrary-size numbers or rationals, as long as they implementCopy
. I understand the argument that they should probably implementClone
instead, but on the other hand, I seriously doubt that many functions rely onBounded
, and that could be added as a generic requirement for those limited cases. Furthermore, usingBounded
does not really make much sense for floating point numbers anyway since it is almost always impractical that any number should ever come even close to the maximum possible float (since they store an exponent and significand rather than a binary number likeu8
;f64::MAX
> 10308).Second, is the
'static
requirement forComplexField
really necessary? Yes, I know that removing this would be very breaking, and make things a bit more difficult to write, but I IMHO at least eventually it is a necessary step in order to write any performant code usingalga
in order to avoid memory leaks. Same goes forSend
,Sync
,Any
, andDebug
/Display
. As is the case forBounded
, I think it would make more sense for rarely-used requirements like these to be specified for individual functions and to only require the real necessities like arithmetic as a requirement for allComplexField
and therebyRealField
numbers.Third, one more breaking change: would it be possible to eventually refactor the requirements for trigonometric/hyperbolic/exponential/logarithmic, etc. functions into requirements for the corresponding traits in
num_traits
? This would make implementing those functions easier. Or better yet, at least forRealField
, would it be possible to remove those requirements except for the functions that use them?Overall, the most important request I have is removing
'static
. Everything else is just a suggestion/proposal, but IMHO removing'static
is essential for proper memory management even if it makes generics a bit more difficult.Thank you again, and please note that everything here is just ideas for consideration and not feature requests. I understand if not everything here would make sense to implement.
The text was updated successfully, but these errors were encountered: