function X=mc(A,B)

[Q R]=qr(A); r=size(A,2); //r est ici le rang de A (variante : rank(A,0))
C=Q'*B;
X=R(1:r,:)\C(1:r,:);

endfunction