rscl(3)

πŸ’… rscl β€” bestie's guide to scaling vectors by a reciprocal

ok so this page is from the LAPACK manual (yes, that LAPACK, the linear algebra queen πŸ‘‘), and it's genuinely just four lil subroutines that all do the same iconic thing: multiply a vector by 1/a. That's it. That's the whole vibe.


✨ NAME ✨

rscl β€” fr fr, this is the "scale vector by reciprocal" family. Not "rescale", not "r-s-c-l", just: take a vector, divide it by a scalar, don't let it overflow. Periodt. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

Functions

  • subroutine csrscl (n, sa, sx, incx) β€” CSRSCL multiplies a vector by the reciprocal of a real scalar.
  • subroutine drscl (n, sa, sx, incx) β€” DRSCL multiplies a vector by the reciprocal of a real scalar.
  • subroutine srscl (n, sa, sx, incx) β€” SRSCL multiplies a vector by the reciprocal of a real scalar.
  • subroutine zdrscl (n, sa, sx, incx) β€” ZDRSCL multiplies a vector by the reciprocal of a real scalar.

πŸ¦‹ Detailed Description

ngl there isn't a big overarching description here β€” the deets live down in the Function Documentation section, one subroutine at a time. Keep scrolling bestie, it's all there 🫢


🌸 Function Documentation 🌸

subroutine csrscl (integer n, real sa, complex, dimension( * ) sx, integer incx)

CSRSCL multiplies a vector by the reciprocal of a real scalar.

Purpose

!>
!> CSRSCL multiplies an n-element complex vector x by the real scalar
!> 1/a.  This is done without overflow or underflow as long as
!> the final result x/a does not overflow or underflow.
!>

so like β€” it's dividing by a, but it does it the smart way so nothing explodes in the middle πŸ”₯ (assuming the final answer x/a itself is representable, which is on you, bestie 😭).

Parameters

  • N
!>          N is INTEGER
!>          The number of components of the vector x.
!>

the number of components of the vector x. how many lil guys are in the vector πŸ’–

  • SA
!>          SA is REAL
!>          The scalar a which is used to divide each component of x.
!>          SA must be >= 0, or the subroutine will divide by zero.
!>

the scalar a that divides every component of x. ⚠️ SA must be >= 0, or the subroutine will divide by zero. like literally, that's the deal.

  • SX
!>          SX is COMPLEX array, dimension
!>                         (1+(N-1)*abs(INCX))
!>          The n-element vector x.
!>

the n-element vector x, as a COMPLEX array sized (1+(N-1)*abs(INCX)).

  • INCX
!>          INCX is INTEGER
!>          The increment between successive values of the vector SX.
!>          > 0:  SX(1) = X(1) and SX(1+(i-1)*INCX) = x(i),     1< i<= n
!>

the stride between successive values of SX. When it's > 0: SX(1) = X(1) and SX(1+(i-1)*INCX) = x(i), for 1< i<= n.

Author

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.

Definition

Definition at line 83 of file csrscl.f.


subroutine drscl (integer n, double precision sa, double precision, dimension( * ) sx, integer incx)

DRSCL multiplies a vector by the reciprocal of a real scalar.

Purpose

!>
!> DRSCL multiplies an n-element real vector x by the real scalar 1/a.
!> This is done without overflow or underflow as long as
!> the final result x/a does not overflow or underflow.
!>

same energy, but DOUBLE PRECISION and real instead of complex. the double-precision glow-up ✨

Parameters

  • N
!>          N is INTEGER
!>          The number of components of the vector x.
!>

the number of components of the vector x.

  • SA
!>          SA is DOUBLE PRECISION
!>          The scalar a which is used to divide each component of x.
!>          SA must be >= 0, or the subroutine will divide by zero.
!>

the scalar a dividing each component of x. ⚠️ again: SA must be >= 0, or you get a divide by zero. no cap.

  • SX
!>          SX is DOUBLE PRECISION array, dimension
!>                         (1+(N-1)*abs(INCX))
!>          The n-element vector x.
!>

the n-element vector x, DOUBLE PRECISION, dimension (1+(N-1)*abs(INCX)).

  • INCX
!>          INCX is INTEGER
!>          The increment between successive values of the vector SX.
!>          > 0:  SX(1) = X(1) and SX(1+(i-1)*INCX) = x(i),     1< i<= n
!>

the increment between successive values of SX. For > 0: SX(1) = X(1) and SX(1+(i-1)*INCX) = x(i), 1< i<= n.

Author

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.

Definition

Definition at line 83 of file drscl.f.


subroutine srscl (integer n, real sa, real, dimension( * ) sx, integer incx)

SRSCL multiplies a vector by the reciprocal of a real scalar.

Purpose

!>
!> SRSCL multiplies an n-element real vector x by the real scalar 1/a.
!> This is done without overflow or underflow as long as
!> the final result x/a does not overflow or underflow.
!>

the single-precision sibling of DRSCL. same brain, smaller floats 🧚

Parameters

  • N
!>          N is INTEGER
!>          The number of components of the vector x.
!>

the number of components of the vector x.

  • SA
!>          SA is REAL
!>          The scalar a which is used to divide each component of x.
!>          SA must be >= 0, or the subroutine will divide by zero.
!>

the REAL scalar a dividing each component of x. ⚠️ SA must be >= 0 or the subroutine will divide by zero β€” yes, this rule follows you everywhere.

  • SX
!>          SX is REAL array, dimension
!>                         (1+(N-1)*abs(INCX))
!>          The n-element vector x.
!>

the n-element vector x as a REAL array of dimension (1+(N-1)*abs(INCX)).

  • INCX
!>          INCX is INTEGER
!>          The increment between successive values of the vector SX.
!>          > 0:  SX(1) = X(1) and SX(1+(i-1)*INCX) = x(i),     1< i<= n
!>

the stride between successive values of SX. When > 0: SX(1) = X(1) and SX(1+(i-1)*INCX) = x(i), 1< i<= n.

Author

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.

Definition

Definition at line 83 of file srscl.f.


subroutine zdrscl (integer n, double precision sa, complex*16, dimension( * ) sx, integer incx)

ZDRSCL multiplies a vector by the reciprocal of a real scalar.

Purpose

!>
!> ZDRSCL multiplies an n-element complex vector x by the real scalar
!> 1/a.  This is done without overflow or underflow as long as
!> the final result x/a does not overflow or underflow.
!>

double-precision complex?? iconic. complex*16, DOUBLE PRECISION scalar, all the drama πŸ’œ

Parameters

  • N
!>          N is INTEGER
!>          The number of components of the vector x.
!>

the number of components of the vector x.

  • SA
!>          SA is DOUBLE PRECISION
!>          The scalar a which is used to divide each component of x.
!>          SA must be >= 0, or the subroutine will divide by zero.
!>

the DOUBLE PRECISION scalar a dividing each component of x. ⚠️ same warning, forever: SA must be >= 0, or the subroutine will divide by zero.

  • SX
!>          SX is COMPLEX*16 array, dimension
!>                         (1+(N-1)*abs(INCX))
!>          The n-element vector x.
!>

the n-element vector x, a COMPLEX*16 array of dimension (1+(N-1)*abs(INCX)).

  • INCX
!>          INCX is INTEGER
!>          The increment between successive values of the vector SX.
!>          > 0:  SX(1) = X(1) and SX(1+(i-1)*INCX) = x(i),     1< i<= n
!>

the increment between successive values of SX. For > 0: SX(1) = X(1) and SX(1+(i-1)*INCX) = x(i), 1< i<= n.

Author

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.

Definition

Definition at line 83 of file zdrscl.f.


πŸ‘‘ Author

Generated automatically by Doxygen for LAPACK from the source code.

(so like… a robot wrote this page for us. respect the automation πŸ™ˆ)


ok that's the whole thing!! thanks for reading besties 🫢

signed off with love β€” LAPACK, Version 3.12.0, and this whole page is rscl(3). πŸŽ€βœ¨

πŸ“¦ where this page comes from