Matrix with two diagonals: Difference between revisions

m
→‎{{header|RPL}}: typos / page layout
(→‎See also: More to see also)
m (→‎{{header|RPL}}: typos / page layout)
Line 2,843:
 
=={{header|RPL}}==
ApproachThe approach here is to fill the second diagonal of an identity matrix generated by the <code>IDN</code> instruction, thanks to a classical <code>FOR.. NEXT</code> loop.
{{works with|Halcyon Calc|4.2.7}}
≪ IDN LAST
1 OVER '''FOR''' line
line OVER 2 →LIST ROT SWAP 1 PUT
SWAP 1 -
'''NEXT''' DROP
‘XDIAG’ STO
DROP
‘XDIAG’ STO
 
5 XDIAG
Line 2,859 ⟶ 2,857:
<pre>
2: [[ 1 0 0 0 1 ]
[ 0 1 0 1 0 ]
[ 0 0 1 0 0 ]
[ 0 1 0 1 0 ]
[ 1 0 0 0 1 ]]
1: [[ 1 0 0 0 0 1 ]
[ 0 1 0 0 1 0 ]
[ 0 0 1 1 0 0 ]
[ 0 0 1 1 0 0 ]
[ 0 1 0 0 1 0 ]
[ 1 0 0 0 0 1 ]]
</pre>
 
1,150

edits