Could anyone help me how to execute array of larger size.

1 view (last 30 days)
I want to execute the following line
A=partitions(100)
When i execute the code I am getting the following error
Error using cell
Maximum variable size allowed by the program is exceeded.
Error in partitions (line 64)
C = cell(S,1); % Main Cell.
Error in test (line 1)
A=partitions(100)
In the same line when i used
A=partitions(10)
It executes.
Could anyone help me is there any other way to execute it for 100.
  6 Comments
jaah navi
jaah navi on 10 Nov 2021
As I working on exhaustive search method I require those subsets.
Walter Roberson
Walter Roberson on 10 Nov 2021
Imagine you have a 64 core machine, with each of the cores operating at 5 gigahertz clock rate. Imagine further that you could fully evaluate based on one of the subsets in 1 clock instruction (which is obviously not enough for real work, but perhaps would be enough for the simple task of counting the state.) Under this imaginary scenario, you could count
format long g
max_per_second = 5*10^9 * 64
max_per_second =
320000000000
bell100 = bell_number(100)
bell100 = 
47585391276764833658790768841387207826363669686825611466616334637559114497892442622672724044217756306953557882560751
seconds_required = seconds(double(bell100) / max_per_second)
seconds_required = duration
1.4870434773989e+104 sec
years(seconds_required)
ans =
4.71225319035533e+96
That is over 10^96 years -- 4.7 yotta yotta yotta yotta years.
To put it another way, if you had started at the time the universe formed,
universe_age_seconds = str2sym('436117076900000000')
universe_age_seconds = 
436117076900000000
operations_per_second_needed = vpa(bell100 / universe_age_seconds)
operations_per_second_needed = 
1.0911150651336678639191981808265e+98
If the universe is in the upper limit of how large it is estimated to be, and if every elementary particle in the universe had been calculating at about 10^12 operations per second since the time the universe began just to count the subsets, then it would be about ready now.
When I say "upper limit", I mean that the generally accepted size is about a factor of 10^10 smaller, but a few people have speculated that if one of the modified gravity theory holds, and there are extensions to the Standard Model, that there might be a lot more to the Universe than has been calculated.
All of which is to say that the probability that you would be able to successfully do an exhaustive search over the desired domain is ZERO.
function B = bell_number(nfinal)
if nfinal == 100
B = str2sym('47585391276764833658790768841387207826363669686825611466616334637559114497892442622672724044217756306953557882560751');
return
end
b = zeros(1, nfinal+1, 'sym');
b(1) = 1;
for i = 2:nfinal+1
b(i) = sym(0);
for j = 0:i-2
b(i) = b(i)+nchoosek(sym(i-2),sym(j))*b(j+1);
end
end
B = b(end);
end

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!