Identity matrix: Difference between revisions

m
Add a "Works in" for example code
mNo edit summary
m (Add a "Works in" for example code)
Line 1:
{{Primitive}}
Given a positive integer argument ''n'', '''identity matrix''' returns a ''n''×''n'' matrix with ones in the main diagonal and zeros elsewhere.<syntaxhighlight lang=text>
 
<syntaxhighlight lang=text>
=5
(1 0 0 0 0
Line 13 ⟶ 15:
=0
()
</syntaxhighlight>{{Works in|ngn/k}}
</syntaxhighlight>This primitive is not available in all dialects, It can be implemented in K as:<syntaxhighlight lang=text>
 
</syntaxhighlight>This primitive is not available in all dialects, It can be implemented in K as:<syntaxhighlight lang=text>
im:{(2#x)#1,&x}
im[4]
3

edits