From: Frank Sabouri on
Hello -

I have problem of memory when I run: NK=nchoosek (1:N,K), in which N is >40. I need to generate a "NK", wherein "N" is 140. Does anyone know how I could deal with this problem?!

Thanks,
Farnk
From: John D'Errico on
"Frank Sabouri" <Frank.Sabouri(a)gmail.com> wrote in message <hn6mt9$9kb$1(a)fred.mathworks.com>...
> Hello -
>
> I have problem of memory when I run: NK=nchoosek (1:N,K), in which N is >40. I need to generate a "NK", wherein "N" is 140. Does anyone know how I could deal with this problem?!
>

Rather than just blindly trying to do something, THINK
first. How many combinations are you hoping to
generate? Just for kicks, try this:

nchoosek(140,70)
Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits
> In nchoosek at 66
ans =
9.3821e+40

Let me see. 10^41 different combinations, suggests
you will need on the order of multiple tredecillion bytes
of memory. Do you really have that big of a computer?
In fact, the number of atoms in the entire Earth is
roughly that large.

http://pages.prodigy.net/jhonig/bignum/qaearth.html

The way to deal with your problem is to make your
problems SMALLER. Your computer is not infinitely
large or infinitely fast.

John
From: Frank Sabouri on
Hello -

Let me ask my question in other way: I have a matrix of data (140X15), I want to randomly generate as much as possible sub-matrices (6X15). It was why I used "nchoosek" to randomly set the sub-matices. There is any function that allow me to creat these submatices.

Frank

"John D'Errico" <woodchips(a)rochester.rr.com> wrote in message <hn6nra$8rc$1(a)fred.mathworks.com>...
> "Frank Sabouri" <Frank.Sabouri(a)gmail.com> wrote in message <hn6mt9$9kb$1(a)fred.mathworks.com>...
> > Hello -
> >
> > I have problem of memory when I run: NK=nchoosek (1:N,K), in which N is >40. I need to generate a "NK", wherein "N" is 140. Does anyone know how I could deal with this problem?!
> >
>
> Rather than just blindly trying to do something, THINK
> first. How many combinations are you hoping to
> generate? Just for kicks, try this:
>
> nchoosek(140,70)
> Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits
> > In nchoosek at 66
> ans =
> 9.3821e+40
>
> Let me see. 10^41 different combinations, suggests
> you will need on the order of multiple tredecillion bytes
> of memory. Do you really have that big of a computer?
> In fact, the number of atoms in the entire Earth is
> roughly that large.
>
> http://pages.prodigy.net/jhonig/bignum/qaearth.html
>
> The way to deal with your problem is to make your
> problems SMALLER. Your computer is not infinitely
> large or infinitely fast.
>
> John
From: Walter Roberson on
Frank Sabouri wrote:
> Hello -
>
> I have problem of memory when I run: NK=nchoosek (1:N,K), in which N is
> >40. I need to generate a "NK", wherein "N" is 140. Does anyone know
> how I could deal with this problem?!

What is your K? With N = 140, K = 4 requires about 116 Mb, and K = 5 requires
over 3 Gb. K = 10 requires about 4 petabytes (that's the unit above terabytes).
From: Oleg Komarov on
Walter Roberson <roberson(a)hushmail.com> wrote in message <hn6qam$sv7$1(a)canopus.cc.umanitoba.ca>...
> Frank Sabouri wrote:
> > Hello -
> >
> > I have problem of memory when I run: NK=nchoosek (1:N,K), in which N is
> > >40. I need to generate a "NK", wherein "N" is 140. Does anyone know
> > how I could deal with this problem?!
>
> What is your K? With N = 140, K = 4 requires about 116 Mb, and K = 5 requires
> over 3 Gb. K = 10 requires about 4 petabytes (that's the unit above terabytes).

I'm sure only Paris Hilton has a petabyte :| !

Oleg