Matrix with two diagonals: Difference between revisions
Content added Content deleted
(→{{header|Vlang}}: Rename "Vlang" in "V (Vlang)") |
|||
Line 2,509: | Line 2,509: | ||
<br> |
<br> |
||
[http://keptarhely.eu/view.php?file=20220217v00xdle18.jpeg Special identity matrix with two diagonals] |
[http://keptarhely.eu/view.php?file=20220217v00xdle18.jpeg Special identity matrix with two diagonals] |
||
=={{header|RPL}}== |
|||
Approach here is to fill the second diagonal of an identity matrix generated by IDN instruction, thanks to a classical FOR.. NEXT 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 |
|||
5 XDIAG |
|||
6 XDIAG |
|||
{{out}} |
|||
<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> |
|||
=={{header|Sidef}}== |
=={{header|Sidef}}== |