Skip to content

Integer to real conversion in single precision scalapack gives wrong estimate of matrix size #99

Open
@sangallidavide

Description

@sangallidavide

AS the title says, when for example pcheevr is called in single precision, rwork(1) should contain the optimal size

*  RWORK    (local workspace/output) REAL  array,
*          dimension (LRWORK)
*          On return, RWORK(1) contains the optimal amount of
*          workspace required for efficient execution.

However the value is obtained from integer to real conversion
https://github.com/Reference-ScaLAPACK/scalapack/blob/master/SRC/pcheevr.f#L592
which gives rounding error for integers bigger than 10^6

If the rounded value is subsequently used in input for phceevr (after conversion back to integer), this may give an error.
See here the comment in a pull request of our code (and the following discussion):
yambo-code/yambo#117 (comment)

To fix this, it would be needed to change the above mentioned line (and other lines across the library) to a rounding procedure which always selects the closest bigger real number, e.g. rounding always done in excess.

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