[선형대수] Lecture 26: Complex matrices; fast fourier transform

이재호·2025년 3월 20일

선형대수

목록 보기
25/31

https://ocw.mit.edu/courses/18-06-linear-algebra-spring-2010/video_galleries/video-lectures/

이번 강의에서는 다음 내용을 배운다.

  • Complex vectors, matrices 의 inner product , length
  • (Fast) Fourier Transform

우선 complex (복소수) vector 를 다뤄보자.

z=[z1z2...zn], (zi : complex number)z=\begin{bmatrix} z_1 \\ z_2 \\ ... \\ z_n \end{bmatrix}, \ (\text{$z_i$ : complex number})

위 벡터 complex vector zz 의 length 는 몇일까? 실수 벡터처럼 zTzz^Tz 로 구하면 될까?
다음 예시를 보자.

z1=[1i]z_1=\begin{bmatrix} 1 \\ i \end{bmatrix}
z1Tz1=[1i][1i]=1+i2=0z_1^Tz_1= \begin{bmatrix} 1 & i \end{bmatrix} \begin{bmatrix} 1 \\ i \end{bmatrix} = 1 + i^2 =0

길이는 0보다 커야 하는데 위와 같이 zTzz^Tz 로 연산할 경우 길이가 0이 나오는 모순이 발생한다.
따라서 conjugate 를 적용하여 zˉTz\bar z ^T z 로 연산하여야 길이를 구할 수 있다.

zˉ1Tz1=[1i][1i]=1i2=2\bar z_1^Tz_1= \begin{bmatrix} 1 & -i \end{bmatrix} \begin{bmatrix} 1 \\ i \end{bmatrix} = 1 - i^2 =2

그리고 zˉT\bar z^T 대신에 zHz^H 로 표기한다. ( H : Hermition )

따라서 다음과 같이 정리가 가능하다.

zHz=length of zz^Hz=length \ of \ z
yˉT=yH\bar y^T=y^H

그렇다면 이를 Symmetric matrix 와 Perpendicular matrix 에도 적용해보자.

1. Symmetric matrix (AT=A)\text{1. Symmetric matrix ($A^T=A$)}
AT=AAH=AA^T=A \to A^H=A
ex. [23+i3i5]\text{ex. } \begin{bmatrix} 2 & 3+i \\ 3-i & 5 \\ \end{bmatrix}

2. Perpendicular matrix (Qq1,q2,...,qn)\text{2. Perpendicular matrix ($Q$, $q_1,q_2,...,q_n$)}
qiHqj={0,if ij1,if i=jq_i^Hq_j = \begin{cases} 0, & \text{if } i \ne j \\ 1, & \text{if } i = j \end{cases}
Q=[...q1...qn...]Q= \begin{bmatrix} | & ... & | \\ q_1 & ... & q_n \\ | & ... & | \\ \end{bmatrix}
QHQ=IQ^HQ=I

다음으로 Fourier matrix 에 대해서 알아보자.

Fourier matrix Fn\text{Fourier matrix $F_n$}
Fn=[111...11ww2...wn11w2w4...w2(n1)...............1wn1w2(n1)...w(n1)2]F_n=\begin{bmatrix} 1 & 1 & 1 & ... & 1 \\ 1 & w & w^2 & ... & w^{n-1} \\ 1 & w^2 & w^4 & ... & w^{2(n-1)} \\ ... & ... & ... & ... & ... \\ 1 & w^{n-1} & w^{2(n-1)} & ... & w^{(n-1)^2} \\ \end{bmatrix}
(Fn)ij=wij (i,j=0,1,...,n1)(F_n)_{ij}=w^{ij} \ (i,j=0,1,...,n-1)
wn=1w^n=1
w=e2π×in=cos2πn+i×sin2πnw=e^{\frac{2\pi \times i}{n}} = \cos \frac{2 \pi}{n}+i\times\sin \frac{2\pi}{n}

그리고 위 ww 를 그래프로 그리면 다음과 같다.

그렇다면 만약 n=4n=4 라면 어떨까?

F4=[11111ii2i31i2i4i61i3i6i9]=[11111i1i11111i1i]F_4=\begin{bmatrix} 1 & 1 & 1 & 1 \\ 1 & i & i^2 & i^3 \\ 1 & i^2 & i^4 & i^6 \\ 1 & i^3 & i^6 & i^9 \\ \end{bmatrix} = \begin{bmatrix} 1 & 1 & 1 & 1 \\ 1 & i & -1 & -i \\ 1 & -1 & 1 & -1 \\ 1 & -i & -1 & i \\ \end{bmatrix}
w4=1,w=e2π×i4w^4=1, w=e^{\frac{2\pi\times i}{4}}

즉, F4=[11111i1i11111i1i]F_4=\begin{bmatrix} 1 & 1 & 1 & 1 \\ 1 & i & -1 & -i \\ 1 & -1 & 1 & -1 \\ 1 & -i & -1 & i \\ \end{bmatrix} 는 위와 같은 그래프로 그릴 수 있으며, orthogonal matrix 라는 것을 알 수 있다.

ex. col2Hcol4=1+i2+1+i2=0\text{ex. } col_2^Hcol_4=1+i^2+1+i^2=0

그리고 모든 벡터의 길이가 2인 것을 알 수 있으며, 다음과 같이 표기가 가능하다.

F4=12[11111i1i11111i1i]orthonomalF_4=\frac{1}{2}\underbrace{\begin{bmatrix} 1 & 1 & 1 & 1 \\ 1 & i & -1 & -i \\ 1 & -1 & 1 & -1 \\ 1 & -i & -1 & i \\ \end{bmatrix}}_{\text{orthonomal}}
F4HF4=IF_4^HF_4=I

이제 Fast Fourier Transform 에 대해서 알아보자.
우선 Fourier Matrix FnF_n 을 계산하려면 총 n2n^2 만큼의 연산이 필요하다. 하지만 Fast Fourier Transform 을 이용하면 이 연산을 n2logn\frac{n}{2}\log n 까지 줄일 수 있다.
다음을 보자.

wn=e2π×inw_n=e^{\frac{2\pi \times i}{n}}
(wn)2=e2π×i×2n=e2π×in2=wn2(w_n)^2=e^{\frac{2\pi \times i\times 2}{n}}=e^{\frac{2\pi \times i}{\frac{n}{2}}} = w_{\frac{n}{2}}
[F64]=[ID32ID32][F3200F32][1.........1.........11.........1.........1]Permutations P\begin{bmatrix} F_{64} \end{bmatrix} = \begin{bmatrix} I & D_{32} \\ I & -D_{32} \\ \end{bmatrix} \begin{bmatrix} F_{32} & 0 \\ 0 & F_{32} \\ \end{bmatrix} \underbrace{ \begin{bmatrix} 1 & ... & ...\\ ... & 1 & ...\\ ... & ... & 1\\ 1 & ... & ...\\ ... & 1 & ...\\ ... & ... & 1 \\ \end{bmatrix}}_{\text{Permutations P}}
D32=[1...............w1...............w2.................................w31]D_{32}=\begin{bmatrix} 1 & ... & ... & ... & ...\\ ... & w^1 & ... & ... & ...\\ ... & ... & w^2 & ... & ...\\ ... & ... & ... & ... & ...\\ ... & ... & ... & ... & w^{31}\\ \end{bmatrix}

따라서 다음과 같이 해석이 가능하다.

  • F64F_{64} 의 cost : 64264^2
  • F32F_{32} 의 cost : 32232^2
  • D32D_{32} 의 cost : 3232
  • 따라서 6422(322)+3264^2\to 2(32^2)+32 로 연산을 줄일 수 있다.

따라서 계속 이어서 연산을 진행하면,

F64F32F16...F1F_{64}\to F_{32} \to F_{16} \to ... \to F_1

와 같고,
연산 비용은 다음과 같을 것이다.

6422(322)+322[(16)2+16]+32...6×32=log64×64264^2\to2(32^2)+32\to2[(16)^2+16]+32\to...\to6\times32=\log 64 \times \frac{64}{2}

따라서 Fast Fourier Transform 을 통해,
FnF_n 의 연산을 n2logn×n2n^2\to \log n \times \frac{n}{2} 까지 줄일 수 있다.

profile
천천히, 그리고 꾸준히.

0개의 댓글