Skip to content

pdgbtrf potential bug under edge cases #114

@TLCFEM

Description

@TLCFEM

When BWL=BWU=0, LDBB evaluates to 0.

LDBB = 2*BW + BWU

Later when it is passed to dgetrf, it triggers an error as the lead is expect to be positive.

scalapack/SRC/pdgbtrf.f

Lines 860 to 861 in a23c2cd

CALL DGETRF( N-LN, N-LN, AF( BBPTR+BW*LDBB ), LDBB,
$ IPIV( LN+1 ), INFO )

 ** On entry to DGETRF parameter number  4 had an illegal value

pdgbtrs will further raise a few errors when BWL=BWU=0.

Here is a MWE.

program gbsv_test
    implicit none
    integer ictxt

    integer n, kl, ku, ja, laf, lwork, info
    integer, dimension(10) :: desca, ipiv, af, work
    double precision a

    call blacs_get(-1, 0, ictxt)
    call blacs_gridinit(ictxt, 'R', 1, 1)

    n = 1
    kl = 0
    ku = 0
    a = 1.0
    ja = 1
    laf = 10
    lwork = 10
    info = 0

    desca(1) = 501
    desca(2) = ictxt
    desca(3) = 1
    desca(4) = 1
    desca(5) = 0
    desca(6) = 1

    call pdgbtrf(n, kl, ku, a, ja, desca, ipiv, af, laf, work, lwork, info)

    call blacs_gridexit(ictxt)
    call blacs_exit(0)

end program gbsv_test

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions