Promote

From APL Wiki
(Redirected from Increase rank)
Jump to navigation Jump to search

Promote is a monadic function that adds a length-1 axis to its argument before the other axes, resulting in an array with rank one higher. It appears as a primitive in Kap (<, "increase rank") and Dyalog APL Vision (), as well as J (,:, "Itemize"), BQN (, "Solo"), and Uiua (¤, "Fix"). In J and BQN it's paired with the related dyadic primitive Laminate. The K primitive Enlist (,), which creates a length-1 list containing its argument, can also be interpreted as Promote because depth and rank are equivalent in the list model of arrays.

For an argument A, promote can be implemented with Ravel with axis as ,[⎕IO-0.5] A, with Reshape as (1,⍴A) ⍴ A, or with Outer Product as (⍳1) ∘.⊢ A. The choice to add an axis at the beginning is based on leading axis theory, as this allows the axis to be placed in any other position using the Rank operator.

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