Completing an rectangular matrix in order to produce several square invertible well conditioned matrices
<p>If I have a rectangular matrix <code>C</code>, with linear independent rows, (see information of its expected numerical values in the first observation at the bottom of the post), whose dimmension is <code>qxn</code> such that <code>q&lt;=n</code> and I want to produce <strong>several</strong> square invertible matrix <code>T=[C;R]</code>.</p>

<p>An important point here is that the matrix T should be well conditioned (<strong>condition number close to 1</strong>).</p>

<p>I wrote a code that solves this problem in a very inneficient way:</p>

<pre><code> clear all
 C=[1 0]; %example
 tol=0.1;

 n=size(C,2);
 q=size(C,1);

 singularity=1;
 it=0;
 while(singularity==1)
    a=-5;
    b=5;
    R=a + (b - a) .* rand(n - q, n); %generates randomic R matrix with numerical values beetwen 'a' and 'b'
    M=[C;R];
    if(abs(cond(M)-1)&lt;tol) %cond(M) computes the condition number of M
        singularity=0;
    end
    it=it+1;
end
</code></pre>

<p>Considering <code>C=[1 0]</code> the algorithm converges in a range of 700~2k iterations (however, the process runs very fast since the instructions are quite simple.)</p>

<p>Now, considering <code>C=[1 0 0]</code> I was forced to break the processing because the iterations were over than 2kkk. </p>

<p><strong>Observation</strong>: The numerical of values of my matrix <code>C</code> usuaally will be small positive integers (from one to ten), small racional numbers from 0 to 5 and zeros.</p>

<p><strong>Important</strong>: For one given matrix <code>C</code> I do <strong>not</strong> need just one matrix <code>R</code> that will make <code>M</code> well conditioned. In my application, I will need several matrix <code>R</code> (as many as I want) for one given <code>C</code>, so thats why I was trying to generate <code>R</code> randomic, but unfortunately in a very inefficient way.</p>

<p><strong>Remark</strong>: Of course I can find one R such that M is well conditioned and then the other well conditioned matrices can be multiple of the previous one, but I wanna try other approaches.</p>