> -----Oorspronkelijk bericht-----
> Van: [email protected] [mailto:programming-
> [email protected]] Namens Aai
> Verzonden: zondag 17 januari 2010 13:00
> Aan: Programming forum
> Onderwerp: Re: [Jprogramming] Matrix calculations
> 
> If I understand correctly, you want something like:
> 
>   0    1    2    3
>   4   15   26   37
>  48  159  270  381
> 
>   0    1    2    3
>   4   25   46   67
>  88  509  930 1351
> 
>   0    1    2    3
>   4   35   66   97
> 128 1059 1990 2921
> 


>From the information given I also think this is the desired result.


   'a b' =: (3 3 4$i.12); (10 20 30)
   a;b
+---------+--------+
|0 1  2  3|10 20 30|
|4 5  6  7|        |
|8 9 10 11|        |
|         |        |
|0 1  2  3|        |
|4 5  6  7|        |
|8 9 10 11|        |
|         |        |
|0 1  2  3|        |
|4 5  6  7|        |
|8 9 10 11|        |
+---------+--------+


   b (4 : '(+x*])/\.&.|.y')"0 2 a

  0    1    2    3
  4   15   26   37
 48  159  270  381

  0    1    2    3
  4   25   46   67
 88  509  930 1351

  0    1    2    3
  4   35   66   97
128 1059 1990 2921


Performance:

   data=: (1e3 10 10 $ i.100),"1 0 (10*1+i.1e3)

   ts 'it=:([: }:"1 domodify/@|.)"2 data'
0.091058149 1056320

   3{0{it
1230 2341 3452 4563 5674 6785 7896 9007 10118 11229

   'a b'=: (1e3 10 10 $ i.100); (10*1+i.1e3)

   ts 'ita=:b (4 : ''(+x*])/\.&.|.y'')"0 2 a'
0.01963199 1062208

   3{0{ita
1230 2341 3452 4563 5674 6785 7896 9007 10118 11229


R.E. Boss


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

Reply via email to