function V=getPreImage(A,S)
% returns a basis of the preimage of A of the linear space spanned by the columns of
% B, i.e. im V = { x | Ax \in im S }

[m1,n1]=size(A); [m2,~]=size(S);

if m1==m2
    H=mynull([A,S]);
    V=mycolspace(H(1:n1,:));
else
    error('Both matrices must have same number of rows');
end;