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.
Examples
Matrix Inverse computes the ordinary inverse if the argument is a square matrix. DOMAIN ERROR is raised if the given matrix is not invertible.
⎕←M←2 2⍴3 4 4 5
3 4
4 5
⎕←R←⌹M
¯5 4
4 ¯3
R+.×M
1 0
0 1
⌹2 2⍴0
DOMAIN ERROR
⌹2 2⍴0
∧
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).
(⌹2)(⌹2J1)
0.5 0.4J¯0.2
÷2 2J1
0.5 0.4J¯0.2
(⌹3 1)(⌹2 1 1J2)
┌───────┬────────────────┐
│0.3 0.1│0.2 0.1 0.1J¯0.2│
└───────┴────────────────┘
{(+⍵)÷⍵+.×+⍵}¨ (3 1) (2 1 1J2)
┌───────┬────────────────┐
│0.3 0.1│0.2 0.1 0.1J¯0.2│
└───────┴────────────────┘
(⌹3 1)(⌹2 1 1J2) +.ר (3 1)(2 1 1J2)
1 1
⎕←M←3 2⍴1 ¯1 0J1 1 ¯1 0J1
1 ¯1
0J1 1
¯1 0J1
⎕←R←⌹M
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
R+.×M
1.0000E000J¯5.5511E¯17 0
¯2.7756E¯17J05.5511E¯17 1
External links
Lesson
Documentation
APL built-ins [edit]
|
Primitives (Timeline) |
Functions
|
Scalar
|
Monadic
|
Conjugate ∙ Negate ∙ Signum ∙ Reciprocal ∙ Magnitude ∙ Exponential ∙ Natural Logarithm ∙ Floor ∙ Ceiling ∙ Factorial ∙ Not ∙ Pi Times ∙ Roll ∙ Type ∙ Imaginary ∙ Square Root ∙ Round
|
Dyadic
|
Add ∙ Subtract ∙ Times ∙ Divide ∙ Residue ∙ Power ∙ Logarithm ∙ Minimum ∙ Maximum ∙ Binomial ∙ Comparison functions ∙ Boolean functions (And, Or, Nand, Nor) ∙ GCD ∙ LCM ∙ Circular ∙ Complex ∙ Root
|
Non-Scalar
|
Structural
|
Shape ∙ Reshape ∙ Tally ∙ Depth ∙ Ravel ∙ Enlist ∙ Table ∙ Catenate ∙ Reverse ∙ Rotate ∙ Transpose ∙ Raze ∙ Mix ∙ Split ∙ Enclose ∙ Nest ∙ Cut (K) ∙ Pair ∙ Link ∙ Partitioned Enclose ∙ Partition
|
Selection
|
First ∙ Pick ∙ Take ∙ Drop ∙ Unique ∙ Identity ∙ Stop ∙ Select ∙ Replicate ∙ Expand ∙ Set functions (Intersection ∙ Union ∙ Without) ∙ Bracket indexing ∙ Index ∙ Cartesian Product ∙ Sort
|
Selector
|
Index generator ∙ Grade ∙ Index Of ∙ Interval Index ∙ Indices ∙ Deal ∙ Prefix and suffix vectors
|
Computational
|
Match ∙ Not Match ∙ Membership ∙ Find ∙ Nub Sieve ∙ Encode ∙ Decode ∙ Matrix Inverse ∙ Matrix Divide ∙ Format ∙ Execute ∙ Materialise ∙ Range
|
Operators |
Monadic
|
Each ∙ Commute ∙ Constant ∙ Replicate ∙ Expand ∙ Reduce ∙ Windowed Reduce ∙ Scan ∙ Outer Product ∙ Key ∙ I-Beam ∙ Spawn ∙ Function axis ∙ Identity (Null, Ident)
|
Dyadic
|
Bind ∙ Compositions (Compose, Reverse Compose, Beside, Withe, Atop, Over) ∙ Inner Product ∙ Determinant ∙ Power ∙ At ∙ Under ∙ Rank ∙ Depth ∙ Variant ∙ Stencil ∙ Cut ∙ Direct definition (operator) ∙ Identity (Lev, Dex)
|
Quad names
|
Index origin ∙ Comparison tolerance ∙ Migration level ∙ Atomic vector
|