classq.f(3)

πŸ“¦ version 3.9.0, in centos-stream 9

πŸ’… classq.f(3) β€” the LAPACK glow-up you didn't know you needed

okay so this is classq.f, straight out of LAPACK, and it's a little baddie of a routine that does exactly one job and does it iconically. it's in section 3 (library calls), iykyk. let's get into it πŸŽ€


✨ NAME ✨

classq.f β€” yes bestie, that's literally the whole name, she's minimal like that.


✨ SYNOPSIS ✨

🌸 Functions/Subroutines 🌸

  • subroutine classq (N, X, INCX, SCALE, SUMSQ) β€” CLASSQ updates a sum of squares represented in scaled form. that's the whole vibe. πŸ’…

✨ Function/Subroutine Documentation ✨

πŸ¦‹ the actual signature πŸ¦‹

subroutine classq (integer N, complex, dimension( * ) X, integer INCX, real
    SCALE, real SUMSQ)

CLASSQ updates a sum of squares represented in scaled form. periodt.

πŸ’œ Purpose:

okay so CLASSQ returns the values scl and ssq such that

   ( scl**2 )*ssq = x( 1 )**2 +...+ x( n )**2 + ( scale**2 )*sumsq,

where

   x( i ) = abs( X( 1 + ( i - 1 )*INCX ) ).

and like β€” the value of sumsq is assumed to be at least unity, and the value of ssq will then satisfy

   1.0 .le. ssq .le. ( sumsq + 2*n ).

no cap, that's the bound. 🫢

also scale is assumed to be non-negative, and scl returns the value

   scl = max( scale, abs( real( x( i ) ) ), abs( aimag( x( i ) ) ) ),
          i

scale and sumsq must be supplied in SCALE and SUMSQ respectively. and then β€” plot twist β€” SCALE and SUMSQ are overwritten by scl and ssq respectively. πŸ’€ so don't come crying when your inputs are gone, that's the whole point.

the routine makes only one pass through the vector X. one. single. pass. efficient queen. πŸ‘‘


πŸŽ€ Parameters: πŸŽ€

  • N β€” N is INTEGER. the number of elements to be used from the vector X. that's how many besties we're inviting to the party.
  • X β€” X is COMPLEX array, dimension (N). the vector x as described above, bestie:
   x( i )  = X( 1 + ( i - 1 )*INCX ), 1 <= i <= n.
  • INCX β€” INCX is INTEGER. the increment between successive values of the vector X. and INCX > 0 β€” gotta be strictly positive, no zero, no negatives, we don't do that here. 🚫
  • SCALE β€” SCALE is REAL. on entry, the value scale in the equation above. on exit, SCALE is overwritten with the value scl. she came in as one thing and left as another, main character energy fr. ✨
  • SUMSQ β€” SUMSQ is REAL. on entry, the value sumsq in the equation above. on exit, SUMSQ is overwritten with the value ssq. same deal, glow-up on the way out. πŸ”₯

πŸ‘‘ Author:

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

look at that little coalition of geniuses, we stan. 🌈

πŸ“… Date:

December 2016

πŸ“– Definition at line 108 of file classq.f.


🌟 Author 🌟

Generated automatically by Doxygen for LAPACK from the source code. (the robots wrote the docs, we just made them cute 🧚)


πŸ’– alright bestie, real talk: if you're passing SCALE and SUMSQ in, remember they get overwritten on the way out. that's not a bug, that's the design. no cap.

okay that's the whole page!! πŸ’œ and for the sign-off: this lil masterpiece is Version 3.8.0, dated Tue Nov 14 2017 β€” oldie but a goodie, she's still slaying πŸ“βœ¨πŸ¦‹

πŸ“¦ where this page comes from