How to construct a combinatorics array from two data sets with each combination having a specified number of elements?
Mostrar comentarios más antiguos
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
Respuesta aceptada
Más respuestas (1)
Bruno Luong
el 5 de Nov. de 2018
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 comentarios
John D'Errico
el 6 de Nov. de 2018
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.
Categorías
Más información sobre Elementary Math en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!