Another way of interpretation is to bring both arguments of * to the same shape
and then apply multiplication,
]dat=: 4 2$ 0 1 1 0 0 0 1 1
0 1
1 0
0 0
1 1
4$,:3 2
3 2
3 2
3 2
3 2
(4$,:3 2) * dat
0 2
3 0
0 0
3 2
The is also the same as what have been done in "1 by J for you.
NEIL JAMES HOSEY wrote:
Thank yous very much for the advice.
I was not sure how "1 worked until now.
Neil
Translating the J answers back into English
perhaps would provide some insight:
3 2 * "1 dat
multiply every row
And working forwards from your specifications:
multiply say 3 2 by every row
* "1
----- Original Message -----
From: NEIL JAMES HOSEY <[EMAIL PROTECTED]>
Date: Sunday, April 29, 2007 3:12 am
Subject: [Jprogramming] Matrix Multiplication Problem
Hi all,
Greatly appreciate the comments about boxing last week.
It solved my problem.
I have one more question ( maybe too simple) about a
certain form of matrix multiplication ( i think its
point to point?)
Anyway say I have data matrix dat
where:
dat=
0 1
1 0
0 0
1 1
how can I multiply say 3 2 by every row. Resulting in
the following matrix:
dat =
0 2
3 0
0 0
3 2
I thought that this form of multiplication was done with
+/.* but I am getting domain errors.
Apologies about the simplcity of this question but its
driving me mad!!
----------------------------------------------------------
------------ For information about J forums see
http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
--
regards,
bill
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm