Hi all,

I've been trying gsl_blas_dtrsv which solves equation: x<--A^{-1}x.
(A is matrix and x is vector)

Here is a part of my code:

       double a[] = {2,1,1,
                          1,2,1,
                          1,1,1};

       double x[]={1,1,1};


       gsl_matrix_view A = gsl_matrix_view_array(m, 3, 3);
       gsl_vector_view X = gsl_vector_view_array(x,3);

       gsl_blas_dtrsv(CblasLower,CblasNoTrans,CblasNonUnit,&A.matrix,&X.vector);

       cout << "\n\nResult: ";
       for(int i=0;i<3;i++){
             cout<<x[i]<<",";
       }
---------------------------------------------------------------------------------------------------------------------------

output is:
Result: 0.5,0.25,0.25,

But when I make it by hand, so:
inversion matrix A^{-1} is:
1,0,-1
0,1,-1
-1,-1,3

so equation (matrix * vector) A^{-1}*x is:
1,0,-1
0,1,-1    *  (1,1,1) = (0,0,1) and NOT (0.5,0.25,0.25) as function dtrsv gave
-1,-1,3


Can you tell me why gsl_blas_dtrsv gives diffrent result?

Thanks for your comments, Tomas


_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl

Reply via email to