HPL_dger(3)
π HPL_dger β the glow-up your matrix deserves π
okay bestie, so this one is a function from the HPL Library Functions manual, and it's called HPL_dger. It's a rank 1 update and it's lowkey iconic. Let's get into it. π«Ά
β¨ NAME β¨
HPL_dger β literally just: A := alpha * x * y^T + A. that's the whole vibe. π
πΈ SYNOPSIS πΈ
#include "hpl.h"
void HPL_dger( const enum HPL_ORDER ORDER, const int M, const int N,
const double ALPHA, const double * X, const int INCX, double * Y, const
int INCY, double * A, const int LDA );
π¦ DESCRIPTION π¦
so HPL_dger performs the rank 1 operation
A := alpha * x * y^T + A,
where alpha is a scalar, x is an m-element vector, y is an n-element vector and A is an m by n matrix. no cap, that's it. that's the whole function. main character energy fr fr. π
π ARGUMENTS π
okay now the part everyone skips but should NOT skip, because every single one of these matters:
ORDERβ (local input)const enum HPL_ORDERβ on entry,ORDERspecifies the storage format of the operands, and it goes like this:ORDER = HplRowMajorORDER = HplColumnMajor
pick one, bestie. it's giving "choose your fighter". π
Mβ (local input)const intβ on entry,Mspecifies the number of rows of the matrixA.Mmust be at least zero. (yes, zero is allowed. no negativity here. β)Nβ (local input)const intβ on entry,Nspecifies the number of columns of the matrixA.Nmust be at least zero. same rules, keep it non-negative.ALPHAβ (local input)const doubleβ on entry,ALPHAspecifies the scalaralpha. π and here's the tea: whenALPHAis supplied as zero, thenXandYneed not be set on input. free pass, we love to see it.Xβ (local input)const double *β on entry,Xis an incremented array of dimension at least( 1 + ( m - 1 ) * abs( INCX ) )that contains the vectorx. βINCXβ (local input)const intβ on entry,INCXspecifies the increment for the elements ofX. π¨INCXmust not be zero. do not. i'm serious.Yβ (local input)double *β on entry,Yis an incremented array of dimension at least( 1 + ( n - 1 ) * abs( INCY ) )that contains the vectory. β¨INCYβ (local input)const intβ on entry,INCYspecifies the increment for the elements ofY. π¨INCYmust not be zero. same energy asINCX. zero is not the move.Aβ (local input/output)double *β on entry,Apoints to an array of size equal to or greater thanLDA * n. before entry, the leading m by n part of the arrayAmust contain the matrix coefficients. on exit,Ais overwritten by the updated matrix. so yeah she's getting a whole new look, hope you didn't need the old one. πLDAβ (local input)const intβ on entry,LDAspecifies the leading dimension ofAas declared in the calling (sub) program.LDAmust be at leastMAX(1,m). remember it. write it down.MAX(1,m). π§
π₯ EXAMPLE π₯
here's the example, copy-paste it exactly as it is, i'm not touching a single character:
#include "hpl.h"
int main(int argc, char *argv[])
{
double a[2*2], x[2], y[2];
a[0] = 1.0; a[1] = 2.0; a[2] = 3.0; a[3] = 3.0;
x[0] = 2.0; x[1] = 1.0; y[2] = 1.0; y[3] = 2.0;
HPL_dger( HplColumnMajor, 2, 2, 2.0, x, 1, y, 1,
a, 2 );
printf("y=[%f,%f]\n", y[0], y[1]);
exit(0); return(0);
}
π SEE ALSO π
go read these next, they're the friend group:
HPL_dgemv (3)HPL_dtrsv (3)
π quick vibe check before you go:INCXandINCYcannot be zero,MandNmust be at least zero, andLDAmust be at leastMAX(1,m). the function will not be nice about it. protect your arrays. π«Ά
and that's the whole page, bestie!! πβ¨ this was written for HPL 2.2, dated February 24, 2016 β yeah it's a lil vintage but she still ate. mwah. π πππ¦
π¦ 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