Classify

From APL Wiki
Revision as of 17:01, 27 January 2024 by Marshall (talk | contribs) (Created page with "'''Self-classify''', or '''index-in-nub''', is a monadic function that gives the index of each of its argument cells in the unique argument cells, which can be implemented as <syntaxhighlight lang=apl inline>{(∪⍵)⍳⍵}</syntaxhighlight> or <syntaxhighlight lang=apl inline>(∪⍳⊢)</syntaxhighlight>. This result is another representation of the boolean matrix returned by the earlier function Nub in defined by Iverson. Classify is implement...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Self-classify, or index-in-nub, is a monadic function that gives the index of each of its argument cells in the unique argument cells, which can be implemented as {(∪⍵)⍳⍵} or (∪⍳⊢). This result is another representation of the boolean matrix returned by the earlier function Nub in defined by Iverson. Classify is implemented in BQN as and Uiua as .

A use of Classify in APL is to avoid issues with comparison tolerance when implementing Nub Sieve. In a naive implementation, some cells might match others that are excluded from the result of Unique, leading to inconsistent results. Classify ensures that the cells are partitioned cleanly into groups where each matches its first element.

External links

Documentation


APL built-ins [edit]
Primitives (Timeline) Functions
Scalar
Monadic ConjugateNegateSignumReciprocalMagnitudeExponentialNatural LogarithmFloorCeilingFactorialNotPi TimesRollTypeImaginarySquare RootRound
Dyadic AddSubtractTimesDivideResiduePowerLogarithmMinimumMaximumBinomialComparison functionsBoolean functions (And, Or, Nand, Nor) ∙ GCDLCMCircularComplexRoot
Non-Scalar
Structural ShapeReshapeTallyDepthRavelEnlistTableCatenateReverseRotateTransposeRazeMixSplitEncloseNestCut (K)PairLinkPartitioned EnclosePartition
Selection FirstPickTakeDropUniqueIdentityStopSelectReplicateExpandSet functions (IntersectionUnionWithout) ∙ Bracket indexingIndexCartesian ProductSort
Selector Index generatorGradeIndex OfInterval IndexIndicesDealPrefix and suffix vectors
Computational MatchNot MatchMembershipFindNub SieveEncodeDecodeMatrix InverseMatrix DivideFormatExecuteMaterialiseRange
Operators Monadic EachCommuteConstantReplicateExpandReduceWindowed ReduceScanOuter ProductKeyI-BeamSpawnFunction axisIdentity (Null, Ident)
Dyadic BindCompositions (Compose, Reverse Compose, Beside, Withe, Atop, Over) ∙ Inner ProductDeterminantPowerAtUnderRankDepthVariantStencilCutDirect definition (operator)Identity (Lev, Dex)
Quad names Index originComparison toleranceMigration levelAtomic vector