File: mtx_pivot.md

package info (click to toggle)
pd-iemmatrix 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,576 kB
  • sloc: ansic: 15,440; makefile: 291; sh: 169
file content (72 lines) | stat: -rw-r--r-- 1,537 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
title: mtx_pivot
description: pivot transform a matrix
categories:
- object
pdcategory: Matrix Transformation
see_also:
inlets:
  1st:
  - type: matrix
    description: \(n\times m\) input matrix
outlets:
  1st:
  - type: matrix
    description: \(n\times m\) output matrix
  2nd:
  - type: matrix
    description: \(n\times n\) pre-multiplication matrix
  3rd:
  - type: matrix
    description: \(m\times m\) post-multiplication matrix
---

This will transform the columns and rows of the input matrix \\(X\\), so that the result \\(Y\\) will have "all" maximum values in the diagonal.
The maximum of the matrix will be located at the upper-left corner.

The first outlet is the pivot-transformed matrix.
The other outlets are the elementary matrices \\(A\\) and \\(B\\)
that have to be pre-multiplied (row-transform) resp. post-multiplied (column-tranform)
with the original matrix to get the pivot-tranformation.

$$
Y_{n\times m} = A_{n\times n} \cdot X_{n\times m} \cdot B_{m\times m}
$$

This is useful for things like de-pivoting.


## Example

$$
X_{m\times n} = \begin{pmatrix}
1 & 2 & 3 \cr
4 & 5 & 6 \cr
7 & 8 & 9 \cr
10 & 11 & 12
\end{pmatrix}
$$

$$
Y_{m\times n} = \begin{pmatrix}
12 & 11 & 10 \cr
9 & 8 & 7 \cr
6 & 5 & 4 \cr
3 & 2 & 1 
\end{pmatrix}
= \begin{pmatrix}
0 & 0 & 0 & 1 \cr
0 & 0 & 1 & 0 \cr
0 & 1 & 0 & 0 \cr
1 & 0 & 0 & 0
\end{pmatrix} \cdot \begin{pmatrix}
1 & 2 & 3 \cr
4 & 5 & 6 \cr
7 & 8 & 9 \cr
10 & 11 & 12
\end{pmatrix} \cdot \begin{pmatrix}
0 & 0 & 1 \cr
0 & 1 & 0 \cr
1 & 0 & 0
\end{pmatrix}
$$