HPL_perm(3)

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

πŸ’– NAME πŸ’–

okay bestie, meet HPL_perm β€” she takes two index arrays and combines them to generate the permutation. no cap, that's the whole gig. πŸŽ€


✨ SYNOPSIS ✨

#include "hpl.h"

void HPL_perm( const int N, int * LINDXA, int * LINDXAU, int * IWORK );

πŸ¦‹ DESCRIPTION πŸ¦‹

so HPL_perm combines two index arrays and generates the permutation that goes with them. it's giving matchmaker, fr fr. πŸ’…

step one: she computes the inverse of LINDXA, then combines it with LINDXAU. periodt.

step two: and this is the iconic part β€” so that the permutation can be done in place, LINDXAU gets overwritten with the sequence of permutation that produces the same result. lowkey a glow-up, highkey necessary.

what we ultimately want is:

U[LINDXAU[i]] := U[LINDXA[i]] for i in [0..N).

after you call this function, that in-place permutation can be performed with:

for i in [0..N) swap U[i] with U[LINDXAU[i]].

literally that's it. main character energy from a tiny little function. πŸ‘‘


🌸 ARGUMENTS 🌸

  • N β€” (global input) const int β€” on entry, N specifies the length of the arrays LINDXA and LINDXAU. N should be at least zero. yes bestie, at least zero, don't be weird about it. πŸ™ˆ
  • LINDXA β€” (global input/output) int * β€” on entry, LINDXA is an array of dimension N containing the source indexes. on exit, LINDXA contains the combined index array. she came in as one thing and left as another, we love a transformation arc. ✨
  • LINDXAU β€” (global input/output) int * β€” on entry, LINDXAU is an array of dimension N containing the target indexes. on exit, LINDXAU contains the sequence of permutation, that should be applied in increasing order to permute the underlying array U in place. don't skip the increasing-order part, iykyk. πŸ”₯
  • IWORK β€” (workspace) int * β€” on entry, IWORK is a workarray of dimension N. she's just here to help, no notes. 🫢

🌈 SEE ALSO 🌈

  • HPL_plindx1 (3)
  • HPL_pdlaswp01N (3)
  • HPL_pdlaswp01T (3)

and that's the whole page, bestie πŸ’œ this one's brought to you by HPL 2.2, dated February 24, 2016 β€” vintage but still slaying, fr fr. πŸŽ€βœ¨

πŸ“¦ where this page comes from