Exhaustively permutate a vector of size 20
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
I'm trying to exhaustively permutate a vector of size 20, but when I tried to use perms(v), I get the error
Error using perms (line 23)
Maximum variable size allowed by the program is exceeded.
I've read from the documentation that the memory required for vectors longer than 10 is astronomical. So I'm looking for an alternative.
What I'm trying to do is the following (using a smaller scale example, where the vector here is only of size 3 instead of 20) - find all vectors, x, of length 3 where (x_i)^2 = 1, e.g.
(1, 1, 1),
(-1, 1, 1), (1, -1, 1), (1, 1, -1),
(-1, -1, 1), (-1, 1, -1), (1, -1, -1),
(-1, -1, -1)
I was trying to iteratively create the "base vector", where the number of '-1' elements increased from 0 to 20, then use perms(v) to permutate each "base vector", but I ran into the memory problem.
Is there any alternative to do this?
Thank you.
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Discrete Math에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!