I was trying to run test cases for CG and I need to generate:
- symmetric positive definite matrices
- of size > 10,000
- FULL DENSE
Using only matrix indices and if necessary 1 vector (Like $A(i,j) = \dfrac{x(i) - x(j)}{(i+j)}$)
With condition number less than 1000.
I have tried:
Generating random matrices using
A=rand(N,N)
and thenA'A
to make it Sym. PD. [This increases condition number]Using the vector appraoch as shown but I can't seem to get a function of
(x,i,j)
which will ensure Sym and PD.
After much experimentation, I came up with:
a(it,jt) = (vec(it)+vec(jt))/((it-1)^2+(jt-1)^2);
If $it \neq jt$
a(it,it) = x(it)
if $it=jt$
But this is PD till about 500x500.
- XLATMR. [With all the grading and scaling, its too difficult to understand. Especially since I cannot understand the underlying linear algebra]
Can someone give me a function in x (vector) and i,j (indices) which meets the above requirements?
a+N*eye(N,N)
ensure that it will work for all values beyond 5000? Can you convert your comment into an answer? $\endgroup$