[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## [Help-gsl] problem with gsl_blas_dtrsv

**From**: |
Tomas Hudik |

**Subject**: |
[Help-gsl] problem with gsl_blas_dtrsv |

**Date**: |
Sat, 8 Sep 2007 14:23:46 +0200 |

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] problem with gsl_blas_dtrsv**,
*Tomas Hudik* **<=**