-
Notifications
You must be signed in to change notification settings - Fork 15
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
Scalar versus Functorial #114
Comments
@tonyday567 very interesting, thank you for your insight! Yes I agree the Scalar type family really looks like poor design, I didn't come up with anything better at the time. |
Not so fast at hitting the self-deprecation button! It's the boiler-plate solution for every other higher-kinded number library out there. If you have like a |
I agree. It's very inflexible because it enforces a hard design-constraint on your type and could lead to very convoluted types if you have a complicated scalar. Also, some types just may not fit the pattern. I like your example of @tonyday567. What you want to construct is usually seen as a direct sum of vector-spaces (where we view the matrix as a sum of vectors). We ideally want to express both things, but I think for the later, the direct sum, the abstraction is too liberal. The type of the scalar and the type of the thing must not go out of sync (when doing matrix-multiplication etc.), which could lead to bugs and in general, seems like a very fragile solution. |
Turning my attention to ocramz/sparse-linear-algebra#60
Interpreted for numhask naming conventions, the library defines this:
The current numhask approach is to "push" the Scalar (or Element) type to the headline, and eschew the Scalar type inside the class definition:
https://en.wikipedia.org/wiki/Vector_space
Conversion would be straight forward.
My (outdated by now) experience with Scalar in subhask was that it caused a lot of constraint explosion for no good reason - plenty of
Scalar s ~s
etc. In sla, there is also:which tends to be unnecessary in numhask.
Having said this, I'm wide open for potential solutions, from status quo, to having both, to going with Scalar etc etc.
The text was updated successfully, but these errors were encountered: