
Ublas : 
Subject: Re: [ublas] combinatoric problem with vectors
From: Matthias Walter (xammy_at_[hidden])
Date: 20101205 12:07:55
On 12/05/2010 11:51 AM, Philipp Kraus wrote:
> On 20101205 17:25:57 +0100, Matthias Walter said:
>
>> On 12/05/2010 11:08 AM, Kraus Philipp wrote:
>>> I have n ublas vectors with different sizes. Now I would create a
>>> ublas matrix with n columns in that way, that each row has a
>>> combination of the vector elements. I need all combination of the
>>> vector elements (I know it is an exponential problem, but my vectors
>>> are small).
>> Can you be a bit more precise? How does a "combination of the vector
>> elements" look like, especially when they are of different sizes? Maybe
>> a small example with 2 or 3 vectors would help.
>
>
> for two vectors with different size [1] & [2 3]
>
> 1 2
> 1 3
>
> with equal size [1 2] & [3 4]
>
> 1 3
> 1 4
> 2 3
> 2 4
>
> I hope I have written all combination :)
> Each element of each vector should be combinate with the elements of
> the others
Ah, that makes sense now :) One has to read the matrix as a collection
of rowvectors...
Last question before I'd answer: Do you want all combinations or only a
specific set?
Like:
[1 2] & [2 1]
1 2
1 1
2 2
2 1
Depending on the usage you *might* want to throw out [2 1], becaue [1 2]
is in the set already. Is this the case here?
Matthias