first i want to describe what i want to solve:
I have a matrix A and want to make QR Factorization: A= QR;
Then i want to solve the Q^T * unit_vector. vec = Q^T * vec;
I have a loop around this operation in which the A matrix which is an
double array changes as well as its dimension.
Now the problem:
For small input matrix A everythink works correct even if the number of loops within for-loop is very big > 1000.
For big input matrices A everything works correkt if the number of loop iterations is small < 30. But if set the iterations to e.g.: 35 than my programms get a segmentation fault within a blas routine. If I check this with valgrind i get several times the following output :
- Code: Select all
Use of uninitialised value of size 4
==7388== at 0x46BE6DC: (within /usr/lib/sse2/libf77blas.so.3.0)
After valgrind returns i have about 16000 errors which cause my seg-fault i think.
I think that this could be because a parameter is not set correct within my for-loop which is neede by the blas routine. Perhaps anybody would see if i made a mistake?
I'm programming in C++ so my code looks like this:
- Code: Select all
for(...)
{
double* work, *tau;
int one = 1, info, lwork, lda,k;
//m and n are set correctly!!!
k = std::min(m, n);
lda = std::max(m, 1);
lwork = std::max(n, 1);
int max = std::max(1, lwork);
*work = new double[max];
*tau = new double[k];
memset(*work, 0, max * sizeof(double));
memset(*tau, 0, k * sizeof(double));
dgeqrf_(&m,
&n,
A,
&m,
tau,
&work,
&lwork,
&info);
char * SIDE = "L";
char * TRANS = "T";
dormqr_(SIDE,
TRANS,
&m,
&one,
&k,
A,
&lda,
tau,
vec,
&lda,
work,
&lwork,
&info);
delete [] work;
delete [] tau;
}
The strange thing is, if is reset the tau array between dgeqrf and dormqr with the following line everything works correct:
memset(tau, 0, k * sizeof(double));
But this way the output is incorrect of course.
Thus i suspect anything is incorrect with the tau array. Can anybode help me with that or say what exactly the tau array is?
For help i'm really thankful.

