Quantcast
Channel: Intel® Software - Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 3005

Fortran PDGETRF + PDGETRI for Matrix Inversion - parameter with an illegal value

$
0
0

Hi everyone,

This is the first time that I am using libraries. I need to calculate the inverse matrix of a square matrix. I found the routine PDGETRF + PDGETRI from ScaLAPACK in the MKL documentation that can solve my problem, but I'm in trouble to compile this routines. 

Can anyone help me?

The code I am trying to compile is:

    program Invtest

    implicit none

    ! Variables
    integer :: i, j, info, lwork, liwork
    integer, parameter :: dlen_ = 9, ia = 1, ja = 1, m=3, n=3
    real(kind = 8), dimension(m,n) :: A, Ainv, Mf, LU
    integer, dimension(size(A,1)) :: ipiv
    integer, dimension(dlen_) :: desca
    real(kind = 8), dimension(size(A,1)) :: work, iwork
    external PDGETRF, PDGETRI

    ! Body of Invtest
    A = reshape(source = (/1, 1, 1, 0, 3, 2, 0, 1, 0/), shape = (/3, 3/))
    do i=1,m
        print *, (A(i,j), j=1,n)
    end do
    info = 0
    lwork = size(A,1)
    work = 0
    liwork = size(A,1)
    iwork = 0

    ! PDGETRF computes an LU factorization of a general M-by-N distributed matrix.
    LU = A
    call pdgetrf(n, n, LU, ia, ja, desca, ipiv, info)

    ! PDGETRI computes the inverse of a matrix using the LU factorization computed by PDGETRF.
    Ainv = LU
    call pdgetri(n, Ainv, ia, ja, desca, ipiv, work, lwork, iwork, liwork, info)

    ! Computation of A^{-1} * A to check the inverse
    Mf = matmul(Ainv,A)

    print*,"Mf = "
    do i=1,m
        print*,Mf(i,:)
    end do

    pause

    end program Invtest

When I compile this code I get the following error message:

{   -1,   -1}:  On entry to
PDGETRF parameter number  602 had an illegal value
{   -1,   -1}:  On entry to
PDGETRI parameter number  502 had an illegal value

The university computer that I am using has installed Microsoft Visual Studio Professional 2013 Update 3, Intel Parallel Studio XE 2016 Update 2 Cluster Edition for Windows with Intel Math Kernel Library 11.3.

Thanks for the attention.

Zone: 

Thread Topic: 

Help Me

Viewing all articles
Browse latest Browse all 3005

Trending Articles



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