Unique

Usage

use Unique;

or

import Unique;

unique finding and counting algorithms these are all based on dense histograms and sparse histograms(assoc domains/arrays)

you could also use a sort if you got into a real bind with really large dense ranges of values and large arrays…

* need to factor in sparsity estimation somehow * for example if (a.max-a.min > a.size) means that a’s are sparse

const uLogger = new Logger(logLevel, logChannel)
proc uniqueSort(a: [?aD] ?eltType, param needCounts = true) throws

sorting based unique finding procedure

Returns a tuple: (UniqueValArray,UniqueValCountsArray) which contains the unique values of a, along with the number of times each unique value appears in a

Arguments

a : [] int – Array of data to be processed

Returns

([] int, [] int)

proc uniqueSortWithInverse(a: [?aD] ?eltType, param needIndices = false) throws
proc uniqueFromSorted(sorted: [?aD] ?eltType, param needCounts = true) throws
proc uniqueGroup(str: SegString, returnInverse = false) throws
proc uniqueFromTruth(str: SegString, perm: [?aD] int, truth: [aD] bool) throws