Matrix transposition: Difference between revisions
Content deleted Content added
m added whitespace before the TOC (table of contents). |
PatGarrett (talk | contribs) →{{header|360 Assembly}}: Section added |
||
Line 2: | Line 2: | ||
[[wp:Transpose|Transpose]] an arbitrarily sized rectangular [[wp:Matrix (mathematics)|Matrix]]. |
[[wp:Transpose|Transpose]] an arbitrarily sized rectangular [[wp:Matrix (mathematics)|Matrix]]. |
||
<br><br> |
<br><br> |
||
/* {{header|360 Assembly}} */ Section added -- Superfluous blanks suppressed |
|||
=={{header|360 Assembly}}== |
|||
<lang 360asm> |
|||
... |
|||
KN EQU 3 |
|||
KM EQU 5 |
|||
N DC AL2(KN) |
|||
M DC AL2(KM) |
|||
A DS (KN*KM)F matrix a(n,m) |
|||
B DS (KM*KN)F matrix b(m,n) |
|||
... |
|||
* b(j,i)=a(i,j) |
|||
* transposition using Horner formula |
|||
LA R4,0 i,from 1 |
|||
LA R7,KN to n |
|||
LA R6,1 step 1 |
|||
LOOPI BXH R4,R6,ELOOPI do i=1 to n |
|||
LA R5,0 j,from 1 |
|||
LA R9,KM to m |
|||
LA R8,1 step 1 |
|||
LOOPJ BXH R5,R8,ELOOPJ do j=1 to m |
|||
LR R1,R4 i |
|||
BCTR R1,0 i-1 |
|||
MH R1,M (i-1)*m |
|||
LR R2,R5 j |
|||
BCTR R2,0 j-1 |
|||
AR R1,R2 r1=(i-1)*m+(j-1) |
|||
SLA R1,2 r1=((i-1)*m+(j-1))*itemlen |
|||
L R0,A(R1) r0=a(i,j) |
|||
LR R1,R5 j |
|||
BCTR R1,0 j-1 |
|||
MH R1,N (j-1)*n |
|||
LR R2,R4 i |
|||
BCTR R2,0 i-1 |
|||
AR R1,R2 r1=(j-1)*n+(i-1) |
|||
SLA R1,2 r1=((j-1)*n+(i-1))*itemlen |
|||
ST R0,B(R1) b(j,i)=r0 |
|||
B LOOPJ next j |
|||
ELOOPJ EQU * out of loop j |
|||
B LOOPI next i |
|||
ELOOPI EQU * out of loop i |
|||
... |
|||
</lang> |
|||
=={{header|ACL2}}== |
=={{header|ACL2}}== |