[Scipy-svn] r5490 - trunk/scipy/fftpack

scipy-svn@scip... scipy-svn@scip...
Sun Jan 18 05:26:53 CST 2009


Author: cdavid
Date: 2009-01-18 05:26:47 -0600 (Sun, 18 Jan 2009)
New Revision: 5490

Modified:
   trunk/scipy/fftpack/fftpack.pyf
   trunk/scipy/fftpack/realtransforms.py
Log:
Handle single precision DCT.

Modified: trunk/scipy/fftpack/fftpack.pyf
===================================================================
--- trunk/scipy/fftpack/fftpack.pyf	2009-01-18 11:26:28 UTC (rev 5489)
+++ trunk/scipy/fftpack/fftpack.pyf	2009-01-18 11:26:47 UTC (rev 5490)
@@ -196,6 +196,28 @@
          integer optional,intent(c,in) :: normalize = 0
        end subroutine ddct3
 
+       subroutine dct2(x,n,howmany,normalize)
+         ! y = dct2(x[,n,normalize,overwrite_x])
+         intent(c) dct2
+         real*4 intent(c,in,out,copy,out=y) :: x(*)
+         integer optional,depend(x),intent(c,in) :: n=size(x)
+         check(n>0&&n<=size(x)) n
+         integer depend(x,n),intent(c,hide) :: howmany = size(x)/n
+         check(n*howmany==size(x)) howmany
+         integer optional,intent(c,in) :: normalize = 0
+       end subroutine dct2
+
+       subroutine dct3(x,n,howmany,normalize)
+         ! y = dct3(x[,n,normalize,overwrite_x])
+         intent(c) dct3
+         real*4 intent(c,in,out,copy,out=y) :: x(*)
+         integer optional,depend(x),intent(c,in) :: n=size(x)
+         check(n>0&&n<=size(x)) n
+         integer depend(x,n),intent(c,hide) :: howmany = size(x)/n
+         check(n*howmany==size(x)) howmany
+         integer optional,intent(c,in) :: normalize = 0
+       end subroutine dct3
+
        subroutine destroy_ddct2_cache()
          intent(c) destroy_ddct2_cache
        end subroutine destroy_ddct2_cache
@@ -204,6 +226,14 @@
          intent(c) destroy_ddct1_cache
        end subroutine destroy_ddct1_cache
 
+       subroutine destroy_dct2_cache()
+         intent(c) destroy_dct2_cache
+       end subroutine destroy_dct2_cache
+
+       subroutine destroy_dct1_cache()
+         intent(c) destroy_dct1_cache
+       end subroutine destroy_dct1_cache
+
     end interface 
 end python module _fftpack
 

Modified: trunk/scipy/fftpack/realtransforms.py
===================================================================
--- trunk/scipy/fftpack/realtransforms.py	2009-01-18 11:26:28 UTC (rev 5489)
+++ trunk/scipy/fftpack/realtransforms.py	2009-01-18 11:26:47 UTC (rev 5490)
@@ -155,14 +155,26 @@
     else:
         raise NotImplemented("Padding/truncating not yet implemented")
 
-    if type == 1:
-        f = _fftpack.ddct1
-    elif type == 2:
-        f = _fftpack.ddct2
-    elif type == 3:
-        f = _fftpack.ddct3
+    if tmp.dtype == np.double:
+        if type == 1:
+            f = _fftpack.ddct1
+        elif type == 2:
+            f = _fftpack.ddct2
+        elif type == 3:
+            f = _fftpack.ddct3
+        else:
+            raise ValueError("Type %d not understood" % type)
+    elif tmp.dtype == np.float32:
+        if type == 1:
+            f = _fftpack.dct1
+        elif type == 2:
+            f = _fftpack.dct2
+        elif type == 3:
+            f = _fftpack.dct3
+        else:
+            raise ValueError("Type %d not understood" % type)
     else:
-        raise ValueError("Type %d not understood" % type)
+        raise ValueError("dtype %s not supported" % tmp.dtype)
 
     if normalize:
         if normalize == "ortho":



More information about the Scipy-svn mailing list