x=: 2 2$0 1 1 0
   y=: 2 4$1 0 0 1 0 1 1 0
   x
0 1
1 0
   y
1 0 0 1
0 1 1 0
   x +/ .* y
0 1 1 0
1 0 0 1

The following J Wiki essay may be of interest:
http://www.jsoftware.com/jwiki/Essays/LU_Decomposition



----- Original Message -----
From: Pascal Heus <[EMAIL PROTECTED]>
Date: Sunday, April 1, 2007 2:17 pm
Subject: [Jprogramming] Matrices operation 9rookie question)

> 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 
> probablytake 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 
> producta 2x2 matrix to each column of a 2xN matrix?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to