T and j are slow, but the tacit version is nice.
'A B'=:3|L:0(([:<i.)"1)3 5,:5 4
BA=: 600$A
BB=: (5r3*600)$B
ts=: 6!:2 , 7!:2@]
ts 'P=:BA ;@:(((=&{: |.)"1 <@# (,}.)"1)"1 _) BB'
1.01695 1.65962e7
ts 'Q=:BA ;@:(((=&{: |.)"1 <@# (,"1}."1))"1 _) BB'
0.601724 1.65965e7
ts 'R=:BA ;@:(((=&{:"1 |."1) <@# (,}.)"1)"1 _) BB'
0.85174 1.65965e7
ts 'S=:BA ;@:(((=&{:"1 |."1) <@# (,"1}."1))"1 _) BB'
0.463207 1.65967e7
ts 'T=:; BA ([:<(=&{:)"1#(, }.)"1)"1 _ BB'
0.842222 1.6596e7
P-:T
1
f=: 13 :'x ;@:(((=&{: |.)"1 <@# (,}.)"1)"1 _) y'
g=: 13 :'x;@:(((=&{: |.)"1 <@# (,"1}."1))"1 _) y'
h=: 13 :'x ;@:(((=&{:"1 |."1) <@# (,}.)"1)"1 _) y'
i=: 13 :'x ;@:(((=&{:"1 |."1) <@# (,"1}."1))"1 _) y'
j=: 13 :';x([:<(=&{:)"1#(, }.)"1)"1 _ y'
ts 'U=:BA j BB'
0.8406 1.6594e7
P-:U
1
f
;@:(((=&{: |.)"1 <@# (, }.)"1)"1 _)
g
;@:(((=&{: |.)"1 <@# (,"1 }."1))"1 _)
h
;@:(((=&{:"1 |."1) <@# (, }.)"1)"1 _)
i
;@:(((=&{:"1 |."1) <@# (,"1 }."1))"1 _)
j
[: ; ([: < =&{:"1 # (, }.)"1)"1 _
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Aai
Sent: Thursday, October 25, 2012 8:59 AM
To: Programming forum
Subject: [Jprogramming] Manipulating ranks (was: stitching matrices)
Data from 'stitching matrices'
'A B'=:3|L:0(([:<i.)"1)3 5,:5 4
BA=. 600$A
BB=. (5r3*600)$B
Observe execution times
ts 'P=.BA ;@:(((=&{: |.)"1 <@# (,}.)"1)"1 _) BB'
1.70547 1.6588e7
ts 'Q=.BA ;@:(((=&{: |.)"1 <@# (,"1}."1))"1 _) BB'
1.00185 1.65882e7
ts 'R=.BA ;@:(((=&{:"1 |."1) <@# (,}.)"1)"1 _) BB'
1.56342 1.65882e7
ts 'S=.BA ;@:(((=&{:"1 |."1) <@# (,"1}."1))"1 _) BB'
0.856076 1.65885e7
P is the desired result.
P-:"2 Q,R,:S
1 1 1
--
Met vriendelijke groet,
@@i = Arie Groeneveld
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm