本文簡要介紹 python 語言中 scipy.linalg.dft
的用法。
用法:
scipy.linalg.dft(n, scale=None)#
離散傅裏葉變換矩陣。
創建計算序列 [1] 的離散傅立葉變換的矩陣。用於生成矩陣的第 n 個原始單位根是 exp(-2*pi*i/n),其中 i = sqrt(-1)。
- n: int
調整要創建的矩陣的大小。
- scale: str,可選
必須為“無”、‘sqrtn’ 或‘n’。如果比例為‘sqrtn’,則矩陣除以 sqrt(n)。如果比例為‘n’,則矩陣除以 n。如果scale為None(默認值),則矩陣不會標準化,並且返回值隻是單位根的Vandermonde矩陣。
- m: (n, n) 數組
DFT 矩陣。
參數 ::
返回 ::
注意:
什麽時候規模為無,將向量乘以返回的矩陣
dft
在數學上等同於(但效率遠低於)由scipy.fft.fft.參考:
[1]“DFT matrix”、https://en.wikipedia.org/wiki/DFT_matrix
例子:
>>> import numpy as np >>> from scipy.linalg import dft >>> np.set_printoptions(precision=2, suppress=True) # for compact output >>> m = dft(5) >>> m array([[ 1. +0.j , 1. +0.j , 1. +0.j , 1. +0.j , 1. +0.j ], [ 1. +0.j , 0.31-0.95j, -0.81-0.59j, -0.81+0.59j, 0.31+0.95j], [ 1. +0.j , -0.81-0.59j, 0.31+0.95j, 0.31-0.95j, -0.81+0.59j], [ 1. +0.j , -0.81+0.59j, 0.31-0.95j, 0.31+0.95j, -0.81-0.59j], [ 1. +0.j , 0.31+0.95j, -0.81+0.59j, -0.81-0.59j, 0.31-0.95j]]) >>> x = np.array([1, 2, 3, 0, 3]) >>> m @ x # Compute the DFT of x array([ 9. +0.j , 0.12-0.81j, -2.12+3.44j, -2.12-3.44j, 0.12+0.81j])
驗證
m @ x
是否與fft(x)
相同。>>> from scipy.fft import fft >>> fft(x) # Same result as m @ x array([ 9. +0.j , 0.12-0.81j, -2.12+3.44j, -2.12-3.44j, 0.12+0.81j])
相關用法
- Python SciPy linalg.det用法及代碼示例
- Python SciPy linalg.diagsvd用法及代碼示例
- Python SciPy linalg.eigvalsh_tridiagonal用法及代碼示例
- Python SciPy linalg.cdf2rdf用法及代碼示例
- Python SciPy linalg.LaplacianNd用法及代碼示例
- Python SciPy linalg.solve_circulant用法及代碼示例
- Python SciPy linalg.polar用法及代碼示例
- Python SciPy linalg.clarkson_woodruff_transform用法及代碼示例
- Python SciPy linalg.rsf2csf用法及代碼示例
- Python SciPy linalg.hessenberg用法及代碼示例
- Python SciPy linalg.tril用法及代碼示例
- Python SciPy linalg.triu用法及代碼示例
- Python SciPy linalg.svd用法及代碼示例
- Python SciPy linalg.ishermitian用法及代碼示例
- Python SciPy linalg.invhilbert用法及代碼示例
- Python SciPy linalg.factorized用法及代碼示例
- Python SciPy linalg.lu_factor用法及代碼示例
- Python SciPy linalg.SuperLU用法及代碼示例
- Python SciPy linalg.lsqr用法及代碼示例
- Python SciPy linalg.cho_factor用法及代碼示例
- Python SciPy linalg.fractional_matrix_power用法及代碼示例
- Python SciPy linalg.eig_banded用法及代碼示例
- Python SciPy linalg.tanhm用法及代碼示例
- Python SciPy linalg.orthogonal_procrustes用法及代碼示例
- Python SciPy linalg.use_solver用法及代碼示例
注:本文由純淨天空篩選整理自scipy.org大神的英文原創作品 scipy.linalg.dft。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。