Reorganization
[scilab.git] / scilab / modules / overloading / macros / %sp_inv.sci
1 function x=%sp_inv(a)
2 // Copyright INRIA
3 [ma,na]=size(a)
4 if ma<>na then error(20,1),end
5 [hand,rk]=lufact(a)
6 if rk<na then ludel(hand);error(19),end
7 x=[]
8 for k=1:ma
9   b=0*ones(ma,1);b(k)=1;
10   x=[x,sparse(lusolve(hand,b))]
11 end
12 ludel(hand);
13 endfunction