当前位置:网站首页>矩 阵 压 缩
矩 阵 压 缩
2022-06-28 23:59:00 【SVIP_Quanw】
1. 对称矩阵压缩
[ 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⎦⎥⎥⎥⎥⎤
二维数组中 a i j a_{ij} aij在一维数组中的下标:
k = i ( i − 1 ) / 2 + j − 1 k=i(i-1)/2+j-1 k=i(i−1)/2+j−1
对于对称矩阵我们可以只保存下三角(包括对角线上的元素),或上三角的元素
原来需要的存储单元个数 n × n n \times n n×n 变成了 ( n ( n + 1 ) / 2 ) (n(n+1)/2) (n(n+1)/2)
2. 上下三角矩阵压缩
2.1 下三角对称矩阵压缩
对于
[ 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⎦⎥⎥⎥⎥⎤
将
[ 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⎦⎥⎥⎥⎥⎤
转化为
[ 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]
原矩阵中的下标 i , j i,j i,j,对应于数组中的下标 k k k
2.2 上三角对称矩阵压缩
对于
[ 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⎦⎥⎥⎤
将
[ 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⎦⎥⎥⎥⎥⎤
转化为
[ 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]
原矩阵中的下标 i , j i,j i,j,对应于数组中的下标 k k k
即:
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. 对角矩阵压缩
将矩阵
[ 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⎦⎥⎥⎥⎥⎤
压缩为一维矩阵
[ 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]
原来 n × n n \times n n×n个存储单元现在只要 3 n − 2 3n-2 3n−2个
原矩阵中的下标 i , j i,j i,j,对应于数组中的下标 k k k
即
k = 2 i + j − 3 k=2i+j-3 k=2i+j−3
已知 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
边栏推荐
- Is the compass stock software reliable? Is it safe to trade stocks on it?
- Typescript -- Section 6 generic
- [C Prime plus chapitre II Questions de programmation après la Classe]
- The second session of question swiping and clock out activity -- solving the switching problem with recursion as the background (2)
- oracle 去掉html标签
- Stm32f407 ------ clock system (systeminit clock initialization, systick tick timer)
- EditText监听焦点
- stm32F407-------通用定时器
- What will be done after digital IC Verification?
- The second session of question swiping and clock out activity -- solving the switching problem with recursion as the background (III)
猜你喜欢

LeetCode每日一题:实现strStr()

【软件分析】软件分析、设计与建模迭代式详解

stm32F407-------时钟系统(SystemInit时钟初始化、Systick滴答定时器)

ERROR 1067 (42000): Invalid default value for ‘end_ time‘ Mysql

一条update语句到底加了多少锁?带你深入理解底层原理

The company has a new Post-00 test paper king. The old oilman said that he could not do it. He has been
![[machine learning] numerical analysis 02 -- finding roots of arbitrary equations](/img/fd/ec82a50017e692ac90f6e8739b28d3.jpg)
[machine learning] numerical analysis 02 -- finding roots of arbitrary equations

ctfshow XSS

小白创业做电商,选对商城系统很重要!

Don't ask me how to do UI automation test again
随机推荐
websocket-js连接如何携带token验证
ERROR 1067 (42000): Invalid default value for ‘end_ time‘ Mysql
Trois questions PWN
小白创业做电商,选对商城系统很重要!
Typescript-- section 4: Functions
Is it safe and reliable to open a securities account in Yixue school?
TypeScript--第五节:类
[C Primer Plus Chapter II after class programming questions]
TypeScript--第四节:函数
How many locks are added to an update statement? Take you to understand the underlying principles
【LeetCode】21. Merge two ordered linked lists - go language solution
What are the virtual machine software? What are their respective roles?
[Electronic Experiment 2] simple electronic doorbell
Is it reliable and safe to avoid five in case of stock trading account opening
With notes: re understanding else if
stm32F407-------跑马灯、蜂鸣器
转载:VTK笔记-裁剪分割-三维曲线或几何切割体数据(黑山老妖)
This thing is called a jump watch?
Stm32f407 ------ running lamp and buzzer
Give you a project, how will you carry out performance testing (I)