How to construct a combinatorics array from two data sets with each combination having a specified number of elements?
이전 댓글 표시
Hi I have two data sets. The first one consists of N1(let's say, 10) elements and the second one has N2(i.e., 8) elements. All the elements of the smaller set has its counterpart in the larger set. I need to construct a combinatorics array that will consist of all the possible combinations of the two data sets with each combinations having N1 elements. However, an element from a data set cannot co-exist with its counter-part from the other data-set.
For example, Set1 = [F1 F2 F3] and set2 = [S2 S3] ; (here, N1 = 3, N2 =2) Now the desired set will be: M = [F1 F2 F3; F1 S2 F3; F1 F2 S3; F1 S2 S3]
So, the total number of possible combinations is : 2^N2. I want Matlab to construct the 'M' set. Any suggestions/insight to this problem will be highly appreciated. Thanks
채택된 답변
추가 답변 (1개)
Bruno Luong
2018년 11월 5일
Sad, people keep asking unreasonable thing. The number of combinations is
2^80,
Each of those is 100 numbers so the size in byte is
>> 2^80*100*8
ans =
9.6714e+26 bytes
>> (2^80*100*8)/(1024^4)
ans =
8.7961e+14 Tera bytes
You can take all the computers on earth, it'ss still impossible to store such quantity, let alone compute it.
댓글 수: 2
John D'Errico
2018년 11월 6일
The point is however, that what you really want to solve is a problem of that size. For 2 or 3 levels, you would never have bothered to ask the question in the first place.
So IF you cannot solve the problem you think that you want to solve, that means you need to focus on how to make the problem manageable, thus using a completely different fundamental algorithm.
카테고리
도움말 센터 및 File Exchange에서 Elementary Math에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!