inverse matrix by m.ukai

#load"nums.cma"open Num open Array
let r,a=Obj.magic iteri,make_matrix 9 18(Int 0);;r(fun i y->r(fun j z->Scanf.scanf"%d "(fun x->y.(j)<-Int x))a;y.(i+9)<-Int 1)a;r(fun i y->r(fun k z->y.(k)<-z+/a.(8).(k))y;r(fun j z->let u,c=y.(i),z.(i)//y.(i)in
r(fun k w->z.(k)<-if i=j then w//u else w-/y.(k)*/c)z)a)a;r(fun i y->r(fun j z->Printf.printf"%d%c"(int_of_num y.(j+9))[|' ';'
'|].(j/8))a)a

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

download

return to the top page