Difference between revisions of "Matrix Inverse"

From APL Wiki
Jump to navigation Jump to search
Line 1: Line 1:
{{Built-in|Matrix Inverse|⌹}} is a [[monadic function]] that returns the [[wikipedia:matrix inverse|inverse]] of the [[simple]] numeric array of [[rank]] 2 or lower. It shares the [[glyph]] <source lang=apl inline>⌹</source> with the dyadic function [[Matrix Divide]].
{{Built-in|Matrix Inverse|⌹}} is a [[monadic function]] that returns the [[wikipedia:matrix inverse|inverse]] of the [[simple]] numeric array of [[rank]] 2 or lower. It shares the [[glyph]] ''Quad Divide'' <source lang=apl inline>⌹</source> (often called ''Domino'') with the dyadic function [[Matrix Divide]].
== Examples ==
== Examples ==

Revision as of 08:27, 10 June 2020

Matrix Inverse () is a monadic function that returns the inverse of the simple numeric array of rank 2 or lower. It shares the glyph Quad Divide (often called Domino) with the dyadic function Matrix Divide.


Matrix Inverse computes the ordinary inverse if the argument is a square matrix. DOMAIN ERROR is raised if the given matrix is not invertible.

      M2 23 4 4 5
3 4
4 5
¯5  4
 4 ¯3
1 0
0 1
      2 20
 2 20     

When the argument is a scalar or vector, or the given matrix has more rows than columns (r>c where r c≡⍴X), Matrix Inverse computes specific forms of generalized inverse called Moore-Penrose inverse. For a scalar, the result is the reciprocal of the argument; for a vector, the result equals (+X)÷X+.×+X. For a non-square matrix, the result equals (+⍉X)(+⍉X)+.×X (where +⍉X is the conjugate transpose of X).

0.5 0.4J¯0.2
      ÷2 2J1
0.5 0.4J¯0.2

      (3 1)(2 1 1J2)
0.3 0.10.2 0.1 0.1J¯0.2
      {(+)÷+.×+}¨ (3 1) (2 1 1J2)
0.3 0.10.2 0.1 0.1J¯0.2
      (3 1)(2 1 1J2) +.ר (3 1)(2 1 1J2)
1 1

      M3 21 ¯1 0J1 1 ¯1 0J1
 1   ¯1  
 0J1  1  
¯1    0J1
 0.5J¯0.5 0.25J¯0.25 ¯0.25J¯0.25
¯0.5J¯0.5 0.25J¯0.25 ¯0.25J¯0.25
      R{(+⍉)(+⍉)+.×} M
 1.0000E000J¯5.5511E¯17 0
¯2.7756E¯17J05.5511E¯17 1

External links



APL built-ins [edit]
Primitive functions
Monadic ConjugateNegateSignumReciprocalMagnitudeExponentialNatural LogarithmFloorCeilingFactorialNotPi TimesRollTypeImaginarySquare Root
Dyadic AddSubtractTimesDivideResiduePowerLogarithmMinimumMaximumBinomialComparison functionsBoolean functions (And, Or, Nand, Nor) ∙ GCDLCMCircularComplexRoot
Structural ShapeReshapeTallyDepthRavelEnlistTableCatenateReverseRotateTransposeRazeMixSplitEncloseNestCut (K)PairLinkPartitioned EnclosePartition
Selection FirstPickTakeDropUniqueIdentitySelectReplicateExpandSet functions (IntersectionUnionWithout) ∙ Bracket indexingIndex
Selector Index generatorGradeIndex OfInterval IndexIndicesDeal
Computational MatchNot MatchMembershipFindNub SieveEncodeDecodeMatrix InverseMatrix DivideFormatExecuteMaterialiseRange
Primitive operators Monadic EachCommuteConstantReplicateExpandReduceWindowed ReduceScanOuter ProductKeyI-beamSpawnFunction axis
Dyadic BindCompositions (Compose, Reverse Compose, Beside, Atop, Over) ∙ Inner ProductPowerAtUnderRankDepthVariantStencilCut (J)
Quad names
Arrays Index originMigration levelAtomic vector
Functions Name classCase convertUnicode convert
Operators SearchReplace