-
Notifications
You must be signed in to change notification settings - Fork 59
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
RFC: vector partitions #128
base: master
Are you sure you want to change the base?
RFC: vector partitions #128
Conversation
This is a julia port of the sage VectorPartitions function originally written by Amritanshu Prasad (2013). A vector partition of "vec" is a list of vectors with non-negative integer entries whose sum is "vec". The method vector_partitions creates all vector partitions of "vector" with all parts greater than or equal to "min" in lexicographic order recursively. INPUT: - "vec" -- a list of non-negative integers. EXAMPLES: If "min" is not specified, then the class of all vector partitions of "vec" is created:: julia> vector_partitions([2, 2]) 9-element Array{Any,1}: Array{Int64,1}[[1,0],[1,0],[0,1],[0,1]] Array{Int64,1}[[2,0],[0,1],[0,1]] Array{Int64,1}[[1,1],[1,0],[0,1]] Array{Int64,1}[[2,1],[0,1]] Array{Int64,1}[[1,0],[1,0],[0,2]] Array{Int64,1}[[2,0],[0,2]] Array{Int64,1}[[1,2],[1,0]] Array{Int64,1}[[1,1],[1,1]] Array{Int64,1}[[2,2]]
Codecov ReportBase: 96.85% // Head: 97.02% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #128 +/- ##
==========================================
+ Coverage 96.85% 97.02% +0.16%
==========================================
Files 7 8 +1
Lines 700 739 +39
==========================================
+ Hits 678 717 +39
Misses 22 22
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
|
||
function vector_partitions(vector::Vector{Int64},min=zeros(Integer,length(vector))) | ||
|
||
# Creates all vector partitions of "vector" with all parts greater than |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this (and the similar comments in functions below) could be moved above the function as a doc string?
Hey everybody,
I implemented this functionality for computing vector partitions years ago and submitted a pull request which grew stale. I recently got back to this and in the hope that perhapas someone might find this useful I have cleaned up the code and added some tests. I would be happy to receive any kind of feedback.
Cheers