More on diagonal assignment 
Author Message
 More on diagonal assignment

    Here is a slightly faster dlr and some interesting usages.

    9!:3(5)
    a =. i. 0 0
    a =. a,'v=.>1{x.'                                    

    a =. a,'$.=.5,~(v<0){3,4'                          


    a =. a,'y.=.(>0{x.)w}y.'                    
    dlr =. ('':a) "(1 2)

    y=.5 5 $ 0

   (4;_4)dlr(2;4)dlr |. (1;_4) dlr (3;4) dlr y
1 0 0 0 2
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
4 0 0 0 3
    (1 2 3 4 5 ; 0) dlr |. (5 4 3 2 1 ;0) dlr y
1 0 0 0 1
0 2 0 2 0
0 0 3 0 0
0 4 0 4 0
5 0 0 0 5
   |. (7 8 1; _2) dlr |. (7 6 5;_2) dlr (1 2 3 ; 2) dlr |. (5 4 3 ; 2) dlr y
0 0 1 0 0
0 8 0 2 0
7 0 0 0 3
0 6 0 4 0
0 0 5 0 0

 y2 =. |: y1 =. 5 3 $ 0


 s1 dlr y1
 s2 dlr y2



Thu, 11 Jan 1996 11:23:42 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. No Assignment in Conditional/PROPOSAL: Assignment expression

2. Question: Tri-diagonal matrices in APL

3. Double Diagonal Lines through For Loops

4. LOGO-L> Diagonal Matrix

5. graphics diagonal line

6. Challenge 4 (matrix diagonal)

7. cholesky decompostion and inverses of upper diagonal matrices

8. 5-diagonal Linear system

9. Eigenvectors of tri-diagonal matrix

10. Eigenvectors for tri-diagonal matrix

11. Initialize a Diagonal Matrix

12. diagonal matrix partial sums

 

 
Powered by phpBB® Forum Software