-
Notifications
You must be signed in to change notification settings - Fork 2
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
Provide limited support for tensors of typed dimensions #36
Comments
Great effort! In principle I like the idea, however, there is one not-so-nice thing when using Java Generics for typing the dimensions - the type arguments for Generics are ordered, while (traditionally) our dimensions are not. For instance, a However, I don't have a clever solution for this yet. I'm wondering if compile-time annotation processing and Tensorbackeds could be a viable alternative to Generics for dimension typing ... |
I agree... The Ordering is artificial in this case ... However, one could accept this I think, by explicitely documenting this feature ... Indeed the two tensors you mention are equivalent (to be checked by the way .. I doubt that the equality holds at the moment). BTW: I just tried and indeed, the following still works with the proposed implementation:
, because the Tensor1D inherits from Tensor ... and still provides the get(Object... coordinates) method.... I think its not that bad ;-) Compiletime annotation processing is nice ... but always comes with the (in my opinion) big drawback that you need particular arguments for your compiler (and each ide...).... I finally always refrained from libraries requiring this .... so I fear that others do also .... Another problem, not mentioned yet in this thread, is one which was there all the time, but becomes much more prominent if we provide this typed coordinates, is this one (I dedicated a separate issueto it): #38 . |
Another question is of course, where to stop the 'limited' support ...
... not sure if this is handlable ... we always can exclude this from the 'support' ... but for sure it might come up ;-) |
As discussed today: I think we agree that we will give it another try to rather provide typed Tensorbacked support than typed Tensor support ... In these cases, the tensorbackeds will usually anyhow have dedicated classes (interfaces) and it might be less confusing to have ordered dimensions in them. Tensors will (for the moment) remain untyped in dimensions. What we still can learn from the previous exercise:
|
First Notes concerning the ongoing refactoring In the end, the proposed treatment of tensorbackeds is as follows: To be able to be instantiated as a tensorbacked object, the class has to either
The required dimensions will be determined by either of the following
In the tensorcis class we will have additional factory methods for builders of typed tensorbackeds:
'Anonymous' tensorbackeds of typed dimensions could be built like:
|
As noted recently by Andrea, one limiting factor, which might bring fear to new users, is the fact that dimensions are never typed and that also the number of dimensions is never known when using a tensor ....
In early designs such things were tried, but always led to horrible "generic" monsters, so it was decided to give this up at that time....
However, since now a core functionality is well established and proves to be useful.... probably it is time to rethink this approach and add limited 'typed tensors' sugar on top of the existing....
For sure we should follow an approach, where all the utility methods always only act on Tensors (only the value is typed). Otherwise, we will have an explosion of methods .... However, we could potentially have e.g. typed tensors (and builders) up to a limited number of dimensions...
The text was updated successfully, but these errors were encountered: