-
Notifications
You must be signed in to change notification settings - Fork 69
ConicMonoid: when values are always increasing. #177
Comments
So, @denisrosset is currently looking into adding an linearly ordered group, either to algebra or spire. May be worth touching base with him. This actually is sort of ground work for possibly having an OrderedRing, followed by a correct truncated division. |
See also this mathoverflow question Standard name for a Monoid/Semigroup with a+b≤a,b? (without an answer). Also note that this is a different property than the (linearly-)ordered semigroup/monoid/group linked above by @tixxit, so we shouldn't squash them into one typeclass. |
The main problem with Otherwise, when a method requires an But @tixxit is right, I'm trying to find a solution that works with the Scala type system without too much fuss. |
This problem with ambiguous implicits comes up often and is a pain. I don't think having a typeclass for each possible combination of properties is feasible, though, because
Perhaps subtyping-free encoding of type classes, as explored by @aloiscochard in scato, can bring some hope. Then, neither @adelbertc is also exploring this in this blog post. |
What I'm coming up is "type towers", where each tower contains a list of properties, and all combinations are available. But the towers do not mix. Thus there would be a |
@TomasMikula Anybody benchmarked the scato approach? How does the JVM JIT deal with the many indirection levels (up to four levels of nested vals)? This seems a bit crazy in a performance-oriented library like Spire. The SAGE library for Python dealt with that problem by implementing some crazy type system on top of Python's to merge instances as needed --- but in a formal way, by basing their types on their category theory definitions. One day, I'd like to explore how this approach could be reproduced in Scala. In the meantime, I think we have to find a middle way. |
I'm not aware that anyone benchmarked that, at least with as many as 4 indirections. I can't even imagine how people would deal with this in Python. They must have basically implemented a separate programming language. Anyway, I would like to understand more about it. Is that solution extensible by users, or does it work only for the "privileged" SAGE code? |
Have a look: http://doc.sagemath.org/html/en/reference/categories/sage/categories/category.html |
@denisrosset yes I did, here is the benchmarks, you can simply run them: https://github.com/aloiscochard/scato/blob/master/benchmarks/src/main/scala/Instantiations.scala IMO it is negligible, I would love to hear @non feedback on it, especially in the context of library like algebra. |
@aloiscochard thanks for the info! |
Copied from @johnynek's issue twitter/algebird#218:
Name from https://twitter.com/DRMacIver/status/388935423709704192
The text was updated successfully, but these errors were encountered: