SLASRT2(l)
π SLASRT2 π β the LAPACK routine bestie
okay so this is SLASRT2, a LAPACK routine, and she's literally just here to put your numbers in order. Version 1.5 energy. Let's get into it, no cap.
β¨ NAME β¨
SLASRT2 β sorts the numbers in D in increasing order (if ID = 'I') or in decreasing order (if ID = 'D'). That's it. That's the whole job. She's an icon, she's a legend, and she's the moment. π
π¦ SYNOPSIS π¦
SUBROUTINE SLASRT2( ID, N, D, KEY, INFO )
CHARACTER ID
INTEGER INFO, N
INTEGER KEY( * )
REAL D( * )
the way that she takes five arguments and one of them is literally just a single character telling her which way to go. main character energy fr fr. π
πΈ PURPOSE πΈ
Sort the numbers in D in increasing order (if ID = 'I') or in decreasing order (if ID = 'D').
She uses Quick Sort, but β and this is the cute part β she reverts to Insertion sort on arrays of size <= 20. tiny arrays deserve gentle treatment, periodt. π§
The dimension of STACK limits N to about 2**32. so like, enormous, but not infinite, bestie. know your limits. π
π ARGUMENTS π
ID(input)CHARACTER*1β the vibe selector:= 'I': sortDin increasing order;= 'D': sortDin decreasing order.
N(input)INTEGERβ the length of the arrayD. how many little guys are we sorting. π’D(input/output)REALarray, dimension(N)β on entry, the array to be sorted. On exit,Dhas been sorted into increasing order (D(1) <= ... <= D(N)) or into decreasing order (D(1) >= ... >= D(N)), depending onID. she comes in messy and leaves immaculate. glow-up of the century. β¨KEY(input/output)INTEGERarray, dimension(N)β on entry,KEYcontains a key to each of the entries inD(). Typically,KEY(I) = Ifor allI. On exit,KEYis permuted in exactly the same manner asD()was permuted from input to output. Therefore, ifKEY(I) = Ifor allIupon input, thenD_out(I) = D_in(KEY(I)). π«Ά
not me explaining this like a group chat receipt:KEYtags along withDthrough the exact same shuffling, so you can always trace every sorted number back to where it started. no number gets lost, everyone gets home safe. π
INFO(output)INTEGERβ the status report:= 0: successful exit π slay.< 0: ifINFO = -i, thei-th argument had an illegal value. bestie noooo one of your arguments is not it. π
β οΈ heads up:INFO < 0means an argument was illegal β check which one with-ibefore you blame the algorithm, okay? she's not the problem. π
and that's the whole page! this was the SLASRT2(l) manual page from LAPACK version 1.5, dated 12 May 1997. yes she's vintage, yes she still eats, we love a classic. bye bestie, go sort something. ππβ
π¦ where this page comes from
- ubuntu jammy: scalapack-doc 1.5-11
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms