i want to use dlarf and zlarf after a qr-decomposition. With dlarf everything works correct, but with zlarf the output is incorrect for some matrices.
My dlarf method looks this:
- Code: Select all
char * side = "L";
double* work = new double[n];
double diag;
memset(work, 0, n * sizeof(double));
double tau_i;
int dlarf;
for(int i = 0; i < n; i++)
{
tau_i = tau[i];
dlarf = m - i;
diag = *A;
*A = 1;
dlarf_(side, &dlarf, &one, A, &one, &tau_i, ek, &m, work);
*A = diag;
ek++;
A += (m + 1);
}
my zlarf method looks this: Its the same procedure only with a structure COMPLEX
- Code: Select all
COMPLEX c_one;
c_one.real = 1.0;
c_one.imag = 0.0;
char * side = "L";
COMPLEX* work = new COMPLEX[n];
COMPLEX diag;
memset(work, 0, n * sizeof(COMPLEX));
COMPLEX tau_i;
int dlarf;
for(int i = 0; i < n; i++)
{
tau_i = tau[i];
dlarf = m - i;
diag = *A;
*A = c_one;
zlarf_(side,
&dlarf,
&one,
A,
&one,
&tau_i,
ek,
&m,
work);
*A = diag;
ek++;
A += (m + 1);
}
why does dlarf produce correct and zlarf incorrect results? If i use zunmqr instead of zlarf everything is correct. But i need zlarf because my zunmqr and dormqr methods produces for some input seg-faults.

