当前位置:网站首页>Matrix compression
Matrix compression
2022-06-29 00:06:00 【SVIP_ Quanw】
Matrix compression
1. Symmetric matrix compression
[ a x x x x x b x x x x x c x x x x x d x x x x x e ] \begin{bmatrix} a& x& x& x&x \\ x& b& x& x&x \\ x& x& c& x&x \\ x& x& x& d&x \\ x& x& x& x&e \end{bmatrix} ⎣⎢⎢⎢⎢⎡axxxxxbxxxxxcxxxxxdxxxxxe⎦⎥⎥⎥⎥⎤
[ a x b x x c x x x d x x x x e ] \begin{bmatrix} a& & & & \\ x& b& & & \\ x& x& c& & \\ x& x& x& d& \\ x& x& x& x&e \end{bmatrix} ⎣⎢⎢⎢⎢⎡axxxxbxxxcxxdxe⎦⎥⎥⎥⎥⎤
In a two-dimensional array a i j a_{ij} aij Subscript in one-dimensional array :
k = i ( i − 1 ) / 2 + j − 1 k=i(i-1)/2+j-1 k=i(i−1)/2+j−1
For symmetric matrices, we can save only the lower triangle ( Including elements on the diagonal ), Or upper triangular element
The number of storage units required n × n n \times n n×n Turned into ( n ( n + 1 ) / 2 ) (n(n+1)/2) (n(n+1)/2)
2. Upper and lower triangular matrix compression
2.1 Lower triangular symmetric matrix compression
about
[ a 11 a 21 a 22 a 31 a 32 a 33 a 41 a 42 a 43 a 44 a 51 a 52 a 53 a 54 a 55 ] \begin{bmatrix} a_{11}& & & & \\ a_{21}& a_{22}& & & \\ a_{31}& a_{32}& a_{33}& & \\ a_{41}& a_{42}& a_{43}& a_{44}& \\ a_{51}& a_{52}& a_{53}& a_{54}& a_{55} \end{bmatrix} ⎣⎢⎢⎢⎢⎡a11a21a31a41a51a22a32a42a52a33a43a53a44a54a55⎦⎥⎥⎥⎥⎤
take
[ a 11 . . . a i 1 . . . a i j . . . . . . a n 1 . . . a n j . . . a n n ] \begin{bmatrix} a_{11}& & & & \\ ...\\ a_{i1}& ...& a_{ij}& ...& \\ ... \\ a_{n1}& ...& a_{nj}& ...& a_{nn} \end{bmatrix} \\ ⎣⎢⎢⎢⎢⎡a11...ai1...an1......aijanj......ann⎦⎥⎥⎥⎥⎤
Turn into
[ a 11 . . . a i 1 . . . a i j . . . a n 1 . . . a n j . . . a n n ] \begin{bmatrix} a_{11}& ...& a_{i1}& ...& a_{ij}& ...& a_{n1}& ...& a_{nj}& ...& a_{nn}&\\ \end{bmatrix} \\ [a11...ai1...aij...an1...anj...ann]
Subscripts in the original matrix i , j i,j i,j, Corresponds to the subscript in the array k k k
2.2 Upper triangular symmetric matrix compression
about
[ a 11 a 12 a 13 a 14 a 22 a 23 a 24 a 33 a 34 a 44 ] \begin{bmatrix} a_{11}& a_{12}& a_{13}& a_{14}\\ & a_{22}& a_{23}& a_{24}\\ & & a_{33}& a_{34}\\ & & & a_{44}\\ \end{bmatrix} ⎣⎢⎢⎡a11a12a22a13a23a33a14a24a34a44⎦⎥⎥⎤
take
[ a 11 . . . a 1 j . . . a 1 n . . . . . . a i j . . . a i n . . . a n n ] \begin{bmatrix} a_{11}& ...& a_{1j}& ...& a_{1n}\\ & & ...& &...\\ & & a_{ij}& ...& a_{in}\\ & & & &... \\ & & & & a_{nn} \end{bmatrix} \\ ⎣⎢⎢⎢⎢⎡a11...a1j...aij......a1n...ain...ann⎦⎥⎥⎥⎥⎤
Turn into
[ a 11 . . . a 1 j . . . a 1 n . . . a i j . . . a i n . . . a n n ] \begin{bmatrix} a_{11}& ...& a_{1j}& ...& a_{1n}& ...& a_{ij}& ...& a_{in}& ...& a_{nn}&\\ \end{bmatrix} \\ [a11...a1j...a1n...aij...ain...ann]
Subscripts in the original matrix i , j i,j i,j, Corresponds to the subscript in the array k k k
namely :
k = ( i − 1 ) ( 2 n − i + 2 ) / 2 + j − i k=(i-1)(2n-i+2)/2+j-i k=(i−1)(2n−i+2)/2+j−i
2. Diagonal matrix compression
The matrix
[ a 11 a 12 0 0 0 a 21 a 22 a 23 0 0 0 a 32 a 33 a 34 0 0 0 a 43 a 44 a 45 0 0 0 a 54 a 55 ] \begin{bmatrix} a_{11}& a_{12}& 0& 0&0 \\ a_{21}& a_{22}& a_{23}&0 &0 \\ 0& a_{32}& a_{33}& a_{34}&0 \\ 0& 0& a_{43}& a_{44}& a_{45}\\ 0& 0& 0&a_{54} &a_{55} \end{bmatrix} ⎣⎢⎢⎢⎢⎡a11a21000a12a22a32000a23a33a43000a34a44a54000a45a55⎦⎥⎥⎥⎥⎤
Compressed into a one-dimensional matrix
[ a 11 a 12 a 21 a 22 a 23 a 32 a 33 a 34 a 43 a 44 a 45 a 54 a 55 ] \begin{bmatrix} a_{11}& a_{12}& a_{21}& a_{22}& a_{23}& a_{32}& a_{33}& a_{34}& a_{43}& a_{44}& a_{45}& a_{54}& a_{55} \end{bmatrix} [a11a12a21a22a23a32a33a34a43a44a45a54a55]
original n × n n \times n n×n Storage units are now just 3 n − 2 3n-2 3n−2 individual
Subscripts in the original matrix i , j i,j i,j, Corresponds to the subscript in the array k k k
namely
k = 2 i + j − 3 k=2i+j-3 k=2i+j−3
It is known that k k k:
{ i = ⌊ ( k + 1 ) / 3 ⌋ + 1 j = k − 2 i + 3 \begin{cases} i=\left \lfloor (k+1)/3 \right \rfloor+1 \\ j=k-2i+3 \end{cases} { i=⌊(k+1)/3⌋+1j=k−2i+3
边栏推荐
- stm32F407-------跑马灯、蜂鸣器
- stm32F407-------电容触摸按键
- [buuctf.reverse] 131-135
- Online yaml to JSON tool
- Notes: three ways to define setters and Getters
- Phoenix installation tutorial
- The secondary market is full of bad news. How should the market go next? One article will show you the general trend
- EditText监听焦点
- Technology sharing | software development process that you must understand if you want to get started with testing
- Three PWN questions
猜你喜欢

stm32F407-------寄存器地址名称映射分析

每日一题:移除元素

Online yaml to JSON tool
JVM底层又是如何实现synchronized的

The secondary market is full of bad news. How should the market go next? One article will show you the general trend

每日一题:消失的数字

三個pwn題
![[software analysis] iterative explanation of software analysis, design and modeling](/img/37/1163fec464aed365d1ea04e63a0c90.png)
[software analysis] iterative explanation of software analysis, design and modeling

Online yaml to JSON tool

12. object detection mask RCNN
随机推荐
[200 opencv routines] 101 adaptive median filter
Trois questions PWN
12. Détection d'objets Mask rcnn
PHP函数file_get_contents与操作系统的内存映射
stm32F407-------寄存器地址名称映射分析
The secondary market is full of bad news. How should the market go next? One article will show you the general trend
Yyds dry goods count 【 vs code work record III 】 set vs code format
Is it safe to open an account for buying stocks online?
Reading notes of English grammar new thinking Basic Edition 2 (I)
每日一题:移除元素
TypeScript --第三节:接口
SQL note 2 [MySQL]
三個pwn題
Analysis of CSRF Cross Site Request Forgery vulnerability
var、let、const 三者的区别
TypeScript -- 第六节 泛型
Yyds dry goods inventory building knowledge map from scratch with neo4j (I)
[buuctf.reverse] 131-135
Online yaml to JSON tool
stm32F407-------外部中断