HPL_dger(3)

πŸ“¦ version 2.2, in fedora 43, fedora 44

πŸ’– 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, ORDER specifies the storage format of the operands, and it goes like this:
    • ORDER = HplRowMajor
    • ORDER = HplColumnMajor

pick one, bestie. it's giving "choose your fighter". 🌈

  • M β€” (local input) const int β€” on entry, M specifies the number of rows of the matrix A. M must be at least zero. (yes, zero is allowed. no negativity here. βœ‹)
  • N β€” (local input) const int β€” on entry, N specifies the number of columns of the matrix A. N must be at least zero. same rules, keep it non-negative.
  • ALPHA β€” (local input) const double β€” on entry, ALPHA specifies the scalar alpha. πŸ“ and here's the tea: when ALPHA is supplied as zero, then X and Y need not be set on input. free pass, we love to see it.
  • X β€” (local input) const double * β€” on entry, X is an incremented array of dimension at least ( 1 + ( m - 1 ) * abs( INCX ) ) that contains the vector x. ⭐
  • INCX β€” (local input) const int β€” on entry, INCX specifies the increment for the elements of X. 🚨 INCX must not be zero. do not. i'm serious.
  • Y β€” (local input) double * β€” on entry, Y is an incremented array of dimension at least ( 1 + ( n - 1 ) * abs( INCY ) ) that contains the vector y. ✨
  • INCY β€” (local input) const int β€” on entry, INCY specifies the increment for the elements of Y. 🚨 INCY must not be zero. same energy as INCX. zero is not the move.
  • A β€” (local input/output) double * β€” on entry, A points to an array of size equal to or greater than LDA * n. before entry, the leading m by n part of the array A must contain the matrix coefficients. on exit, A is 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, LDA specifies the leading dimension of A as declared in the calling (sub) program. LDA must be at least MAX(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: INCX and INCY cannot be zero, M and N must be at least zero, and LDA must be at least MAX(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