Quantcast
Channel: Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 2652

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

$
0
0

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:

  1. Compute the Cholesky factorization, Q=LU, where U=L^{T}
  2. Solve Lw = b
  3. Solve Um=w
  4. Sample z~N(0,1)
  5. Solve Uv=z
  6. Compute x=m+v
  7. 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.

 


Viewing all articles
Browse latest Browse all 2652

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>