Hi:
I'm mostly new to J.
Why do I get a "length error" when I define a verb as shown below (the
dot product of a 4x4 matrix with a 4x1 column vector)

cnot_gate =: 3 : '(4 4 $ 1 0 0 0  0 1 0 0  0 0 0 1  0 0 1 0) (+/ . *) (x)'
and then executes
cnot_gate (,. 0 1 0 1)
|length error: cnot_gate
|   (4 4$1 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0)    (+/ .*)(x)

The direct call works correctly
    (4 4 $ 1 0 0 0  0 1 0 0  0 0 0 1  0 0 1 0) (+/ . *) (,. 0 1 0 1)
0
1
1
0


thanks
Pascal

-- 
A person starts to live when he can live outside himself.
- Albert Einstein
www.quotator.net

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

Reply via email to