inverse matrix by yshl

0/g{m exch get}def/m[9{[9{(%stdin)(r)file token pop}repeat
9{0}repeat]}repeat]def
1 8 3 copy{dup g exch 9 add 1 put}for{/i exch def{/j
0 1e9 i 1 8{dup g i get abs dup 0 ne{dup 3 index lt{4 2 roll}if}if pop pop}for/p exch def def
m j i g m i j g put put
i g i get 0 lt{m i[i g{neg}forall]put}if
0 1 8{/j exch def/x j g i get p idiv def
i j ne{0 1 17{j g exch 2 copy get i g 2 index get x mul sub put}for}if}for
p 1 eq{exit}if}loop}for
m{9 1 17{2 copy get =only 17 ne{( )}{(
)}ifelse print}for}forall

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page