-
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
Add HMatrix Backend #6
base: master
Are you sure you want to change the base?
Add HMatrix Backend #6
Conversation
I've begun adding instances, and have only accomplished the trivial ones. You're right, there's much to think about wrt |
Thanks! That's a good start. So you've decided to make it Shall I fill out the Have you formed some opinions with regard to the different options how to do these tensors properly? |
I was just playing around, and didn't necessarily settle on
how can it? The GADT's types wouldn't align, so, I think this would be safe. I see your point if it were an ADT, but GADTs seem safe. I'm in no rush for this, so, I'd be happy if we tried maybe a few approaches, and I'll benchmark them. Maybe we can have: Numeric/LinearAlgebra/Static/Experiment/TypeFamily.hs
Numeric/LinearAlgebra/Static/Experiment/Singletons.hs
Numeric/LinearAlgebra/Static/Experiment/TensorList.hs
Numeric/LinearAlgebra/Static/Experiment/GADT.hs That'd be great if you wanted to start filling out |
Well, rather
Exactly what my experience / intuition also says.
Yes, I suppose. But I'd hope that this would be a one-time cost for an entire vector operation. I'd expect the HMatrix backend to be used for large vectors, where this would become insignificant (similar to how people use Python and get good performance because We seem to agree that As for “custom mechanism” – well, I've hardly thought that through. The idea is something like a type family The “hybrid solution” is quite different from this. The problem I'm seeing is, the GADT data HMatRTensor n w where
HMatrixTensor :: HMatrix.L n m -> HMatRTensor n (HMatrix.R m)
HMatGenericTensor :: [w] -> HMatRTensor n [w] only ensures that |
I haven't forgotten about your PR, but you know how it is... the little time I could set aside for maintaining my old Haskell packages went mostly into a bunch of changes in Have you arrived at any further conclusions in the meantime as to how the backend problem should be addressed? |
After repeatedly rolling the thoughts in my head, I like none of the options (for achieving the tensor products of hmatrix-vectors to be implemented as hmatrix-matrices) enough to justify the added complexity to the library. Specifically, all this would push the package more in a direction of being just another type wrapper around the old everything's a matrix paradigm, and though putting matrices on a more category-cal backing isn't worthless, that's just not at all in line with my grand vision for this library (getting rid of particular basis expansions). There's still nothing wrong with having vector spaces whose implementation is based on Meanwhile, for the One change to the classes that would be relatively simple and could help with performance would be, instead of a full-blown variety of backends, to only add a method that decides whether or not the type is |
Yet another option, before I settle on one: add class (...) => TensorSpace v where
...
type StaticDimension v :: Maybe Nat This would be allowed to be ...So as to hopefully get the best of both worlds between generality and performance, though that may be optimistic. |
Some heads-up on the (glacial-pace) progress with regards to this PR:
The further plan is to make @freckletonj do you have any feedback on this, to either the general roadmap or the concrete implementation? In particular, this is the first time I really used singletons, to express the dependent typing involved when we construct the optional-dimension of tensor products etc.. Any comments on that? |
No description provided.