How I can use perms_reps(vec,reps) function with big vectors
11 views (last 30 days)
Show older comments
slimani djamel
on 20 Dec 2016
Commented: slimani djamel
on 21 Dec 2016
I used perms_reps(vec,reps) function (author:John D'Errico, the function :https://www.mathworks.com/matlabcentral/newsreader/view_thread/102182), it was very helpful, but the function crashed when I executed perms_reps([0 1],[40 5]) after around 24 hours of execution,due to the large number of permutations (1,221,759 permutations). I would like know if it's possible to use this function to found in each execution a part of permutation and in next execution the next part etc. Thank you for help.
0 Comments
Accepted Answer
Roger Stafford
on 20 Dec 2016
For your particular problem, try this:
C = nchoosek(1:45,5);
n = size(C,1);
M = zeros(n,45);
% If you get this far without memory errors, you’re in business
for k = 1:n
M(k,C(k,:)) = 1;
end
If you have enough memory for C and M (M will be 1221759 by 45,) it might be faster than perms_reps since it avoids the overhead of recursive calls.
More Answers (1)
John D'Errico
on 20 Dec 2016
"YOUR" perms_reps function? Who are you talking to? This is not part of MATLAB, so must we guess? And then of course, we need to infer what the syntax is too? As a guess, is this referring to something I actually posted 11 years ago?
https://www.mathworks.com/matlabcentral/newsreader/view_thread/102182
0 Comments
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!