借助於scipy.fft.idctn()方法,我們可以通過選擇不同類型的序列來計算多維離散餘弦變換的逆值,並使用此方法返回變換後的數組。
用法:
scipy.fft.idctn(x, type=2)
返回值:它將返回轉換後的數組。
範例1:在此示例中,我們可以看到,通過使用scipy.fft.idctn()方法,我們可以通過默認選擇不同類型的序列來獲得多維離散餘弦變換的逆函數(即2)。
Python3
# import scipy and numpy
from scipy import fft
import numpy as np
array_gfg = np.random.randn(3, 3)
# Using scipy.fft.idctn() method
gfg = fft.idctn(array_gfg)
print(gfg)
輸出:
[[-0.27264259 0.12356192 0.12133914] [ 0.00835797 0.11993761 -0.12110712] [ 0.09770593 -0.14543749 -0.01109258]]
範例2:
Python3
# import scipy and numpy
from scipy import fft
import numpy as np
array_gfg = np.random.randn(4, 2)
# Using scipy.fft.idctn() method
gfg = fft.idctn(array_gfg, 4)
print(gfg)
輸出:
[[ 0.1430296 0.09689253] [ 0.00632705 0.24546606] [-0.26553743 0.01931002] [-0.07106229 -0.02292552]]
相關用法
- Python os._exit()用法及代碼示例
- Python os.WEXITSTATUS()用法及代碼示例
- Python os.abort()用法及代碼示例
- Python os.renames()用法及代碼示例
- Python os.lseek()用法及代碼示例
- Python calendar formatmonth()用法及代碼示例
- Python PyTorch sin()用法及代碼示例
- Python Sympy Line.is_parallel()用法及代碼示例
- Python PIL GaussianBlur()用法及代碼示例
- Python range()用法及代碼示例
- Python Numpy np.hermefit()用法及代碼示例
- Python Numpy np.hermevander()用法及代碼示例
注:本文由純淨天空篩選整理自Jitender_1998大神的英文原創作品 Python – scipy.fft.idctn() method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。