Skip to content
Related Articles

Related Articles

Improve Article

Python – scipy.fft.idctn() method

  • Last Updated : 01 Oct, 2020

With the help of scipy.fft.idctn() method, we can compute the inverse of multidimensional discrete cosine transform by selecting different types of sequences and return the transformed array by using this method.

Syntax :

scipy.fft.idctn(x, type=2)

Return value: It will return the transformed array.

Example #1: In this example, we can see that by using scipy.fft.idctn() method, we are able to get the inverse of multidimensional discrete cosine transform by selecting different types of sequences by default it’s 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)

Output :

[[-0.27264259  0.12356192  0.12133914]
 [ 0.00835797  0.11993761 -0.12110712]
 [ 0.09770593 -0.14543749 -0.01109258]]

Example #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)

Output :

[[ 0.1430296   0.09689253]
 [ 0.00632705  0.24546606]
 [-0.26553743  0.01931002]
 [-0.07106229 -0.02292552]]

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course




My Personal Notes arrow_drop_up
Recommended Articles
Page :