All:
I have a few matrices/vectors operations that I'm a bit struggling with.
Suggestions on any of the issues below would be much appreciated (I'm
getting close to a semester project deadline....)
(1) Apply a dot product to multiple vectors
I have define a dot product verb and I'm trying to apply the same matrix
to multiple verb at once. I though J would do this automatically but it
doesn't seem so
dot =: 4 : ' x +/ . * y'
qb0 =: ,. 1 0
qb1 =: ,. 0 1
pauliX =: 2 2 $ (0 1 1 0)
pauliX dot qb0 NB. Works
pauliX dot qb0 qb1 NB. Syntax error
pauliX dot (,. 1 0) (,. 0 1) NB. Syntax error
(2) Selecting columns
Is there a verb to directly select columns of a matrix. Right now, I'm
double transposing and selecting rows using the { from dyad .
m =: 2 5 $ i. 10
|: 0 2 3 { |: m NB. Selects columns 0 2 and 3 of matrix m
(3) Updating column
In the same line of problems, what's the easiest way to update a column
of a 2 by n matrix ?
(4) The real problem
What in the end I need to accomplish is to (a) select one or more column
vectors from a 2xN matrix, (b) apply a transformation (dot product with
a 2x2, 4x4 8x8 matrix), (c) and update the initial column vector in the
2xN wit the new values.
Rows seem easier to manipulate in J than columns. To simplify the code,
should I transpose all my operations and use row vectors instead of
column vectors?
thanks
Pascal
--
Be great in act, as you have been in thought.
-- William Shakespeare
www.quotator.net
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm