Problem with MKL dpotrf function

Problem with MKL dpotrf function

Can anyone see why I am getting all zeroes back in [A] when calling the MKL dpotrf function below? Info comes back as 0 which indicates success, but A is just full of zeroes. What am I missing?

I have set it up in Visual Studio 2010 as a 32-bit application as follows:
Fortran => Libraries => Use Intel Math Kernel Library = Sequential
Linker => General => Additional Library Directories = C:\Program Files (x86)\Intel\Composer XE 2013 SP1.139\mkl\lib\ia32
Linker => Input => Additional Dependencies = mkl_blas95.lib mkl_lapack95.lib mkl_intel_c.lib mkl_core.lib mkl_sequential.lib

      SUBROUTINE MatrixTest

      IMPLICIT NONE

      INCLUDE 'mkl.fi'

      INTEGER    n
      PARAMETER (n=4)

      REAL*8     A(n,n)
      INTEGER    info,i,j

c     Fill the upper triangle
      A(1,1)=11.0d0
      A(1,2)=-5.0d0
      A(1,3)=3.0d0
      A(1,4)=2.0d0
      A(2,2)=13.0d0
      A(2,3)=4.0d0
      A(2,4)=-6.0d0
      A(3,3)=16.0d0
      A(3,4)=7.0d0
      A(4,4)=19.0d0

c     Make it symmetrical
      do i=2,n
         do j=1,i-1
            A(i,j)=A(j,i)
         enddo
      enddo

      call dpotrf ('L',n,A,n,info)

      end

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi,

I run your code, I got the good result with code.

A(1,1) 3.31662479035540 REAL(8)
A(2,1) -1.50755672288882 REAL(8)
A(3,1) 0.904534033733291 REAL(8)
A(4,1) 0.603022689155527 REAL(8)
A(1,2) -5.00000000000000 REAL(8)
A(2,2) 3.27525155175488 REAL(8)
A(3,2) 1.63762577587744 REAL(8)
A(4,2) -1.55435666862943 REAL(8)
A(1,3) 3.00000000000000 REAL(8)
A(2,3) 4.00000000000000 REAL(8)
A(3,3) 3.53553390593274 REAL(8)
A(4,3) 2.54558441227157 REAL(8)
A(1,4) 2.00000000000000 REAL(8)
A(2,4) -6.00000000000000 REAL(8)
A(3,4) 7.00000000000000 REAL(8)
A(4,4) 3.12095161498073 REAL(8)

The problem there may be relatd to the project setting? What is the compiler you are using?

If you set the first one:
Fortran => Libraries => Use Intel Math Kernel Library = Sequential
The last one is not needed any more:
Fortran => Libraries => Use Intel Math Kernel Library = Sequential

Also, you upload the whoe project, it may help to have further check.

Thanks,
Chao

Hi,

I run your code, I got the good result with code.

A(1,1) 3.31662479035540 REAL(8)
A(2,1) -1.50755672288882 REAL(8)
A(3,1) 0.904534033733291 REAL(8)
A(4,1) 0.603022689155527 REAL(8)
A(1,2) -5.00000000000000 REAL(8)
A(2,2) 3.27525155175488 REAL(8)
A(3,2) 1.63762577587744 REAL(8)
A(4,2) -1.55435666862943 REAL(8)
A(1,3) 3.00000000000000 REAL(8)
A(2,3) 4.00000000000000 REAL(8)
A(3,3) 3.53553390593274 REAL(8)
A(4,3) 2.54558441227157 REAL(8)
A(1,4) 2.00000000000000 REAL(8)
A(2,4) -6.00000000000000 REAL(8)
A(3,4) 7.00000000000000 REAL(8)
A(4,4) 3.12095161498073 REAL(8)

The problem there may be relatd to the project setting? What is the compiler you are using?

If you set the first one:
Fortran => Libraries => Use Intel Math Kernel Library = Sequential
The last one is not needed any more:
Fortran => Libraries => Use Intel Math Kernel Library = Sequential

Also, you upload the whoe project, it may help to have further check.

Thanks,
Chao

The code posted by Schulzey merits a couple of comments. 

First of all, the dpotrf routine is appropriate to use only if the matrix A is positive-definite -- it is necessary but not sufficient that A be symmetric. The particular matrix values do satisfy this requirement.

Secondly, only the lower triangle of A is used if the first argument passed to the routine dpotrf is 'L'. What is contained in the upper triangular part, not including the main diagonal, is immaterial. Therefore, there is no need for the "make it symmetrical" part of the posted code. It would be more efficient to fill in only the lower triangle of A if the intent is to call dpotrf with 'L' as the first argument.

Thanks guys, I started a new project and now it's working properly. I must have had a setting in Visual Studio that was stopping it.

Leave a Comment

Please sign in to add a comment. Not a member? Join today