Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
16
Task/Identity-matrix/PostScript/identity-matrix.ps
Normal file
16
Task/Identity-matrix/PostScript/identity-matrix.ps
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
% n ident [identity-matrix]
|
||||
% create an identity matrix of dimension n*n.
|
||||
% Uses a local dictionary for its one parameter, perhaps overkill.
|
||||
% Constructs arrays of arrays of integers using [], for loops, and stack manipulation.
|
||||
/ident { 1 dict begin /n exch def
|
||||
[
|
||||
1 1 n { % [ i
|
||||
[ exch % [ [ i
|
||||
1 1 n { % [ [ i j
|
||||
1 index eq { 1 }{ 0 } ifelse % [ [ i b
|
||||
exch % [ [ b i
|
||||
} for % [ [ b+ i
|
||||
pop ] % [ [ b+ ]
|
||||
} for % [ [b+]+ ]
|
||||
]
|
||||
end } def
|
||||
Loading…
Add table
Add a link
Reference in a new issue