Stitch it is! Thanks Bill.
*P

bill lam wrote:
> Is the ,. (stitch) what you are looking for?
>    pauliX (+/ .*) qb1,. qb1,. qb0,. qb0
> 1 1 0 0
> 0 0 1 1
>
> I think that the mathematical definition of dot product already
> suggests the right argument is operated in a column-wise manner.
>
> Pascal Heus wrote:
>> Hi:
>> I'm new to J and am trying to apply a unitary transformation to a
>> collection of column vectors in a single operation. This would probably
>> take a second to the J gurus out there....
>>
>> Something like:
>> | 0 1 |     |1| |0| |0| |1|
>> | 1 0 | dot |0| |1| |1| |0|
>> where "dot" is the matrix product
>>
>> For example, I have defined a 2x2 matrix:
>> pauliX   =: 2 2 $ (0 1 1 0)
>>
>> a couple of column vectors
>> qb0 =: 2 1 $ 1 0
>> qb1 =: 2 1 $ 0 1
>>
>> and the matrix product
>> dot =: 4 : ' x +/ . *  y'
>>
>> and would like to write something like
>> pauliX dot qb1 qb1 qb0 qb0
>>
>> which should then return four column vectors with their value inverted
>> (or a 2x4 matrix).
>>
>> Should I define a 2xN matrix first? How can I then apply the dot product
>> a 2x2 matrix to each column of a 2xN matrix?
>>
>> Any help/suggestion would be appreciated.
>>
>> thanks
>> Pascal
>>
>
>


-- 
In the end, we will remember not the words of our enemies, but the silence of 
our friends.
-- Martin Luther King Jr.
www.quotator.net

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to