% Mat-1.3379 Dynaamisten systeemien erikoiskurssi Eirola/Hannukainen
%
% compute the right inverse of AI with QR-dec.
%
% 


function AIx = qrifun(A,x)


[Q,R]=qr(A');



% NOTE : in realworld computing the inverse is a bad idea.
%        only opearation to vector i.e. AI*x wich can be done
%        without explicitely construction the inverse.


AIx = Q*( (R')\x);

