The LAPACK forum has moved to https://github.com/Reference-LAPACK/lapack/discussions.

problem with subroutine dgetrs in lapack-3.0

Open discussion regarding features, bugs, issues, vendors, etc.

problem with subroutine dgetrs in lapack-3.0

Postby lonix » Wed Nov 07, 2007 7:15 am

The test script is below:
Code: Select all
 integer N, NRHS, LDA, LDB, INFO
    parameter(N=4, NRHS=1, LDA=4, LDB=4)
    double precision A(4,4), B(4,1)
    integer IPIV(4)
    A(1,1) = 1.; A(1,2) = 10.; A(1,3)= 1.;  A(1,4) = 1.
    A(2,1) = 2.; A(2,2) = -1.; A(2,3)= 50.; A(2,4) = -11.
    A(3,1) = 4.; A(3,2) = 8.;  A(3,3)= -7.; A(3,4) = -19.
    A(4,1) = 4.; A(4,2) = 8.;  A(4,3)= -7.; A(4,4) = 23
   
    B(1,1) = 13.; B(2,1) = 40.; B(3,1) = -14.; B(4,1) = 28.
    call dgetrs('N', N, NRHS, A, LDA, IPIV, B, LDB, INFO)
    write(*,*)B
    end

and it compiles well with:
f77 test.f -o test -llapack
and it actually generate the execute file "test", but when I execute this file, there is segment fault. I doubt that whether the algorithm in this subroutine has its own flaw. Anyone can explain this kind of phenomenon? Many thanks.
lonix
 
Posts: 2
Joined: Wed Nov 07, 2007 7:00 am

Postby sven » Wed Nov 07, 2007 8:15 am

IPIV is an input argument to DGETRS and so needs to be defined before the call to DGETRS. I am sure that you realise that DGETRS is normally preceded by a call to DGETRF, which factorizes A and returns the pivot indices in IPIV.

Best wishes,

Sven Hammarling.
sven
 
Posts: 146
Joined: Wed Dec 22, 2004 4:28 am

Postby lonix » Wed Nov 07, 2007 9:47 am

I got it, thanks very much.
lonix
 
Posts: 2
Joined: Wed Nov 07, 2007 7:00 am


Return to User Discussion

Who is online

Users browsing this forum: No registered users and 4 guests