ノイズに鈍感なDMD

# 初めに
DMDの中心的な考え方は，大雑把に理解したつもりである（[こちら](https://qiita.com/ShotaDeguchi/items/28171cc8acae1d06649e)）．

DMDはノイズに敏感だと聞く．本当だろうか．どう改良するのか．

# MAIN
## Data
$\mathrm{Re} = 100$の流れに，Gaussianなノイズを加える．適当に$\sim \mathcal{N} (0, 1)$とした．なお，前回は$0.01 \ [\mathrm{s}]$毎のスナップショットを取ったが，今回は$0.1 \ [\mathrm{s}]$毎とした．

|  | $\text{Data}$ |
|:-|:-:|
| $\text{w/o noise}$ | ![wo_noise.gif](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/0d784116-759a-4063-a1d8-51d0502e6990.gif) |
| $\text{w/  noise}$ | ![w_noise.gif](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/049589f5-13f6-4066-a38c-93ded1366c4f.gif) |

## POD: Proper Orthogonal Decomposition
### w/o noise
スナップショットの撮影間隔が前回と違うので，念の為，確認しておく．

![singular_value.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/e2603614-ad72-482c-bf47-899559b23dbb.png)
![POD_mode_0.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/03231072-0a7a-4f00-9df3-4c26643e025d.png)
![POD_mode_1.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/4112c464-1b66-4aa2-8703-dae8d72b0920.png)
![POD_mode_2.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/a8b1bb36-c520-44de-8fbc-c892c83ed339.png)
![POD_mode_3.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/c1df9752-1721-4b6f-9ddc-527c507cd5e0.png)
![POD_mode_4.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/bd1a96c7-84ae-4076-92af-9dea7e72ecfa.png)
![POD_mode_5.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/315e154d-be3d-4c7b-b64e-6d7b8c35d116.png)
![POD_mode_6.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/14911784-4b36-494f-8911-25dba6295e70.png)
![POD_mode_7.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/f349a86a-f649-47cd-9eef-c817daea8201.png)
![POD_mode_8.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/8503e8fa-22dd-4340-8db9-8e6fbfba0e74.png)
![POD_mode_9.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/7f94879e-48be-404c-a255-6c48cb3b2c88.png)
![POD_mode_10.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/9ea93711-da5e-4ddc-baf2-a1e5276ce44d.png)
![POD_mode_11.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/0345cf7d-f8c4-48b2-8c04-0c5615d894df.png)
![POD_mode_12.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/b0f3307e-437a-49d3-87d0-00459ddd0a66.png)
![POD_mode_13.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/76fa8bde-3712-40d7-8d74-76288775a76d.png)
![POD_mode_14.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/941f38d3-2cb2-4a85-9784-860b9a111ddf.png)
![POD_mode_15.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/0ac2aee4-75a0-48bd-80a8-8459f04474af.png)
![POD_mode_16.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/1ed05482-b6a3-4561-b465-97ae6983182b.png)
![POD_mode_17.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/8f031235-9618-4b5a-8ff5-da04c2ffb703.png)
![POD_mode_18.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/be501330-ae3d-4b27-b29c-03346883f92e.png)
![POD_mode_19.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/5ae36305-2d87-42eb-9848-3f300a60f1de.png)

時間モードの解像能が違うが，殆ど同じような挙動をしている．

### w/ noise
ノイズが入ると，かなりのモードが影響を受ける．本当に少しだけのleading modeが存在し，その後ひどくplateauしている．

![singular_value.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/5db76775-83bd-4570-8986-c80586bcbc58.png)
![POD_mode_0.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/4d048672-58e4-4cb2-a23f-0635dbdc8971.png)
![POD_mode_1.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/3eee3b30-db7b-4924-baaf-7ce34fa15630.png)
![POD_mode_2.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/93dd50ec-b149-4683-b552-290f4726f593.png)
![POD_mode_3.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/13380f3e-f072-4ebe-a1e2-cf9d7adadfbd.png)
![POD_mode_4.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/5d30fc40-8283-41ef-82c7-e92972216c86.png)
![POD_mode_5.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/8a1c34fd-eab6-4cb7-9870-dcf0fcd3c635.png)
![POD_mode_6.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/3ac256be-1184-47eb-98a4-168a92efc51c.png)
![POD_mode_7.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/c4987886-c95c-45e2-852f-d83809590a85.png)
![POD_mode_8.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/b7f37a69-10e0-443c-ba8f-210ba95411a5.png)
![POD_mode_9.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/e00b3d75-56a6-44e4-8827-d15015fc440f.png)
![POD_mode_10.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/0be16884-5f5e-48ac-a06e-f60c8ef770cf.png)
![POD_mode_11.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/5c22a15b-e8a1-4c84-ada8-74c4bde41e59.png)
![POD_mode_12.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/bd7a65b9-4f06-469c-8960-f5bd8b4975b3.png)
![POD_mode_13.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/c3bb8c92-8d8f-4c1e-9dde-1d08d32f3aec.png)
![POD_mode_14.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/15ef259a-9695-4d17-bab9-aaaac5825e47.png)
![POD_mode_15.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/ffb58ee3-2245-483d-b2d3-66478bb9cfdb.png)
![POD_mode_16.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/d19e3ed2-e23d-4156-88c6-6917f6f7cb66.png)
![POD_mode_17.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/d12bba34-2a9a-4041-9a0d-7e1832a34176.png)
![POD_mode_18.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/8cacb69f-f63f-4c2c-a5b8-b53d664a99d1.png)
![POD_mode_19.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/54eba7ed-1b70-4101-a87a-cc9bb2c609b3.png)

平均場とほんの幾つかのleading modeを除けば，殆どがノイズに支配されている．ノイズのことをエネルギーと解釈してしまっている．PODはノイズに敏感と言えるだろう．

![singular_value.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/0b638271-a4aa-4a45-9a8a-aaf6c60ebe3d.png)
![singular_value.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/648c0d94-35d8-4133-aa43-1a1221fd2f27.png)
![singular_value.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/5a8a0319-1490-49db-afb3-d95d814198a3.png)
![singular_value.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/578f1e57-3faf-462d-bda5-b2e53e5c2f26.png)

## DMD: Dynamic Mode Decomposition
### w/o noise
前回も実施したが，是非に何度でも．

![eigenvals.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/b4180a7c-6f9b-4a0c-9810-433b142976c3.png)
![DMD_mode_0.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/4de4cd44-be11-4deb-bac5-bca762dc728a.png)
![DMD_mode_1.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/2e330f18-1f45-4651-9108-ad04e7511cb7.png)
![DMD_mode_2.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/1d416781-0792-418a-87f9-370813a7345e.png)
![DMD_mode_3.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/0d0f8571-bf7a-424c-93b8-1ee97bf23b6d.png)
![DMD_mode_4.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/c217ec44-ad02-45d8-888c-9ae60f72f2ec.png)
![DMD_mode_5.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/f8e71b56-6627-4981-ba92-15b0b4bfd53f.png)
![DMD_mode_6.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/1acdd1af-d15d-4ec8-8dc1-a9df6d267be8.png)
![DMD_mode_7.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/1b372f37-aab4-4f9f-8381-6e0a3dcfb8f7.png)
![DMD_mode_8.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/ea291e92-37b6-49a7-95ad-4c262ab38562.png)

mode 7, 8を除けば，殆どがunityであり，エネルギーを保存している．

### w/ noise
$\sim \mathcal{N} (0, 1)$だけのノイズを加えるとどうなるか？

![eigenvals.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/30d5eb38-81dc-4c4b-8f58-064edecad23c.png)
![DMD_mode_0.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/2c71418d-4894-4217-b641-787f7d27f9aa.png)
![DMD_mode_1.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/1e797afd-5cf3-496b-afc1-4ebcefb20d8f.png)
![DMD_mode_2.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/300fac3f-f814-4ba7-9b34-57a5ed8f12ca.png)
![DMD_mode_3.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/fba183e8-3168-477a-8ec4-1137f743203d.png)
![DMD_mode_4.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/78e8c819-f25e-43ec-be94-dddfad5180cb.png)
![DMD_mode_5.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/20703282-a6c8-493d-b615-3cf67cf84681.png)
![DMD_mode_6.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/7753ce34-16e3-4579-ba53-b9d266079665.png)
![DMD_mode_7.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/a6bd1425-4d45-4e4e-b534-1c0db724990f.png)
![DMD_mode_8.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/77fb39fd-7f46-41fa-9fc3-fbedeb37ef5b.png)

固有値はunit circle上に留まるはずだが（そうあってほしいが），内側に押し込まれている．エネルギーが減衰している．

<!---
## TLS-DMD: Total Least-Squares DMD
多分，沢山あるのだろうが，どうやらこれが一番浸透しているようなので，これだけ考える．
[Dawson2016](https://doi.org/10.1007/s00348-016-2127-7)
[Hemati2017](https://doi.org/10.1007/s00162-017-0432-2)
--->

## piDMD: physics-informed DMD
[Baddoo2023](https://doi.org/10.1098/rspa.2022.0576)による．

### w/o noise
先ずは，ノイズを入れずに．

![eigenvals.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/825a01d8-c655-4104-9165-e1c97684268c.png)
![DMD_mode_0.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/c478efa5-5e21-43dd-b5e2-0928bb3e2281.png)
![DMD_mode_1.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/942afe0b-4a32-4d0f-a0b2-a5840f9f577d.png)
![DMD_mode_2.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/25f369de-4f99-427b-9354-44109be64a6b.png)
![DMD_mode_3.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/7938783b-b7c8-49c6-ad6e-7a192df0990e.png)
![DMD_mode_4.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/b635493d-a06b-4585-b20f-3963f83a97fa.png)
![DMD_mode_5.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/a97f72fb-59f2-4c6c-aaab-c19253813260.png)
![DMD_mode_6.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/ee11b250-a135-4196-bdfd-96eb41d19d56.png)
![DMD_mode_7.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/5d8904d0-efc2-4f82-917b-200203410126.png)
![DMD_mode_8.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/cc0215c7-4fd3-49f5-8665-70c584d00084.png)

素朴なDMDと殆ど同じだが，特にmode 7-8は，より保存性が良い．

### w/ noise
ノイズを入れるとどれくらい劣化するか？

![eigenvals.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/e02d67f8-38d5-4d6f-9118-fecba262a682.png)
![DMD_mode_0.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/31074f62-5557-442c-8c36-6381d0804202.png)
![DMD_mode_1.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/144085d4-f992-4ddc-bcac-136817691955.png)
![DMD_mode_2.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/eaa91db7-43df-472e-933a-6664a4a9adc6.png)
![DMD_mode_3.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/b69b6af2-3048-4f17-92a5-d7b1f46e961a.png)
![DMD_mode_4.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/9017b897-15c1-4c89-b7ea-1bd6ed083e28.png)
![DMD_mode_5.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/6107eef5-80c3-4eb1-870a-8d3dd0dd8539.png)
![DMD_mode_6.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/541a61f6-ced5-4e9e-9837-0d6074af2724.png)
![DMD_mode_7.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/22e26ef7-43b5-4001-9dd1-036d94474555.png)
![DMD_mode_8.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/acd710ec-c635-4260-9fb6-329d0c2ec6cf.png)

驚くべき結果である．

### w/ stronger noise
何処まで耐えるか．

![eigenvals.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/5410ed6b-5f41-48cb-a74b-a7ce98bc2287.png)
![eigenvals.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/3a062b11-6716-45e3-a057-3b86412e7886.png)
![eigenvals.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/82ca4998-42b8-4579-a353-86b1ff651200.png)
![eigenvals.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/e5f22c32-7503-4658-ac30-f6ac74cc9332.png)

なお驚くべき結果である．但し，固有ベクトルには多大なノイズが残ったことを強調しておく．

# 終わりに
探索するMatrix Manifoldを積極的に制約している．

# Misc
こういうのに適用するとどうなるだろうか？なんて思ったが，尾が長いだけだろう．

![45_degrees.gif](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2529612/b7fe71d8-9f89-40da-943c-cbf81d8395be.gif)