Matrix with two diagonals: Difference between revisions
→K: add
mNo edit summary |
(→K: add) |
||
Line 2,098:
1 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 1
</syntaxhighlight>
=={{header|K}}==
K6
<syntaxhighlight lang="k">diag2: {x||x}@=:
diag2 5</syntaxhighlight>
{{out}}
<pre>(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)</pre>
=={{header|Matlab}}==
Line 2,128 ⟶ 2,140:
A(1:N+1:end) = 1;
end</syntaxhighlight>
{{
<pre>
>> diagdiag(7)
|