Showing results for

- Intel Community
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
- unexpected ?potrf subroutine failure

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

Yuna_D_

Beginner

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

09-24-2015
04:03 PM

27 Views

unexpected ?potrf subroutine failure

AHi,

I need to generate a gaussian correlated noise based on a covariance matrix with fortran. I am using spotrf subroutine to do the cholesky decomposition. However, the decomposition is always failed at a specific row of input matrix. As the reference indicates, it means the leading minors of that row is not positive definite. But previous work with the same data in matlab **chol **function shows that the matrix is positive definite.

This problem is killing me now. Can anyone help me get out of the swap ? Or just if there is a better way to generate correlated noise without getting involved in the covariance matrix.The code for generate the covariance matrix and cholesky decomposition is listed below. Thanks a lot!!

-------------------------------------------------------------------------------------------

Program DensityRealization

Implicit None

Real::lc

Integer::std,cases,Layer_Num,i,j,CholFlag

Real,Allocatable,Dimension(:,:)::c,sigma,rhostd

Real,Allocatable,Dimension(:)::z,Rnd

REAL,Parameter::p3=38.2273

Layer_Num=13827

std=20

cases=500

Allocate(z(Layer_Num),c(Layer_Num,Layer_Num),sigma(Layer_Num,Layer_Num),rhostd(Layer_Num,1),Rnd(cases*Layer_Num))

DO i=1,10000

z(i)=(i-1)*0.01

END DO

DO i=10001,11799

z(i)=100+(i-10000-1)*0.5

END DO

DO i=11800,Layer_Num

z(i)=1000+(i-11799-1)

END DO

! coveriance matrix

Do i=1,Layer_Num

Do j=1,i

c(i,j)=abs(z(i)-z(j))

c(j,i)=c(i,j)

End DO

End DO

c=-c/lc

c=exp(c)

rhostd(:,1)=std*exp(-z/p3)

sigma=matmul(rhostd,TRANSPOSE(rhostd))

sigma=sigma*c

!cholesky decomposition

CALL SPOTRF('U',Layer_Num,sigma,Layer_Num,CholFlag)

print*,CholFlag

End

Link Copied

2 Replies

mecej4

Black Belt

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

09-24-2015
04:26 PM

27 Views

Please post the actual code. You cannot use the integer variable "Layer_Num" to dimension arrays, so your code gets rejected by the compiler. It is of little use to discuss the running behavior of code that cannot even be compiled.

It would be better if you attached the source file or pasted the code using the {code} button.

Yuna_D_

Beginner

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

09-24-2015
05:12 PM

27 Views

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