From: Rajeev Narayanan on
Hello,

I have the following declaration in my program. I have the following combination:

P = 11;
R = 3;
Q = R^P;

W = zeros(P, Q, R);

At this point, i am limited to the above values. If I increase P = 15 or R = 4, i am getting "out of memory". Is there a better way to do such thing for higher values in a more compact way.


Thanks.
Rajeev
From: us on
"Rajeev Narayanan" <rite2rajeev(a)gmail.com> wrote in message <hps6on$qfq$1(a)fred.mathworks.com>...
> Hello,
>
> I have the following declaration in my program. I have the following combination:
>
> P = 11;
> R = 3;
> Q = R^P;
>
> W = zeros(P, Q, R);
>
> At this point, i am limited to the above values. If I increase P = 15 or R = 4, i am getting "out of memory". Is there a better way to do such thing for higher values in a more compact way.
>
>
> Thanks.
> Rajeev

it surely depends on what you want to do with W...

us
From: Oleg Komarov on
"Rajeev Narayanan" <rite2rajeev(a)gmail.com> wrote in message <hps6on$qfq$1(a)fred.mathworks.com>...
> Hello,
>
> I have the following declaration in my program. I have the following combination:
>
> P = 11;
> R = 3;
> Q = R^P;
>
> W = zeros(P, Q, R);
>
> At this point, i am limited to the above values. If I increase P = 15 or R = 4, i am getting "out of memory". Is there a better way to do such thing for higher values in a more compact way.
>
>
> Thanks.
> Rajeev

Consider that a 15 by 4 matrix in double class would be 15*4*8/1024^2 = 0.000457 MB.

Then if you repeat this layer for 4^15 (1073741824) you get approximately:
479 GB...

What do you need such a big array for?

Oleg
From: Rajeev Narayanan on
Hello,

I am doing monte carlo simulation and creating a big sample for my analysis. I need to do it for different P and R....

Rajeev

"Oleg Komarov" <oleg.komarovRemove.this(a)hotmail.it> wrote in message <hps7mn$93n$1(a)fred.mathworks.com>...
> "Rajeev Narayanan" <rite2rajeev(a)gmail.com> wrote in message <hps6on$qfq$1(a)fred.mathworks.com>...
> > Hello,
> >
> > I have the following declaration in my program. I have the following combination:
> >
> > P = 11;
> > R = 3;
> > Q = R^P;
> >
> > W = zeros(P, Q, R);
> >
> > At this point, i am limited to the above values. If I increase P = 15 or R = 4, i am getting "out of memory". Is there a better way to do such thing for higher values in a more compact way.
> >
> >
> > Thanks.
> > Rajeev
>
> Consider that a 15 by 4 matrix in double class would be 15*4*8/1024^2 = 0.000457 MB.
>
> Then if you repeat this layer for 4^15 (1073741824) you get approximately:
> 479 GB...
>
> What do you need such a big array for?
>
> Oleg
From: John D'Errico on
"Rajeev Narayanan" <rite2rajeev(a)gmail.com> wrote in message <hps6on$qfq$1(a)fred.mathworks.com>...
> Hello,
>
> I have the following declaration in my program. I have the following combination:
>
> P = 11;
> R = 3;
> Q = R^P;
>
> W = zeros(P, Q, R);
>
> At this point, i am limited to the above values. If I increase P = 15 or R = 4, i am getting "out of memory". Is there a better way to do such thing for higher values in a more compact way.
>

Why do people think they have an infinitely large,
infinitely fast computer? Don't bother to think. Just
throw your arbitrarily chosen huge problem at it. If
it actually succeeds, then increase the problem size
exponentially. Then wail when you run out of memory
or time before the universe dies of heat death, while
your computer is still blissfully chugging away.

Perhaps there is a way to artfully solve your problem
using less memory. Or, perhaps, you have simply
chosen too large of a problem to solve. Your choice.