Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library
- solve system when matrix is banded, symmetric, positive definite matrix.

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

Fiori

Beginner

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

05-20-2016
08:25 AM

207 Views

solve system when matrix is banded, symmetric, positive definite matrix.

Hello.

Let Q be a banded, symmetric, positive definite matrix. (The number of rows of Q is 2e+5) . I want to do the following:

- Compute the Cholesky factorization, Q=LU, where U=L^{T}
- Solve Lw = b
- Solve Um=w
- Sample z~N(0,1)
- Solve Uv=z
- Compute x=m+v
- Return x

Steps 2 and 3 give the solution of Qm=b.

I have asked this question here, but then Q was a triagonal, symmetric matrix. I used fuctions **'LAPACKE_dpbtrf, cblas_dtbsv' **and solved the problem,

/* Colesky factorization */ info = LAPACKE_dpbtrf(LAPACK_COL_MAJOR, 'U', dim+1, 1, Sigmab, 2 ); if(info!= 0){mexPrintf( "C++ error: Cholesky failed"); } /* step 2*/ cblas_dtbsv(CblasColMajor, CblasUpper, CblasTrans, CblasNonUnit, dim, 1, Sigmab, 2, y1, 1); /* step 3*/ cblas_dtbsv(CblasColMajor, CblasUpper, CblasNoTrans, CblasNonUnit, dim, 1, Sigmab, 2, y1, 1); /* step 5 */ cblas_dtbsv(CblasColMajor, CblasUpper, CblasNoTrans, CblasNonUnit, dim, 1, Sigmab 2, y2, 1);

I found functions **'LAPACKE_dpbtrf**, **LAPACKE_dpbtrs' **that give the solution of steps 2 and 3.

info = LAPACKE_dpbtrf(LAPACK_COL_MAJOR, 'L', dim, p, Sigma, p+1); if(info!= 0){mexPrintf( "C++ error: Cholesky failed"); } info = LAPACKE_dpbtrs(LAPACK_COL_MAJOR, 'L', dim, p, NRHS, Sigma, p+1, y1, dim); if(info!= 0){mexPrintf( "C++ error: the execution is not successful"); }

Firstly, I would like to ask if there is a better way to solve this and secondly I don't know how to find the solution of step 5.

Thank you very much.

1 Solution

mecej4

Black Belt

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

05-20-2016
08:57 AM

207 Views

How about this:

- Factorize by calling ?PBTRF.
- Call ?TBTRS with UPLO='L' to solve Lw = b.
- Sample z~N(0,1).
- Compute y = w+z.
- Call ?TBTRS with UPLO='U' to solve Ux = y and obtain the solution x.

Note that I have collapsed the two calls in your Steps 3 and 5 into a single call in my Step 5. The computational savings are modest but it is the spirit that counts.

My Step 5 also contains the answer to your statement "I don't know how to find the solution of step 5".

P.S.: I notice that you are coding in C and using the LapackE interface. Please use the LapackE versions of the Lapack routines that I named.

Link Copied

4 Replies

mecej4

Black Belt

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

05-20-2016
08:57 AM

208 Views

How about this:

- Factorize by calling ?PBTRF.
- Call ?TBTRS with UPLO='L' to solve Lw = b.
- Sample z~N(0,1).
- Compute y = w+z.
- Call ?TBTRS with UPLO='U' to solve Ux = y and obtain the solution x.

Note that I have collapsed the two calls in your Steps 3 and 5 into a single call in my Step 5. The computational savings are modest but it is the spirit that counts.

My Step 5 also contains the answer to your statement "I don't know how to find the solution of step 5".

P.S.: I notice that you are coding in C and using the LapackE interface. Please use the LapackE versions of the Lapack routines that I named.

Fiori

Beginner

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

05-20-2016
01:08 PM

207 Views

Thank you very much.

Fiori

Beginner

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

05-23-2016
08:27 AM

207 Views

I would like to ask you, if you mean at step 2 and 5 to use the function 'LAPACKE_dtbtrs' and not '?PBTRS'.?

Thank you very much.

mecej4

Black Belt

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

05-23-2016
09:25 AM

207 Views

You are correct on both counts. I have corrected #2 accordingly.

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

For more complete information about compiler optimizations, see our Optimization Notice.