How to randomly construct a square (1000*1000) full-ranked matrix with low determinant?
I have tried the following method, but it failed.
In MATLAB, I just use:
n=100;
A=randi([0 1], n, n);
while rank(A)~=n
A=randi([0 1], n, n);
end
The above code generates a random binary matrix, with the hope that the corresponding determinant can be small.
However, the determinant is usually about 10^49, a huge number.
Not to mention when n>200, the determinant is usually overflowed in MATLAB.
Could anyone have comments how I can generate matrix (could be non-binary) with very low determinant (e.g. <10^3)?
One possibility: Generate a lower triangular matrix with ones on the diagonal. Generate an upper triangular matrix with ones on the diagonal. The multiple would be a matrix with determinant of one.
This would look a bit non-random when inspected as the lower right corner elements would be larger than the upper left. But the idea gives you control over what determinant you obtain. You could scale the triangular matrices appropriately elementwise to compensate.
Second possibility: If you want to calculate an inverse (maybe just generate a matrix and inverse some other less expensive way) then do $PDP^{-1}$ and the result has determinant same as $D$ a diagonal matrix. Be careful not to use $D=I$ as you will only obtain the identity again.
Third possibility: perform random elementary row operations on the identity matrix (or another $D$ of desired determinant.)