tam wrote:
2. I decided Q were not fully unpacked because I exam my big Q at the end. Maybe I dont how to transfer the result from q to the big Q.
Code:
for (int i = 0; i < m; i++)
for (int j = 0; j < n; j++)
Q(i,j) = double(q(i,j));
Now I see what's wrong. Your code extracts just m*n elements from
q to
Q, but "full"
q is m*
n. Just a minor error in the extraction code :)
tam wrote:
1. I noticed that you don't have to do setlength after you define a, tau, q, r. Wonder if that makes a difference in your code versus my code
No difference except for performance. Subroutines set sizes of tau/q/r automatically, rewriting old data if these arrays were already allocated. As for
a, setcontent() call allocates memory instead of setlength().
tam wrote:
2. How do I assign value to each position in a.
.....
A(i,j) is a double value--> wonder if doing that assignment statement is wrong??
.....
Does double(q(i,j)) --> indeed return me a double value?
real ALGLIB vectors/matrices store double values, complex vectors/matrices store pairs of doubles. This will NOT be changed in the foreseeable future. So explicit typecasting to double is unnecessary. You can just assign to elements of
a.