Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
automatic combinations of +1 and -1

Subject: automatic combinations of +1 and -1

From: Syed Galib

Date: 25 Jun, 2009 04:14:01

Message: 1 of 10

Hello,

I need to know how I can create all possible combinations of m-bits of +1 and -1.
If anybody can help me in this matter, I'd very much appreciate that.

Thank you in advance. Please, reply soon.

Regards

Galib

Subject: automatic combinations of +1 and -1

From: Matt Fig

Date: 25 Jun, 2009 04:25:02

Message: 2 of 10

If you mean permutations, you may want to check out npermutek

http://www.mathworks.com/matlabcentral/fileexchange/11462

>> npermutek([-1 1],4)
ans =
    -1 -1 -1 -1
    -1 -1 -1 1
    -1 -1 1 -1
    -1 -1 1 1
    -1 1 -1 -1
    -1 1 -1 1
    -1 1 1 -1
    -1 1 1 1
     1 -1 -1 -1
     1 -1 -1 1
     1 -1 1 -1
     1 -1 1 1
     1 1 -1 -1
     1 1 -1 1
     1 1 1 -1
     1 1 1 1

If you really mean combinations, check out combinator (FEX #24325)

>>A = [-1 1];
>>A(combinator(2,4,'c','r'))
ans =
    -1 -1 -1 -1
    -1 -1 -1 1
    -1 -1 1 1
    -1 1 1 1
     1 1 1 1

Subject: automatic combinations of +1 and -1

From: Syed Galib

Date: 25 Jun, 2009 05:11:01

Message: 3 of 10

Thank you very much for your reply.

But here, the MATLab is saying :
"??? Undefined function or method 'npermutek' for input arguments of type 'double'."

So, please help a little bit more.

Thanks again.

Regards
Galib

"Matt Fig" <spamanon@yahoo.com> wrote in message <h1uu6u$q5r$1@fred.mathworks.com>...
> If you mean permutations, you may want to check out npermutek
>
> http://www.mathworks.com/matlabcentral/fileexchange/11462
>
> >> npermutek([-1 1],4)
> ans =
> -1 -1 -1 -1
> -1 -1 -1 1
> -1 -1 1 -1
> -1 -1 1 1
> -1 1 -1 -1
> -1 1 -1 1
> -1 1 1 -1
> -1 1 1 1
> 1 -1 -1 -1
> 1 -1 -1 1
> 1 -1 1 -1
> 1 -1 1 1
> 1 1 -1 -1
> 1 1 -1 1
> 1 1 1 -1
> 1 1 1 1
>
> If you really mean combinations, check out combinator (FEX #24325)
>
> >>A = [-1 1];
> >>A(combinator(2,4,'c','r'))
> ans =
> -1 -1 -1 -1
> -1 -1 -1 1
> -1 -1 1 1
> -1 1 1 1
> 1 1 1 1

Subject: automatic combinations of +1 and -1

From: Syed Galib

Date: 25 Jun, 2009 05:17:01

Message: 4 of 10

Oh it's ok...
i just restarted my MATLab... and it is working nice...
thank you very much...


"Syed Galib" <galib.cse@gmail.com> wrote in message <h1v0t5$jtd$1@fred.mathworks.com>...
> Thank you very much for your reply.
>
> But here, the MATLab is saying :
> "??? Undefined function or method 'npermutek' for input arguments of type 'double'."
>
> So, please help a little bit more.
>
> Thanks again.
>
> Regards
> Galib

Subject: automatic combinations of +1 and -1

From: Syed Galib

Date: 8 Jul, 2009 08:39:02

Message: 5 of 10

Hi,

your function really helped me for the first stage. But, now I am in trouble. actually, I need to generate permutations of m-bits of +1 and -1 where possible values of m is sometimes 2^32768. So, this is actually a big problem for me that in MATLab in your function it is supporting 2^53. I got a toolbox from mathworks fileexchange named vpi (variable precision integers) where I can have 2^32768 but the type of the variable is 'vpi'. So,actually I need the function npermutek to support 'vpi' and as I am very new new and naiive to MATLab I am asking this help to you.

Hope you consider this and help me. Thank you very much in advance.

Regards
Galib

"Matt Fig" <spamanon@yahoo.com> wrote in message <h1uu6u$q5r$1@fred.mathworks.com>...
> If you mean permutations, you may want to check out npermutek
>
> http://www.mathworks.com/matlabcentral/fileexchange/11462
>
> >> npermutek([-1 1],4)
> ans =
> -1 -1 -1 -1
> -1 -1 -1 1
> -1 -1 1 -1
> -1 -1 1 1
> -1 1 -1 -1
> -1 1 -1 1
> -1 1 1 -1
> -1 1 1 1
> 1 -1 -1 -1
> 1 -1 -1 1
> 1 -1 1 -1
> 1 -1 1 1
> 1 1 -1 -1
> 1 1 -1 1
> 1 1 1 -1
> 1 1 1 1
>
> If you really mean combinations, check out combinator (FEX #24325)
>
> >>A = [-1 1];
> >>A(combinator(2,4,'c','r'))
> ans =
> -1 -1 -1 -1
> -1 -1 -1 1
> -1 -1 1 1
> -1 1 1 1
> 1 1 1 1

Subject: automatic combinations of +1 and -1

From: Bruno Luong

Date: 8 Jul, 2009 09:13:02

Message: 6 of 10

"Syed Galib" <galib.cse@gmail.com> wrote in message <h31lv5$nht$1@fred.mathworks.com>...
> Hi,
>
> your function really helped me for the first stage. But, now I am in trouble. actually, I need to generate permutations of m-bits of +1 and -1 where possible values of m is sometimes 2^32768.

Hah hah... you must be kidding. You are good to participate to the contest

http://en.wikipedia.org/wiki/Googolplex

Bruno

Subject: automatic combinations of +1 and -1

From: Syed Galib

Date: 8 Jul, 2009 10:24:02

Message: 7 of 10

no man i am not kiddiing...i am actually very much in need of this...
if anybody can help...then that would really be appreciated...

thanks

Galib


"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <h31nuu$5pm$1@fred.mathworks.com>...
> "Syed Galib" <galib.cse@gmail.com> wrote in message <h31lv5$nht$1@fred.mathworks.com>...
> > Hi,
> >
> > your function really helped me for the first stage. But, now I am in trouble. actually, I need to generate permutations of m-bits of +1 and -1 where possible values of m is sometimes 2^32768.
>
> Hah hah... you must be kidding. You are good to participate to the contest
>
> http://en.wikipedia.org/wiki/Googolplex
>
> Bruno

Subject: automatic combinations of +1 and -1

From: Bruno Luong

Date: 8 Jul, 2009 10:38:01

Message: 8 of 10

"Syed Galib" <galib.cse@gmail.com> wrote in message <h31s42$4e7$1@fred.mathworks.com>...
> no man i am not kiddiing...i am actually very much in need of this...
> if anybody can help...then that would really be appreciated...
>

Length of m = is about 9864 digits
All combinaision of m is ... man! I have no idea to express this one in words.
  
Hah, hah, you continue to be kidding... Don't realize how big is the number (I'm talking about the length of m, not even the combination of it)? It is way larger than the number of atoms in the whole universe. Sorry, but you are in big trouble nobody can help you, even god himself.

Bruno

Subject: automatic combinations of +1 and -1

From: Steven Lord

Date: 8 Jul, 2009 13:48:54

Message: 9 of 10


"Syed Galib" <galib.cse@gmail.com> wrote in message
news:h31lv5$nht$1@fred.mathworks.com...
> Hi,
>
> your function really helped me for the first stage. But, now I am in
> trouble. actually, I need to generate permutations of m-bits of +1 and -1
> where possible values of m is sometimes 2^32768.

I'm assuming you mean that you want to generate the bit representations of
all numbers between 0 and 2^32768-1 -- if you're actually looking to
generate the bit representations of all numbers between 0 and 2^(2^32768)-1
then what I'm about to say below is a VAST understatement.

There's not enough memory in the universe to store that much information,
even if you used each atom to store a permutation (the observable universe
is estimated to contain 10^80 atoms, which is about 2^266.) Even if you
were able to store each permutation or you could generate each individual
permutation, it would take all the world's computing power many, many, MANY
years to operate on all those combinations.

If you're solving a problem that requires you to operate on each
permutation, find a new way to solve it or find a new problem to solve.

> So, this is actually a big problem for me that in MATLab in your function
> it is supporting 2^53. I got a toolbox from mathworks fileexchange named
> vpi (variable precision integers) where I can have 2^32768 but the type of
> the variable is 'vpi'. So,actually I need the function npermutek to
> support 'vpi' and as I am very new new and naiive to MATLab I am asking
> this help to you.

As described above, your problem is not feasible to solve in what I'd call a
reasonable amount of time.

--
Steve Lord
slord@mathworks.com

Subject: automatic combinations of +1 and -1

From: Matt Fig

Date: 8 Jul, 2009 14:42:02

Message: 10 of 10

"Steven Lord" <slord@mathworks.com> wrote in message
... Yet again explaining the 2^(2^32768)-by-(2^32768) storage (and computational) problem.

Shouldn't there be a FAQ about this one already?

FAQ N.K.1: How can I compute more permutations/combinations than there are atoms in the universe? I am willing to store the result in int8 format.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us