lassq(3)
π
lassq(3) β bestie's guide to lassq
okay so welcome to lassq(3), the manual page for the lassq family of routines β¨ and ngl the NAME line is doing a lot of heavy lifting here, so let's read it together:
lassq β sum-of-squares, avoiding over/underflow π«Ά
that's the whole vibe. sum of squares. but make it safe so your numbers don't yeet themselves into overflow or underflow territory π iconic behaviour honestly.
πΈ SYNOPSIS πΈ
β¨ Functions β¨
okay so there's not one, not two, but four of these cuties β one for each flavour of Fortran real/complex β¨ same signature, different letter, no cap:
subroutine classq (n, x, incx, scale, sumsq)β CLASSQ updates a sum of squares represented in scaled form πsubroutine dlassq (n, x, incx, scale, sumsq)β DLASSQ updates a sum of squares represented in scaled form πsubroutine slassq (n, x, incx, scale, sumsq)β SLASSQ updates a sum of squares represented in scaled form πsubroutine zlassq (n, x, incx, scale, sumsq)β ZLASSQ updates a sum of squares represented in scaled form π
and like, yes, they all have the exact same argument list (n, x, incx, scale, sumsq) β that's the whole point, the naming convention is right there in the first letter, iykyk π
subroutine classq (n, x, incx, scale, sumsq)
subroutine dlassq (n, x, incx, scale, sumsq)
subroutine slassq (n, x, incx, scale, sumsq)
subroutine zlassq (n, x, incx, scale, sumsq)
π¦ Detailed Description π¦
okay so lowkey this section is empty in this version of the page β the details are all up in the SYNOPSIS and in each routine's own entry π no extra lore here, bestie, don't go looking for it.
fr fr if you want the actual argument-by-argument tea for each one, go pull up that specific routine β this page is just the family reunion π
β¨ FUNCTION DOCUMENTATION β¨
okay so this is where the actual subroutines live, bestie β and there are four of them, all doing the same iconic scaled-sum-of-squares thing but for different types. let's get into it π
π classq β the complex one π
subroutine classq (integer n, complex(wp), dimension(*) x, integer incx,
real(wp) scale, real(wp) sumsq)
CLASSQ updates a sum of squares represented in scaled form. literally what it says on the tin, no cap.
Purpose
ok so CLASSQ returns the values scale_out and sumsq_out such that:
(scale_out**2)*sumsq_out = x( 1 )**2 +...+ x( n )**2 + (scale**2)*sumsq,
where x( i ) = X( 1 + ( i - 1 )*INCX ). The value of sumsq is assumed to be non-negative. (so don't come at it with negative sumsq, okay? it's assumed non-negative for a reason π)
scale and sumsq must be supplied in SCALE and SUMSQ and scale_out and sumsq_out are overwritten on SCALE and SUMSQ respectively. (it's an in-place glow-up, periodt π
)
Parameters
NβNisINTEGER. the number of elements to be used from the vectorx. (like how many besties are invited to the party π)XβXisCOMPLEXarray, dimension(1+(N-1)*abs(INCX)). the vector for which a scaled sum of squares is computed. andx( i ) = X( 1 + ( i - 1 )*INCX ), 1 <= i <= n. (so it's the guest list, basically π¦)INCXβINCXisINTEGER. the increment between successive values of the vectorx. here's the tea:- if
INCX > 0,X(1+(i-1)*INCX) = x(i)for1 <= i <= n - if
INCX < 0,X(1-(n-i)*INCX) = x(i)for1 <= i <= n - if
INCX = 0,xisn't a vector so there is no need to call this subroutine. if you call it anyway, it will countx(1)in the vector normNtimes. (so like, why would you? but okay, it's your funeral π)
- if
SCALEβSCALEisREAL. on entry, the valuescalein the equation above. on exit,SCALEis overwritten byscale_out, the scaling factor for the sum of squares. (glow-up: it goes in asscaleand comes out asscale_outβ¨)SUMSQβSUMSQisREAL. on entry, the valuesumsqin the equation above. on exit,SUMSQis overwritten bysumsq_out, the basic sum of squares from whichscale_outhas been factored out. (same deal, but for the sum of squares)
Author
Edward Anderson, Lockheed Martin (iconic π)
Contributors
Weslley Pereira, University of Colorado Denver, USA Nick Papior, Technical University of Denmark, DK (shoutout to the contributors, we love to see it π«Ά)
Further Details
- Anderson E. (2017) β Algorithm 978: Safe Scaling in the Level 1 BLAS β ACM Trans Math Softw 44:1--28 β https://doi.org/10.1145/3061665
- Blue, James L. (1978) β A Portable Fortran Program to Find the Euclidean Norm of a Vector β ACM Trans Math Softw 4:15--23 β https://doi.org/10.1145/355769.355771
(these are the receipts, bestie β read them if you're curious about the math lore π)
Definition at line 123 of file classq.f90.
π dlassq β the double-precision real one π
subroutine dlassq (integer n, real(wp), dimension(*) x, integer incx,
real(wp) scale, real(wp) sumsq)
DLASSQ updates a sum of squares represented in scaled form. same energy as classq but for DOUBLE PRECISION reals β lowkey the same vibe, highkey still important π₯
Purpose
same deal: DLASSQ returns the values scale_out and sumsq_out such that:
(scale_out**2)*sumsq_out = x( 1 )**2 +...+ x( n )**2 + (scale**2)*sumsq,
where x( i ) = X( 1 + ( i - 1 )*INCX ). The value of sumsq is assumed to be non-negative. (still non-negative, still not playing around π€)
scale and sumsq must be supplied in SCALE and SUMSQ and scale_out and sumsq_out are overwritten on SCALE and SUMSQ respectively.
Parameters
NβNisINTEGER. the number of elements to be used from the vectorx.XβXisDOUBLE PRECISIONarray, dimension(1+(N-1)*abs(INCX)). the vector for which a scaled sum of squares is computed.x( i ) = X( 1 + ( i - 1 )*INCX ), 1 <= i <= n.INCXβINCXisINTEGER. the increment between successive values of the vectorx.- if
INCX > 0,X(1+(i-1)*INCX) = x(i)for1 <= i <= n - if
INCX < 0,X(1-(n-i)*INCX) = x(i)for1 <= i <= n - if
INCX = 0,xisn't a vector so there is no need to call this subroutine. if you call it anyway, it will countx(1)in the vector normNtimes. (like, please don't, but if you do, it's gonna count that one elementNtimes π)
- if
SCALEβSCALEisDOUBLE PRECISION. on entry, the valuescalein the equation above. on exit,SCALEis overwritten byscale_out, the scaling factor for the sum of squares.SUMSQβSUMSQisDOUBLE PRECISION. on entry, the valuesumsqin the equation above. on exit,SUMSQis overwritten bysumsq_out, the basic sum of squares from whichscale_outhas been factored out.
Author
Edward Anderson, Lockheed Martin
Contributors
Weslley Pereira, University of Colorado Denver, USA Nick Papior, Technical University of Denmark, DK
Further Details
- Anderson E. (2017) β Algorithm 978: Safe Scaling in the Level 1 BLAS β ACM Trans Math Softw 44:1--28 β https://doi.org/10.1145/3061665
- Blue, James L. (1978) β A Portable Fortran Program to Find the Euclidean Norm of a Vector β ACM Trans Math Softw 4:15--23 β https://doi.org/10.1145/355769.355771
Definition at line 123 of file dlassq.f90.
okay so that's classq and dlassq covered β next up in part 3 we've got slassq and zlassq, which are literally the same but for REAL and DOUBLE COMPLEX. same vibe, different precision. stay tuned, bestie π
β¨
π AUTHOR π
Okay so nobody actually sat down and wrote this one, bestie β it says right here: Generated automatically by Doxygen for LAPACK from the source code. So the "author" is a robot that reads Fortran and spits out docs π Not me getting emotional over an automated doc generator, but like... it ate. No cap.
So yeah β no human byline, no "written by β¨someoneβ¨", just Doxygen doing its little auto-gen thing for LAPACK, pulling everything straight from the source code. That's the whole author section, fr fr. Short and iconic π
And that's a wrap on lassq(3), bestie!! π¦ This whole gorgeous little page comes to you courtesy of LAPACK, Version 3.12.0, with lassq(3) sitting pretty in the footer alongside its date stamp β the standard man-page send-off, just delivered with way more sparkle β¨ Go forth and sum those squares responsibly. Mwah ππΈ
π¦ where this page comes from
- arch rolling: lapack-doc 3.12.1-2 Β· custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms