help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] Advise on how to refine LU decomposition


From: Olumide
Subject: [Help-gsl] Advise on how to refine LU decomposition
Date: Fri, 27 Mar 2009 15:48:02 +0000
User-agent: Thunderbird 2.0.0.19 (Windows/20081209)

Hello,

I'm trying to use the function gsl_linalg_LU_refine() refine the solution of a linear system that was computed by gsl_linalg_LU_decomp and gsl_linalg_LU_solve, but I'm getting very unusual results. I'd appreciate help debugging the following bit of code, or perhaps a short snippet illustrating proper use of gsl_linalg_LU_decomp.

Thanks,

- Olumide


gsl_vector* DenseMatrixSolver::gsl( double *rbfMatrixData , double *constrainValdata , unsigned matrixDim )
{
gsl_matrix_view copy_rbfMatrixView = gsl_matrix_view_array( rbfMatrixData, matrixDim , matrixDim ); gsl_vector_view copy_weightVecView = gsl_vector_view_array( constrainValdata , matrixDim );

gsl_matrix_view rbfMatrixView = gsl_matrix_view_array( rbfMatrixData, matrixDim , matrixDim ); gsl_vector_view weightVecView = gsl_vector_view_array( constrainValdata , matrixDim );

        /////////// solve (by LU decomposition) ///////////

        int s;
        gsl_vector *weight = gsl_vector_alloc( matrixDim );
        gsl_permutation *perm = gsl_permutation_alloc( matrixDim );

        gsl_linalg_LU_decomp( &rbfMatrixView.matrix , perm , &s );
gsl_linalg_LU_solve( &rbfMatrixView.matrix , perm , &weightVecView.vector, weight );

        /////////// refine LU decomposition ///////////

        gsl_vector *res = gsl_vector_alloc( matrixDim );
gsl_linalg_LU_refine( &copy_rbfMatrixView.matrix , &rbfMatrixView.matrix , perm , &copy_weightVecView.vector , weight , res );
        return weight;
}






reply via email to

[Prev in Thread] Current Thread [Next in Thread]