- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Please see attachment b.c.

if I comment out from* * to *//hmli begin* in the follow code of b.c, it works wrong, but if I do not comment out and use sprintf and atof to convert from double to string, then convert back to double, it work well. *//hmli end*

for (k = 0; k < 64; k++)a+=(double) A1* A1 ; //hmli begin sprintf(t,"%lf",a ); a=atof(t); //hmli end a= (double)a ;

Is it just because of the precision?

Can you help me? Thank you very much.

- b.c: source code
- body.log : input data file
- ainv.log: result of matrix inversion.
- compiling :icc -mkl b.c

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hello,

The input matrix in the example is very ill-conditioned. This means it hardly could lead to an accurate result, and round-offs cause big fluctuation of the output.

As I see the best option here is to improve the condition number of the input matrix.

However you also could try dgesvxx with FACT=E. This way the function does normalization and equlibration of input data, which could improve accuracy for ill-conditioned matrices. Please provide and identity matrix NxN in B, and on output B will contain inverse of matrix A. Or the function will return a warning in INFO (see documentation) if the matrix is too ill-conditioned.

Best regards,

Alexander

Link Copied

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

You are methodically destroying the precision of the input matrix. Take the (1,1) element of A, for example. It has the value 5.2734375...e-002. After your strange manipulation, the 15+ digit precision of A_{1,1} has been degraded to just five significant digits, i.e, it is now 5.2734000e-002. What is the purpose of writing a limited number of digits and reading the truncated number back in?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hello,

The input matrix in the example is very ill-conditioned. This means it hardly could lead to an accurate result, and round-offs cause big fluctuation of the output.

As I see the best option here is to improve the condition number of the input matrix.

However you also could try dgesvxx with FACT=E. This way the function does normalization and equlibration of input data, which could improve accuracy for ill-conditioned matrices. Please provide and identity matrix NxN in B, and on output B will contain inverse of matrix A. Or the function will return a warning in INFO (see documentation) if the matrix is too ill-conditioned.

Best regards,

Alexander

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Thank you very much. I see.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Thank you.

The reason is: if the double float data not truncated, LAPACKE_dgetrf and LAPACKE_dgetri can't give the right result, so I want to know why and how to use LAPACKE_dgetrf and LAPACKE_dgetri right.