Matrix Divide (⌹
) is a dyadic function that performs matrix division or between two arguments of rank 2 or less. Some dialects automatically apply it to rank-2 subarrays of higher-rank arguments. It shares the glyph Quad Divide ⌹
(often called Domino) with the monadic function Matrix Inverse.
Examples
The result of X⌹Y
is equal to (⌹Y)+.×X
, which is analogous to X÷Y
being equal to (÷Y)×X
. As a consequence, X≡Y+.×X⌹Y
is true for square matrices.
⎕←X←2 2⍴1 2 3 4
1 2
3 4
⎕←Y←2 2⍴5 6 7 8
5 6
7 8
X⌹Y
5 4
¯4 ¯3
(⌹Y)+.×X
5 4
¯4 ¯3
X≡Y+.×X⌹Y
1
Applications
From the properties of Moore-Penrose inverse (which Matrix Inverse uses), Matrix Divide can not only be used to solve a system of linear equations, but also to find the linear least squares solution to an overdetermined system.
The following example solves the system of equations . The answer is .
⎕←X←2 2⍴1 2 2 ¯1
1 2
2 ¯1
Y←5 8
Y⌹X
4.2 0.4
The following example solves the linear least squares over the five points . The answer is .
⎕←X←1,⍪⍳5
1 1
1 2
1 3
1 4
1 5
Y←5 1 4 2 8
Y⌹X
1.9 0.7
When used with real vectors as both arguments, Y×X⌹Y
gives the projection of X onto a basis vector Y. The remaining component of X, namely R←X-Y×X⌹Y
, is orthogonal to Y (R+.×Y
is zero).
(X Y)←(2 7)(3 1)
X⌹Y
1.3
Y×X⌹Y ⍝ Projection of X onto Y
3.9 1.3
X-Y×X⌹Y ⍝ The remaining component in X
¯1.9 5.7
⎕CT>|Y+.×X-Y×X⌹Y ⍝ ∧ is orthogonal to Y (with negligible error)
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
|