HPL_dscal(3)
π HPL_dscal(3) β the HPL library function that just... multiplies ur vector π
okay so bestie, welcome to section 3 of the HPL manual, where the C functions live. this one is HPL_dscal, and honestly? she's an icon, she's a legend, and she does exactly one thing:
x = alpha * x.
that's it. that's the whole girl. β¨
πΈ NAME πΈ
HPL_dscal β x = alpha * x. no cap. that's the assignment statement, that's the vibe.
π SYNOPSIS π
#include "hpl.h"
void HPL_dscal( const int N, const double ALPHA, double * X, const int
INCX );
π¦ DESCRIPTION π¦
HPL_dscal scales the vector x by alpha. that's it!! she takes ur vector, she takes ur scalar, she makes them become one (well, she multiplies every entry by it). main character energy, minimal effort, ate. π₯
β¨ ARGUMENTS β¨
Nβ (local input)const intβ on entry,Nspecifies the length of the vector x. and listen:Nmust be at least zero. not negative, okay? zero is fine, negative is not. π«ΆALPHAβ (local input)const doubleβ on entry,ALPHAspecifies the scalar alpha. here's the cute part: whenALPHAis supplied as zero, then the entries of the incremented arrayXneed not be set on input. so like... if ur scaling by nothing, nobody even has to look at ur data first. lowkey iconic.Xβ (local input/output)double *β on entry,Xis an incremented array of dimension at least( 1 + ( n - 1 ) * abs( INCX ) )that contains the vector x. on exit, the entries of the incremented arrayXare scaled by the scalar alpha. so she goes in, she multiplies, she leaves. glow up achieved. πINCXβ (local input)const intβ on entry,INCXspecifies the increment for the elements ofX. andINCXmust not be zero. like, do not. zero is not a slay here, it's a disaster. π
π EXAMPLE π
here's a lil demo so u can see her in her natural habitat:
#include "hpl.h"
int main(int argc, char *argv[])
{
double x[3];
x[0] = 1.0; x[1] = 2.0; x[2] = 3.0;
HPL_dscal( 3, 2.0, x, 1 );
printf("x=[%f,%f,%f]\n", x[0], x[1], x[2]);
exit(0); return(0);
}
three entries, scaled by 2.0, increment of 1. she's serving. π
π SEE ALSO π
HPL_daxpy (3)HPL_dcopy (3)HPL_dswap (3)
her besties fr fr. the whole vector-ops group chat. π«Ά
okay that's the page!! this was HPL 2.2, dated February 24, 2016, and it's the HPL_dscal(3) page from the HPL Library Functions. stay slay, scale responsibly, and remember: INCX is never zero. periodt. ππ
π¦ where this page comes from
- fedora 43: hpl-doc 2.2-22.fc43 Β· LicenseRef-Callaway-BSD-with-advertising
- fedora 44: hpl-doc 2.2-23.fc44 Β· LicenseRef-Callaway-BSD-with-advertising
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms