1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| int
gsl_linalg_complex_QR_decomp (gsl_matrix_complex * A, gsl_vector_complex * tau)
{
const size_t M = A->size1;
const size_t N = A->size2;
if (tau->size != GSL_MIN (M, N))
{
GSL_ERROR ("size of tau must be MIN(M,N)", GSL_EBADLEN);
}
else
{
size_t i;
for (i = 0; i < GSL_MIN (M, N); i++)
{
/* Compute the Householder transformation to reduce the j-th
column of the matrix to a multiple of the j-th unit vector */
gsl_vector_complex_view c_full = gsl_matrix_complex_column (A, i);
gsl_vector_complex_view c = gsl_vector_complex_subvector (&(c_full.vector), i, M-i);
"!!!!!!!!!!!!!!!!!!!"
gsl_complex tau_i = gsl_linalg_complex_householder_transform (&(c.vector));
gsl_vector_complex_set (tau, i, tau_i);
/* Apply the transformation to the remaining columns and
update the norms */
if (i + 1 < N)
{
gsl_matrix_complex_view m = gsl_matrix_complex_submatrix (A, i, i + 1, M - i, N - (i + 1));
gsl_linalg_complex_householder_hm (tau_i, &(c.vector), &(m.matrix));
}
}
return GSL_SUCCESS;
}
} |
Partager