Suppose a matrix C and a matrix D. I want to bring the matrix into the form:
where is in reduced row echelon form. Currently, I do this using the following code:
%Our aim is to bring the matrix (C,D) in the form
% [Ctilde, Dtilde_1]
% [0-rows , Dtilde_2].
[CtildeT,BVCtilde] = rref([C,speye(q)]);%Delete Zero Rows in Ctilde
CtildeWZ = CtildeT(:,1:n);Ctilde = CtildeWZ(any(CtildeWZ~=0,2),:);T = CtildeT(:,n+1:end);Dtilde = T*D;Dtilde_1 = Dtilde(any(CtildeWZ~=0,2),:);Dtilde_2 = Dtilde(all(CtildeWZ==0,2),:);
the rref function turns out to be a bottleneck for large matrices C. Is there another potentially faster way do compute these matrices?
Best Answer