How to get all permutation of a large vector?

9 次查看(过去 30 天)
How to get all permutation of a large vector? (50 elements) I need this to generate a Simulink simulation with each combination result. So the ideal is some generation in a loop.

采纳的回答

Walter Roberson
Walter Roberson 2016-11-17
If you were able to process the entries at a rate of 5 GHz (that is, you were able to process 5*10^9 complete entries per second), then it would take you 1.93 * 10^47 years to process all 30414093201713378043612608166064768844377641568960512000000000000 permutations.
But if you have a yotta-yotta year to spare,
  4 个评论
Walter Roberson
Walter Roberson 2016-11-17
If you processed at the same rate that I described above, then a vector with 30 elements would take approximately 1.68 * 10^15 years.
This figure needs to be understood as a very very rough approximation. The rotation of the Earth is slowing down due to gravity interactions with the Moon, so the very meaning of "year" will change, even if only in terms of "days". On the other hand, apparently the Sun is likely to only last about another 2.2 * 10^9 years and if the Earth survives that, you can be sure that "year" will have a very different meaning.
If you were to compare age of the Universe itself to the age that the Universe would have at the end of the 1.68 * 10^15 years, it would be like the first 4.38 minutes out of a year.
You should probably rethink your strategy.
John D'Errico
John D'Errico 2016-11-17
编辑:John D'Errico 2016-11-17
Yes, but with Moore's law in operation, before 10^15 years have passed, computers will be fast enough to process this easily. In fact, we can even predict when computers will be capable of solving the larger problem, of computing all permutations of 50 elements. (In theory, assuming we are still alive by then, and Skynet has not managed to do nasty things to us.) The thing is, by the time we are actually capable of solving the desired problem, this question will have been replaced by someone wanting to generate all permutations of 100000 elements, or something as bad.
So, even with Moore's law on our side, we can't win. Lets just call it John's law:
No matter how big or powerful their computer may be, there will always be somebody wanting to solve a problem that is ridiculously large, far beyond the capabilities of that computer, or even any computer in the known universe.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Spectral Measurements 的更多信息

标签

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by