Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scaling routines to return immediately when scaling with one #674

Merged
merged 1 commit into from
May 21, 2022

Conversation

angsch
Copy link
Collaborator

@angsch angsch commented May 21, 2022

Description

This is a proposal to add a check for alpha being equal to one to the early return criterion of the scaling routines.

It appears prudent to add an early exit to the BLAS and the LAPACK scaling routines and not rely on the caller to precede every invocation of a scaling routine with a check for one. Other BLAS routines such as HER or AXPY have a quick return based on the value of alpha already.

 * SCAL: Quick return if scaling factor is one
 * LASCL: If cto == cfrom and neither input is NaN or Inf, skip scaling
IF (INCX.EQ.1) THEN
*
* code for increment equal to 1
*
DO I = 1,N
ZX(I) = DCMPLX(DA,0.0d0)*ZX(I)
ZX(I) = DCMPLX(DA*DBLE(ZX(I)),DA*DIMAG(ZX(I)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Thanks. Much better like this indeed. The previous line of code was weird.

Copy link
Contributor

@langou langou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Looks good to me.

@langou langou merged commit 0eb7706 into Reference-LAPACK:master May 21, 2022
@angsch angsch deleted the scal branch July 7, 2022 19:13
@julielangou julielangou added this to the LAPACK 3.11.0 milestone Nov 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants