Import Multipartition functionality from JuLie#4746
Import Multipartition functionality from JuLie#4746fingolfin merged 48 commits intooscar-system:masterfrom
Multipartition functionality from JuLie#4746Conversation
fingolfin
left a comment
There was a problem hiding this comment.
Thank you for getting this started! Now we need to clean this up some more
|
Couple of spare things to clean up, but this should hopefully pass tests now and be ready for more serious review. |
Co-authored-by: Max Horn <max@quendi.de>
Co-authored-by: Lars Göttgens <lars.goettgens@gmail.com>
|
I vaguely remember that we used artificial iterators to make the API "stable" (even if we don't have a proper iterator yet). Maybe @joschmitt remembers? |
Yes, before the OSCAR 1.0 release, I turned all the |
|
Perfect, thanks; I will use this for Multipartition until there is demand to convert to a real iterator.
… On 31. Mar 2025, at 3:13 PM, Johannes Schmitt ***@***.***> wrote:
joschmitt
left a comment
(oscar-system/Oscar.jl#4746)
I vaguely remember that we used artificial iterators to make the API "stable" (even if we don't have a proper iterator yet). Maybe @joschmitt remembers?
Yes, before the OSCAR 1.0 release, I turned all the return some_array into return (x for x in some_array).
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
<https://github.com/joschmitt> <#4746 (comment)> <https://github.com/notifications/unsubscribe-auth/AANWIWPSIVJGI67TRPKCNGL2XE5PNAVCNFSM6AAAAABZNMGE2CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONRWGE4TAMJWG4>
joschmitt
left a comment
(oscar-system/Oscar.jl#4746)
<#4746 (comment)>
I vaguely remember that we used artificial iterators to make the API "stable" (even if we don't have a proper iterator yet). Maybe @joschmitt <https://github.com/joschmitt> remembers?
Yes, before the OSCAR 1.0 release, I turned all the return some_array into return (x for x in some_array).
—
Reply to this email directly, view it on GitHub <#4746 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AANWIWPSIVJGI67TRPKCNGL2XE5PNAVCNFSM6AAAAABZNMGE2CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONRWGE4TAMJWG4>.
You are receiving this because you authored the thread.
|
| Partition{Int64}[[], [2]] | ||
|
|
||
| julia> collect(multipartitions(2,2)) | ||
| 5-element Vector{Multipartition{Int64}}: |
There was a problem hiding this comment.
Is this perhaps like this?
| 5-element Vector{Multipartition{Int64}}: | |
| 5-element Vector{Partition{Int64}}: |
There was a problem hiding this comment.
But CI test pass... It seems I am misunderstanding something... huh
There was a problem hiding this comment.
I agree that it seems like this should be Vector{Multipartition}, this definitely passes CI but that doesn't mean that it's what we want... I'm looking at it now.
There was a problem hiding this comment.
Ah okay, I understand the confusion. multipartitions returns ALL the multipartitions of n into r parts, so we get a Vector{Multipartition}. While each individual Multipartion looks like a Vector{Partition}. So this is all correct.
There was a problem hiding this comment.
Ahah I get it now:
julia> foo = collect(MP)
5-element Vector{Multipartition{Int64}}:
Partition{Int64}[[], [2]]
Partition{Int64}[[], [1, 1]]
Partition{Int64}[[1], [1]]
Partition{Int64}[[2], []]
Partition{Int64}[[1, 1], []]
julia> typeof(foo)
Vector{Multipartition{Int64}} (alias for Array{Multipartition{Int64}, 1})
julia> foo[1]
Partition{Int64}[[], [2]]
julia> typeof(foo[1])
Multipartition{Int64}
So my confusion is that Multipartition is printed as a Vector{Partition}. Which makes some sense, but at least for me it would be easier to understand what is going on if there was a custom show` method...
There was a problem hiding this comment.
I can do this but I'm not sure what it should look like. We have the same issue with Partition printing as Vector{Int}:
julia> P = partition(6, 4, 4, 2)
[6, 4, 4, 2]Co-authored-by: Max Horn <max@quendi.de>
|
If I compare to what is detailed about the Combinatorics API, I should maybe have a dedicated |
|
@mjrodgers are you working on that then? |
Co-authored-by: Max Horn <max@quendi.de>
After our last conversation, I thought we decided to merge this and work on the printing in a separate pull request; but I can take care of this before merging if you think that's better. |
|
@mjrodgers ok I forgot about that, I am happy to do it like you said :-) |
Co-authored-by: Max Horn <max@quendi.de> Co-authored-by: Lars Göttgens <lars.goettgens@gmail.com>
Import
Multipartitionfunctionality from JuLie.Fixes #4656