Skip to content

RFC: vector partitions #128

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Stivanification
Copy link

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

Stivanification and others added 3 commits January 5, 2017 17:00
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]]
@Stivanification Stivanification changed the title RFC: vector partitions Draft: vector partitions Dec 25, 2022
@codecov
Copy link

codecov bot commented Dec 26, 2022

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.02%. Comparing base (d1b633b) to head (6245f53).
Report is 28 commits behind head on master.

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              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Stivanification Stivanification changed the title Draft: vector partitions RFC: vector partitions Dec 26, 2022
@Stivanification Stivanification marked this pull request as draft December 26, 2022 09:36
@Stivanification Stivanification marked this pull request as ready for review December 26, 2022 09:36

function vector_partitions(vector::Vector{Int64},min=zeros(Integer,length(vector)))

# Creates all vector partitions of "vector" with all parts greater than
Copy link
Contributor

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?

@inkydragon inkydragon added the feature Indicates new feature / enhancement requests label May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Indicates new feature / enhancement requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants