From scipy-svn at scipy.org Fri Jan 2 02:52:50 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 2 Jan 2009 01:52:50 -0600 (CST) Subject: [Scipy-svn] r5316 - trunk/scipy/special/tests Message-ID: <20090102075250.9F2D4C7C019@scipy.org> Author: cdavid Date: 2009-01-02 01:52:43 -0600 (Fri, 02 Jan 2009) New Revision: 5316 Modified: trunk/scipy/special/tests/test_basic.py Log: Add regression test for #834. Modified: trunk/scipy/special/tests/test_basic.py =================================================================== --- trunk/scipy/special/tests/test_basic.py 2009-01-01 01:12:34 UTC (rev 5315) +++ trunk/scipy/special/tests/test_basic.py 2009-01-02 07:52:43 UTC (rev 5316) @@ -128,6 +128,11 @@ cephes.expi(1) def test_expn(self): cephes.expn(1,1) + def test_exp1_reg(self): + # Regression for #834 + a = cephes.exp1(-complex(19.9999990)) + b = cephes.exp1(-complex(19.9999991)) + assert_array_almost_equal(a.imag, b.imag) def test_exp10(self): assert_approx_equal(cephes.exp10(2),100.0) From scipy-svn at scipy.org Fri Jan 2 02:53:04 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 2 Jan 2009 01:53:04 -0600 (CST) Subject: [Scipy-svn] r5317 - trunk/scipy/special/specfun Message-ID: <20090102075304.0FCD4C7C019@scipy.org> Author: cdavid Date: 2009-01-02 01:53:00 -0600 (Fri, 02 Jan 2009) New Revision: 5317 Modified: trunk/scipy/special/specfun/specfun.f Log: BUG: fix #834 (by R. Kern). Modified: trunk/scipy/special/specfun/specfun.f =================================================================== --- trunk/scipy/special/specfun/specfun.f 2009-01-02 07:52:43 UTC (rev 5316) +++ trunk/scipy/special/specfun/specfun.f 2009-01-02 07:53:00 UTC (rev 5317) @@ -9016,7 +9016,7 @@ C ==================================================== C IMPLICIT COMPLEX*16 (C,Z) - IMPLICIT DOUBLE PRECISION (D-H,O-Y) + IMPLICIT DOUBLE PRECISION (A,D-H,O-Y) PI=3.141592653589793D0 EL=0.5772156649015328D0 X=DBLE(Z) From scipy-svn at scipy.org Sun Jan 4 06:23:31 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 4 Jan 2009 05:23:31 -0600 (CST) Subject: [Scipy-svn] r5318 - trunk Message-ID: <20090104112331.C6D68C7C029@scipy.org> Author: cdavid Date: 2009-01-04 05:23:24 -0600 (Sun, 04 Jan 2009) New Revision: 5318 Modified: trunk/MANIFEST.in Log: Add scons scripts to sdist. Modified: trunk/MANIFEST.in =================================================================== --- trunk/MANIFEST.in 2009-01-02 07:53:00 UTC (rev 5317) +++ trunk/MANIFEST.in 2009-01-04 11:23:24 UTC (rev 5318) @@ -8,10 +8,8 @@ include setupegg.py include setup.py include scipy/*.py -## Adding scons build relateed files not found by distutils -#recursive-include numpy/core/code_generators *.py -#include numpy/core/include/numpy/numpyconfig.h.in -#recursive-include numpy SConstruct +# Adding scons build relateed files not found by distutils +recursive-include scipy SConstruct SConscript # Add documentation: we don't use add_data_dir since we do not want to include # this at installation, only for sdist-generated tarballs include doc/Makefile doc/postprocess.py From scipy-svn at scipy.org Sun Jan 4 06:23:46 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 4 Jan 2009 05:23:46 -0600 (CST) Subject: [Scipy-svn] r5319 - trunk/scipy/optimize Message-ID: <20090104112346.6315CC7C029@scipy.org> Author: cdavid Date: 2009-01-04 05:23:42 -0600 (Sun, 04 Jan 2009) New Revision: 5319 Modified: trunk/scipy/optimize/SConscript Log: Remove a .txt file in minpack sources for scons build; should have never been there in the first place. Modified: trunk/scipy/optimize/SConscript =================================================================== --- trunk/scipy/optimize/SConscript 2009-01-04 11:23:24 UTC (rev 5318) +++ trunk/scipy/optimize/SConscript 2009-01-04 11:23:42 UTC (rev 5319) @@ -1,4 +1,4 @@ -# Last Change: Thu Jun 12 07:00 PM 2008 J +# Last Change: Sun Jan 04 07:00 PM 2009 J # vim:syntax=python import os @@ -43,7 +43,7 @@ minpack_src = [pjoin("minpack", s) for s in ["chkder.f", "dogleg.f", "dpmpar.f", "enorm.f", "fdjac1.f", "fdjac2.f", "hybrd.f", "hybrd1.f", "hybrj.f", "hybrj1.f", "lmder.f", "lmder1.f", "lmdif.f", "lmdif1.f", "lmpar.f", -"lmstr.f", "lmstr1.f", "minpack.txt", "qform.f", "qrfac.f", "qrsolv.f", +"lmstr.f", "lmstr1.f", "qform.f", "qrfac.f", "qrsolv.f", "r1mpyq.f", "r1updt.f", "rwupdt.f"]] env.DistutilsStaticExtLibrary('minpack', source = minpack_src) From scipy-svn at scipy.org Sun Jan 4 06:24:01 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 4 Jan 2009 05:24:01 -0600 (CST) Subject: [Scipy-svn] r5320 - trunk/scipy/weave Message-ID: <20090104112401.B4CB1C7C029@scipy.org> Author: cdavid Date: 2009-01-04 05:23:56 -0600 (Sun, 04 Jan 2009) New Revision: 5320 Modified: trunk/scipy/weave/build_tools.py trunk/scipy/weave/platform_info.py Log: Do not use popen* in weave anymore. Modified: trunk/scipy/weave/build_tools.py =================================================================== --- trunk/scipy/weave/build_tools.py 2009-01-04 11:23:42 UTC (rev 5319) +++ trunk/scipy/weave/build_tools.py 2009-01-04 11:23:56 UTC (rev 5320) @@ -23,6 +23,7 @@ import tempfile import exceptions import commands +import subprocess import platform_info @@ -341,11 +342,11 @@ Does this return correct value on win98??? """ result = 0 - cmd = '%s -v' % name + cmd = [str(name), '-v'] try: - w,r=os.popen4(cmd) - w.close() - str_result = r.read() + p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, close_fds=True) + str_result = p.stdout.read() #print str_result if 'Reading specs' in str_result: result = 1 @@ -362,9 +363,9 @@ """ result = 0 try: - w,r=os.popen4('cl') - w.close() - str_result = r.read() + p = subprocess.Popen(['cl'], shell=True, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, close_fds=True) + str_result = p.stdout.read() #print str_result if 'Microsoft' in str_result: result = 1 @@ -379,9 +380,9 @@ if os.name == 'nt': def run_command(command): """ not sure how to get exit status on nt. """ - in_pipe,out_pipe = os.popen4(command) - in_pipe.close() - text = out_pipe.read() + p = subprocess.Popen(['cl'], shell=True, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, close_fds=True) + text = p.stdout.read() return 0, text else: run_command = commands.getstatusoutput @@ -457,9 +458,9 @@ # get_versions methods regex if self.gcc_version is None: import re - out = os.popen('gcc' + ' -dumpversion','r') - out_string = out.read() - out.close() + p = subprocess.Popen(['gcc', ' -dumpversion']. shell=True, + stdout=subprocess.PIPE, close_fds=True) + out_string = p.stdout.read() result = re.search('(\d+\.\d+)',out_string) if result: self.gcc_version = StrictVersion(result.group(1)) Modified: trunk/scipy/weave/platform_info.py =================================================================== --- trunk/scipy/weave/platform_info.py 2009-01-04 11:23:42 UTC (rev 5319) +++ trunk/scipy/weave/platform_info.py 2009-01-04 11:23:56 UTC (rev 5320) @@ -5,7 +5,7 @@ multiple platforms share the same file system. """ -import os, sys +import os, sys, subprocess import distutils from distutils.sysconfig import customize_compiler @@ -169,9 +169,9 @@ result = 0 cmd = '%s -v' % name try: - w,r=os.popen4(cmd) - w.close() - str_result = r.read() + p = subprocess.Popen([str(name), '-v'], shell=True, close_fds=True, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + str_result = p.stdout.read() if 'Reading specs' in str_result: result = 1 except: @@ -187,9 +187,9 @@ """ result = 0 try: - w,r=os.popen4('cl') - w.close() - str_result = r.read() + p = subprocess.Popen(['cl'], shell=True, close_fds=True, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + str_result = p.stdout.read() if 'Microsoft' in str_result: result = 1 except: From scipy-svn at scipy.org Sun Jan 4 07:30:00 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 4 Jan 2009 06:30:00 -0600 (CST) Subject: [Scipy-svn] r5321 - trunk/scipy/weave Message-ID: <20090104123000.1DBAAC7C029@scipy.org> Author: stefan Date: 2009-01-04 06:29:39 -0600 (Sun, 04 Jan 2009) New Revision: 5321 Added: trunk/scipy/weave/md5_load.py Modified: trunk/scipy/weave/accelerate_tools.py trunk/scipy/weave/catalog.py trunk/scipy/weave/platform_info.py Log: Provide a version-agnostic md5 loader. Modified: trunk/scipy/weave/accelerate_tools.py =================================================================== --- trunk/scipy/weave/accelerate_tools.py 2009-01-04 11:23:56 UTC (rev 5320) +++ trunk/scipy/weave/accelerate_tools.py 2009-01-04 12:29:39 UTC (rev 5321) @@ -11,7 +11,7 @@ from types import InstanceType, XRangeType import inspect -import md5 +import scipy.weave.md5_load as md5 import scipy.weave as weave from bytecodecompiler import CXXCoder,Type_Descriptor,Function_Descriptor Modified: trunk/scipy/weave/catalog.py =================================================================== --- trunk/scipy/weave/catalog.py 2009-01-04 11:23:56 UTC (rev 5320) +++ trunk/scipy/weave/catalog.py 2009-01-04 12:29:39 UTC (rev 5321) @@ -86,7 +86,7 @@ Something that was a little more human readable would be nice, but the computer doesn't seem to care. """ - import md5 + import scipy.weave.md5_load as md5 base = 'sc_' return base + md5.new(expr).hexdigest() Added: trunk/scipy/weave/md5_load.py =================================================================== --- trunk/scipy/weave/md5_load.py 2009-01-04 11:23:56 UTC (rev 5320) +++ trunk/scipy/weave/md5_load.py 2009-01-04 12:29:39 UTC (rev 5321) @@ -0,0 +1,10 @@ +# Import correct md5, irrespective of the Python version +# +# `hashlib` was introduced in 2.5, deprecating `md5` + +try: + from hashlib import * +except ImportError: + from md5 import * + +new = md5 Modified: trunk/scipy/weave/platform_info.py =================================================================== --- trunk/scipy/weave/platform_info.py 2009-01-04 11:23:56 UTC (rev 5320) +++ trunk/scipy/weave/platform_info.py 2009-01-04 12:29:39 UTC (rev 5321) @@ -88,8 +88,7 @@ return exe_path def check_sum(file): - - import md5 + import scipy.weave.md5_load as md5 try: f = open(file,'r') bytes = f.read(-1) From scipy-svn at scipy.org Sun Jan 4 07:51:58 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 4 Jan 2009 06:51:58 -0600 (CST) Subject: [Scipy-svn] r5322 - trunk/scipy/cluster/tests Message-ID: <20090104125158.81CA2C7C029@scipy.org> Author: jarrod.millman Date: 2009-01-04 06:51:57 -0600 (Sun, 04 Jan 2009) New Revision: 5322 Modified: trunk/scipy/cluster/tests/test_hierarchy.py trunk/scipy/cluster/tests/vq_test.py Log: less verbose tests Modified: trunk/scipy/cluster/tests/test_hierarchy.py =================================================================== --- trunk/scipy/cluster/tests/test_hierarchy.py 2009-01-04 12:29:39 UTC (rev 5321) +++ trunk/scipy/cluster/tests/test_hierarchy.py 2009-01-04 12:51:57 UTC (rev 5322) @@ -152,7 +152,7 @@ Zmlab = eo['linkage-Q-single'] eps = 1e-06 expectedZ = from_mlab_linkage(Zmlab) - print abs(Z-expectedZ).max() + #print abs(Z-expectedZ).max() self.failUnless(within_tol(Z, expectedZ, eps)) def test_linkage_complete_q(self): @@ -162,7 +162,7 @@ Zmlab = eo['linkage-Q-complete'] eps = 1e-07 expectedZ = from_mlab_linkage(Zmlab) - print abs(Z-expectedZ).max() + #print abs(Z-expectedZ).max() self.failUnless(within_tol(Z, expectedZ, eps)) def test_linkage_centroid_q(self): @@ -172,7 +172,7 @@ Zmlab = eo['linkage-Q-centroid'] eps = 1e-07 expectedZ = from_mlab_linkage(Zmlab) - print abs(Z-expectedZ).max() + #print abs(Z-expectedZ).max() self.failUnless(within_tol(Z, expectedZ, eps)) def test_linkage_weighted_q(self): @@ -182,7 +182,7 @@ Zmlab = eo['linkage-Q-weighted'] eps = 1e-07 expectedZ = from_mlab_linkage(Zmlab) - print abs(Z-expectedZ).max() + #print abs(Z-expectedZ).max() self.failUnless(within_tol(Z, expectedZ, eps)) class TestInconsistent(TestCase): @@ -194,7 +194,7 @@ R = inconsistent(Z, 1) Rright = eo['inconsistent-single-tdist-depth-1'] eps = 1e-15 - print np.abs(R - Rright).max() + #print np.abs(R - Rright).max() self.failUnless(within_tol(R, Rright, eps)) def test_single_inconsistent_tdist_2(self): @@ -204,7 +204,7 @@ R = inconsistent(Z, 2) Rright = eo['inconsistent-single-tdist-depth-2'] eps = 1e-05 - print np.abs(R - Rright).max() + #print np.abs(R - Rright).max() self.failUnless(within_tol(R, Rright, eps)) def test_single_inconsistent_tdist_3(self): @@ -214,7 +214,7 @@ R = inconsistent(Z, 3) Rright = eo['inconsistent-single-tdist-depth-3'] eps = 1e-05 - print np.abs(R - Rright).max() + #print np.abs(R - Rright).max() self.failUnless(within_tol(R, Rright, eps)) def test_single_inconsistent_tdist_4(self): @@ -224,7 +224,7 @@ R = inconsistent(Z, 4) Rright = eo['inconsistent-single-tdist-depth-4'] eps = 1e-05 - print np.abs(R - Rright).max() + #print np.abs(R - Rright).max() self.failUnless(within_tol(R, Rright, eps)) # with complete linkage... @@ -236,7 +236,7 @@ R = inconsistent(Z, 1) Rright = eo['inconsistent-complete-tdist-depth-1'] eps = 1e-15 - print np.abs(R - Rright).max() + #print np.abs(R - Rright).max() self.failUnless(within_tol(R, Rright, eps)) def test_complete_inconsistent_tdist_2(self): @@ -246,7 +246,7 @@ R = inconsistent(Z, 2) Rright = eo['inconsistent-complete-tdist-depth-2'] eps = 1e-05 - print np.abs(R - Rright).max() + #print np.abs(R - Rright).max() self.failUnless(within_tol(R, Rright, eps)) def test_complete_inconsistent_tdist_3(self): @@ -256,7 +256,7 @@ R = inconsistent(Z, 3) Rright = eo['inconsistent-complete-tdist-depth-3'] eps = 1e-05 - print np.abs(R - Rright).max() + #print np.abs(R - Rright).max() self.failUnless(within_tol(R, Rright, eps)) def test_complete_inconsistent_tdist_4(self): @@ -266,7 +266,7 @@ R = inconsistent(Z, 4) Rright = eo['inconsistent-complete-tdist-depth-4'] eps = 1e-05 - print np.abs(R - Rright).max() + #print np.abs(R - Rright).max() self.failUnless(within_tol(R, Rright, eps)) # with single linkage and Q data set @@ -278,7 +278,7 @@ R = inconsistent(Z, 1) Rright = eo['inconsistent-Q-single-1'] eps = 1e-06 - print np.abs(R - Rright).max() + #print np.abs(R - Rright).max() self.failUnless(within_tol(R, Rright, eps)) def test_single_inconsistent_Q_2(self): @@ -288,7 +288,7 @@ R = inconsistent(Z, 2) Rright = eo['inconsistent-Q-single-2'] eps = 1e-06 - print np.abs(R - Rright).max() + #print np.abs(R - Rright).max() self.failUnless(within_tol(R, Rright, eps)) def test_single_inconsistent_Q_3(self): @@ -298,7 +298,7 @@ R = inconsistent(Z, 3) Rright = eo['inconsistent-Q-single-3'] eps = 1e-05 - print np.abs(R - Rright).max() + #print np.abs(R - Rright).max() self.failUnless(within_tol(R, Rright, eps)) def test_single_inconsistent_Q_4(self): @@ -308,7 +308,7 @@ R = inconsistent(Z, 4) Rright = eo['inconsistent-Q-single-4'] eps = 1e-05 - print np.abs(R - Rright).max() + #print np.abs(R - Rright).max() self.failUnless(within_tol(R, Rright, eps)) class TestCopheneticDistance(TestCase): @@ -357,7 +357,7 @@ [ 6., 9., 295., 6.]], dtype=np.double) ZS = from_mlab_linkage(Z) - print expectedZS, ZS + #print expectedZS, ZS self.failUnless((expectedZS == ZS).all()) @@ -387,7 +387,7 @@ [ 6., 9., 295., 6.]], dtype=np.double) ZM = to_mlab_linkage(Z) - print expectedZM, ZM + #print expectedZM, ZM self.failUnless((expectedZM == ZM).all()) class TestFcluster(TestCase): @@ -450,7 +450,7 @@ T = fcluster(Z, criterion='maxclust', t=3) Lright = (np.array([53, 55, 56]), np.array([2, 3, 1])) L = leaders(Z, T) - print L, Lright, T + #print L, Lright, T self.failUnless((L[0] == Lright[0]).all() and (L[1] == Lright[1]).all()) class TestIsIsomorphic(TestCase): @@ -1397,7 +1397,7 @@ n = Z.shape[0] + 1 B = np.zeros((n-1,)) q = np.zeros((3,)) - print R.shape + #print R.shape for i in xrange(0, n - 1): q[:] = 0.0 left = Z[i, 0] Modified: trunk/scipy/cluster/tests/vq_test.py =================================================================== --- trunk/scipy/cluster/tests/vq_test.py 2009-01-04 12:29:39 UTC (rev 5321) +++ trunk/scipy/cluster/tests/vq_test.py 2009-01-04 12:51:57 UTC (rev 5322) @@ -6,21 +6,21 @@ t1 = time.time() codes1,dist1 = vq.vq(all_data,code_book) t2 = time.time() - print 'fast (double):', t2 - t1 - print ' first codes:', codes1[:5] - print ' first dist:', dist1[:5] - print ' last codes:', codes1[-5:] - print ' last dist:', dist1[-5:] + #print 'fast (double):', t2 - t1 + #print ' first codes:', codes1[:5] + #print ' first dist:', dist1[:5] + #print ' last codes:', codes1[-5:] + #print ' last dist:', dist1[-5:] float_obs = all_data.astype(np.float32) float_code = code_book.astype(np.float32) t1 = time.time() codes1,dist1 = vq.vq(float_obs,float_code) t2 = time.time() - print 'fast (float):', t2 - t1 - print ' first codes:', codes1[:5] - print ' first dist:', dist1[:5] - print ' last codes:', codes1[-5:] - print ' last dist:', dist1[-5:] + #print 'fast (float):', t2 - t1 + #print ' first codes:', codes1[:5] + #print ' first dist:', dist1[:5] + #print ' last codes:', codes1[-5:] + #print ' last dist:', dist1[-5:] return codes1,dist1 From scipy-svn at scipy.org Sun Jan 4 08:26:18 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 4 Jan 2009 07:26:18 -0600 (CST) Subject: [Scipy-svn] r5323 - trunk/scipy/weave Message-ID: <20090104132618.6815AC7C029@scipy.org> Author: jarrod.millman Date: 2009-01-04 07:26:17 -0600 (Sun, 04 Jan 2009) New Revision: 5323 Modified: trunk/scipy/weave/build_tools.py Log: typo Modified: trunk/scipy/weave/build_tools.py =================================================================== --- trunk/scipy/weave/build_tools.py 2009-01-04 12:51:57 UTC (rev 5322) +++ trunk/scipy/weave/build_tools.py 2009-01-04 13:26:17 UTC (rev 5323) @@ -458,7 +458,7 @@ # get_versions methods regex if self.gcc_version is None: import re - p = subprocess.Popen(['gcc', ' -dumpversion']. shell=True, + p = subprocess.Popen(['gcc', ' -dumpversion'], shell=True, stdout=subprocess.PIPE, close_fds=True) out_string = p.stdout.read() result = re.search('(\d+\.\d+)',out_string) From scipy-svn at scipy.org Sun Jan 4 09:21:05 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 4 Jan 2009 08:21:05 -0600 (CST) Subject: [Scipy-svn] r5324 - trunk/scipy/weave/tests Message-ID: <20090104142105.AF496C7C029@scipy.org> Author: stefan Date: 2009-01-04 08:20:49 -0600 (Sun, 04 Jan 2009) New Revision: 5324 Modified: trunk/scipy/weave/tests/test_ast_tools.py trunk/scipy/weave/tests/test_blitz_tools.py trunk/scipy/weave/tests/test_ext_tools.py trunk/scipy/weave/tests/test_slice_handler.py Log: Use assert_equal instead of the more verbose print_assert_equal. Modified: trunk/scipy/weave/tests/test_ast_tools.py =================================================================== --- trunk/scipy/weave/tests/test_ast_tools.py 2009-01-04 13:26:17 UTC (rev 5323) +++ trunk/scipy/weave/tests/test_ast_tools.py 2009-01-04 14:20:49 UTC (rev 5324) @@ -11,7 +11,7 @@ import parser ast_list = parser.suite(expr).tolist() actual = ast_tools.harvest_variables(ast_list) - print_assert_equal(expr,actual,desired) + assert_equal(expr,actual,desired) def test_simple_expr(self): """convert simple expr to blitz Modified: trunk/scipy/weave/tests/test_blitz_tools.py =================================================================== --- trunk/scipy/weave/tests/test_blitz_tools.py 2009-01-04 13:26:17 UTC (rev 5323) +++ trunk/scipy/weave/tests/test_blitz_tools.py 2009-01-04 14:20:49 UTC (rev 5324) @@ -20,7 +20,7 @@ actual = blitz_tools.ast_to_blitz_expr(ast_list) actual = remove_whitespace(actual) desired = remove_whitespace(desired) - print_assert_equal(expr,actual,desired) + assert_equal(expr,actual,desired) def test_simple_expr(self): """convert simple expr to blitz Modified: trunk/scipy/weave/tests/test_ext_tools.py =================================================================== --- trunk/scipy/weave/tests/test_ext_tools.py 2009-01-04 13:26:17 UTC (rev 5323) +++ trunk/scipy/weave/tests/test_ext_tools.py 2009-01-04 14:20:49 UTC (rev 5324) @@ -133,7 +133,7 @@ cd.name, cd.var_type = 'c', types.IntType desired = [ad,bd,cd] expr = "" - print_assert_equal(expr,actual,desired) + assert_equal(expr,actual,desired) if __name__ == "__main__": nose.run(argv=['', __file__]) Modified: trunk/scipy/weave/tests/test_slice_handler.py =================================================================== --- trunk/scipy/weave/tests/test_slice_handler.py 2009-01-04 13:26:17 UTC (rev 5323) +++ trunk/scipy/weave/tests/test_slice_handler.py 2009-01-04 14:20:49 UTC (rev 5324) @@ -9,7 +9,7 @@ pos = slice_vars['pos'] ast_list = slice_handler.build_slice_atom(slice_vars,pos) actual = ast_to_string(ast_list) - print_assert_equal('',actual,desired) + assert_equal('',actual,desired) def test_exclusive_end(self): slice_vars = {'begin':'1', 'end':'2', 'step':'_stp', 'single_index':'_index','pos':0} @@ -24,7 +24,7 @@ found, data = find_first_pattern(ast_tuple,indexed_array_pattern) subscript = data['subscript_list'][1] #[0] is symbol, [1] is the supscript actual = slice_handler.slice_ast_to_dict(subscript) - print_assert_equal(suite_string,actual,desired) + assert_equal(suite_string,actual,desired) def test_empty_2_slice(self): """match slice from a[:]""" @@ -126,7 +126,7 @@ # but differently formatted string will compare equally actual = replace_whitespace(actual) desired = replace_whitespace(desired) - print_assert_equal(suite_string,actual,desired) + assert_equal(suite_string,actual,desired) def test_simple_expr(self): """transform a[:] to slice notation""" From scipy-svn at scipy.org Sun Jan 4 11:19:33 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 4 Jan 2009 10:19:33 -0600 (CST) Subject: [Scipy-svn] r5325 - trunk/scipy/stats/tests Message-ID: <20090104161933.49778C7C02C@scipy.org> Author: stefan Date: 2009-01-04 10:19:18 -0600 (Sun, 04 Jan 2009) New Revision: 5325 Modified: trunk/scipy/stats/tests/test_stats.py Log: Refactor percentileofscore tests. Modified: trunk/scipy/stats/tests/test_stats.py =================================================================== --- trunk/scipy/stats/tests/test_stats.py 2009-01-04 14:20:49 UTC (rev 5324) +++ trunk/scipy/stats/tests/test_stats.py 2009-01-04 16:19:18 UTC (rev 5325) @@ -903,60 +903,102 @@ assert_array_almost_equal(p, self.P1_2) def test_scoreatpercentile(): - assert_equal(stats.scoreatpercentile(range(10),50),4.5) - assert_equal(stats.scoreatpercentile(range(10),50,(2,7)),4.5) - assert_equal(stats.scoreatpercentile(range(100),50,(1,8)),4.5) - assert_equal(stats.scoreatpercentile(np.array([1, 10 ,100]),50,(10,100)), 55) - assert_equal(stats.scoreatpercentile(np.array([1, 10 ,100]),50,(1,10)), 5.5) + assert_equal(stats.scoreatpercentile(range(10), 50), 4.5) + assert_equal(stats.scoreatpercentile(range(10), 50, (2,7)), 4.5) + assert_equal(stats.scoreatpercentile(range(100), 50, (1,8)), 4.5) + assert_equal(stats.scoreatpercentile(np.array([1, 10 ,100]), + 50, (10,100)), + 55) + assert_equal(stats.scoreatpercentile(np.array([1, 10 ,100]), + 50, (1,10)), + 5.5) + def test_percentileofscore(): - assert_equal(stats.percentileofscore([1,2,3,4,5,6,7,8,9,10],4),40.0) - assert_equal(stats.percentileofscore([1,2,3,4,5,6,7,8,9,10],4,kind = 'mean'),35.0) - assert_equal(stats.percentileofscore([1,2,3,4,5,6,7,8,9,10],4,kind = 'strict'),30.0) - assert_equal(stats.percentileofscore([1,2,3,4,5,6,7,8,9,10],4,kind = 'weak'),40.0) + pcos = stats.percentileofscore + + assert_equal(pcos([1,2,3,4,5,6,7,8,9,10],4), 40.0) + + for (kind, result) in [('mean', 35.0), + ('strict', 30.0), + ('weak', 40.0)]: + yield assert_equal, pcos(np.arange(10) + 1, + 4, kind=kind), \ + result + # multiple - 2 - assert_equal(stats.percentileofscore([1,2,3,4,4,5,6,7,8,9],4,kind = 'rank'),45.0) - assert_equal(stats.percentileofscore([1,2,3,4,4,5,6,7,8,9],4,kind = 'strict'),30.0) - assert_equal(stats.percentileofscore([1,2,3,4,4,5,6,7,8,9],4,kind = 'weak'),50.0) - assert_equal(stats.percentileofscore([1,2,3,4,4,5,6,7,8,9],4,kind = 'mean'),40.0) + for (kind, result) in [('rank', 45.0), + ('strict', 30.0), + ('weak', 50.0), + ('mean', 40.0)]: + yield assert_equal, pcos([1,2,3,4,4,5,6,7,8,9], + 4, kind=kind), \ + result + # multiple - 3 - assert_equal(stats.percentileofscore([1,2,3,4,4,4,5,6,7,8],4),50.0) - assert_equal(stats.percentileofscore([1,2,3,4,4,4,5,6,7,8],4,kind = 'rank'),50.0) - assert_equal(stats.percentileofscore([1,2,3,4,4,4,5,6,7,8],4,kind = 'mean'),45.0) - assert_equal(stats.percentileofscore([1,2,3,4,4,4,5,6,7,8],4,kind = 'strict'),30.0) - assert_equal(stats.percentileofscore([1,2,3,4,4,4,5,6,7,8],4,kind = 'weak'),60.0) + assert_equal(pcos([1,2,3,4,4,4,5,6,7,8], 4), 50.0) + for (kind, result) in [('rank', 50.0), + ('mean', 45.0), + ('strict', 30.0), + ('weak', 60.0)]: + + yield assert_equal, pcos([1,2,3,4,4,4,5,6,7,8], + 4, kind=kind), \ + result + # missing - assert_equal(stats.percentileofscore([1,2,3,5,6,7,8,9,10,11],4,kind = 'rank'),30.0) - assert_equal(stats.percentileofscore([1,2,3,5,6,7,8,9,10,11],4,kind = 'mean'),30.0) - assert_equal(stats.percentileofscore([1,2,3,5,6,7,8,9,10,11],4,kind = 'strict'),30.0) - assert_equal(stats.percentileofscore([1,2,3,5,6,7,8,9,10,11],4,kind = 'weak'),30.0) + for kind in ('rank', 'mean', 'strict', 'weak'): + yield assert_equal, pcos([1,2,3,5,6,7,8,9,10,11], + 4, kind=kind), \ + 30 + #larger numbers - assert_equal(stats.percentileofscore([10,20,30,40,50,60,70,80,90,100],40,kind = 'mean'),35.0) - assert_equal(stats.percentileofscore([10,20,30,40,50,60,70,80,90,100],40,kind = 'strict'),30.0) - assert_equal(stats.percentileofscore([10,20,30,40,50,60,70,80,90,100],40,kind = 'weak'),40.0) - assert_equal(stats.percentileofscore([10,20,30,40,40,40,50,60,70,80],40,kind = 'mean'),45.0) - assert_equal(stats.percentileofscore([10,20,30,40,40,40,50,60,70,80],40,kind = 'strict'),30.0) - assert_equal(stats.percentileofscore([10,20,30,40,40,40,50,60,70,80],40,kind = 'weak'),60.0) - assert_equal(stats.percentileofscore([ 10,20,30,50,60,70,80,90,100,110],40,kind = 'rank'),30.0) - assert_equal(stats.percentileofscore([ 10,20,30,50,60,70,80,90,100,110],40,kind = 'mean'),30.0) - assert_equal(stats.percentileofscore([ 10,20,30,50,60,70,80,90,100,110],40,kind = 'strict'),30.0) - assert_equal(stats.percentileofscore([ 10,20,30,50,60,70,80,90,100,110],40,kind = 'weak'),30.0) + for (kind, result) in [('mean', 35.0), + ('strict', 30.0), + ('weak', 40.0)]: + yield assert_equal, \ + pcos([10, 20, 30, 40, 50, 60, 70, 80, 90, 100], 40, + kind=kind), result + + for (kind, result) in [('mean', 45.0), + ('strict', 30.0), + ('weak', 60.0)]: + yield assert_equal, \ + pcos([10, 20, 30, 40, 40, 40, 50, 60, 70, 80], + 40, kind=kind), result + + + for kind in ('rank', 'mean', 'strict', 'weak'): + yield assert_equal, \ + pcos([10, 20, 30, 50, 60, 70, 80, 90, 100, 110], + 40, kind=kind), 30.0 + #boundaries - assert_equal(stats.percentileofscore([ 10,20,30,50,60,70,80,90,100,110],10,kind = 'rank'),10.0) - assert_equal(stats.percentileofscore([ 10,20,30,50,60,70,80,90,100,110],10,kind = 'mean'),5.0) - assert_equal(stats.percentileofscore([ 10,20,30,50,60,70,80,90,100,110],10,kind = 'strict'),0.0) - assert_equal(stats.percentileofscore([ 10,20,30,50,60,70,80,90,100,110],10,kind = 'weak'),10.0) - assert_equal(stats.percentileofscore([ 10,20,30,50,60,70,80,90,100,110],110),100.0) - assert_equal(stats.percentileofscore([ 10,20,30,50,60,70,80,90,100,110],110,kind = 'mean'),95.0) - assert_equal(stats.percentileofscore([ 10,20,30,50,60,70,80,90,100,110],110,kind = 'strict'),90.0) - assert_equal(stats.percentileofscore([ 10,20,30,50,60,70,80,90,100,110],110,kind = 'weak'),100.0) + for (kind, result) in [('rank', 10.0), + ('mean', 5.0), + ('strict', 0.0), + ('weak', 10.0)]: + yield assert_equal, \ + pcos([10, 20, 30, 50, 60, 70, 80, 90, 100, 110], + 10, kind=kind), result + + for (kind, result) in [('rank', 100.0), + ('mean', 95.0), + ('strict', 90.0), + ('weak', 100.0)]: + yield assert_equal, \ + pcos([10, 20, 30, 50, 60, 70, 80, 90, 100, 110], + 110, kind=kind), result + #out of bounds - assert_equal(stats.percentileofscore([ 10,20,30,50,60,70,80,90,100,110],200,kind = 'rank'),100.0) - assert_equal(stats.percentileofscore([ 10,20,30,50,60,70,80,90,100,110],200,kind = 'mean'),100.0) - assert_equal(stats.percentileofscore([ 10,20,30,50,60,70,80,90,100,110],0,kind = 'mean'),0.0) + for (kind, score, result) in [('rank', 200, 100.0), + ('mean', 200, 100.0), + ('mean', 0, 0.0)]: + yield assert_equal, \ + pcos([10, 20, 30, 50, 60, 70, 80, 90, 100, 110], + score, kind=kind), result - def test_friedmanchisquare(): # see ticket:113 # verified with matlab and R From scipy-svn at scipy.org Sun Jan 4 11:20:07 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 4 Jan 2009 10:20:07 -0600 (CST) Subject: [Scipy-svn] r5326 - trunk/scipy/stats Message-ID: <20090104162007.AC61BC7C02C@scipy.org> Author: stefan Date: 2009-01-04 10:19:54 -0600 (Sun, 04 Jan 2009) New Revision: 5326 Modified: trunk/scipy/stats/stats.py Log: Clean up percentileofscore docstring and space according to PEP8. Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2009-01-04 16:19:18 UTC (rev 5325) +++ trunk/scipy/stats/stats.py 2009-01-04 16:19:54 UTC (rev 5326) @@ -1025,165 +1025,93 @@ return _interpolate(values[int(idx)], values[int(idx) + 1], idx % 1) -def percentileofscore(a, score, kind = 'rank' ): +def percentileofscore(a, score, kind='rank'): ''' - The percentile rank of a score relative to a list of scores a. + The percentile rank of a score relative to a list of scores. - A percentileofscore of for example 80% means that 80% of the scores in a - are below the given score. In the case of gaps or ties, the exact - definition depends on the optional kind: + A `percentileofscore` of, for example, 80% means that 80% of the + scores in `a` are below the given score. In the case of gaps or + ties, the exact definition depends on the optional keyword, `kind`. - "rank": average percentage ranking of score - "weak": This kind corresponds to the definition of a cumulative - distribution function, and means that 80% have a score lower - or equal to the given score - "strict": A percentileofscore of 80% means that 80% have a strictly - lower score - "mean": is the average score between "weak" and "strict" and is used in - testing - see: http://en.wikipedia.org/wiki/Percentile_rank - - Parameters ---------- a: array like - list or array of scores to which score is compared + Array of scores to which `score` is compared. score: int or float - score that is compared with elements in a - kind: kind/type of percentile - 'rank' (default): average percentile ranks of score - 'weak': percent of elements in a smaller or equal to score - 'strict': percent of elements in a strictly smaller than to score - 'mean': average score between 'weak' and 'strict' + Score that is compared to the elements in `a`. + kind: {'rank', 'weak', 'strict', 'mean'}, optional + This optional parameter specifies the interpretation of the + resulting score: + - "rank": Average percentage ranking of score. In case of + multiple matches, average the percentage rankings of + all matching scores. + - "weak": This kind corresponds to the definition of a cumulative + distribution function. A percentileofscore of 80% + means that 80% of values are less than or equal + to the provided score. + - "strict": Similar to "weak", except that only values that are + strictly less than the given score are counted. + - "mean": The average of the "weak" and "strict" scores, often used in + testing. See + + http://en.wikipedia.org/wiki/Percentile_rank + Returns ------- - float: percentile-position of score (0-100) relative to a + pcos : float + Percentile-position of score (0-100) relative to `a`. - >>> percentileofscore([20,80,100],80) - 66.666666666666657 - >>> percentileofscore([20,80,100],80,kind='mean') - 50.0 - >>> percentileofscore([20,80,100],80,kind='strict') - 33.333333333333329 - >>> percentileofscore([20,80,100],80,kind='weak') - 66.666666666666657 + Examples + -------- + Three-quarters of the given values lie below a given score: - >>> percentileofscore([1,2,3,4,5,6,7,8,9,10],4) #default kind = 'rank - 40.0 - >>> percentileofscore([1,2,3,4,5,6,7,8,9,10],4,kind = 'mean') - 35.0 - >>> percentileofscore([1,2,3,4,5,6,7,8,9,10],4,kind = 'strict') - 30.0 - >>> percentileofscore([1,2,3,4,5,6,7,8,9,10],4,kind = 'weak') - 40.0 + >>> percentileofscore([1, 2, 3, 4], 3) + 75.0 - # multiple - 2 - >>> percentileofscore([1,2,3,4,4,5,6,7,8,9],4) - 45.0 - >>> percentileofscore([1,2,3,4,4,5,6,7,8,9],4,kind = 'mean') - 40.0 - >>> percentileofscore([1,2,3,4,4,5,6,7,8,9],4,kind = 'strict') - 30.0 - >>> percentileofscore([1,2,3,4,4,5,6,7,8,9],4,kind = 'weak') - 50.0 + With multiple matches, note how the scores of the two matches, 0.6 + and 0.8 respectively, are averaged: + >>> percentileofscore([1, 2, 3, 3, 4], 3) + 70.0 - # multiple - 3 - >>> percentileofscore([1,2,3,4,4,4,5,6,7,8],4) - 50.0 - >>> percentileofscore([1,2,3,4,4,4,5,6,7,8],4,kind = 'mean') - 45.0 - >>> percentileofscore([1,2,3,4,4,4,5,6,7,8],4,kind = 'strict') - 30.0 - >>> percentileofscore([1,2,3,4,4,4,5,6,7,8],4,kind = 'weak') - 60.0 + Only 2/5 values are strictly less than 3: - # missing - >>> percentileofscore([1,2,3,5,6,7,8,9,10,11],4) - 30.0 - >>> percentileofscore([1,2,3,5,6,7,8,9,10,11],4,kind = 'mean') - 30.0 - >>> percentileofscore([1,2,3,5,6,7,8,9,10,11],4,kind = 'strict') - 30.0 - >>> percentileofscore([1,2,3,5,6,7,8,9,10,11],4,kind = 'weak') - 30.0 - - #larger numbers - >>> percentileofscore([10,20,30,40,50,60,70,80,90,100],40) + >>> percentileofscore([1, 2, 3, 3, 4], 3, kind='strict') 40.0 - >>> percentileofscore([10,20,30,40,50,60,70,80,90,100],40,kind = 'mean') - 35.0 - >>> percentileofscore([10,20,30,40,50,60,70,80,90,100],40,kind = 'strict') - 30.0 - >>> percentileofscore([10,20,30,40,50,60,70,80,90,100],40,kind = 'weak') - 40.0 - >>> percentileofscore([10,20,30,40,40,40,50,60,70,80],40,kind = 'mean') - 45.0 - >>> percentileofscore([10,20,30,40,40,40,50,60,70,80],40,kind = 'strict') - 30.0 - >>> percentileofscore([10,20,30,40,40,40,50,60,70,80],40,kind = 'weak') - 60.0 - >>> percentileofscore([ 10,20,30,50,60,70,80,90,100,110],40,kind = 'rank') - 30.0 - >>> percentileofscore([ 10,20,30,50,60,70,80,90,100,110],40,kind = 'mean') - 30.0 - >>> percentileofscore([ 10,20,30,50,60,70,80,90,100,110],40,kind = 'strict') - 30.0 - >>> percentileofscore([ 10,20,30,50,60,70,80,90,100,110],40,kind = 'weak') - 30.0 - #boundaries - >>> percentileofscore([ 10,20,30,50,60,70,80,90,100,110],10) - 10.0 - >>> percentileofscore([ 10,20,30,50,60,70,80,90,100,110],10,kind = 'mean') - 5.0 - >>> percentileofscore([ 10,20,30,50,60,70,80,90,100,110],10,kind = 'strict') - 0.0 - >>> percentileofscore([ 10,20,30,50,60,70,80,90,100,110],10,kind = 'weak') - 10.0 + But 4/5 values are less than or equal to 3: - >>> percentileofscore([ 10,20,30,50,60,70,80,90,100,110],110) - 100.0 - >>> percentileofscore([ 10,20,30,50,60,70,80,90,100,110],110,kind = 'mean') - 95.0 - >>> percentileofscore([ 10,20,30,50,60,70,80,90,100,110],110,kind = 'strict') - 90.0 - >>> percentileofscore([ 10,20,30,50,60,70,80,90,100,110],110,kind = 'weak') - 100.0 + >>> percentileofscore([1, 2, 3, 3, 4], 3, kind='weak') + 80.0 + The average between the weak and the strict scores is + >>> percentileofscore([1, 2, 3, 3, 4], 3, kind='mean') + 60.0 - #out of bounds - >>> percentileofscore([ 10,20,30,50,60,70,80,90,100,110],200) - 100.0 - >>> percentileofscore([ 10,20,30,50,60,70,80,90,100,110],0) - 0.0 - -''' - - + ''' a=np.array(a) n = len(a) if kind == 'rank': if not(np.any(a == score)): - a = np.append(a,score) + a = np.append(a, score) a_len = np.array(range(len(a))) else: a_len = np.array(range(len(a))) + 1.0 a = np.sort(a) idx = [a == score] - pct = (np.mean(a_len[idx])/(n))*100.0 + pct = (np.mean(a_len[idx]) / n) * 100.0 return pct elif kind == 'strict': - return sum(a Author: stefan Date: 2009-01-04 10:22:42 -0600 (Sun, 04 Jan 2009) New Revision: 5327 Modified: trunk/scipy/stats/stats.py Log: Missed one space. Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2009-01-04 16:19:54 UTC (rev 5326) +++ trunk/scipy/stats/stats.py 2009-01-04 16:22:42 UTC (rev 5327) @@ -1091,7 +1091,7 @@ 60.0 ''' - a=np.array(a) + a = np.array(a) n = len(a) if kind == 'rank': From scipy-svn at scipy.org Mon Jan 5 16:45:47 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 5 Jan 2009 15:45:47 -0600 (CST) Subject: [Scipy-svn] r5328 - trunk Message-ID: <20090105214547.16D99C7C02A@scipy.org> Author: stefan Date: 2009-01-05 15:44:49 -0600 (Mon, 05 Jan 2009) New Revision: 5328 Modified: trunk/THANKS.txt Log: Credit more developers. Modified: trunk/THANKS.txt =================================================================== --- trunk/THANKS.txt 2009-01-04 16:22:42 UTC (rev 5327) +++ trunk/THANKS.txt 2009-01-05 21:44:49 UTC (rev 5328) @@ -9,36 +9,37 @@ suggestions, and financial support. Below is a partial list. If you've been left off, please email the "SciPy Developers List" . -Please add names as needed so that we can keep up with all the contributors. +Please add names as needed so that we can keep up with all the contributors. -Kumar Appaiah for Dolph Chebyshev window -Nathan Bell for sparsetools, help with scipy.sparse and scipy.splinalg -Robert Cimrman for UMFpack wrapper for sparse matrix module -David M. Cooke for improvements to system_info, and LBFGSB wrapper -Aric Hagberg for ARPACK wrappers, help with splinalg.eigen -Chuck Harris for Zeros package in optimize (1d root-finding algorithms) -Prabhu Ramachandran for improvements to gui_thread -Robert Kern for improvements to stats and bug-fixes -Jean-Sebastien Roy for fmin_tnc code which he adapted from Stephen Nash's - original Fortran +Kumar Appaiah for Dolph Chebyshev window. +Nathan Bell for sparsetools, help with scipy.sparse and scipy.splinalg. +Robert Cimrman for UMFpack wrapper for sparse matrix module. +David M. Cooke for improvements to system_info, and LBFGSB wrapper. +Aric Hagberg for ARPACK wrappers, help with splinalg.eigen. +Chuck Harris for Zeros package in optimize (1d root-finding algorithms). +Prabhu Ramachandran for improvements to gui_thread. +Robert Kern for improvements to stats and bug-fixes. +Jean-Sebastien Roy for fmin_tnc code which he adapted from Stephen Nash's + original Fortran. Ed Schofield for Maximum entropy and Monte Carlo modules, help with - sparse matrix module + sparse matrix module. Travis Vaught for numerous contributions to annual conference and community - web-site and the initial work on stats module clean up -Jeff Whitaker for Mac OS X support + web-site and the initial work on stats module clean up. +Jeff Whitaker for Mac OS X support. David Cournapeau for bug-fixes, refactor of fftpack and cluster, numscons build. Damian Eads for hierarchical clustering, dendrogram plotting, - distance functions in spatial package, vq documentation -Anne Archibald for kd-trees and nearest neighbor in scipy.spatial -Pauli Virtanen for Sphinx documentation generation, interpolation bugfixes. -Josef Perktold for major improvements to scipy.stats and its test suite + distance functions in spatial package, vq documentation. +Anne Archibald for kd-trees and nearest neighbor in scipy.spatial. +Pauli Virtanen for Sphinx documentation generation, online documentation + framework and interpolation bugfixes. +Josef Perktold for major improvements to scipy.stats and its test suite. David Morrill for getting the scoreboard test system up and running. Louis Luangkesorn for providing multiple tests for the stats module. -Jochen Kupper for the zoom feature in the now-deprecated plt plotting module +Jochen Kupper for the zoom feature in the now-deprecated plt plotting module. Tiffany Kamm for working on the community web-site. -Mark Koudritsky for maintaining the web-site -Andrew Straw for help with the web-page, documentation, packaging and - testing. +Mark Koudritsky for maintaining the web-site. +Andrew Straw for help with the web-page, documentation, packaging, + testing and work on the linalg module. Stefan van der Walt for numerous bug-fixes, testing and documentation. Jarrod Millman for release management, community coordination, and code clean up. @@ -50,8 +51,12 @@ Tiziano Zito for generalized symmetric and hermitian eigenvalue problem solver. Chris Burns for bug-fixes. -Per Brodtkorb for improvements to stats distributions +Per Brodtkorb for improvements to stats distributions. +Neilen Marais for testing and bug-fixing in the ARPACK wrappers. +Johannes Loehnert and Bart Vandereycken for fixes in the linalg + module. + Institutions ------------ @@ -59,4 +64,5 @@ Brigham Young University for providing resources for students to work on SciPy. Agilent which gave a genereous donation for support of SciPy. UC Berkeley for providing travel money and hosting numerous sprints. - +The University of Stellenbosch for funding the development of + the SciKits portal. From scipy-svn at scipy.org Tue Jan 6 04:28:19 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 6 Jan 2009 03:28:19 -0600 (CST) Subject: [Scipy-svn] r5329 - in trunk/scipy: io/matlab/tests sparse/linalg/eigen/lobpcg/tests Message-ID: <20090106092819.649D9C7C038@scipy.org> Author: stefan Date: 2009-01-06 03:27:50 -0600 (Tue, 06 Jan 2009) New Revision: 5329 Modified: trunk/scipy/io/matlab/tests/gen_mat4files.m trunk/scipy/io/matlab/tests/gen_mat5files.m trunk/scipy/io/matlab/tests/save_matfile.m trunk/scipy/sparse/linalg/eigen/lobpcg/tests/test_lobpcg.py Log: Fix permission errors reported by lintian (patch by Ondrej Certik). Modified: trunk/scipy/io/matlab/tests/gen_mat4files.m =================================================================== Property changes on: trunk/scipy/io/matlab/tests/gen_mat4files.m ___________________________________________________________________ Name: svn:executable - * Modified: trunk/scipy/io/matlab/tests/gen_mat5files.m =================================================================== Property changes on: trunk/scipy/io/matlab/tests/gen_mat5files.m ___________________________________________________________________ Name: svn:executable - * Modified: trunk/scipy/io/matlab/tests/save_matfile.m =================================================================== Property changes on: trunk/scipy/io/matlab/tests/save_matfile.m ___________________________________________________________________ Name: svn:executable - * Modified: trunk/scipy/sparse/linalg/eigen/lobpcg/tests/test_lobpcg.py =================================================================== --- trunk/scipy/sparse/linalg/eigen/lobpcg/tests/test_lobpcg.py 2009-01-05 21:44:49 UTC (rev 5328) +++ trunk/scipy/sparse/linalg/eigen/lobpcg/tests/test_lobpcg.py 2009-01-06 09:27:50 UTC (rev 5329) @@ -1,4 +1,4 @@ -#!/usr/bin/env pytho n +#!/usr/bin/env python """ Test functions for the sparse.linalg.eigen.lobpcg module """ From scipy-svn at scipy.org Tue Jan 6 04:52:37 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 6 Jan 2009 03:52:37 -0600 (CST) Subject: [Scipy-svn] r5330 - in trunk/scipy/special: . tests Message-ID: <20090106095237.597E1C7C03F@scipy.org> Author: stefan Date: 2009-01-06 03:51:38 -0600 (Tue, 06 Jan 2009) New Revision: 5330 Modified: trunk/scipy/special/basic.py trunk/scipy/special/tests/test_basic.py Log: Use correct shape in scipy.special.lqmn. Fixes #804. Modified: trunk/scipy/special/basic.py =================================================================== --- trunk/scipy/special/basic.py 2009-01-06 09:27:50 UTC (rev 5329) +++ trunk/scipy/special/basic.py 2009-01-06 09:51:38 UTC (rev 5330) @@ -529,9 +529,11 @@ raise ValueError, "z must be scalar." m = int(m) n = int(n) - if (m*n == 0): - mm = max(1,m) - nn = max(1,n) + + # Ensure neither m nor n == 0 + mm = max(1,m) + nn = max(1,n) + if iscomplex(z): q,qd = specfun.clqmn(mm,nn,z) else: Modified: trunk/scipy/special/tests/test_basic.py =================================================================== --- trunk/scipy/special/tests/test_basic.py 2009-01-06 09:27:50 UTC (rev 5329) +++ trunk/scipy/special/tests/test_basic.py 2009-01-06 09:51:38 UTC (rev 5330) @@ -1739,6 +1739,15 @@ assert_array_almost_equal(lqmnf[0][0],lqf[0],4) assert_array_almost_equal(lqmnf[1][0],lqf[1],4) + def test_lqmn_shape(self): + a, b = lqmn(4, 4, 1.1) + assert_equal(a.shape, (5, 5)) + assert_equal(b.shape, (5, 5)) + + a, b = lqmn(4, 0, 1.1) + assert_equal(a.shape, (5, 1)) + assert_equal(b.shape, (5, 1)) + def test_lqn(self): lqf = lqn(2,.5) assert_array_almost_equal(lqf,(array([ 0.5493, -0.7253, -0.8187]), From scipy-svn at scipy.org Tue Jan 6 05:28:15 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 6 Jan 2009 04:28:15 -0600 (CST) Subject: [Scipy-svn] r5331 - trunk/doc/release Message-ID: <20090106102815.928D7C7C037@scipy.org> Author: cdavid Date: 2009-01-06 04:28:09 -0600 (Tue, 06 Jan 2009) New Revision: 5331 Modified: trunk/doc/release/0.7.0-notes.rst Log: Remove f2py problem with python 2.6, since it was fixed by Pearu. Modified: trunk/doc/release/0.7.0-notes.rst =================================================================== --- trunk/doc/release/0.7.0-notes.rst 2009-01-06 09:51:38 UTC (rev 5330) +++ trunk/doc/release/0.7.0-notes.rst 2009-01-06 10:28:09 UTC (rev 5331) @@ -36,8 +36,7 @@ The main issue with 2.6 support is NumPy. On UNIX (including Mac OS X), NumPy 1.2.1 mostly works, with a few caveats. On Windows, there are some problems related to the compilation process. The upcoming 1.3 version of NumPy will fix -those. Then, because of some Python 2.6 bugs, ``f2py`` does not work on Python -2.6; the fixes will also be in the upcoming NumPy 1.3. +those. Sparse Matrices --------------- From scipy-svn at scipy.org Tue Jan 6 12:03:26 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 6 Jan 2009 11:03:26 -0600 (CST) Subject: [Scipy-svn] r5332 - trunk/doc/source Message-ID: <20090106170326.F21DAC7C010@scipy.org> Author: josef Date: 2009-01-06 11:03:22 -0600 (Tue, 06 Jan 2009) New Revision: 5332 Added: trunk/doc/source/stsci.rst Log: add stsci.rst, not sure it works Added: trunk/doc/source/stsci.rst =================================================================== --- trunk/doc/source/stsci.rst 2009-01-06 10:28:09 UTC (rev 5331) +++ trunk/doc/source/stsci.rst 2009-01-06 17:03:22 UTC (rev 5332) @@ -0,0 +1,40 @@ +============================================================= +Image Array Manipulation and Convolution (:mod:`scipy.stsci`) +============================================================= + +.. module:: scipy.stci + +Image Array manipulation Functions (:mod:`scipy.stsci.image`) +============================================================= + +.. module:: scipy.stci.image + +.. autosummary:: + :toctree: generated/ + + average + combine + median + minimum + threshhold + translate + + +Image Array Convolution Functions (:mod:`scipy.stsci.convolve`) +=============================================================== + +.. module:: scipy.stci.convolve + +.. autosummary:: + :toctree: generated/ + + boxcar + convolution_modes + convolve + convolve2d + correlate + correlate2d + cross_correlate + dft + iraf_frame + pix_modes \ No newline at end of file From scipy-svn at scipy.org Tue Jan 6 14:09:04 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 6 Jan 2009 13:09:04 -0600 (CST) Subject: [Scipy-svn] r5333 - trunk/scipy/interpolate Message-ID: <20090106190904.F0ED0C7C017@scipy.org> Author: cdavid Date: 2009-01-06 13:09:00 -0600 (Tue, 06 Jan 2009) New Revision: 5333 Modified: trunk/scipy/interpolate/SConscript Log: BUG: Fix fitpack scons build/ Modified: trunk/scipy/interpolate/SConscript =================================================================== --- trunk/scipy/interpolate/SConscript 2009-01-06 17:03:22 UTC (rev 5332) +++ trunk/scipy/interpolate/SConscript 2009-01-06 19:09:00 UTC (rev 5333) @@ -13,31 +13,32 @@ config.Finish() # Build fitpack -src = [pjoin("fitpack", s) for s in ["bispev.f", "clocur.f", "cocosp.f", -"concon.f", "concur.f", "cualde.f", "curev.f", "curfit.f", "dblint.f", -"evapol.f", "fourco.f", "fpader.f", "fpadno.f", "fpadpo.f", "fpback.f", -"fpbacp.f", "fpbfout.f", "fpbisp.f", "fpbspl.f", "fpchec.f", "fpched.f", -"fpchep.f", "fpclos.f", "fpcoco.f", "fpcons.f", "fpcosp.f", "fpcsin.f", -"fpcurf.f", "fpcuro.f", "fpcyt1.f", "fpcyt2.f", "fpdeno.f", "fpdisc.f", -"fpfrno.f", "fpgivs.f", "fpgrdi.f", "fpgrpa.f", "fpgrre.f", "fpgrsp.f", -"fpinst.f", "fpintb.f", "fpknot.f", "fpopdi.f", "fpopsp.f", "fporde.f", -"fppara.f", "fppasu.f", "fpperi.f", "fppocu.f", "fppogr.f", "fppola.f", -"fprank.f", "fprati.f", "fpregr.f", "fprota.f", "fprppo.f", "fprpsp.f", -"fpseno.f", "fpspgr.f", "fpsphe.f", "fpsuev.f", "fpsurf.f", "fpsysy.f", -"fptrnp.f", "fptrpe.f", "insert.f", "parcur.f", "parder.f", "parsur.f", -"percur.f", "pogrid.f", "polar.f", "profil.f", "regrid.f", "spalde.f", -"spgrid.f", "sphere.f", "splder.f", "splev.f", "splint.f", "sproot.f", -"surev.f", "surfit.f"]] +src = [pjoin("fitpack", s) for s in ["bispev.f", "bispeu.f", "clocur.f", +"cocosp.f", "concon.f", "concur.f", "cualde.f", "curev.f", "curfit.f", +"dblint.f", "evapol.f", "fourco.f", "fpader.f", "fpadno.f", "fpadpo.f", +"fpback.f", "fpbacp.f", "fpbfout.f", "fpbisp.f", "fpbspl.f", "fpchec.f", +"fpched.f", "fpchep.f", "fpclos.f", "fpcoco.f", "fpcons.f", "fpcosp.f", +"fpcsin.f", "fpcurf.f", "fpcuro.f", "fpcyt1.f", "fpcyt2.f", "fpdeno.f", +"fpdisc.f", "fpfrno.f", "fpgivs.f", "fpgrdi.f", "fpgrpa.f", "fpgrre.f", +"fpgrsp.f", "fpinst.f", "fpintb.f", "fpknot.f", "fpopdi.f", "fpopsp.f", +"fporde.f", "fppara.f", "fppasu.f", "fpperi.f", "fppocu.f", "fppogr.f", +"fppola.f", "fprank.f", "fprati.f", "fpregr.f", "fprota.f", "fprppo.f", +"fprpsp.f", "fpseno.f", "fpspgr.f", "fpsphe.f", "fpsuev.f", "fpsurf.f", +"fpsysy.f", "fptrnp.f", "fptrpe.f", "insert.f", "parcur.f", "parder.f", +"parsur.f", "percur.f", "pogrid.f", "polar.f", "profil.f", "regrid.f", +"spalde.f", "spgrid.f", "sphere.f", "splder.f", "splev.f", "splint.f", +"sproot.f", "surev.f", "surfit.f"]] fitpack = env.DistutilsStaticExtLibrary('fitpack', source = src) -env.PrependUnique(LIBS = ['fitpack']) env.PrependUnique(LIBPATH = ['.']) # Build _fitpack -env.NumpyPythonExtension('_fitpack', source = 'src/_fitpackmodule.c') +env.NumpyPythonExtension('_fitpack', source = 'src/_fitpackmodule.c', + LIBS="fitpack") # Build dfitpack -env.NumpyPythonExtension('dfitpack', source = 'src/fitpack.pyf') +env.NumpyPythonExtension('dfitpack', source = 'src/fitpack.pyf', + LIBS="fitpack") # Build _interpolate env.NumpyPythonExtension('_interpolate', source = 'src/_interpolate.cpp', From scipy-svn at scipy.org Tue Jan 6 14:54:17 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 6 Jan 2009 13:54:17 -0600 (CST) Subject: [Scipy-svn] r5334 - trunk/scipy/optimize Message-ID: <20090106195417.86D52C7C017@scipy.org> Author: josef Date: 2009-01-06 13:54:15 -0600 (Tue, 06 Jan 2009) New Revision: 5334 Modified: trunk/scipy/optimize/info.py Log: add fmin_slsqp to optimize info Modified: trunk/scipy/optimize/info.py =================================================================== --- trunk/scipy/optimize/info.py 2009-01-06 19:09:00 UTC (rev 5333) +++ trunk/scipy/optimize/info.py 2009-01-06 19:54:15 UTC (rev 5334) @@ -27,6 +27,8 @@ fmin_cobyla -- Constrained Optimization BY Linear Approximation + fmin_slsqp -- Minimize a function using Sequential Least SQuares Programming + nnls -- Solve linear least squares problem with non-negativity constraint From scipy-svn at scipy.org Tue Jan 6 15:19:33 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 6 Jan 2009 14:19:33 -0600 (CST) Subject: [Scipy-svn] r5335 - trunk/scipy/weave/tests Message-ID: <20090106201933.56EB5C7C00B@scipy.org> Author: jarrod.millman Date: 2009-01-06 14:19:31 -0600 (Tue, 06 Jan 2009) New Revision: 5335 Modified: trunk/scipy/weave/tests/test_ast_tools.py trunk/scipy/weave/tests/test_blitz_tools.py trunk/scipy/weave/tests/test_ext_tools.py trunk/scipy/weave/tests/test_slice_handler.py Log: BUG: unlike print_assert_equal, assert_equal's first argument is one of the tested item Modified: trunk/scipy/weave/tests/test_ast_tools.py =================================================================== --- trunk/scipy/weave/tests/test_ast_tools.py 2009-01-06 19:54:15 UTC (rev 5334) +++ trunk/scipy/weave/tests/test_ast_tools.py 2009-01-06 20:19:31 UTC (rev 5335) @@ -11,7 +11,7 @@ import parser ast_list = parser.suite(expr).tolist() actual = ast_tools.harvest_variables(ast_list) - assert_equal(expr,actual,desired) + assert_equal(actual,desired,expr) def test_simple_expr(self): """convert simple expr to blitz Modified: trunk/scipy/weave/tests/test_blitz_tools.py =================================================================== --- trunk/scipy/weave/tests/test_blitz_tools.py 2009-01-06 19:54:15 UTC (rev 5334) +++ trunk/scipy/weave/tests/test_blitz_tools.py 2009-01-06 20:19:31 UTC (rev 5335) @@ -20,7 +20,7 @@ actual = blitz_tools.ast_to_blitz_expr(ast_list) actual = remove_whitespace(actual) desired = remove_whitespace(desired) - assert_equal(expr,actual,desired) + assert_equal(actual,desired,expr) def test_simple_expr(self): """convert simple expr to blitz Modified: trunk/scipy/weave/tests/test_ext_tools.py =================================================================== --- trunk/scipy/weave/tests/test_ext_tools.py 2009-01-06 19:54:15 UTC (rev 5334) +++ trunk/scipy/weave/tests/test_ext_tools.py 2009-01-06 20:19:31 UTC (rev 5335) @@ -132,8 +132,7 @@ cd = c_spec.int_converter() cd.name, cd.var_type = 'c', types.IntType desired = [ad,bd,cd] - expr = "" - assert_equal(expr,actual,desired) + assert_equal(actual,desired) if __name__ == "__main__": nose.run(argv=['', __file__]) Modified: trunk/scipy/weave/tests/test_slice_handler.py =================================================================== --- trunk/scipy/weave/tests/test_slice_handler.py 2009-01-06 19:54:15 UTC (rev 5334) +++ trunk/scipy/weave/tests/test_slice_handler.py 2009-01-06 20:19:31 UTC (rev 5335) @@ -9,7 +9,7 @@ pos = slice_vars['pos'] ast_list = slice_handler.build_slice_atom(slice_vars,pos) actual = ast_to_string(ast_list) - assert_equal('',actual,desired) + assert_equal(actual,desired) def test_exclusive_end(self): slice_vars = {'begin':'1', 'end':'2', 'step':'_stp', 'single_index':'_index','pos':0} @@ -24,7 +24,7 @@ found, data = find_first_pattern(ast_tuple,indexed_array_pattern) subscript = data['subscript_list'][1] #[0] is symbol, [1] is the supscript actual = slice_handler.slice_ast_to_dict(subscript) - assert_equal(suite_string,actual,desired) + assert_equal(actual,desired,suite_string) def test_empty_2_slice(self): """match slice from a[:]""" @@ -126,7 +126,7 @@ # but differently formatted string will compare equally actual = replace_whitespace(actual) desired = replace_whitespace(desired) - assert_equal(suite_string,actual,desired) + assert_equal(actual,desired,suite_string) def test_simple_expr(self): """transform a[:] to slice notation""" From scipy-svn at scipy.org Tue Jan 6 20:26:41 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 6 Jan 2009 19:26:41 -0600 (CST) Subject: [Scipy-svn] r5336 - trunk/scipy/weave Message-ID: <20090107012641.9309CC7C00B@scipy.org> Author: jarrod.millman Date: 2009-01-06 19:26:40 -0600 (Tue, 06 Jan 2009) New Revision: 5336 Modified: trunk/scipy/weave/inline_tools.py Log: reducing test noise Modified: trunk/scipy/weave/inline_tools.py =================================================================== --- trunk/scipy/weave/inline_tools.py 2009-01-06 20:19:31 UTC (rev 5335) +++ trunk/scipy/weave/inline_tools.py 2009-01-07 01:26:40 UTC (rev 5336) @@ -183,7 +183,7 @@ On Unix, it'll probably use the same compiler that was used when compiling Python. Cygwin's behavior should be similar. - verbose -- optional. 0,1, or 2. defualt 0. Speficies how much + verbose -- optional. 0,1, or 2. default 0. Speficies how much much information is printed during the compile phase of inlining code. 0 is silent (except on windows with msvc where it still prints some garbage). 1 informs @@ -451,7 +451,8 @@ # it's nice to let the users know when anything gets compiled, as the # slowdown is very noticeable. - print '' + if verbose > 0: + print '' # compile code in correct location, with the given compiler and verbosity # setting. All input keywords are passed through to distutils From scipy-svn at scipy.org Tue Jan 6 23:59:01 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 6 Jan 2009 22:59:01 -0600 (CST) Subject: [Scipy-svn] r5337 - trunk/scipy/optimize Message-ID: <20090107045901.39D2AC7C038@scipy.org> Author: jarrod.millman Date: 2009-01-06 22:59:00 -0600 (Tue, 06 Jan 2009) New Revision: 5337 Modified: trunk/scipy/optimize/info.py Log: ran reindent Modified: trunk/scipy/optimize/info.py =================================================================== --- trunk/scipy/optimize/info.py 2009-01-07 01:26:40 UTC (rev 5336) +++ trunk/scipy/optimize/info.py 2009-01-07 04:59:00 UTC (rev 5337) @@ -28,7 +28,7 @@ fmin_cobyla -- Constrained Optimization BY Linear Approximation fmin_slsqp -- Minimize a function using Sequential Least SQuares Programming - + nnls -- Solve linear least squares problem with non-negativity constraint From scipy-svn at scipy.org Wed Jan 7 00:18:24 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 6 Jan 2009 23:18:24 -0600 (CST) Subject: [Scipy-svn] r5338 - branches Message-ID: <20090107051824.B291DC7C038@scipy.org> Author: jarrod.millman Date: 2009-01-06 23:18:23 -0600 (Tue, 06 Jan 2009) New Revision: 5338 Added: branches/0.7.x/ Log: Create a release branch. Copied: branches/0.7.x (from rev 5337, trunk) From scipy-svn at scipy.org Wed Jan 7 00:22:41 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 6 Jan 2009 23:22:41 -0600 (CST) Subject: [Scipy-svn] r5339 - trunk/scipy Message-ID: <20090107052241.504EDC7C038@scipy.org> Author: jarrod.millman Date: 2009-01-06 23:22:39 -0600 (Tue, 06 Jan 2009) New Revision: 5339 Modified: trunk/scipy/version.py Log: trunk is open for 0.8 development Modified: trunk/scipy/version.py =================================================================== --- trunk/scipy/version.py 2009-01-07 05:18:23 UTC (rev 5338) +++ trunk/scipy/version.py 2009-01-07 05:22:39 UTC (rev 5339) @@ -1,4 +1,4 @@ -version = '0.7.0' +version = '0.8.0' release=False if not release: From scipy-svn at scipy.org Wed Jan 7 01:19:31 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 00:19:31 -0600 (CST) Subject: [Scipy-svn] r5340 - branches/0.7.x/scipy/weave/tests Message-ID: <20090107061931.E9479C7C038@scipy.org> Author: jarrod.millman Date: 2009-01-07 00:19:30 -0600 (Wed, 07 Jan 2009) New Revision: 5340 Modified: branches/0.7.x/scipy/weave/tests/test_ext_tools.py Log: Josef reported that this test segfaults python on windows with mingw Modified: branches/0.7.x/scipy/weave/tests/test_ext_tools.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_ext_tools.py 2009-01-07 05:22:39 UTC (rev 5339) +++ branches/0.7.x/scipy/weave/tests/test_ext_tools.py 2009-01-07 06:19:30 UTC (rev 5340) @@ -33,6 +33,9 @@ import module_multi_function module_multi_function.test() module_multi_function.test2() + + @dec.knownfailureif(sys.platform == 'win32', + "this crashes python (segfault) on windows with mingw") @dec.slow def test_with_include(self): # decalaring variables From scipy-svn at scipy.org Wed Jan 7 08:02:22 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 07:02:22 -0600 (CST) Subject: [Scipy-svn] r5341 - trunk/scipy/weave Message-ID: <20090107130222.564BCC7C040@scipy.org> Author: stefan Date: 2009-01-07 07:02:05 -0600 (Wed, 07 Jan 2009) New Revision: 5341 Modified: trunk/scipy/weave/catalog.py Log: Ensure output directory is writable in weave. Modified: trunk/scipy/weave/catalog.py =================================================================== --- trunk/scipy/weave/catalog.py 2009-01-07 06:19:30 UTC (rev 5340) +++ trunk/scipy/weave/catalog.py 2009-01-07 13:02:05 UTC (rev 5341) @@ -178,28 +178,35 @@ # Use a cached value for fast return if possible if hasattr(default_dir,"cached_path") and \ - os.path.exists(default_dir.cached_path): + os.path.exists(default_dir.cached_path) and \ + os.access(default_dir.cached_path, os.W_OK): return default_dir.cached_path python_name = "python%d%d_compiled" % tuple(sys.version_info[:2]) + path_candidates = [] if sys.platform != 'win32': try: - path = os.path.join(os.environ['HOME'],'.' + python_name) + path_candidates.append(os.path.join(os.environ['HOME'], + '.' + python_name)) except KeyError: - temp_dir = `os.getuid()` + '_' + python_name - path = os.path.join(tempfile.gettempdir(),temp_dir) + pass - # add a subdirectory for the OS. - # It might be better to do this at a different location so that - # it wasn't only the default directory that gets this behavior. - #path = os.path.join(path,sys.platform) + temp_dir = `os.getuid()` + '_' + python_name + path_candidates.append(os.path.join(tempfile.gettempdir(), temp_dir)) else: - path = os.path.join(tempfile.gettempdir(),"%s"%whoami(),python_name) + path_candiates.append(os.path.join(tempfile.gettempdir(), + "%s" % whoami(), python_name)) - if not os.path.exists(path): - create_dir(path) - os.chmod(path,0700) # make it only accessible by this user. - if not is_writable(path): + writable = False + for path in path_candidates: + if not os.path.exists(path): + create_dir(path) + os.chmod(path, 0700) # make it only accessible by this user. + if is_writable(path): + writable = True + break + + if not writable: print 'warning: default directory is not write accessible.' print 'default:', path @@ -373,11 +380,7 @@ paths = [] if 'PYTHONCOMPILED' in os.environ: path_string = os.environ['PYTHONCOMPILED'] - if sys.platform == 'win32': - #probably should also look in registry - paths = path_string.split(';') - else: - paths = path_string.split(':') + paths = path_string.split(os.path.pathsep) return paths def build_search_order(self): From scipy-svn at scipy.org Wed Jan 7 09:39:30 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 08:39:30 -0600 (CST) Subject: [Scipy-svn] r5342 - in trunk/scipy/stsci: . image/lib Message-ID: <20090107143930.94D1AC7C040@scipy.org> Author: chanley Date: 2009-01-07 08:39:23 -0600 (Wed, 07 Jan 2009) New Revision: 5342 Modified: trunk/scipy/stsci/__init__.py trunk/scipy/stsci/image/lib/_image.py Log: making stsci modules more scipy friendly Modified: trunk/scipy/stsci/__init__.py =================================================================== --- trunk/scipy/stsci/__init__.py 2009-01-07 13:02:05 UTC (rev 5341) +++ trunk/scipy/stsci/__init__.py 2009-01-07 14:39:23 UTC (rev 5342) @@ -0,0 +1,8 @@ +import convolve +import image + +__all__ = ['convolve','image'] + +from numpy.testing import Tester +test = Tester().test + Modified: trunk/scipy/stsci/image/lib/_image.py =================================================================== --- trunk/scipy/stsci/image/lib/_image.py 2009-01-07 13:02:05 UTC (rev 5341) +++ trunk/scipy/stsci/image/lib/_image.py 2009-01-07 14:39:23 UTC (rev 5342) @@ -1,6 +1,6 @@ import numpy as np -import scipy.stsci.convolve -import scipy.stsci.convolve._correlate as _correlate +import convolve +import convolve._correlate as _correlate def _translate(a, dx, dy, output=None, mode="nearest", cval=0.0): """_translate does positive sub-pixel shifts using bilinear interpolation.""" From scipy-svn at scipy.org Wed Jan 7 09:43:17 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 08:43:17 -0600 (CST) Subject: [Scipy-svn] r5343 - trunk/scipy/fftpack Message-ID: <20090107144317.68233C7C040@scipy.org> Author: cdavid Date: 2009-01-07 08:43:04 -0600 (Wed, 07 Jan 2009) New Revision: 5343 Modified: trunk/scipy/fftpack/setup.py Log: Build single precision fftpack lib. Modified: trunk/scipy/fftpack/setup.py =================================================================== --- trunk/scipy/fftpack/setup.py 2009-01-07 14:39:23 UTC (rev 5342) +++ trunk/scipy/fftpack/setup.py 2009-01-07 14:43:04 UTC (rev 5343) @@ -14,6 +14,9 @@ config.add_library('dfftpack', sources=[join('src/dfftpack','*.f')]) + config.add_library('fftpack', + sources=[join('src/fftpack','*.f')]) + sources = ['fftpack.pyf','src/zfft.c','src/drfft.c','src/zrfft.c', 'src/zfftnd.c'] From scipy-svn at scipy.org Wed Jan 7 09:44:02 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 08:44:02 -0600 (CST) Subject: [Scipy-svn] r5344 - trunk/scipy/fftpack Message-ID: <20090107144402.1CB76C7C040@scipy.org> Author: cdavid Date: 2009-01-07 08:43:52 -0600 (Wed, 07 Jan 2009) New Revision: 5344 Modified: trunk/scipy/fftpack/setup.py Log: Link single precision fftpack to python low-level wrapper. Modified: trunk/scipy/fftpack/setup.py =================================================================== --- trunk/scipy/fftpack/setup.py 2009-01-07 14:43:04 UTC (rev 5343) +++ trunk/scipy/fftpack/setup.py 2009-01-07 14:43:52 UTC (rev 5344) @@ -22,7 +22,7 @@ config.add_extension('_fftpack', sources=sources, - libraries=['dfftpack'], + libraries=['dfftpack', 'fftpack'], depends=['src/zfft_fftpack.c', 'src/drfft_fftpack.c', 'src/zfftnd_fftpack.c']) From scipy-svn at scipy.org Wed Jan 7 09:44:31 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 08:44:31 -0600 (CST) Subject: [Scipy-svn] r5345 - trunk/scipy/fftpack/src Message-ID: <20090107144431.D5C82C7C040@scipy.org> Author: cdavid Date: 2009-01-07 08:44:18 -0600 (Wed, 07 Jan 2009) New Revision: 5345 Added: trunk/scipy/fftpack/src/cfft_fftpack.c Modified: trunk/scipy/fftpack/src/zfft.c Log: Add cfft wrapper. Added: trunk/scipy/fftpack/src/cfft_fftpack.c =================================================================== --- trunk/scipy/fftpack/src/cfft_fftpack.c 2009-01-07 14:43:52 UTC (rev 5344) +++ trunk/scipy/fftpack/src/cfft_fftpack.c 2009-01-07 14:44:18 UTC (rev 5345) @@ -0,0 +1,46 @@ +/* XXX: use the .src mechanism: zfft_cfft are the same */ +extern void F_FUNC(cfftf,CFFTF)(int*,float*,float*); +extern void F_FUNC(cfftb,CFFTB)(int*,float*,float*); +extern void F_FUNC(cffti,CFFTI)(int*,float*); +GEN_CACHE(cfftpack,(int n) + ,float* wsave; + ,(caches_cfftpack[i].n==n) + ,caches_cfftpack[id].wsave = (float*)malloc(sizeof(float)*(4*n+15)); + F_FUNC(cffti,CFFTI)(&n,caches_cfftpack[id].wsave); + ,free(caches_cfftpack[id].wsave); + ,10) + +static void cfft_fftpack(complex_float * inout, + int n, int direction, int howmany, int normalize) +{ + int i; + complex_float *ptr = inout; + float *wsave = NULL; + + wsave = caches_cfftpack[get_cache_id_cfftpack(n)].wsave; + + switch (direction) { + case 1: + for (i = 0; i < howmany; ++i, ptr += n) { + cfftf_(&n, (float *) (ptr), wsave); + + } + break; + + case -1: + for (i = 0; i < howmany; ++i, ptr += n) { + cfftb_(&n, (float *) (ptr), wsave); + } + break; + default: + fprintf(stderr, "cfft: invalid direction=%d\n", direction); + } + + if (normalize) { + ptr = inout; + for (i = n * howmany - 1; i >= 0; --i) { + *((float *) (ptr)) /= n; + *((float *) (ptr++) + 1) /= n; + } + } +} Modified: trunk/scipy/fftpack/src/zfft.c =================================================================== --- trunk/scipy/fftpack/src/zfft.c 2009-01-07 14:43:52 UTC (rev 5344) +++ trunk/scipy/fftpack/src/zfft.c 2009-01-07 14:44:18 UTC (rev 5345) @@ -18,7 +18,18 @@ int direction, int howmany, int normalize)\ {\ zfft_##name(inout, n, direction, howmany, normalize);\ +}\ +void destroy_cfft_cache(void)\ +{\ + destroy_c##name##_caches();\ +}\ +\ +void cfft(complex_float *inout, int n, \ + int direction, int howmany, int normalize)\ +{\ + cfft_##name(inout, n, direction, howmany, normalize);\ } #include "zfft_fftpack.c" +#include "cfft_fftpack.c" GEN_PUBLIC_API(fftpack) From scipy-svn at scipy.org Wed Jan 7 09:45:00 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 08:45:00 -0600 (CST) Subject: [Scipy-svn] r5346 - trunk/scipy/fftpack/src Message-ID: <20090107144500.9A393C7C040@scipy.org> Author: cdavid Date: 2009-01-07 08:44:46 -0600 (Wed, 07 Jan 2009) New Revision: 5346 Added: trunk/scipy/fftpack/src/rfft_fftpack.c Modified: trunk/scipy/fftpack/src/drfft.c Log: Add single prec backend for real fft. Modified: trunk/scipy/fftpack/src/drfft.c =================================================================== --- trunk/scipy/fftpack/src/drfft.c 2009-01-07 14:44:18 UTC (rev 5345) +++ trunk/scipy/fftpack/src/drfft.c 2009-01-07 14:44:46 UTC (rev 5346) @@ -18,7 +18,19 @@ int direction, int howmany, int normalize)\ {\ drfft_##name(inout, n, direction, howmany, normalize);\ +}\ +void destroy_rfft_cache(void)\ +{\ + destroy_r##name##_caches();\ +}\ +\ +void rfft(float *inout, int n, \ + int direction, int howmany, int normalize)\ +{\ + rfft_##name(inout, n, direction, howmany, normalize);\ } + #include "drfft_fftpack.c" +#include "rfft_fftpack.c" GEN_PUBLIC_API(fftpack) Added: trunk/scipy/fftpack/src/rfft_fftpack.c =================================================================== --- trunk/scipy/fftpack/src/rfft_fftpack.c 2009-01-07 14:44:18 UTC (rev 5345) +++ trunk/scipy/fftpack/src/rfft_fftpack.c 2009-01-07 14:44:46 UTC (rev 5346) @@ -0,0 +1,54 @@ +/* + * Last Change: Wed Aug 01 07:00 PM 2007 J + * + * FFTPACK implementation + * + * Original code by Pearu Peterson. + */ + +extern void F_FUNC(rfftf, RFFTF) (int *, float *, float *); +extern void F_FUNC(rfftb, RFFTB) (int *, float *, float *); +extern void F_FUNC(rffti, RFFTI) (int *, float *); +GEN_CACHE(rfftpack, (int n) + , float *wsave; + , (caches_rfftpack[i].n == n) + , caches_rfftpack[id].wsave = + (float *) malloc(sizeof(float) * (2 * n + 15)); + F_FUNC(rffti, RFFTI) (&n, caches_rfftpack[id].wsave); + , free(caches_rfftpack[id].wsave); + , 10) + +static void rfft_fftpack(float *inout, int n, int direction, int howmany, + int normalize) +{ + int i; + float *ptr = inout; + float *wsave = NULL; + wsave = caches_rfftpack[get_cache_id_rfftpack(n)].wsave; + + + switch (direction) { + case 1: + for (i = 0; i < howmany; ++i, ptr += n) { + rfftf_(&n, ptr, wsave); + } + break; + + case -1: + for (i = 0; i < howmany; ++i, ptr += n) { + rfftb_(&n, ptr, wsave); + } + break; + + default: + fprintf(stderr, "rfft: invalid direction=%d\n", direction); + } + + if (normalize) { + float d = 1.0 / n; + ptr = inout; + for (i = n * howmany - 1; i >= 0; --i) { + (*(ptr++)) *= d; + } + } +} From scipy-svn at scipy.org Wed Jan 7 09:45:26 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 08:45:26 -0600 (CST) Subject: [Scipy-svn] r5347 - trunk/scipy/fftpack Message-ID: <20090107144526.A5A0FC7C040@scipy.org> Author: cdavid Date: 2009-01-07 08:45:13 -0600 (Wed, 07 Jan 2009) New Revision: 5347 Modified: trunk/scipy/fftpack/SConscript Log: Handle single prec fftpack backend in scons build. Modified: trunk/scipy/fftpack/SConscript =================================================================== --- trunk/scipy/fftpack/SConscript 2009-01-07 14:44:46 UTC (rev 5346) +++ trunk/scipy/fftpack/SConscript 2009-01-07 14:45:13 UTC (rev 5347) @@ -14,7 +14,15 @@ "dsinti.f", "zfftb.f", "zfftb1.f", "zfftf.f", "zfftf1.f", "zffti.f", "zffti1.f"]] dfftpack = env.DistutilsStaticExtLibrary('dfftpack', source = [str(s) for s in src]) -env.PrependUnique(LIBS = ['dfftpack']) + +# Build fftpack (single prec) +src = [pjoin("src/fftpack", i) for i in [ 'cfftb.f', 'cfftb1.f', 'cfftf.f', +'cfftf1.f', 'cffti.f', 'cffti1.f', 'cosqb.f', 'cosqf.f', 'cosqi.f', 'cost.f', +'costi.f', 'rfftb.f', 'rfftb1.f', 'rfftf.f', 'rfftf1.f', 'rffti.f', +'rffti1.f', 'sinqb.f', 'sinqf.f', 'sinqi.f', 'sint.f', 'sint1.f', 'sinti.f']] +fftpack = env.DistutilsStaticExtLibrary('fftpack', source = [str(s) for s in src]) + +env.PrependUnique(LIBS = ['fftpack', 'dfftpack']) env.PrependUnique(LIBPATH = ['.']) # Build _fftpack From scipy-svn at scipy.org Wed Jan 7 09:45:56 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 08:45:56 -0600 (CST) Subject: [Scipy-svn] r5348 - trunk/scipy/fftpack/src Message-ID: <20090107144556.442F1C7C040@scipy.org> Author: cdavid Date: 2009-01-07 08:45:41 -0600 (Wed, 07 Jan 2009) New Revision: 5348 Added: trunk/scipy/fftpack/src/cfftnd_fftpack.c Modified: trunk/scipy/fftpack/src/zfftnd.c Log: Add single prec backend for ND complex transform. Added: trunk/scipy/fftpack/src/cfftnd_fftpack.c =================================================================== --- trunk/scipy/fftpack/src/cfftnd_fftpack.c 2009-01-07 14:45:13 UTC (rev 5347) +++ trunk/scipy/fftpack/src/cfftnd_fftpack.c 2009-01-07 14:45:41 UTC (rev 5348) @@ -0,0 +1,118 @@ +/* + * fftpack backend for multi dimensional fft + * + * Original code by Pearu Peaterson + * + * Last Change: Wed Aug 08 02:00 PM 2007 J + */ + +GEN_CACHE(cfftnd_fftpack, (int n, int rank) + , complex_float * ptr; int *iptr; int rank; + , ((caches_cfftnd_fftpack[i].n == n) + && (caches_cfftnd_fftpack[i].rank == rank)) + , caches_cfftnd_fftpack[id].n = n; + caches_cfftnd_fftpack[id].ptr = + (complex_float *) malloc(2 * sizeof(float) * n); + caches_cfftnd_fftpack[id].iptr = + (int *) malloc(4 * rank * sizeof(int)); + , + free(caches_cfftnd_fftpack[id].ptr); + free(caches_cfftnd_fftpack[id].iptr); + , 10) + +static +/*inline : disabled because MSVC6.0 fails to compile it. */ +int next_comb(int *ia, int *da, int m) +{ + while (m >= 0 && ia[m] == da[m]) { + ia[m--] = 0; + } + if (m < 0) { + return 0; + } + ia[m]++; + return 1; +} + +static +void flatten(complex_float * dest, complex_float * src, + int rank, int strides_axis, int dims_axis, int unflat, + int *tmp) +{ + int *new_strides = tmp + rank; + int *new_dims = tmp + 2 * rank; + int *ia = tmp + 3 * rank; + int rm1 = rank - 1, rm2 = rank - 2; + int i, j, k; + for (i = 0; i < rm2; ++i) + ia[i] = 0; + ia[rm2] = -1; + j = 0; + if (unflat) { + while (next_comb(ia, new_dims, rm2)) { + k = 0; + for (i = 0; i < rm1; ++i) { + k += ia[i] * new_strides[i]; + } + for (i = 0; i < dims_axis; ++i) { + *(dest + k + i * strides_axis) = *(src + j++); + } + } + } else { + while (next_comb(ia, new_dims, rm2)) { + k = 0; + for (i = 0; i < rm1; ++i) { + k += ia[i] * new_strides[i]; + } + for (i = 0; i < dims_axis; ++i) { + *(dest + j++) = *(src + k + i * strides_axis); + } + } + } +} + +extern void cfft(complex_float * inout, + int n, int direction, int howmany, int normalize); + +extern void cfftnd_fftpack(complex_float * inout, int rank, + int *dims, int direction, int howmany, + int normalize) +{ + int i, sz; + complex_float *ptr = inout; + int axis; + complex_float *tmp; + int *itmp; + int k, j; + + sz = 1; + for (i = 0; i < rank; ++i) { + sz *= dims[i]; + } + cfft(ptr, dims[rank - 1], direction, howmany * sz / dims[rank - 1], + normalize); + + i = get_cache_id_cfftnd_fftpack(sz, rank); + tmp = caches_cfftnd_fftpack[i].ptr; + itmp = caches_cfftnd_fftpack[i].iptr; + + itmp[rank - 1] = 1; + for (i = 2; i <= rank; ++i) { + itmp[rank - i] = itmp[rank - i + 1] * dims[rank - i + 1]; + } + + for (i = 0; i < howmany; ++i, ptr += sz) { + for (axis = 0; axis < rank - 1; ++axis) { + for (k = j = 0; k < rank; ++k) { + if (k != axis) { + *(itmp + rank + j) = itmp[k]; + *(itmp + 2 * rank + j++) = dims[k] - 1; + } + } + flatten(tmp, ptr, rank, itmp[axis], dims[axis], 0, itmp); + cfft(tmp, dims[axis], direction, sz / dims[axis], normalize); + flatten(ptr, tmp, rank, itmp[axis], dims[axis], 1, itmp); + } + } + +} Modified: trunk/scipy/fftpack/src/zfftnd.c =================================================================== --- trunk/scipy/fftpack/src/zfftnd.c 2009-01-07 14:45:13 UTC (rev 5347) +++ trunk/scipy/fftpack/src/zfftnd.c 2009-01-07 14:45:41 UTC (rev 5348) @@ -17,7 +17,19 @@ int *dims, int direction, int howmany, int normalize)\ {\ zfftnd_##name(inout, rank, dims, direction, howmany, normalize);\ +}\ +void destroy_cfftnd_cache(void)\ +{\ + destroy_cfftnd_##name##_caches();\ +}\ +\ +void cfftnd(complex_float * inout, int rank,\ + int *dims, int direction, int howmany, int normalize)\ +{\ + cfftnd_##name(inout, rank, dims, direction, howmany, normalize);\ } + #include "zfftnd_fftpack.c" +#include "cfftnd_fftpack.c" GEN_PUBLIC_API(fftpack) From scipy-svn at scipy.org Wed Jan 7 09:46:23 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 08:46:23 -0600 (CST) Subject: [Scipy-svn] r5349 - trunk/scipy/fftpack/src Message-ID: <20090107144623.00F96C7C040@scipy.org> Author: cdavid Date: 2009-01-07 08:46:12 -0600 (Wed, 07 Jan 2009) New Revision: 5349 Modified: trunk/scipy/fftpack/src/cfftnd_fftpack.c Log: Rename flatten for single prec to avoid clash with double prec. Modified: trunk/scipy/fftpack/src/cfftnd_fftpack.c =================================================================== --- trunk/scipy/fftpack/src/cfftnd_fftpack.c 2009-01-07 14:45:41 UTC (rev 5348) +++ trunk/scipy/fftpack/src/cfftnd_fftpack.c 2009-01-07 14:46:12 UTC (rev 5349) @@ -21,21 +21,7 @@ , 10) static -/*inline : disabled because MSVC6.0 fails to compile it. */ -int next_comb(int *ia, int *da, int m) -{ - while (m >= 0 && ia[m] == da[m]) { - ia[m--] = 0; - } - if (m < 0) { - return 0; - } - ia[m]++; - return 1; -} - -static -void flatten(complex_float * dest, complex_float * src, +void sflatten(complex_float * dest, complex_float * src, int rank, int strides_axis, int dims_axis, int unflat, int *tmp) { @@ -109,9 +95,9 @@ *(itmp + 2 * rank + j++) = dims[k] - 1; } } - flatten(tmp, ptr, rank, itmp[axis], dims[axis], 0, itmp); + sflatten(tmp, ptr, rank, itmp[axis], dims[axis], 0, itmp); cfft(tmp, dims[axis], direction, sz / dims[axis], normalize); - flatten(ptr, tmp, rank, itmp[axis], dims[axis], 1, itmp); + sflatten(ptr, tmp, rank, itmp[axis], dims[axis], 1, itmp); } } From scipy-svn at scipy.org Wed Jan 7 09:46:56 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 08:46:56 -0600 (CST) Subject: [Scipy-svn] r5350 - trunk/scipy/fftpack Message-ID: <20090107144656.98C13C7C040@scipy.org> Author: cdavid Date: 2009-01-07 08:46:46 -0600 (Wed, 07 Jan 2009) New Revision: 5350 Modified: trunk/scipy/fftpack/fftpack.pyf Log: Add single prec implementation to f2py wrapper. Modified: trunk/scipy/fftpack/fftpack.pyf =================================================================== --- trunk/scipy/fftpack/fftpack.pyf 2009-01-07 14:46:12 UTC (rev 5349) +++ trunk/scipy/fftpack/fftpack.pyf 2009-01-07 14:46:46 UTC (rev 5350) @@ -83,6 +83,86 @@ intent(c) destroy_drfft_cache end subroutine destroy_drfft_cache + /* Single precision version */ + subroutine cfft(x,n,direction,howmany,normalize) + ! y = fft(x[,n,direction,normalize,overwrite_x]) + intent(c) cfft + complex*8 intent(c,in,out,copy,out=y) :: x(*) + integer optional,depend(x),intent(c,in) :: n=size(x) + check(n>0) n + integer depend(x,n),intent(c,hide) :: howmany = size(x)/n + check(n*howmany==size(x)) howmany + integer optional,intent(c,in) :: direction = 1 + integer optional,intent(c,in),depend(direction) & + :: normalize = (direction<0) + end subroutine cfft + + subroutine rfft(x,n,direction,howmany,normalize) + ! y = rfft(x[,n,direction,normalize,overwrite_x]) + intent(c) rfft + 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) :: direction = 1 + integer optional,intent(c,in),depend(direction) & + :: normalize = (direction<0) + end subroutine rfft + +! subroutine crfft(x,n,direction,howmany,normalize) +! ! y = crfft(x[,n,direction,normalize,overwrite_x]) +! intent(c) crfft +! complex*8 intent(c,in,out,overwrite,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) :: direction = 1 +! integer optional,intent(c,in),depend(direction) & +! :: normalize = (direction<0) +! end subroutine crfft +! + subroutine cfftnd(x,r,s,direction,howmany,normalize,j) + ! y = cfftnd(x[,s,direction,normalize,overwrite_x]) + intent(c) cfftnd + complex*8 intent(c,in,out,copy,out=y) :: x(*) + integer intent(c,hide),depend(x) :: r=old_rank(x) + integer intent(c,hide) :: j=0 + integer optional,depend(r),dimension(r),intent(c,in) & + :: s=old_shape(x,j++) + check(r>=len(s)) s + integer intent(c,hide) :: howmany = 1 + integer optional,intent(c,in) :: direction = 1 + integer optional,intent(c,in),depend(direction) :: & + normalize = (direction<0) + callprotoargument complex_float*,int,int*,int,int,int + callstatement {& + int i,sz=1,xsz=size(x); & + for (i=0;i Author: cdavid Date: 2009-01-07 08:47:11 -0600 (Wed, 07 Jan 2009) New Revision: 5351 Modified: trunk/scipy/fftpack/tests/test_basic.py Log: Implement single prec tests. Modified: trunk/scipy/fftpack/tests/test_basic.py =================================================================== --- trunk/scipy/fftpack/tests/test_basic.py 2009-01-07 14:46:46 UTC (rev 5350) +++ trunk/scipy/fftpack/tests/test_basic.py 2009-01-07 14:47:11 UTC (rev 5351) @@ -17,6 +17,7 @@ from numpy import arange, add, array, asarray, zeros, dot, exp, pi,\ swapaxes, double, cdouble +import numpy as np import numpy.fft from numpy.random import rand @@ -88,28 +89,37 @@ x1[0] = x[0] return direct_idft(x1).real -class TestFft(TestCase): +class _TestFFTBase(TestCase): + def setUp(self): + self.cdt = None + self.rdt = None def test_definition(self): - x = [1,2,3,4+1j,1,2,3,4+2j] + x = np.array([1,2,3,4+1j,1,2,3,4+2j], dtype = self.cdt) y = fft(x) + self.failUnless(y.dtype == self.cdt, + "Output dtype is %s, expected %s" % (y.dtype, self.cdt)) y1 = direct_dft(x) assert_array_almost_equal(y,y1) - x = [1,2,3,4+0j,5] + x = np.array([1,2,3,4+0j,5], dtype = self.cdt) assert_array_almost_equal(fft(x),direct_dft(x)) def test_n_argument_real(self): - x1 = [1,2,3,4] - x2 = [1,2,3,4] + x1 = np.array([1,2,3,4], dtype=self.rdt) + x2 = np.array([1,2,3,4], dtype=self.rdt) y = fft([x1,x2],n=4) + self.failUnless(y.dtype == self.cdt, + "Output dtype is %s, expected %s" % (y.dtype, self.cdt)) assert_equal(y.shape,(2,4)) assert_array_almost_equal(y[0],direct_dft(x1)) assert_array_almost_equal(y[1],direct_dft(x2)) def _test_n_argument_complex(self): - x1 = [1,2,3,4+1j] - x2 = [1,2,3,4+1j] + x1 = np.array([1,2,3,4+1j], dtype=self.cdt) + x2 = np.array([1,2,3,4+1j], dtype=self.cdt) y = fft([x1,x2],n=4) + self.failUnless(y.dtype == self.cdt, + "Output dtype is %s, expected %s" % (y.dtype, self.cdt)) assert_equal(y.shape,(2,4)) assert_array_almost_equal(y[0],direct_dft(x1)) assert_array_almost_equal(y[1],direct_dft(x2)) @@ -125,6 +135,16 @@ assert_array_almost_equal(y,y2) +class TestDoubleFFT(_TestFFTBase): + def setUp(self): + self.cdt = np.cdouble + self.rdt = np.double + +class TestSingleFFT(_TestFFTBase): + def setUp(self): + self.cdt = np.complex64 + self.rdt = np.float32 + class TestIfft(TestCase): def test_definition(self): From scipy-svn at scipy.org Wed Jan 7 09:47:54 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 08:47:54 -0600 (CST) Subject: [Scipy-svn] r5352 - trunk/scipy/fftpack/tests Message-ID: <20090107144754.8B76FC7C040@scipy.org> Author: cdavid Date: 2009-01-07 08:47:42 -0600 (Wed, 07 Jan 2009) New Revision: 5352 Modified: trunk/scipy/fftpack/tests/test_basic.py Log: Add test for single prec ifft. Modified: trunk/scipy/fftpack/tests/test_basic.py =================================================================== --- trunk/scipy/fftpack/tests/test_basic.py 2009-01-07 14:47:11 UTC (rev 5351) +++ trunk/scipy/fftpack/tests/test_basic.py 2009-01-07 14:47:42 UTC (rev 5352) @@ -145,20 +145,26 @@ self.cdt = np.complex64 self.rdt = np.float32 -class TestIfft(TestCase): - +class _TestIFFTBase(TestCase): def test_definition(self): - x = [1,2,3,4+1j,1,2,3,4+2j] + x = np.array([1,2,3,4+1j,1,2,3,4+2j], self.cdt) y = ifft(x) y1 = direct_idft(x) + self.failUnless(y.dtype == self.cdt, + "Output dtype is %s, expected %s" % (y.dtype, self.cdt)) assert_array_almost_equal(y,y1) - x = [1,2,3,4+0j,5] + + x = np.array([1,2,3,4+0j,5], self.cdt) assert_array_almost_equal(ifft(x),direct_idft(x)) - x = [1,2,3,4,1,2,3,4] + x = np.array([1,2,3,4,1,2,3,4], self.rdt) y = ifft(x) + self.failUnless(y.dtype == self.cdt, + "Output dtype is %s, expected %s" % (y.dtype, self.cdt)) y1 = direct_idft(x) assert_array_almost_equal(y,y1) - x = [1,2,3,4,5] + x = np.array([1,2,3,4,5], dtype=self.rdt) + self.failUnless(y.dtype == self.cdt, + "Output dtype is %s, expected %s" % (y.dtype, self.cdt)) assert_array_almost_equal(ifft(x),direct_idft(x)) def test_djbfft(self): @@ -173,18 +179,40 @@ def test_random_complex(self): for size in [1,51,111,100,200,64,128,256,1024]: - x = random([size]).astype(cdouble) - x = random([size]).astype(cdouble) +1j*x - assert_array_almost_equal (ifft(fft(x)),x) - assert_array_almost_equal (fft(ifft(x)),x) + x = random([size]).astype(self.cdt) + x = random([size]).astype(self.cdt) +1j*x + y1 = ifft(fft(x)) + y2 = fft(ifft(x)) + self.failUnless(y1.dtype == self.cdt, + "Output dtype is %s, expected %s" % (y1.dtype, self.cdt)) + self.failUnless(y2.dtype == self.cdt, + "Output dtype is %s, expected %s" % (y2.dtype, self.cdt)) + assert_array_almost_equal (y1, x) + assert_array_almost_equal (y2, x) def test_random_real(self): for size in [1,51,111,100,200,64,128,256,1024]: - x = random([size]).astype(double) - assert_array_almost_equal (ifft(fft(x)),x) - assert_array_almost_equal (fft(ifft(x)),x) + x = random([size]).astype(self.rdt) + y1 = ifft(fft(x)) + y2 = fft(ifft(x)) + self.failUnless(y1.dtype == self.cdt, + "Output dtype is %s, expected %s" % (y1.dtype, self.cdt)) + self.failUnless(y2.dtype == self.cdt, + "Output dtype is %s, expected %s" % (y2.dtype, self.cdt)) + assert_array_almost_equal (y1, x) + assert_array_almost_equal (y2, x) +class TestDoubleIFFT(_TestIFFTBase): + def setUp(self): + self.cdt = np.cdouble + self.rdt = np.double +class TestSingleIFFT(_TestIFFTBase): + def setUp(self): + self.cdt = np.complex64 + self.rdt = np.float32 + + class TestRfft(TestCase): def test_definition(self): From scipy-svn at scipy.org Wed Jan 7 09:48:31 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 08:48:31 -0600 (CST) Subject: [Scipy-svn] r5353 - trunk/scipy/fftpack Message-ID: <20090107144831.87DD7C7C040@scipy.org> Author: cdavid Date: 2009-01-07 08:48:20 -0600 (Wed, 07 Jan 2009) New Revision: 5353 Modified: trunk/scipy/fftpack/basic.py Log: Raise an exception when single prec real input in fft. Modified: trunk/scipy/fftpack/basic.py =================================================================== --- trunk/scipy/fftpack/basic.py 2009-01-07 14:47:42 UTC (rev 5352) +++ trunk/scipy/fftpack/basic.py 2009-01-07 14:48:20 UTC (rev 5353) @@ -110,6 +110,8 @@ work_function = fftpack.zfft elif istype(tmp, numpy.complex64): raise NotImplementedError + elif istype(tmp, numpy.float32): + raise NotImplementedError else: overwrite_x = 1 work_function = fftpack.zrfft From scipy-svn at scipy.org Wed Jan 7 09:49:01 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 08:49:01 -0600 (CST) Subject: [Scipy-svn] r5354 - trunk/scipy/fftpack/tests Message-ID: <20090107144901.7C5D9C7C040@scipy.org> Author: cdavid Date: 2009-01-07 08:48:50 -0600 (Wed, 07 Jan 2009) New Revision: 5354 Modified: trunk/scipy/fftpack/tests/test_basic.py Log: Skip not yet implemented single prec cases. Modified: trunk/scipy/fftpack/tests/test_basic.py =================================================================== --- trunk/scipy/fftpack/tests/test_basic.py 2009-01-07 14:48:20 UTC (rev 5353) +++ trunk/scipy/fftpack/tests/test_basic.py 2009-01-07 14:48:50 UTC (rev 5354) @@ -145,6 +145,10 @@ self.cdt = np.complex64 self.rdt = np.float32 + @dec.skipif(True, "Single precision real input not implemented yet") + def test_n_argument_real(self): + pass + class _TestIFFTBase(TestCase): def test_definition(self): x = np.array([1,2,3,4+1j,1,2,3,4+2j], self.cdt) @@ -156,12 +160,15 @@ x = np.array([1,2,3,4+0j,5], self.cdt) assert_array_almost_equal(ifft(x),direct_idft(x)) + + def test_definition_real(self): x = np.array([1,2,3,4,1,2,3,4], self.rdt) y = ifft(x) self.failUnless(y.dtype == self.cdt, "Output dtype is %s, expected %s" % (y.dtype, self.cdt)) y1 = direct_idft(x) assert_array_almost_equal(y,y1) + x = np.array([1,2,3,4,5], dtype=self.rdt) self.failUnless(y.dtype == self.cdt, "Output dtype is %s, expected %s" % (y.dtype, self.cdt)) @@ -212,7 +219,15 @@ self.cdt = np.complex64 self.rdt = np.float32 + @dec.skipif(True, "Single precision real input not implemented yet") + def test_random_real(self): + pass + @dec.skipif(True, "Single precision real input not implemented yet") + def test_definition_real(self): + pass + + class TestRfft(TestCase): def test_definition(self): From scipy-svn at scipy.org Wed Jan 7 09:49:28 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 08:49:28 -0600 (CST) Subject: [Scipy-svn] r5355 - trunk/scipy/fftpack Message-ID: <20090107144928.BD09AC7C040@scipy.org> Author: cdavid Date: 2009-01-07 08:49:15 -0600 (Wed, 07 Jan 2009) New Revision: 5355 Modified: trunk/scipy/fftpack/basic.py Log: Handle single prec complex input for fft and ifft. Modified: trunk/scipy/fftpack/basic.py =================================================================== --- trunk/scipy/fftpack/basic.py 2009-01-07 14:48:50 UTC (rev 5354) +++ trunk/scipy/fftpack/basic.py 2009-01-07 14:49:15 UTC (rev 5355) @@ -109,9 +109,9 @@ hasattr(x,'__array__')) work_function = fftpack.zfft elif istype(tmp, numpy.complex64): - raise NotImplementedError - elif istype(tmp, numpy.float32): - raise NotImplementedError + overwrite_x = overwrite_x or (tmp is not x and not \ + hasattr(x,'__array__')) + work_function = fftpack.cfft else: overwrite_x = 1 work_function = fftpack.zrfft @@ -149,7 +149,9 @@ hasattr(x,'__array__')) work_function = fftpack.zfft elif istype(tmp, numpy.complex64): - raise NotImplementedError + overwrite_x = overwrite_x or (tmp is not x and not \ + hasattr(x,'__array__')) + work_function = fftpack.cfft else: overwrite_x = 1 work_function = fftpack.zrfft From scipy-svn at scipy.org Wed Jan 7 09:50:01 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 08:50:01 -0600 (CST) Subject: [Scipy-svn] r5356 - trunk/scipy/fftpack/tests Message-ID: <20090107145001.2BA82C7C040@scipy.org> Author: cdavid Date: 2009-01-07 08:49:46 -0600 (Wed, 07 Jan 2009) New Revision: 5356 Modified: trunk/scipy/fftpack/tests/test_basic.py Log: Add single prec test for rfft. Modified: trunk/scipy/fftpack/tests/test_basic.py =================================================================== --- trunk/scipy/fftpack/tests/test_basic.py 2009-01-07 14:49:15 UTC (rev 5355) +++ trunk/scipy/fftpack/tests/test_basic.py 2009-01-07 14:49:46 UTC (rev 5356) @@ -228,17 +228,16 @@ pass -class TestRfft(TestCase): +class _TestRFFTBase(TestCase): def test_definition(self): - x = [1,2,3,4,1,2,3,4] - y = rfft(x) - y1 = direct_rdft(x) - assert_array_almost_equal(y,y1) - x = [1,2,3,4,1,2,3,4,5] - y = rfft(x) - y1 = direct_rdft(x) - assert_array_almost_equal(y,y1) + for t in [[1, 2, 3, 4, 1, 2, 3, 4], [1, 2, 3, 4, 1, 2, 3, 4, 5]]: + x = np.array([1,2,3,4,1,2,3,4], dtype=self.rdt) + y = rfft(x) + y1 = direct_rdft(x) + assert_array_almost_equal(y,y1) + self.failUnless(y1.dtype == self.rdt, + "Output dtype is %s, expected %s" % (y1.dtype, self.rdt)) def test_djbfft(self): from numpy.fft import fft as numpy_fft @@ -255,7 +254,16 @@ y = fftpack.drfft(x) assert_array_almost_equal(y,y1) +class TestRFFTDouble(_TestRFFTBase): + def setUp(self): + self.cdt = np.cdouble + self.rdt = np.double +class TestRFFTSingle(_TestRFFTBase): + def setUp(self): + self.cdt = np.complex64 + self.rdt = np.float32 + class TestIrfft(TestCase): def test_definition(self): From scipy-svn at scipy.org Wed Jan 7 09:50:31 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 08:50:31 -0600 (CST) Subject: [Scipy-svn] r5357 - trunk/scipy/fftpack/tests Message-ID: <20090107145031.A5825C7C040@scipy.org> Author: cdavid Date: 2009-01-07 08:50:17 -0600 (Wed, 07 Jan 2009) New Revision: 5357 Modified: trunk/scipy/fftpack/tests/test_basic.py Log: Add test for irfft, single prec. Modified: trunk/scipy/fftpack/tests/test_basic.py =================================================================== --- trunk/scipy/fftpack/tests/test_basic.py 2009-01-07 14:49:46 UTC (rev 5356) +++ trunk/scipy/fftpack/tests/test_basic.py 2009-01-07 14:50:17 UTC (rev 5357) @@ -264,22 +264,25 @@ self.cdt = np.complex64 self.rdt = np.float32 -class TestIrfft(TestCase): +class _TestIRFFTBase(TestCase): def test_definition(self): - x = [1,2,3,4,1,2,3,4] - x1 = [1,2+3j,4+1j,2+3j,4,2-3j,4-1j,2-3j] - y = irfft(x) - y1 = direct_irdft(x) - assert_array_almost_equal(y,y1) - assert_array_almost_equal(y,ifft(x1)) - x = [1,2,3,4,1,2,3,4,5] - x1 = [1,2+3j,4+1j,2+3j,4+5j,4-5j,2-3j,4-1j,2-3j] - y = irfft(x) - y1 = direct_irdft(x) - assert_array_almost_equal(y,y1) - assert_array_almost_equal(y,ifft(x1)) + x1 = [1,2,3,4,1,2,3,4] + x1_1 = [1,2+3j,4+1j,2+3j,4,2-3j,4-1j,2-3j] + x2= [1,2,3,4,1,2,3,4,5] + x2_1 = [1,2+3j,4+1j,2+3j,4+5j,4-5j,2-3j,4-1j,2-3j] + def _test(x, xr): + y = irfft(x) + y1 = direct_irdft(x) + self.failUnless(y1.dtype == self.cdt, + "Output dtype is %s, expected %s" % (y1.dtype, self.cdt)) + assert_array_almost_equal(y,y1) + assert_array_almost_equal(y,ifft(xr)) + + _test(x1, x1_1) + _test(x2, x2_1) + def test_djbfft(self): from numpy.fft import ifft as numpy_ifft for i in range(2,14): @@ -297,10 +300,26 @@ def test_random_real(self): for size in [1,51,111,100,200,64,128,256,1024]: - x = random([size]).astype(double) - assert_array_almost_equal (irfft(rfft(x)),x) - assert_array_almost_equal (rfft(irfft(x)),x) + x = random([size]).astype(self.rdt) + y1 = irfft(rfft(x)) + y2 = rfft(irfft(x)) + self.failUnless(y1.dtype == self.rdt, + "Output dtype is %s, expected %s" % (y1.dtype, self.rdt)) + self.failUnless(y2.dtype == self.rdt, + "Output dtype is %s, expected %s" % (y2.dtype, self.rdt)) + assert_array_almost_equal (y1,x) + assert_array_almost_equal (y2,x) +class TestIRFFTDouble(_TestIRFFTBase): + def setUp(self): + self.cdt = np.cdouble + self.rdt = np.double + +class TestIRFFTSingle(_TestIRFFTBase): + def setUp(self): + self.cdt = np.complex64 + self.rdt = np.float32 + class Testfft2(TestCase): def test_regression_244(self): """fft returns wrong result with axes parameter.""" From scipy-svn at scipy.org Wed Jan 7 09:51:01 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 08:51:01 -0600 (CST) Subject: [Scipy-svn] r5358 - trunk/scipy/fftpack Message-ID: <20090107145101.CF2CDC7C040@scipy.org> Author: cdavid Date: 2009-01-07 08:50:47 -0600 (Wed, 07 Jan 2009) New Revision: 5358 Modified: trunk/scipy/fftpack/basic.py Log: Handle single prec in rfft and irfft. Modified: trunk/scipy/fftpack/basic.py =================================================================== --- trunk/scipy/fftpack/basic.py 2009-01-07 14:50:17 UTC (rev 5357) +++ trunk/scipy/fftpack/basic.py 2009-01-07 14:50:47 UTC (rev 5358) @@ -201,7 +201,10 @@ tmp = asarray(x) if not numpy.isrealobj(tmp): raise TypeError,"1st argument must be real sequence" - work_function = fftpack.drfft + if istype(tmp, numpy.float32): + work_function = fftpack.rfft + else: + work_function = fftpack.drfft return _raw_fft(tmp,n,axis,1,overwrite_x,work_function) @@ -245,7 +248,10 @@ tmp = asarray(x) if not numpy.isrealobj(tmp): raise TypeError,"1st argument must be real sequence" - work_function = fftpack.drfft + if istype(tmp, numpy.float32): + work_function = fftpack.rfft + else: + work_function = fftpack.drfft return _raw_fft(tmp,n,axis,-1,overwrite_x,work_function) From scipy-svn at scipy.org Wed Jan 7 09:51:51 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 08:51:51 -0600 (CST) Subject: [Scipy-svn] r5359 - trunk/scipy/fftpack/tests Message-ID: <20090107145151.8B5B5C7C040@scipy.org> Author: cdavid Date: 2009-01-07 08:51:19 -0600 (Wed, 07 Jan 2009) New Revision: 5359 Modified: trunk/scipy/fftpack/tests/test_basic.py Log: Fix test. Modified: trunk/scipy/fftpack/tests/test_basic.py =================================================================== --- trunk/scipy/fftpack/tests/test_basic.py 2009-01-07 14:50:47 UTC (rev 5358) +++ trunk/scipy/fftpack/tests/test_basic.py 2009-01-07 14:51:19 UTC (rev 5359) @@ -232,7 +232,7 @@ def test_definition(self): for t in [[1, 2, 3, 4, 1, 2, 3, 4], [1, 2, 3, 4, 1, 2, 3, 4, 5]]: - x = np.array([1,2,3,4,1,2,3,4], dtype=self.rdt) + x = np.array(t, dtype=self.rdt) y = rfft(x) y1 = direct_rdft(x) assert_array_almost_equal(y,y1) From scipy-svn at scipy.org Wed Jan 7 10:52:54 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 09:52:54 -0600 (CST) Subject: [Scipy-svn] r5360 - trunk/scipy/fftpack/tests Message-ID: <20090107155254.86FE7C7C055@scipy.org> Author: cdavid Date: 2009-01-07 09:52:50 -0600 (Wed, 07 Jan 2009) New Revision: 5360 Modified: trunk/scipy/fftpack/tests/test_basic.py Log: Use different number of decimals for single and double tests. Modified: trunk/scipy/fftpack/tests/test_basic.py =================================================================== --- trunk/scipy/fftpack/tests/test_basic.py 2009-01-07 14:51:19 UTC (rev 5359) +++ trunk/scipy/fftpack/tests/test_basic.py 2009-01-07 15:52:50 UTC (rev 5360) @@ -275,10 +275,10 @@ def _test(x, xr): y = irfft(x) y1 = direct_irdft(x) - self.failUnless(y1.dtype == self.cdt, - "Output dtype is %s, expected %s" % (y1.dtype, self.cdt)) - assert_array_almost_equal(y,y1) - assert_array_almost_equal(y,ifft(xr)) + self.failUnless(y1.dtype == self.rdt, + "Output dtype is %s, expected %s" % (y1.dtype, self.rdt)) + assert_array_almost_equal(y,y1, decimal=self.ndec) + assert_array_almost_equal(y,ifft(xr), decimal=self.ndec) _test(x1, x1_1) _test(x2, x2_1) @@ -310,15 +310,19 @@ assert_array_almost_equal (y1,x) assert_array_almost_equal (y2,x) +# self.ndec is bogus; we should have a assert_array_approx_equal for number of +# significant digits class TestIRFFTDouble(_TestIRFFTBase): def setUp(self): self.cdt = np.cdouble self.rdt = np.double + self.ndec = 14 class TestIRFFTSingle(_TestIRFFTBase): def setUp(self): self.cdt = np.complex64 self.rdt = np.float32 + self.ndec = 7 class Testfft2(TestCase): def test_regression_244(self): From scipy-svn at scipy.org Wed Jan 7 10:53:10 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 09:53:10 -0600 (CST) Subject: [Scipy-svn] r5361 - trunk/scipy/fftpack/tests Message-ID: <20090107155310.6A3AFC7C055@scipy.org> Author: cdavid Date: 2009-01-07 09:53:06 -0600 (Wed, 07 Jan 2009) New Revision: 5361 Modified: trunk/scipy/fftpack/tests/test_basic.py Log: Use 5 significant decimals only (bogus - but 'work' for the time being) Modified: trunk/scipy/fftpack/tests/test_basic.py =================================================================== --- trunk/scipy/fftpack/tests/test_basic.py 2009-01-07 15:52:50 UTC (rev 5360) +++ trunk/scipy/fftpack/tests/test_basic.py 2009-01-07 15:53:06 UTC (rev 5361) @@ -307,8 +307,8 @@ "Output dtype is %s, expected %s" % (y1.dtype, self.rdt)) self.failUnless(y2.dtype == self.rdt, "Output dtype is %s, expected %s" % (y2.dtype, self.rdt)) - assert_array_almost_equal (y1,x) - assert_array_almost_equal (y2,x) + assert_array_almost_equal (y1, x, decimal=self.ndec) + assert_array_almost_equal (y2, x, decimal=self.ndec) # self.ndec is bogus; we should have a assert_array_approx_equal for number of # significant digits @@ -322,7 +322,7 @@ def setUp(self): self.cdt = np.complex64 self.rdt = np.float32 - self.ndec = 7 + self.ndec = 5 class Testfft2(TestCase): def test_regression_244(self): From scipy-svn at scipy.org Wed Jan 7 10:53:25 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 09:53:25 -0600 (CST) Subject: [Scipy-svn] r5362 - trunk/scipy/fftpack Message-ID: <20090107155325.C940DC7C055@scipy.org> Author: cdavid Date: 2009-01-07 09:53:21 -0600 (Wed, 07 Jan 2009) New Revision: 5362 Modified: trunk/scipy/fftpack/basic.py Log: Forgot to register cache destructors. Modified: trunk/scipy/fftpack/basic.py =================================================================== --- trunk/scipy/fftpack/basic.py 2009-01-07 15:53:06 UTC (rev 5361) +++ trunk/scipy/fftpack/basic.py 2009-01-07 15:53:21 UTC (rev 5362) @@ -16,6 +16,9 @@ atexit.register(fftpack.destroy_zfft_cache) atexit.register(fftpack.destroy_zfftnd_cache) atexit.register(fftpack.destroy_drfft_cache) +atexit.register(fftpack.destroy_cfft_cache) +atexit.register(fftpack.destroy_cfftnd_cache) +atexit.register(fftpack.destroy_rfft_cache) del atexit def istype(arr, typeclass): From scipy-svn at scipy.org Wed Jan 7 10:53:41 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 09:53:41 -0600 (CST) Subject: [Scipy-svn] r5363 - trunk/scipy/fftpack/tests Message-ID: <20090107155341.BB686C7C055@scipy.org> Author: cdavid Date: 2009-01-07 09:53:37 -0600 (Wed, 07 Jan 2009) New Revision: 5363 Modified: trunk/scipy/fftpack/tests/test_basic.py Log: BUG: Fix single prec tests for rfft and irfft. Modified: trunk/scipy/fftpack/tests/test_basic.py =================================================================== --- trunk/scipy/fftpack/tests/test_basic.py 2009-01-07 15:53:21 UTC (rev 5362) +++ trunk/scipy/fftpack/tests/test_basic.py 2009-01-07 15:53:37 UTC (rev 5363) @@ -236,8 +236,8 @@ y = rfft(x) y1 = direct_rdft(x) assert_array_almost_equal(y,y1) - self.failUnless(y1.dtype == self.rdt, - "Output dtype is %s, expected %s" % (y1.dtype, self.rdt)) + self.failUnless(y.dtype == self.rdt, + "Output dtype is %s, expected %s" % (y.dtype, self.rdt)) def test_djbfft(self): from numpy.fft import fft as numpy_fft @@ -273,10 +273,10 @@ x2_1 = [1,2+3j,4+1j,2+3j,4+5j,4-5j,2-3j,4-1j,2-3j] def _test(x, xr): - y = irfft(x) + y = irfft(np.array(x, dtype=self.rdt)) y1 = direct_irdft(x) - self.failUnless(y1.dtype == self.rdt, - "Output dtype is %s, expected %s" % (y1.dtype, self.rdt)) + self.failUnless(y.dtype == self.rdt, + "Output dtype is %s, expected %s" % (y.dtype, self.rdt)) assert_array_almost_equal(y,y1, decimal=self.ndec) assert_array_almost_equal(y,ifft(xr), decimal=self.ndec) From scipy-svn at scipy.org Wed Jan 7 13:23:43 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 12:23:43 -0600 (CST) Subject: [Scipy-svn] r5364 - trunk/scipy/fftpack/src Message-ID: <20090107182343.D597FC7C073@scipy.org> Author: cdavid Date: 2009-01-07 12:23:33 -0600 (Wed, 07 Jan 2009) New Revision: 5364 Modified: trunk/scipy/fftpack/src/zrfft.c Log: Add single precision version of zrfft. Modified: trunk/scipy/fftpack/src/zrfft.c =================================================================== --- trunk/scipy/fftpack/src/zrfft.c 2009-01-07 15:53:37 UTC (rev 5363) +++ trunk/scipy/fftpack/src/zrfft.c 2009-01-07 18:23:33 UTC (rev 5364) @@ -7,6 +7,7 @@ #include "fftpack.h" extern void drfft(double *inout,int n,int direction,int howmany,int normalize); +extern void rfft(float *inout,int n,int direction,int howmany,int normalize); extern void zrfft(complex_double *inout, int n,int direction,int howmany,int normalize) { @@ -52,3 +53,48 @@ fprintf(stderr,"zrfft: invalid direction=%d\n",direction); } } + +extern void crfft(complex_float *inout, + int n,int direction,int howmany,int normalize) { + int i,j,k; + float* ptr = (float *)inout; + switch (direction) { + case 1: + for (i=0;i Author: cdavid Date: 2009-01-07 12:23:56 -0600 (Wed, 07 Jan 2009) New Revision: 5365 Modified: trunk/scipy/fftpack/fftpack.pyf Log: Add crfft f2py wrapper. Modified: trunk/scipy/fftpack/fftpack.pyf =================================================================== --- trunk/scipy/fftpack/fftpack.pyf 2009-01-07 18:23:33 UTC (rev 5364) +++ trunk/scipy/fftpack/fftpack.pyf 2009-01-07 18:23:56 UTC (rev 5365) @@ -110,19 +110,19 @@ :: normalize = (direction<0) end subroutine rfft -! subroutine crfft(x,n,direction,howmany,normalize) -! ! y = crfft(x[,n,direction,normalize,overwrite_x]) -! intent(c) crfft -! complex*8 intent(c,in,out,overwrite,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) :: direction = 1 -! integer optional,intent(c,in),depend(direction) & -! :: normalize = (direction<0) -! end subroutine crfft -! + subroutine crfft(x,n,direction,howmany,normalize) + ! y = crfft(x[,n,direction,normalize,overwrite_x]) + intent(c) crfft + complex*8 intent(c,in,out,overwrite,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) :: direction = 1 + integer optional,intent(c,in),depend(direction) & + :: normalize = (direction<0) + end subroutine crfft + subroutine cfftnd(x,r,s,direction,howmany,normalize,j) ! y = cfftnd(x[,s,direction,normalize,overwrite_x]) intent(c) cfftnd From scipy-svn at scipy.org Wed Jan 7 13:24:32 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 12:24:32 -0600 (CST) Subject: [Scipy-svn] r5366 - in trunk/scipy/fftpack: . tests Message-ID: <20090107182432.6F53DC7C073@scipy.org> Author: cdavid Date: 2009-01-07 12:24:18 -0600 (Wed, 07 Jan 2009) New Revision: 5366 Modified: trunk/scipy/fftpack/basic.py trunk/scipy/fftpack/tests/test_basic.py Log: Handle single prec real input in fft/ifft. Modified: trunk/scipy/fftpack/basic.py =================================================================== --- trunk/scipy/fftpack/basic.py 2009-01-07 18:23:56 UTC (rev 5365) +++ trunk/scipy/fftpack/basic.py 2009-01-07 18:24:18 UTC (rev 5366) @@ -117,7 +117,10 @@ work_function = fftpack.cfft else: overwrite_x = 1 - work_function = fftpack.zrfft + if istype(tmp, numpy.float32): + work_function = fftpack.crfft + else: + work_function = fftpack.zrfft #return _raw_fft(tmp,n,axis,1,overwrite_x,work_function) if n is None: @@ -157,7 +160,10 @@ work_function = fftpack.cfft else: overwrite_x = 1 - work_function = fftpack.zrfft + if istype(tmp, numpy.float32): + work_function = fftpack.crfft + else: + work_function = fftpack.zrfft #return _raw_fft(tmp,n,axis,-1,overwrite_x,work_function) if n is None: Modified: trunk/scipy/fftpack/tests/test_basic.py =================================================================== --- trunk/scipy/fftpack/tests/test_basic.py 2009-01-07 18:23:56 UTC (rev 5365) +++ trunk/scipy/fftpack/tests/test_basic.py 2009-01-07 18:24:18 UTC (rev 5366) @@ -145,9 +145,9 @@ self.cdt = np.complex64 self.rdt = np.float32 - @dec.skipif(True, "Single precision real input not implemented yet") - def test_n_argument_real(self): - pass + #@dec.skipif(True, "Single precision real input not implemented yet") + #def test_n_argument_real(self): + # pass class _TestIFFTBase(TestCase): def test_definition(self): @@ -219,13 +219,13 @@ self.cdt = np.complex64 self.rdt = np.float32 - @dec.skipif(True, "Single precision real input not implemented yet") - def test_random_real(self): - pass + #@dec.skipif(True, "Single precision real input not implemented yet") + #def test_random_real(self): + # pass - @dec.skipif(True, "Single precision real input not implemented yet") - def test_definition_real(self): - pass + #@dec.skipif(True, "Single precision real input not implemented yet") + #def test_definition_real(self): + # pass class _TestRFFTBase(TestCase): From scipy-svn at scipy.org Wed Jan 7 13:25:01 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 12:25:01 -0600 (CST) Subject: [Scipy-svn] r5367 - trunk/scipy/fftpack/tests Message-ID: <20090107182501.1C291C7C073@scipy.org> Author: cdavid Date: 2009-01-07 12:24:48 -0600 (Wed, 07 Jan 2009) New Revision: 5367 Modified: trunk/scipy/fftpack/tests/test_basic.py Log: Remove dead code. Modified: trunk/scipy/fftpack/tests/test_basic.py =================================================================== --- trunk/scipy/fftpack/tests/test_basic.py 2009-01-07 18:24:18 UTC (rev 5366) +++ trunk/scipy/fftpack/tests/test_basic.py 2009-01-07 18:24:48 UTC (rev 5367) @@ -145,10 +145,6 @@ self.cdt = np.complex64 self.rdt = np.float32 - #@dec.skipif(True, "Single precision real input not implemented yet") - #def test_n_argument_real(self): - # pass - class _TestIFFTBase(TestCase): def test_definition(self): x = np.array([1,2,3,4+1j,1,2,3,4+2j], self.cdt) @@ -219,15 +215,6 @@ self.cdt = np.complex64 self.rdt = np.float32 - #@dec.skipif(True, "Single precision real input not implemented yet") - #def test_random_real(self): - # pass - - #@dec.skipif(True, "Single precision real input not implemented yet") - #def test_definition_real(self): - # pass - - class _TestRFFTBase(TestCase): def test_definition(self): From scipy-svn at scipy.org Wed Jan 7 13:25:27 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 12:25:27 -0600 (CST) Subject: [Scipy-svn] r5368 - trunk/scipy/fftpack/src Message-ID: <20090107182527.1340EC7C073@scipy.org> Author: cdavid Date: 2009-01-07 12:25:14 -0600 (Wed, 07 Jan 2009) New Revision: 5368 Modified: trunk/scipy/fftpack/src/zfft.c Log: Put all complex fft code in zfft.c Modified: trunk/scipy/fftpack/src/zfft.c =================================================================== --- trunk/scipy/fftpack/src/zfft.c 2009-01-07 18:24:48 UTC (rev 5367) +++ trunk/scipy/fftpack/src/zfft.c 2009-01-07 18:25:14 UTC (rev 5368) @@ -6,30 +6,95 @@ #include "fftpack.h" -/* The following macro convert private backend specific function to the public - * functions exported by the module */ -#define GEN_PUBLIC_API(name) \ -void destroy_zfft_cache(void)\ -{\ - destroy_z##name##_caches();\ -}\ -\ -void zfft(complex_double *inout, int n, \ - int direction, int howmany, int normalize)\ -{\ - zfft_##name(inout, n, direction, howmany, normalize);\ -}\ -void destroy_cfft_cache(void)\ -{\ - destroy_c##name##_caches();\ -}\ -\ -void cfft(complex_float *inout, int n, \ - int direction, int howmany, int normalize)\ -{\ - cfft_##name(inout, n, direction, howmany, normalize);\ +extern void F_FUNC(zfftf,ZFFTF)(int*,double*,double*); +extern void F_FUNC(zfftb,ZFFTB)(int*,double*,double*); +extern void F_FUNC(zffti,ZFFTI)(int*,double*); +extern void F_FUNC(cfftf,CFFTF)(int*,float*,float*); +extern void F_FUNC(cfftb,CFFTB)(int*,float*,float*); +extern void F_FUNC(cffti,CFFTI)(int*,float*); + +GEN_CACHE(zfft,(int n) + ,double* wsave; + ,(caches_zfft[i].n==n) + ,caches_zfft[id].wsave = (double*)malloc(sizeof(double)*(4*n+15)); + F_FUNC(zffti,ZFFTI)(&n,caches_zfft[id].wsave); + ,free(caches_zfft[id].wsave); + ,10) + +GEN_CACHE(cfft,(int n) + ,float* wsave; + ,(caches_cfft[i].n==n) + ,caches_cfft[id].wsave = (float*)malloc(sizeof(float)*(4*n+15)); + F_FUNC(cffti,CFFTI)(&n,caches_cfft[id].wsave); + ,free(caches_cfft[id].wsave); + ,10) + +void zfft(complex_double * inout, int n, int direction, int howmany, + int normalize) +{ + int i; + complex_double *ptr = inout; + double *wsave = NULL; + + wsave = caches_zfft[get_cache_id_zfft(n)].wsave; + + switch (direction) { + case 1: + for (i = 0; i < howmany; ++i, ptr += n) { + zfftf_(&n, (double *) (ptr), wsave); + + } + break; + + case -1: + for (i = 0; i < howmany; ++i, ptr += n) { + zfftb_(&n, (double *) (ptr), wsave); + } + break; + default: + fprintf(stderr, "zfft: invalid direction=%d\n", direction); + } + + if (normalize) { + ptr = inout; + for (i = n * howmany - 1; i >= 0; --i) { + *((double *) (ptr)) /= n; + *((double *) (ptr++) + 1) /= n; + } + } } -#include "zfft_fftpack.c" -#include "cfft_fftpack.c" -GEN_PUBLIC_API(fftpack) +void cfft(complex_float * inout, int n, int direction, int howmany, + int normalize) +{ + int i; + complex_float *ptr = inout; + float *wsave = NULL; + + wsave = caches_cfft[get_cache_id_cfft(n)].wsave; + + switch (direction) { + case 1: + for (i = 0; i < howmany; ++i, ptr += n) { + cfftf_(&n, (float *) (ptr), wsave); + + } + break; + + case -1: + for (i = 0; i < howmany; ++i, ptr += n) { + cfftb_(&n, (float *) (ptr), wsave); + } + break; + default: + fprintf(stderr, "cfft: invalid direction=%d\n", direction); + } + + if (normalize) { + ptr = inout; + for (i = n * howmany - 1; i >= 0; --i) { + *((float *) (ptr)) /= n; + *((float *) (ptr++) + 1) /= n; + } + } +} From scipy-svn at scipy.org Wed Jan 7 13:26:00 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 12:26:00 -0600 (CST) Subject: [Scipy-svn] r5369 - trunk/scipy/fftpack/src Message-ID: <20090107182600.7A3F8C7C073@scipy.org> Author: cdavid Date: 2009-01-07 12:25:47 -0600 (Wed, 07 Jan 2009) New Revision: 5369 Modified: trunk/scipy/fftpack/src/drfft.c Log: Put all real input fft code in one file. Modified: trunk/scipy/fftpack/src/drfft.c =================================================================== --- trunk/scipy/fftpack/src/drfft.c 2009-01-07 18:25:14 UTC (rev 5368) +++ trunk/scipy/fftpack/src/drfft.c 2009-01-07 18:25:47 UTC (rev 5369) @@ -6,31 +6,98 @@ #include "fftpack.h" -/* The following macro convert private backend specific function to the public - * functions exported by the module */ -#define GEN_PUBLIC_API(name) \ -void destroy_drfft_cache(void)\ -{\ - destroy_dr##name##_caches();\ -}\ -\ -void drfft(double *inout, int n, \ - int direction, int howmany, int normalize)\ -{\ - drfft_##name(inout, n, direction, howmany, normalize);\ -}\ -void destroy_rfft_cache(void)\ -{\ - destroy_r##name##_caches();\ -}\ -\ -void rfft(float *inout, int n, \ - int direction, int howmany, int normalize)\ -{\ - rfft_##name(inout, n, direction, howmany, normalize);\ +extern void F_FUNC(dfftf, DFFTF) (int *, double *, double *); +extern void F_FUNC(dfftb, DFFTB) (int *, double *, double *); +extern void F_FUNC(dffti, DFFTI) (int *, double *); +extern void F_FUNC(rfftf, RFFTF) (int *, float *, float *); +extern void F_FUNC(rfftb, RFFTB) (int *, float *, float *); +extern void F_FUNC(rffti, RFFTI) (int *, float *); + + +GEN_CACHE(drfftpack, (int n) + , double *wsave; + , (caches_drfftpack[i].n == n) + , caches_drfftpack[id].wsave = + (double *) malloc(sizeof(double) * (2 * n + 15)); + F_FUNC(dffti, DFFTI) (&n, caches_drfftpack[id].wsave); + , free(caches_drfftpack[id].wsave); + , 10) + +GEN_CACHE(rfftpack, (int n) + , float *wsave; + , (caches_rfftpack[i].n == n) + , caches_rfftpack[id].wsave = + (float *) malloc(sizeof(float) * (2 * n + 15)); + F_FUNC(rffti, RFFTI) (&n, caches_rfftpack[id].wsave); + , free(caches_rfftpack[id].wsave); + , 10) + +void drfft_fftpack(double *inout, int n, int direction, int howmany, + int normalize) +{ + int i; + double *ptr = inout; + double *wsave = NULL; + wsave = caches_drfftpack[get_cache_id_drfftpack(n)].wsave; + + + switch (direction) { + case 1: + for (i = 0; i < howmany; ++i, ptr += n) { + dfftf_(&n, ptr, wsave); + } + break; + + case -1: + for (i = 0; i < howmany; ++i, ptr += n) { + dfftb_(&n, ptr, wsave); + } + break; + + default: + fprintf(stderr, "drfft: invalid direction=%d\n", direction); + } + + if (normalize) { + double d = 1.0 / n; + ptr = inout; + for (i = n * howmany - 1; i >= 0; --i) { + (*(ptr++)) *= d; + } + } } +void rfft_fftpack(float *inout, int n, int direction, int howmany, + int normalize) +{ + int i; + float *ptr = inout; + float *wsave = NULL; + wsave = caches_rfftpack[get_cache_id_rfftpack(n)].wsave; -#include "drfft_fftpack.c" -#include "rfft_fftpack.c" -GEN_PUBLIC_API(fftpack) + + switch (direction) { + case 1: + for (i = 0; i < howmany; ++i, ptr += n) { + rfftf_(&n, ptr, wsave); + } + break; + + case -1: + for (i = 0; i < howmany; ++i, ptr += n) { + rfftb_(&n, ptr, wsave); + } + break; + + default: + fprintf(stderr, "rfft: invalid direction=%d\n", direction); + } + + if (normalize) { + float d = 1.0 / n; + ptr = inout; + for (i = n * howmany - 1; i >= 0; --i) { + (*(ptr++)) *= d; + } + } +} From scipy-svn at scipy.org Wed Jan 7 13:26:40 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 12:26:40 -0600 (CST) Subject: [Scipy-svn] r5370 - trunk/scipy/fftpack/src Message-ID: <20090107182640.19E08C7C085@scipy.org> Author: cdavid Date: 2009-01-07 12:26:15 -0600 (Wed, 07 Jan 2009) New Revision: 5370 Modified: trunk/scipy/fftpack/src/zfftnd.c Log: Put all nd code in zfftnd.c Modified: trunk/scipy/fftpack/src/zfftnd.c =================================================================== --- trunk/scipy/fftpack/src/zfftnd.c 2009-01-07 18:25:47 UTC (rev 5369) +++ trunk/scipy/fftpack/src/zfftnd.c 2009-01-07 18:26:15 UTC (rev 5370) @@ -5,31 +5,210 @@ */ #include "fftpack.h" -/* The following macro convert private backend specific function to the public - * functions exported by the module */ -#define GEN_PUBLIC_API(name) \ -void destroy_zfftnd_cache(void)\ -{\ - destroy_zfftnd_##name##_caches();\ -}\ -\ -void zfftnd(complex_double * inout, int rank,\ - int *dims, int direction, int howmany, int normalize)\ -{\ - zfftnd_##name(inout, rank, dims, direction, howmany, normalize);\ -}\ -void destroy_cfftnd_cache(void)\ -{\ - destroy_cfftnd_##name##_caches();\ -}\ -\ -void cfftnd(complex_float * inout, int rank,\ - int *dims, int direction, int howmany, int normalize)\ -{\ - cfftnd_##name(inout, rank, dims, direction, howmany, normalize);\ +GEN_CACHE(zfftnd_fftpack, (int n, int rank) + , complex_double * ptr; int *iptr; int rank; + , ((caches_zfftnd_fftpack[i].n == n) + && (caches_zfftnd_fftpack[i].rank == rank)) + , caches_zfftnd_fftpack[id].n = n; + caches_zfftnd_fftpack[id].ptr = + (complex_double *) malloc(2 * sizeof(double) * n); + caches_zfftnd_fftpack[id].iptr = + (int *) malloc(4 * rank * sizeof(int)); + , + free(caches_zfftnd_fftpack[id].ptr); + free(caches_zfftnd_fftpack[id].iptr); + , 10) + +GEN_CACHE(cfftnd_fftpack, (int n, int rank) + , complex_float * ptr; int *iptr; int rank; + , ((caches_cfftnd_fftpack[i].n == n) + && (caches_cfftnd_fftpack[i].rank == rank)) + , caches_cfftnd_fftpack[id].n = n; + caches_cfftnd_fftpack[id].ptr = + (complex_float *) malloc(2 * sizeof(float) * n); + caches_cfftnd_fftpack[id].iptr = + (int *) malloc(4 * rank * sizeof(int)); + , + free(caches_cfftnd_fftpack[id].ptr); + free(caches_cfftnd_fftpack[id].iptr); + , 10) + +static +/*inline : disabled because MSVC6.0 fails to compile it. */ +int next_comb(int *ia, int *da, int m) +{ + while (m >= 0 && ia[m] == da[m]) { + ia[m--] = 0; + } + if (m < 0) { + return 0; + } + ia[m]++; + return 1; } +static +void flatten(complex_double * dest, complex_double * src, + int rank, int strides_axis, int dims_axis, int unflat, + int *tmp) +{ + int *new_strides = tmp + rank; + int *new_dims = tmp + 2 * rank; + int *ia = tmp + 3 * rank; + int rm1 = rank - 1, rm2 = rank - 2; + int i, j, k; + for (i = 0; i < rm2; ++i) + ia[i] = 0; + ia[rm2] = -1; + j = 0; + if (unflat) { + while (next_comb(ia, new_dims, rm2)) { + k = 0; + for (i = 0; i < rm1; ++i) { + k += ia[i] * new_strides[i]; + } + for (i = 0; i < dims_axis; ++i) { + *(dest + k + i * strides_axis) = *(src + j++); + } + } + } else { + while (next_comb(ia, new_dims, rm2)) { + k = 0; + for (i = 0; i < rm1; ++i) { + k += ia[i] * new_strides[i]; + } + for (i = 0; i < dims_axis; ++i) { + *(dest + j++) = *(src + k + i * strides_axis); + } + } + } +} -#include "zfftnd_fftpack.c" -#include "cfftnd_fftpack.c" -GEN_PUBLIC_API(fftpack) +static +void sflatten(complex_float * dest, complex_float * src, + int rank, int strides_axis, int dims_axis, int unflat, + int *tmp) +{ + int *new_strides = tmp + rank; + int *new_dims = tmp + 2 * rank; + int *ia = tmp + 3 * rank; + int rm1 = rank - 1, rm2 = rank - 2; + int i, j, k; + for (i = 0; i < rm2; ++i) + ia[i] = 0; + ia[rm2] = -1; + j = 0; + if (unflat) { + while (next_comb(ia, new_dims, rm2)) { + k = 0; + for (i = 0; i < rm1; ++i) { + k += ia[i] * new_strides[i]; + } + for (i = 0; i < dims_axis; ++i) { + *(dest + k + i * strides_axis) = *(src + j++); + } + } + } else { + while (next_comb(ia, new_dims, rm2)) { + k = 0; + for (i = 0; i < rm1; ++i) { + k += ia[i] * new_strides[i]; + } + for (i = 0; i < dims_axis; ++i) { + *(dest + j++) = *(src + k + i * strides_axis); + } + } + } +} + +extern void cfft(complex_float * inout, + int n, int direction, int howmany, int normalize); + +extern void zfft(complex_double * inout, + int n, int direction, int howmany, int normalize); + +extern void zfftnd_fftpack(complex_double * inout, int rank, + int *dims, int direction, int howmany, + int normalize) +{ + int i, sz; + complex_double *ptr = inout; + int axis; + complex_double *tmp; + int *itmp; + int k, j; + + sz = 1; + for (i = 0; i < rank; ++i) { + sz *= dims[i]; + } + zfft(ptr, dims[rank - 1], direction, howmany * sz / dims[rank - 1], + normalize); + + i = get_cache_id_zfftnd_fftpack(sz, rank); + tmp = caches_zfftnd_fftpack[i].ptr; + itmp = caches_zfftnd_fftpack[i].iptr; + + itmp[rank - 1] = 1; + for (i = 2; i <= rank; ++i) { + itmp[rank - i] = itmp[rank - i + 1] * dims[rank - i + 1]; + } + + for (i = 0; i < howmany; ++i, ptr += sz) { + for (axis = 0; axis < rank - 1; ++axis) { + for (k = j = 0; k < rank; ++k) { + if (k != axis) { + *(itmp + rank + j) = itmp[k]; + *(itmp + 2 * rank + j++) = dims[k] - 1; + } + } + flatten(tmp, ptr, rank, itmp[axis], dims[axis], 0, itmp); + zfft(tmp, dims[axis], direction, sz / dims[axis], normalize); + flatten(ptr, tmp, rank, itmp[axis], dims[axis], 1, itmp); + } + } + +} + +extern void cfftnd_fftpack(complex_float * inout, int rank, + int *dims, int direction, int howmany, + int normalize) +{ + int i, sz; + complex_float *ptr = inout; + int axis; + complex_float *tmp; + int *itmp; + int k, j; + + sz = 1; + for (i = 0; i < rank; ++i) { + sz *= dims[i]; + } + cfft(ptr, dims[rank - 1], direction, howmany * sz / dims[rank - 1], + normalize); + + i = get_cache_id_cfftnd_fftpack(sz, rank); + tmp = caches_cfftnd_fftpack[i].ptr; + itmp = caches_cfftnd_fftpack[i].iptr; + + itmp[rank - 1] = 1; + for (i = 2; i <= rank; ++i) { + itmp[rank - i] = itmp[rank - i + 1] * dims[rank - i + 1]; + } + + for (i = 0; i < howmany; ++i, ptr += sz) { + for (axis = 0; axis < rank - 1; ++axis) { + for (k = j = 0; k < rank; ++k) { + if (k != axis) { + *(itmp + rank + j) = itmp[k]; + *(itmp + 2 * rank + j++) = dims[k] - 1; + } + } + sflatten(tmp, ptr, rank, itmp[axis], dims[axis], 0, itmp); + cfft(tmp, dims[axis], direction, sz / dims[axis], normalize); + sflatten(ptr, tmp, rank, itmp[axis], dims[axis], 1, itmp); + } + } + +} From scipy-svn at scipy.org Wed Jan 7 13:27:19 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 12:27:19 -0600 (CST) Subject: [Scipy-svn] r5371 - trunk/scipy/fftpack/src Message-ID: <20090107182719.62C77C7C073@scipy.org> Author: cdavid Date: 2009-01-07 12:26:54 -0600 (Wed, 07 Jan 2009) New Revision: 5371 Removed: trunk/scipy/fftpack/src/cfft_fftpack.c trunk/scipy/fftpack/src/cfftnd_fftpack.c trunk/scipy/fftpack/src/drfft_fftpack.c trunk/scipy/fftpack/src/rfft_fftpack.c trunk/scipy/fftpack/src/zfft_fftpack.c trunk/scipy/fftpack/src/zfftnd_fftpack.c Modified: trunk/scipy/fftpack/src/convolve.c trunk/scipy/fftpack/src/drfft.c trunk/scipy/fftpack/src/fftpack.h trunk/scipy/fftpack/src/zfftnd.c Log: Rename the caches for fftpack wrappers. Deleted: trunk/scipy/fftpack/src/cfft_fftpack.c =================================================================== --- trunk/scipy/fftpack/src/cfft_fftpack.c 2009-01-07 18:26:15 UTC (rev 5370) +++ trunk/scipy/fftpack/src/cfft_fftpack.c 2009-01-07 18:26:54 UTC (rev 5371) @@ -1,46 +0,0 @@ -/* XXX: use the .src mechanism: zfft_cfft are the same */ -extern void F_FUNC(cfftf,CFFTF)(int*,float*,float*); -extern void F_FUNC(cfftb,CFFTB)(int*,float*,float*); -extern void F_FUNC(cffti,CFFTI)(int*,float*); -GEN_CACHE(cfftpack,(int n) - ,float* wsave; - ,(caches_cfftpack[i].n==n) - ,caches_cfftpack[id].wsave = (float*)malloc(sizeof(float)*(4*n+15)); - F_FUNC(cffti,CFFTI)(&n,caches_cfftpack[id].wsave); - ,free(caches_cfftpack[id].wsave); - ,10) - -static void cfft_fftpack(complex_float * inout, - int n, int direction, int howmany, int normalize) -{ - int i; - complex_float *ptr = inout; - float *wsave = NULL; - - wsave = caches_cfftpack[get_cache_id_cfftpack(n)].wsave; - - switch (direction) { - case 1: - for (i = 0; i < howmany; ++i, ptr += n) { - cfftf_(&n, (float *) (ptr), wsave); - - } - break; - - case -1: - for (i = 0; i < howmany; ++i, ptr += n) { - cfftb_(&n, (float *) (ptr), wsave); - } - break; - default: - fprintf(stderr, "cfft: invalid direction=%d\n", direction); - } - - if (normalize) { - ptr = inout; - for (i = n * howmany - 1; i >= 0; --i) { - *((float *) (ptr)) /= n; - *((float *) (ptr++) + 1) /= n; - } - } -} Deleted: trunk/scipy/fftpack/src/cfftnd_fftpack.c =================================================================== --- trunk/scipy/fftpack/src/cfftnd_fftpack.c 2009-01-07 18:26:15 UTC (rev 5370) +++ trunk/scipy/fftpack/src/cfftnd_fftpack.c 2009-01-07 18:26:54 UTC (rev 5371) @@ -1,104 +0,0 @@ -/* - * fftpack backend for multi dimensional fft - * - * Original code by Pearu Peaterson - * - * Last Change: Wed Aug 08 02:00 PM 2007 J - */ - -GEN_CACHE(cfftnd_fftpack, (int n, int rank) - , complex_float * ptr; int *iptr; int rank; - , ((caches_cfftnd_fftpack[i].n == n) - && (caches_cfftnd_fftpack[i].rank == rank)) - , caches_cfftnd_fftpack[id].n = n; - caches_cfftnd_fftpack[id].ptr = - (complex_float *) malloc(2 * sizeof(float) * n); - caches_cfftnd_fftpack[id].iptr = - (int *) malloc(4 * rank * sizeof(int)); - , - free(caches_cfftnd_fftpack[id].ptr); - free(caches_cfftnd_fftpack[id].iptr); - , 10) - -static -void sflatten(complex_float * dest, complex_float * src, - int rank, int strides_axis, int dims_axis, int unflat, - int *tmp) -{ - int *new_strides = tmp + rank; - int *new_dims = tmp + 2 * rank; - int *ia = tmp + 3 * rank; - int rm1 = rank - 1, rm2 = rank - 2; - int i, j, k; - for (i = 0; i < rm2; ++i) - ia[i] = 0; - ia[rm2] = -1; - j = 0; - if (unflat) { - while (next_comb(ia, new_dims, rm2)) { - k = 0; - for (i = 0; i < rm1; ++i) { - k += ia[i] * new_strides[i]; - } - for (i = 0; i < dims_axis; ++i) { - *(dest + k + i * strides_axis) = *(src + j++); - } - } - } else { - while (next_comb(ia, new_dims, rm2)) { - k = 0; - for (i = 0; i < rm1; ++i) { - k += ia[i] * new_strides[i]; - } - for (i = 0; i < dims_axis; ++i) { - *(dest + j++) = *(src + k + i * strides_axis); - } - } - } -} - -extern void cfft(complex_float * inout, - int n, int direction, int howmany, int normalize); - -extern void cfftnd_fftpack(complex_float * inout, int rank, - int *dims, int direction, int howmany, - int normalize) -{ - int i, sz; - complex_float *ptr = inout; - int axis; - complex_float *tmp; - int *itmp; - int k, j; - - sz = 1; - for (i = 0; i < rank; ++i) { - sz *= dims[i]; - } - cfft(ptr, dims[rank - 1], direction, howmany * sz / dims[rank - 1], - normalize); - - i = get_cache_id_cfftnd_fftpack(sz, rank); - tmp = caches_cfftnd_fftpack[i].ptr; - itmp = caches_cfftnd_fftpack[i].iptr; - - itmp[rank - 1] = 1; - for (i = 2; i <= rank; ++i) { - itmp[rank - i] = itmp[rank - i + 1] * dims[rank - i + 1]; - } - - for (i = 0; i < howmany; ++i, ptr += sz) { - for (axis = 0; axis < rank - 1; ++axis) { - for (k = j = 0; k < rank; ++k) { - if (k != axis) { - *(itmp + rank + j) = itmp[k]; - *(itmp + 2 * rank + j++) = dims[k] - 1; - } - } - sflatten(tmp, ptr, rank, itmp[axis], dims[axis], 0, itmp); - cfft(tmp, dims[axis], direction, sz / dims[axis], normalize); - sflatten(ptr, tmp, rank, itmp[axis], dims[axis], 1, itmp); - } - } - -} Modified: trunk/scipy/fftpack/src/convolve.c =================================================================== --- trunk/scipy/fftpack/src/convolve.c 2009-01-07 18:26:15 UTC (rev 5370) +++ trunk/scipy/fftpack/src/convolve.c 2009-01-07 18:26:54 UTC (rev 5371) @@ -24,7 +24,7 @@ extern void destroy_convolve_cache(void) { - destroy_dfftpack_caches(); + destroy_dfftpack_cache(); } /**************** convolve **********************/ Modified: trunk/scipy/fftpack/src/drfft.c =================================================================== --- trunk/scipy/fftpack/src/drfft.c 2009-01-07 18:26:15 UTC (rev 5370) +++ trunk/scipy/fftpack/src/drfft.c 2009-01-07 18:26:54 UTC (rev 5371) @@ -14,31 +14,31 @@ extern void F_FUNC(rffti, RFFTI) (int *, float *); -GEN_CACHE(drfftpack, (int n) +GEN_CACHE(drfft, (int n) , double *wsave; - , (caches_drfftpack[i].n == n) - , caches_drfftpack[id].wsave = + , (caches_drfft[i].n == n) + , caches_drfft[id].wsave = (double *) malloc(sizeof(double) * (2 * n + 15)); - F_FUNC(dffti, DFFTI) (&n, caches_drfftpack[id].wsave); - , free(caches_drfftpack[id].wsave); + F_FUNC(dffti, DFFTI) (&n, caches_drfft[id].wsave); + , free(caches_drfft[id].wsave); , 10) -GEN_CACHE(rfftpack, (int n) +GEN_CACHE(rfft, (int n) , float *wsave; - , (caches_rfftpack[i].n == n) - , caches_rfftpack[id].wsave = + , (caches_rfft[i].n == n) + , caches_rfft[id].wsave = (float *) malloc(sizeof(float) * (2 * n + 15)); - F_FUNC(rffti, RFFTI) (&n, caches_rfftpack[id].wsave); - , free(caches_rfftpack[id].wsave); + F_FUNC(rffti, RFFTI) (&n, caches_rfft[id].wsave); + , free(caches_rfft[id].wsave); , 10) -void drfft_fftpack(double *inout, int n, int direction, int howmany, +void drfft(double *inout, int n, int direction, int howmany, int normalize) { int i; double *ptr = inout; double *wsave = NULL; - wsave = caches_drfftpack[get_cache_id_drfftpack(n)].wsave; + wsave = caches_drfft[get_cache_id_drfft(n)].wsave; switch (direction) { @@ -67,13 +67,13 @@ } } -void rfft_fftpack(float *inout, int n, int direction, int howmany, +void rfft(float *inout, int n, int direction, int howmany, int normalize) { int i; float *ptr = inout; float *wsave = NULL; - wsave = caches_rfftpack[get_cache_id_rfftpack(n)].wsave; + wsave = caches_rfft[get_cache_id_rfft(n)].wsave; switch (direction) { Deleted: trunk/scipy/fftpack/src/drfft_fftpack.c =================================================================== --- trunk/scipy/fftpack/src/drfft_fftpack.c 2009-01-07 18:26:15 UTC (rev 5370) +++ trunk/scipy/fftpack/src/drfft_fftpack.c 2009-01-07 18:26:54 UTC (rev 5371) @@ -1,54 +0,0 @@ -/* - * Last Change: Wed Aug 01 07:00 PM 2007 J - * - * FFTPACK implementation - * - * Original code by Pearu Peterson. - */ - -extern void F_FUNC(dfftf, DFFTF) (int *, double *, double *); -extern void F_FUNC(dfftb, DFFTB) (int *, double *, double *); -extern void F_FUNC(dffti, DFFTI) (int *, double *); -GEN_CACHE(drfftpack, (int n) - , double *wsave; - , (caches_drfftpack[i].n == n) - , caches_drfftpack[id].wsave = - (double *) malloc(sizeof(double) * (2 * n + 15)); - F_FUNC(dffti, DFFTI) (&n, caches_drfftpack[id].wsave); - , free(caches_drfftpack[id].wsave); - , 10) - -static void drfft_fftpack(double *inout, int n, int direction, int howmany, - int normalize) -{ - int i; - double *ptr = inout; - double *wsave = NULL; - wsave = caches_drfftpack[get_cache_id_drfftpack(n)].wsave; - - - switch (direction) { - case 1: - for (i = 0; i < howmany; ++i, ptr += n) { - dfftf_(&n, ptr, wsave); - } - break; - - case -1: - for (i = 0; i < howmany; ++i, ptr += n) { - dfftb_(&n, ptr, wsave); - } - break; - - default: - fprintf(stderr, "drfft: invalid direction=%d\n", direction); - } - - if (normalize) { - double d = 1.0 / n; - ptr = inout; - for (i = n * howmany - 1; i >= 0; --i) { - (*(ptr++)) *= d; - } - } -} Modified: trunk/scipy/fftpack/src/fftpack.h =================================================================== --- trunk/scipy/fftpack/src/fftpack.h 2009-01-07 18:26:15 UTC (rev 5370) +++ trunk/scipy/fftpack/src/fftpack.h 2009-01-07 18:26:54 UTC (rev 5371) @@ -73,7 +73,7 @@ last_cache_id_##name = id;\ return id;\ }\ -static void destroy_##name##_caches(void) {\ +void destroy_##name##_cache(void) {\ int id;\ for (id=0;id= 0; --i) { - (*(ptr++)) *= d; - } - } -} Deleted: trunk/scipy/fftpack/src/zfft_fftpack.c =================================================================== --- trunk/scipy/fftpack/src/zfft_fftpack.c 2009-01-07 18:26:15 UTC (rev 5370) +++ trunk/scipy/fftpack/src/zfft_fftpack.c 2009-01-07 18:26:54 UTC (rev 5371) @@ -1,45 +0,0 @@ -extern void F_FUNC(zfftf,ZFFTF)(int*,double*,double*); -extern void F_FUNC(zfftb,ZFFTB)(int*,double*,double*); -extern void F_FUNC(zffti,ZFFTI)(int*,double*); -GEN_CACHE(zfftpack,(int n) - ,double* wsave; - ,(caches_zfftpack[i].n==n) - ,caches_zfftpack[id].wsave = (double*)malloc(sizeof(double)*(4*n+15)); - F_FUNC(zffti,ZFFTI)(&n,caches_zfftpack[id].wsave); - ,free(caches_zfftpack[id].wsave); - ,10) - -static void zfft_fftpack(complex_double * inout, - int n, int direction, int howmany, int normalize) -{ - int i; - complex_double *ptr = inout; - double *wsave = NULL; - - wsave = caches_zfftpack[get_cache_id_zfftpack(n)].wsave; - - switch (direction) { - case 1: - for (i = 0; i < howmany; ++i, ptr += n) { - zfftf_(&n, (double *) (ptr), wsave); - - } - break; - - case -1: - for (i = 0; i < howmany; ++i, ptr += n) { - zfftb_(&n, (double *) (ptr), wsave); - } - break; - default: - fprintf(stderr, "zfft: invalid direction=%d\n", direction); - } - - if (normalize) { - ptr = inout; - for (i = n * howmany - 1; i >= 0; --i) { - *((double *) (ptr)) /= n; - *((double *) (ptr++) + 1) /= n; - } - } -} Modified: trunk/scipy/fftpack/src/zfftnd.c =================================================================== --- trunk/scipy/fftpack/src/zfftnd.c 2009-01-07 18:26:15 UTC (rev 5370) +++ trunk/scipy/fftpack/src/zfftnd.c 2009-01-07 18:26:54 UTC (rev 5371) @@ -5,32 +5,32 @@ */ #include "fftpack.h" -GEN_CACHE(zfftnd_fftpack, (int n, int rank) +GEN_CACHE(zfftnd, (int n, int rank) , complex_double * ptr; int *iptr; int rank; - , ((caches_zfftnd_fftpack[i].n == n) - && (caches_zfftnd_fftpack[i].rank == rank)) - , caches_zfftnd_fftpack[id].n = n; - caches_zfftnd_fftpack[id].ptr = + , ((caches_zfftnd[i].n == n) + && (caches_zfftnd[i].rank == rank)) + , caches_zfftnd[id].n = n; + caches_zfftnd[id].ptr = (complex_double *) malloc(2 * sizeof(double) * n); - caches_zfftnd_fftpack[id].iptr = + caches_zfftnd[id].iptr = (int *) malloc(4 * rank * sizeof(int)); , - free(caches_zfftnd_fftpack[id].ptr); - free(caches_zfftnd_fftpack[id].iptr); + free(caches_zfftnd[id].ptr); + free(caches_zfftnd[id].iptr); , 10) -GEN_CACHE(cfftnd_fftpack, (int n, int rank) +GEN_CACHE(cfftnd, (int n, int rank) , complex_float * ptr; int *iptr; int rank; - , ((caches_cfftnd_fftpack[i].n == n) - && (caches_cfftnd_fftpack[i].rank == rank)) - , caches_cfftnd_fftpack[id].n = n; - caches_cfftnd_fftpack[id].ptr = + , ((caches_cfftnd[i].n == n) + && (caches_cfftnd[i].rank == rank)) + , caches_cfftnd[id].n = n; + caches_cfftnd[id].ptr = (complex_float *) malloc(2 * sizeof(float) * n); - caches_cfftnd_fftpack[id].iptr = + caches_cfftnd[id].iptr = (int *) malloc(4 * rank * sizeof(int)); , - free(caches_cfftnd_fftpack[id].ptr); - free(caches_cfftnd_fftpack[id].iptr); + free(caches_cfftnd[id].ptr); + free(caches_cfftnd[id].iptr); , 10) static @@ -127,7 +127,7 @@ extern void zfft(complex_double * inout, int n, int direction, int howmany, int normalize); -extern void zfftnd_fftpack(complex_double * inout, int rank, +extern void zfftnd(complex_double * inout, int rank, int *dims, int direction, int howmany, int normalize) { @@ -145,9 +145,9 @@ zfft(ptr, dims[rank - 1], direction, howmany * sz / dims[rank - 1], normalize); - i = get_cache_id_zfftnd_fftpack(sz, rank); - tmp = caches_zfftnd_fftpack[i].ptr; - itmp = caches_zfftnd_fftpack[i].iptr; + i = get_cache_id_zfftnd(sz, rank); + tmp = caches_zfftnd[i].ptr; + itmp = caches_zfftnd[i].iptr; itmp[rank - 1] = 1; for (i = 2; i <= rank; ++i) { @@ -170,7 +170,7 @@ } -extern void cfftnd_fftpack(complex_float * inout, int rank, +extern void cfftnd(complex_float * inout, int rank, int *dims, int direction, int howmany, int normalize) { @@ -188,9 +188,9 @@ cfft(ptr, dims[rank - 1], direction, howmany * sz / dims[rank - 1], normalize); - i = get_cache_id_cfftnd_fftpack(sz, rank); - tmp = caches_cfftnd_fftpack[i].ptr; - itmp = caches_cfftnd_fftpack[i].iptr; + i = get_cache_id_cfftnd(sz, rank); + tmp = caches_cfftnd[i].ptr; + itmp = caches_cfftnd[i].iptr; itmp[rank - 1] = 1; for (i = 2; i <= rank; ++i) { Deleted: trunk/scipy/fftpack/src/zfftnd_fftpack.c =================================================================== --- trunk/scipy/fftpack/src/zfftnd_fftpack.c 2009-01-07 18:26:15 UTC (rev 5370) +++ trunk/scipy/fftpack/src/zfftnd_fftpack.c 2009-01-07 18:26:54 UTC (rev 5371) @@ -1,118 +0,0 @@ -/* - * fftpack backend for multi dimensional fft - * - * Original code by Pearu Peaterson - * - * Last Change: Wed Aug 08 02:00 PM 2007 J - */ - -GEN_CACHE(zfftnd_fftpack, (int n, int rank) - , complex_double * ptr; int *iptr; int rank; - , ((caches_zfftnd_fftpack[i].n == n) - && (caches_zfftnd_fftpack[i].rank == rank)) - , caches_zfftnd_fftpack[id].n = n; - caches_zfftnd_fftpack[id].ptr = - (complex_double *) malloc(2 * sizeof(double) * n); - caches_zfftnd_fftpack[id].iptr = - (int *) malloc(4 * rank * sizeof(int)); - , - free(caches_zfftnd_fftpack[id].ptr); - free(caches_zfftnd_fftpack[id].iptr); - , 10) - -static -/*inline : disabled because MSVC6.0 fails to compile it. */ -int next_comb(int *ia, int *da, int m) -{ - while (m >= 0 && ia[m] == da[m]) { - ia[m--] = 0; - } - if (m < 0) { - return 0; - } - ia[m]++; - return 1; -} - -static -void flatten(complex_double * dest, complex_double * src, - int rank, int strides_axis, int dims_axis, int unflat, - int *tmp) -{ - int *new_strides = tmp + rank; - int *new_dims = tmp + 2 * rank; - int *ia = tmp + 3 * rank; - int rm1 = rank - 1, rm2 = rank - 2; - int i, j, k; - for (i = 0; i < rm2; ++i) - ia[i] = 0; - ia[rm2] = -1; - j = 0; - if (unflat) { - while (next_comb(ia, new_dims, rm2)) { - k = 0; - for (i = 0; i < rm1; ++i) { - k += ia[i] * new_strides[i]; - } - for (i = 0; i < dims_axis; ++i) { - *(dest + k + i * strides_axis) = *(src + j++); - } - } - } else { - while (next_comb(ia, new_dims, rm2)) { - k = 0; - for (i = 0; i < rm1; ++i) { - k += ia[i] * new_strides[i]; - } - for (i = 0; i < dims_axis; ++i) { - *(dest + j++) = *(src + k + i * strides_axis); - } - } - } -} - -extern void zfft(complex_double * inout, - int n, int direction, int howmany, int normalize); - -extern void zfftnd_fftpack(complex_double * inout, int rank, - int *dims, int direction, int howmany, - int normalize) -{ - int i, sz; - complex_double *ptr = inout; - int axis; - complex_double *tmp; - int *itmp; - int k, j; - - sz = 1; - for (i = 0; i < rank; ++i) { - sz *= dims[i]; - } - zfft(ptr, dims[rank - 1], direction, howmany * sz / dims[rank - 1], - normalize); - - i = get_cache_id_zfftnd_fftpack(sz, rank); - tmp = caches_zfftnd_fftpack[i].ptr; - itmp = caches_zfftnd_fftpack[i].iptr; - - itmp[rank - 1] = 1; - for (i = 2; i <= rank; ++i) { - itmp[rank - i] = itmp[rank - i + 1] * dims[rank - i + 1]; - } - - for (i = 0; i < howmany; ++i, ptr += sz) { - for (axis = 0; axis < rank - 1; ++axis) { - for (k = j = 0; k < rank; ++k) { - if (k != axis) { - *(itmp + rank + j) = itmp[k]; - *(itmp + 2 * rank + j++) = dims[k] - 1; - } - } - flatten(tmp, ptr, rank, itmp[axis], dims[axis], 0, itmp); - zfft(tmp, dims[axis], direction, sz / dims[axis], normalize); - flatten(ptr, tmp, rank, itmp[axis], dims[axis], 1, itmp); - } - } - -} From scipy-svn at scipy.org Wed Jan 7 13:58:53 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 12:58:53 -0600 (CST) Subject: [Scipy-svn] r5372 - branches/0.7.x/scipy/weave/tests Message-ID: <20090107185853.334C1C7C07A@scipy.org> Author: jarrod.millman Date: 2009-01-07 12:58:51 -0600 (Wed, 07 Jan 2009) New Revision: 5372 Modified: branches/0.7.x/scipy/weave/tests/test_ext_tools.py Log: BUG: missing import Modified: branches/0.7.x/scipy/weave/tests/test_ext_tools.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_ext_tools.py 2009-01-07 18:26:54 UTC (rev 5371) +++ branches/0.7.x/scipy/weave/tests/test_ext_tools.py 2009-01-07 18:58:51 UTC (rev 5372) @@ -1,3 +1,4 @@ +import sys from numpy.testing import * from scipy.weave import ext_tools, c_spec From scipy-svn at scipy.org Wed Jan 7 18:39:29 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 17:39:29 -0600 (CST) Subject: [Scipy-svn] r5373 - trunk/scipy/special Message-ID: <20090107233929.015D0C7C020@scipy.org> Author: fperez Date: 2009-01-07 17:39:27 -0600 (Wed, 07 Jan 2009) New Revision: 5373 Modified: trunk/scipy/special/orthogonal.py Log: Add bibliographical references contributed by Alan Isaac after discussion of origins of the algorithm on the mailing list. Modified: trunk/scipy/special/orthogonal.py =================================================================== --- trunk/scipy/special/orthogonal.py 2009-01-07 18:58:51 UTC (rev 5372) +++ trunk/scipy/special/orthogonal.py 2009-01-07 23:39:27 UTC (rev 5373) @@ -34,9 +34,8 @@ P_0(x) = 1 P_-1(x) == 0 -For a more detailed discussion see Numerical Recipies in C (p. 156) and -Abramowitz and Stegun (p. 774, 782); while our implementation differs, the -algorithm and formulas are similar. +For the mathematical background, see [golub.welsch-1969-mathcomp]_ and +[abramowitz.stegun-1965]_. Functions: @@ -56,6 +55,17 @@ p_roots -- Legendre ps_roots -- Shifted Legendre l_roots -- Laguerre + + +.. [golub.welsch-1969-mathcomp] + Golub, Gene H, and John H Welsch. 1969. Calculation of Gauss + Quadrature Rules. *Mathematics of Computation* 23, 221-230+s1--s10. + +.. [abramowitz.stegun-1965] + Abramowitz, Milton, and Irene A Stegun. (1965) *Handbook of + Mathematical Functions: with Formulas, Graphs, and Mathematical + Tables*. Gaithersburg, MD: National Bureau of Standards. + http://www.math.sfu.ca/~cbm/aands/ """ # Scipy imports. From scipy-svn at scipy.org Wed Jan 7 18:55:38 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 7 Jan 2009 17:55:38 -0600 (CST) Subject: [Scipy-svn] r5374 - branches/0.7.x/scipy/special Message-ID: <20090107235538.B0D2DC7C019@scipy.org> Author: jarrod.millman Date: 2009-01-07 17:55:37 -0600 (Wed, 07 Jan 2009) New Revision: 5374 Modified: branches/0.7.x/scipy/special/orthogonal.py Log: Backport updated bibliographical references contributed by Alan Isaac (see r5373) Modified: branches/0.7.x/scipy/special/orthogonal.py =================================================================== --- branches/0.7.x/scipy/special/orthogonal.py 2009-01-07 23:39:27 UTC (rev 5373) +++ branches/0.7.x/scipy/special/orthogonal.py 2009-01-07 23:55:37 UTC (rev 5374) @@ -34,9 +34,8 @@ P_0(x) = 1 P_-1(x) == 0 -For a more detailed discussion see Numerical Recipies in C (p. 156) and -Abramowitz and Stegun (p. 774, 782); while our implementation differs, the -algorithm and formulas are similar. +For the mathematical background, see [golub.welsch-1969-mathcomp]_ and +[abramowitz.stegun-1965]_. Functions: @@ -56,6 +55,17 @@ p_roots -- Legendre ps_roots -- Shifted Legendre l_roots -- Laguerre + + +.. [golub.welsch-1969-mathcomp] + Golub, Gene H, and John H Welsch. 1969. Calculation of Gauss + Quadrature Rules. *Mathematics of Computation* 23, 221-230+s1--s10. + +.. [abramowitz.stegun-1965] + Abramowitz, Milton, and Irene A Stegun. (1965) *Handbook of + Mathematical Functions: with Formulas, Graphs, and Mathematical + Tables*. Gaithersburg, MD: National Bureau of Standards. + http://www.math.sfu.ca/~cbm/aands/ """ # Scipy imports. From scipy-svn at scipy.org Thu Jan 8 02:49:27 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 01:49:27 -0600 (CST) Subject: [Scipy-svn] r5375 - in trunk/scipy/weave: . tests Message-ID: <20090108074927.EBE13C7C020@scipy.org> Author: stefan Date: 2009-01-08 01:49:11 -0600 (Thu, 08 Jan 2009) New Revision: 5375 Removed: trunk/scipy/weave/tests/test_wx_spec.py trunk/scipy/weave/vtk_spec.py trunk/scipy/weave/wx_spec.py Modified: trunk/scipy/weave/converters.py trunk/scipy/weave/swig2_spec.py Log: Remove wx_spec and vtk_spec from weave. Modified: trunk/scipy/weave/converters.py =================================================================== --- trunk/scipy/weave/converters.py 2009-01-07 23:55:37 UTC (rev 5374) +++ trunk/scipy/weave/converters.py 2009-01-08 07:49:11 UTC (rev 5375) @@ -41,29 +41,6 @@ pass #---------------------------------------------------------------------------- -# Add wxPython support -# -# RuntimeError can occur if wxPython isn't installed. -#---------------------------------------------------------------------------- - -try: - # this is currently safe because it doesn't import wxPython. - import wx_spec - default.insert(0,wx_spec.wx_converter()) -except (RuntimeError,IndexError): - pass - -#---------------------------------------------------------------------------- -# Add VTK support -#---------------------------------------------------------------------------- - -try: - import vtk_spec - default.insert(0,vtk_spec.vtk_converter()) -except IndexError: - pass - -#---------------------------------------------------------------------------- # Add "sentinal" catchall converter # # if everything else fails, this one is the last hope (it always works) Modified: trunk/scipy/weave/swig2_spec.py =================================================================== --- trunk/scipy/weave/swig2_spec.py 2009-01-07 23:55:37 UTC (rev 5374) +++ trunk/scipy/weave/swig2_spec.py 2009-01-08 07:49:11 UTC (rev 5375) @@ -2,13 +2,12 @@ This module allows one to use SWIG2 (SWIG version >= 1.3) wrapped objects from Weave. SWIG-1.3 wraps objects differently from SWIG-1.1. -The code here is based on wx_spec.py. However, this module is more -like a template for any SWIG2 wrapped converter. To wrap any special -code that uses SWIG the user simply needs to override the defaults in -the swig2_converter class. These special circumstances arise when one -has wrapped code that uses C++ namespaces. However, for most -straightforward SWIG wrappers this converter should work fine out of -the box. +This module is a template for a SWIG2 wrapped converter. To wrap any +special code that uses SWIG the user simply needs to override the +defaults in the swig2_converter class. These special circumstances +arise when one has wrapped code that uses C++ namespaces. However, +for most straightforward SWIG wrappers this converter should work fine +out of the box. Newer versions of SWIG (>=1.3.22) represent the wrapped object using a PyCObject and also a PySwigObject (>=1.3.24). This code supports all Deleted: trunk/scipy/weave/tests/test_wx_spec.py =================================================================== --- trunk/scipy/weave/tests/test_wx_spec.py 2009-01-07 23:55:37 UTC (rev 5374) +++ trunk/scipy/weave/tests/test_wx_spec.py 2009-01-08 07:49:11 UTC (rev 5375) @@ -1,123 +0,0 @@ -""" -check_var_in -- tests whether a variable is passed in correctly - and also if the passed in variable can be reassigned -check_var_local -- tests wheter a variable is passed in , modified, - and returned correctly in the local_dict dictionary - argument -check_return -- test whether a variable is passed in, modified, and - then returned as a function return value correctly -""" - -from numpy.testing import * - -e = None -DONOTRUN = False -try: - from scipy.weave import ext_tools, wx_spec - import wx -except ImportError, e: - wx = None - DONOTRUN = True -except RuntimeError, e: - wx = None - DONOTRUN = True - -skip = dec.skipif(DONOTRUN, "(error was %s)" % str(e)) - -class TestWxConverter(TestCase): - def setUp(self): - if not DONOTRUN: - self.app = wx.App() - self.s = wx_spec.wx_converter() - - @dec.slow - def test_type_match_string(self): - assert(not self.s.type_match('string') ) - - @dec.slow - def test_type_match_int(self): - assert(not self.s.type_match(5)) - - @dec.slow - def test_type_match_float(self): - assert(not self.s.type_match(5.)) - - @dec.slow - def test_type_match_complex(self): - assert(not self.s.type_match(5.+1j)) - - @dec.slow - def test_type_match_complex(self): - assert(not self.s.type_match(5.+1j)) - - @dec.slow - def test_type_match_wxframe(self): - f=wx.Frame(None,-1,'bob') - assert(self.s.type_match(f)) - - @dec.slow - def test_var_in(self): - mod = ext_tools.ext_module('wx_var_in',compiler='') - mod.customize.add_header('') - mod.customize.add_extra_compile_arg(' '.join(self.s.extra_compile_args)) - mod.customize.add_extra_link_arg(' '.join(self.s.extra_link_args)) - - a = wx.Frame(None,-1,'bob') - code = """ - py::tuple args(1); - args[0] = py::object("jim"); - a.mcall("SetTitle",args); - """ - test = ext_tools.ext_function('test',code,['a'],locals(),globals()) - mod.add_function(test) - mod.compile() - import wx_var_in - b=a - wx_var_in.test(b) - assert(b.GetTitle() == "jim") - try: - b = 1. - wx_var_in.test(b) - except AttributeError: - pass - try: - b = 1 - wx_var_in.test(b) - except AttributeError: - pass - - @dec.slow - def no_check_var_local(self): - mod = ext_tools.ext_module('wx_var_local') - a = 'string' - code = 'a="hello";' - var_specs = ext_tools.assign_variable_types(['a'],locals()) - test = ext_tools.ext_function_from_specs('test',code,var_specs) - mod.add_function(test) - mod.compile() - import wx_var_local - b='bub' - q={} - wx_var_local.test(b,q) - assert('a' == 'string') - - @dec.slow - def no_test_no_check_return(self): - mod = ext_tools.ext_module('wx_return') - a = 'string' - code = """ - a= Py::wx("hello"); - return_val = Py::new_reference_to(a); - """ - test = ext_tools.ext_function('test',code,['a'],locals()) - mod.add_function(test) - mod.compile() - import wx_return - b='bub' - c = wx_return.test(b) - assert(c == 'hello') - -decorate_methods(TestWxConverter, skip) - -if __name__ == "__main__": - nose.run(argv=['', __file__]) Deleted: trunk/scipy/weave/vtk_spec.py =================================================================== --- trunk/scipy/weave/vtk_spec.py 2009-01-07 23:55:37 UTC (rev 5374) +++ trunk/scipy/weave/vtk_spec.py 2009-01-08 07:49:11 UTC (rev 5375) @@ -1,130 +0,0 @@ -""" -VTK type converter. - -This module handles conversion between VTK C++ and VTK Python objects -so that one can write inline C++ code to manipulate VTK Python -objects. It requires that you have VTK and the VTK-Python wrappers -installed. It has been tested with VTK 4.0 and above. The code is -based on wx_spec.py. You will need to call inline with include_dirs, -library_dirs and often even libraries appropriately set for this to -work without errors. Sometimes you might need to include additional -headers. - -Distributed under the SciPy License. - -Authors: - Prabhu Ramachandran - Eric Jones -""" - -from c_spec import common_base_converter - - -vtk_py_to_c_template = \ -""" -class %(type_name)s_handler -{ -public: - %(c_type)s convert_to_%(type_name)s(PyObject* py_obj, const char* name) - { - %(c_type)s vtk_ptr = (%(c_type)s) vtkPythonGetPointerFromObject(py_obj, "%(type_name)s"); - if (!vtk_ptr) - handle_conversion_error(py_obj,"%(type_name)s", name); - %(inc_ref_count)s - return vtk_ptr; - } - - %(c_type)s py_to_%(type_name)s(PyObject* py_obj, const char* name) - { - %(c_type)s vtk_ptr = (%(c_type)s) vtkPythonGetPointerFromObject(py_obj, "%(type_name)s"); - if (!vtk_ptr) - handle_bad_type(py_obj,"%(type_name)s", name); - %(inc_ref_count)s - return vtk_ptr; - } -}; - -%(type_name)s_handler x__%(type_name)s_handler = %(type_name)s_handler(); -#define convert_to_%(type_name)s(py_obj,name) \\ - x__%(type_name)s_handler.convert_to_%(type_name)s(py_obj,name) -#define py_to_%(type_name)s(py_obj,name) \\ - x__%(type_name)s_handler.py_to_%(type_name)s(py_obj,name) - -""" - -vtk_c_to_py_template = \ -""" -PyObject* %(type_name)s_to_py(vtkObjectBase* obj) -{ - return vtkPythonGetObjectFromPointer(obj); -} -""" - - -class vtk_converter(common_base_converter): - def __init__(self,class_name="undefined"): - self.class_name = class_name - common_base_converter.__init__(self) - - def init_info(self): - common_base_converter.init_info(self) - # These are generated on the fly instead of defined at - # the class level. - self.type_name = self.class_name - self.c_type = self.class_name + "*" - self.return_type = self.c_type - self.to_c_return = None # not used - self.check_func = None # not used - hdr = self.class_name + ".h" - # Remember that you need both the quotes! - self.headers.extend(['"vtkPythonUtil.h"', '"vtkObject.h"', - '"%s"'%hdr]) - #self.include_dirs.extend(vtk_inc) - #self.define_macros.append(('SOME_VARIABLE', '1')) - #self.library_dirs.extend(vtk_lib) - self.libraries.extend(['vtkCommonPython', 'vtkCommon']) - #self.support_code.append(common_info.swig_support_code) - - def type_match(self,value): - is_match = 0 - try: - if value.IsA('vtkObject'): - is_match = 1 - except AttributeError: - pass - return is_match - - def generate_build_info(self): - if self.class_name != "undefined": - res = common_base_converter.generate_build_info(self) - else: - # if there isn't a class_name, we don't want the - # we don't want the support_code to be included - import base_info - res = base_info.base_info() - return res - - def py_to_c_code(self): - return vtk_py_to_c_template % self.template_vars() - - def c_to_py_code(self): - return vtk_c_to_py_template % self.template_vars() - - def type_spec(self,name,value): - # factory - class_name = value.__class__.__name__ - new_spec = self.__class__(class_name) - new_spec.name = name - return new_spec - - def __cmp__(self,other): - #only works for equal - res = -1 - try: - res = cmp(self.name,other.name) or \ - cmp(self.__class__, other.__class__) or \ - cmp(self.class_name, other.class_name) or \ - cmp(self.type_name,other.type_name) - except: - pass - return res Deleted: trunk/scipy/weave/wx_spec.py =================================================================== --- trunk/scipy/weave/wx_spec.py 2009-01-07 23:55:37 UTC (rev 5374) +++ trunk/scipy/weave/wx_spec.py 2009-01-08 07:49:11 UTC (rev 5375) @@ -1,184 +0,0 @@ -import common_info -from c_spec import common_base_converter -import sys,os -import glob - -def find_base_dir(): - searched_locations = ['c:\third\wxpython*', - '/usr/lib/wx*'] - - candidate_locations = [] - for pattern in searched_locations: - candidate_locations.extend(glob.glob(pattern)) - candidate_locations.sort() - - if len(candidate_locations) == 0: - raise RuntimeError("Could not locate wxPython base directory.") - else: - return candidate_locations[-1] - -wx_base = find_base_dir() - -def get_wxconfig(flag): - wxconfig = os.path.join(wx_base,'bin','wx-config') - if not os.path.exists(wxconfig): - # Could not locate wx-config, assume it is on the path. - wxconfig = 'wx-config' - - import commands - res,settings = commands.getstatusoutput(wxconfig + ' --' + flag) - if res: - msg = wxconfig + ' failed. Impossible to learn wxPython settings' - raise RuntimeError, msg - return settings.split() - -wx_to_c_template = \ -""" -class %(type_name)s_handler -{ -public: - %(c_type)s convert_to_%(type_name)s(PyObject* py_obj, const char* name) - { - %(c_type)s wx_ptr; - // work on this error reporting... - if (SWIG_GetPtrObj(py_obj,(void **) &wx_ptr,"_%(type_name)s_p")) - handle_conversion_error(py_obj,"%(type_name)s", name); - %(inc_ref_count)s - return wx_ptr; - } - - %(c_type)s py_to_%(type_name)s(PyObject* py_obj,const char* name) - { - %(c_type)s wx_ptr; - // work on this error reporting... - if (SWIG_GetPtrObj(py_obj,(void **) &wx_ptr,"_%(type_name)s_p")) - handle_bad_type(py_obj,"%(type_name)s", name); - %(inc_ref_count)s - return wx_ptr; - } -}; - -%(type_name)s_handler x__%(type_name)s_handler = %(type_name)s_handler(); -#define convert_to_%(type_name)s(py_obj,name) \\ - x__%(type_name)s_handler.convert_to_%(type_name)s(py_obj,name) -#define py_to_%(type_name)s(py_obj,name) \\ - x__%(type_name)s_handler.py_to_%(type_name)s(py_obj,name) - -""" - -class wx_converter(common_base_converter): - def __init__(self,class_name="undefined"): - self.class_name = class_name - common_base_converter.__init__(self) - - def init_info(self): - common_base_converter.init_info(self) - # These are generated on the fly instead of defined at - # the class level. - self.type_name = self.class_name - self.c_type = self.class_name + "*" - self.return_type = self.class_name + "*" - self.to_c_return = None # not used - self.check_func = None # not used - self.headers.append('"wx/wx.h"') - if sys.platform == "win32": - # These will be used in many cases - self.headers.append('') - - # These are needed for linking. - self.libraries.extend(['kernel32','user32','gdi32','comdlg32', - 'winspool', 'winmm', 'shell32', - 'oldnames', 'comctl32', 'ctl3d32', - 'odbc32', 'ole32', 'oleaut32', - 'uuid', 'rpcrt4', 'advapi32', 'wsock32']) - - # not sure which of these macros are needed. - self.define_macros.append(('WIN32', '1')) - self.define_macros.append(('__WIN32__', '1')) - self.define_macros.append(('_WINDOWS', '1')) - self.define_macros.append(('STRICT', '1')) - # I think this will only work on NT/2000/XP set - # set to 0x0400 for earlier versions. - # Hmmm. setting this breaks stuff - #self.define_macros.append(('WINVER', '0x0350')) - - self.library_dirs.append(os.path.join(wx_base,'lib')) - #self.include_dirs.append(os.path.join(wx_base,'include')) - self.include_dirs.append(wx_base) - self.include_dirs.append(os.path.join(wx_base,'include')) - self.include_dirs.append(os.path.join(wx_base,'include','msw')) - # how do I discover unicode or not unicode?? - # non-unicode - self.libraries.append('wxmsw24h') - self.include_dirs.append(os.path.join(wx_base,'lib')) - - # unicode - #self.libraries.append('wxmswuh') - #self.include_dirs.append(os.path.join(wx_base,'lib','mswdlluh')) - #self.define_macros.append(('UNICODE', '1')) - else: - # make sure the gtk files are available - # ?? Do I need to link to them? - self.headers.append('"gdk/gdk.h"') - # !! This shouldn't be hard coded. - self.include_dirs.append("/usr/include/gtk-1.2") - self.include_dirs.append("/usr/include/glib-1.2") - self.include_dirs.append("/usr/lib/glib/include") - cxxflags = get_wxconfig('cxxflags') - libflags = get_wxconfig('libs') + get_wxconfig('gl-libs') - - #older versions of wx do not support the ldflags. - try: - ldflags = get_wxconfig('ldflags') - except RuntimeError: - ldflags = [] - - self.extra_compile_args.extend(cxxflags) - self.extra_link_args.extend(libflags) - self.extra_link_args.extend(ldflags) - self.support_code.append(common_info.swig_support_code) - - def type_match(self,value): - is_match = 0 - try: - wx_class = str(value.this).split('_')[-1] - if wx_class[:2] == 'wx': - is_match = 1 - except AttributeError: - pass - return is_match - - def generate_build_info(self): - if self.class_name != "undefined": - res = common_base_converter.generate_build_info(self) - else: - # if there isn't a class_name, we don't want the - # we don't want the support_code to be included - import base_info - res = base_info.base_info() - return res - - def py_to_c_code(self): - return wx_to_c_template % self.template_vars() - - #def c_to_py_code(self): - # return simple_c_to_py_template % self.template_vars() - - def type_spec(self,name,value): - # factory - class_name = str(value.this).split('_')[-1] - new_spec = self.__class__(class_name) - new_spec.name = name - return new_spec - - def __cmp__(self,other): - #only works for equal - res = -1 - try: - res = cmp(self.name,other.name) or \ - cmp(self.__class__, other.__class__) or \ - cmp(self.class_name, other.class_name) or \ - cmp(self.type_name,other.type_name) - except: - pass - return res From scipy-svn at scipy.org Thu Jan 8 02:50:00 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 01:50:00 -0600 (CST) Subject: [Scipy-svn] r5376 - trunk/scipy/fftpack Message-ID: <20090108075000.2C291C7C040@scipy.org> Author: stefan Date: 2009-01-08 01:49:50 -0600 (Thu, 08 Jan 2009) New Revision: 5376 Modified: trunk/scipy/fftpack/setup.py Log: Temporarily remove fft depends so that SciPy can compile more than one run successively. Modified: trunk/scipy/fftpack/setup.py =================================================================== --- trunk/scipy/fftpack/setup.py 2009-01-08 07:49:11 UTC (rev 5375) +++ trunk/scipy/fftpack/setup.py 2009-01-08 07:49:50 UTC (rev 5376) @@ -23,8 +23,7 @@ config.add_extension('_fftpack', sources=sources, libraries=['dfftpack', 'fftpack'], - depends=['src/zfft_fftpack.c', 'src/drfft_fftpack.c', - 'src/zfftnd_fftpack.c']) + depends=[]) config.add_extension('convolve', sources=['convolve.pyf','src/convolve.c'], From scipy-svn at scipy.org Thu Jan 8 02:50:40 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 01:50:40 -0600 (CST) Subject: [Scipy-svn] r5377 - trunk/scipy/weave Message-ID: <20090108075040.719E6C7C020@scipy.org> Author: stefan Date: 2009-01-08 01:50:30 -0600 (Thu, 08 Jan 2009) New Revision: 5377 Modified: trunk/scipy/weave/blitz_spec.py Log: Remove unused variable from blitz_spec. Modified: trunk/scipy/weave/blitz_spec.py =================================================================== --- trunk/scipy/weave/blitz_spec.py 2009-01-08 07:49:50 UTC (rev 5376) +++ trunk/scipy/weave/blitz_spec.py 2009-01-08 07:50:30 UTC (rev 5377) @@ -27,7 +27,6 @@ { blitz::TinyVector shape(0); blitz::TinyVector strides(0); - int stride_acc = 1; //for (int i = N-1; i >=0; i--) for (int i = 0; i < N; i++) { @@ -45,7 +44,6 @@ blitz::TinyVector shape(0); blitz::TinyVector strides(0); - int stride_acc = 1; //for (int i = N-1; i >=0; i--) for (int i = 0; i < N; i++) { From scipy-svn at scipy.org Thu Jan 8 02:51:16 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 01:51:16 -0600 (CST) Subject: [Scipy-svn] r5378 - trunk/scipy/weave Message-ID: <20090108075116.BD088C7C040@scipy.org> Author: stefan Date: 2009-01-08 01:51:00 -0600 (Thu, 08 Jan 2009) New Revision: 5378 Modified: trunk/scipy/weave/inline_tools.py Log: Mark raw_globals and raw_locals as unused to prevent compiler warnings. Modified: trunk/scipy/weave/inline_tools.py =================================================================== --- trunk/scipy/weave/inline_tools.py 2009-01-08 07:50:30 UTC (rev 5377) +++ trunk/scipy/weave/inline_tools.py 2009-01-08 07:51:00 UTC (rev 5378) @@ -81,9 +81,11 @@ try_code = 'try \n' \ '{ \n' \ - ' PyObject* raw_locals = py_to_raw_dict(' \ + ' PyObject* raw_locals __attribute__ ((unused));\n' \ + ' raw_locals = py_to_raw_dict(' \ 'py__locals,"_locals");\n' \ - ' PyObject* raw_globals = py_to_raw_dict(' \ + ' PyObject* raw_globals __attribute__ ((unused));\n' \ + ' raw_globals = py_to_raw_dict(' \ 'py__globals,"_globals");\n' + \ ' /* argument conversion code */ \n' + \ decl_code + \ From scipy-svn at scipy.org Thu Jan 8 02:57:19 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 01:57:19 -0600 (CST) Subject: [Scipy-svn] r5379 - in branches/0.7.x/scipy/weave: . tests Message-ID: <20090108075719.2C754C7C020@scipy.org> Author: jarrod.millman Date: 2009-01-08 01:57:17 -0600 (Thu, 08 Jan 2009) New Revision: 5379 Removed: branches/0.7.x/scipy/weave/tests/test_wx_spec.py branches/0.7.x/scipy/weave/vtk_spec.py branches/0.7.x/scipy/weave/wx_spec.py Modified: branches/0.7.x/scipy/weave/converters.py branches/0.7.x/scipy/weave/swig2_spec.py Log: Backport r5375 Modified: branches/0.7.x/scipy/weave/converters.py =================================================================== --- branches/0.7.x/scipy/weave/converters.py 2009-01-08 07:51:00 UTC (rev 5378) +++ branches/0.7.x/scipy/weave/converters.py 2009-01-08 07:57:17 UTC (rev 5379) @@ -41,29 +41,6 @@ pass #---------------------------------------------------------------------------- -# Add wxPython support -# -# RuntimeError can occur if wxPython isn't installed. -#---------------------------------------------------------------------------- - -try: - # this is currently safe because it doesn't import wxPython. - import wx_spec - default.insert(0,wx_spec.wx_converter()) -except (RuntimeError,IndexError): - pass - -#---------------------------------------------------------------------------- -# Add VTK support -#---------------------------------------------------------------------------- - -try: - import vtk_spec - default.insert(0,vtk_spec.vtk_converter()) -except IndexError: - pass - -#---------------------------------------------------------------------------- # Add "sentinal" catchall converter # # if everything else fails, this one is the last hope (it always works) Modified: branches/0.7.x/scipy/weave/swig2_spec.py =================================================================== --- branches/0.7.x/scipy/weave/swig2_spec.py 2009-01-08 07:51:00 UTC (rev 5378) +++ branches/0.7.x/scipy/weave/swig2_spec.py 2009-01-08 07:57:17 UTC (rev 5379) @@ -2,13 +2,12 @@ This module allows one to use SWIG2 (SWIG version >= 1.3) wrapped objects from Weave. SWIG-1.3 wraps objects differently from SWIG-1.1. -The code here is based on wx_spec.py. However, this module is more -like a template for any SWIG2 wrapped converter. To wrap any special -code that uses SWIG the user simply needs to override the defaults in -the swig2_converter class. These special circumstances arise when one -has wrapped code that uses C++ namespaces. However, for most -straightforward SWIG wrappers this converter should work fine out of -the box. +This module is a template for a SWIG2 wrapped converter. To wrap any +special code that uses SWIG the user simply needs to override the +defaults in the swig2_converter class. These special circumstances +arise when one has wrapped code that uses C++ namespaces. However, +for most straightforward SWIG wrappers this converter should work fine +out of the box. Newer versions of SWIG (>=1.3.22) represent the wrapped object using a PyCObject and also a PySwigObject (>=1.3.24). This code supports all Deleted: branches/0.7.x/scipy/weave/tests/test_wx_spec.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_wx_spec.py 2009-01-08 07:51:00 UTC (rev 5378) +++ branches/0.7.x/scipy/weave/tests/test_wx_spec.py 2009-01-08 07:57:17 UTC (rev 5379) @@ -1,123 +0,0 @@ -""" -check_var_in -- tests whether a variable is passed in correctly - and also if the passed in variable can be reassigned -check_var_local -- tests wheter a variable is passed in , modified, - and returned correctly in the local_dict dictionary - argument -check_return -- test whether a variable is passed in, modified, and - then returned as a function return value correctly -""" - -from numpy.testing import * - -e = None -DONOTRUN = False -try: - from scipy.weave import ext_tools, wx_spec - import wx -except ImportError, e: - wx = None - DONOTRUN = True -except RuntimeError, e: - wx = None - DONOTRUN = True - -skip = dec.skipif(DONOTRUN, "(error was %s)" % str(e)) - -class TestWxConverter(TestCase): - def setUp(self): - if not DONOTRUN: - self.app = wx.App() - self.s = wx_spec.wx_converter() - - @dec.slow - def test_type_match_string(self): - assert(not self.s.type_match('string') ) - - @dec.slow - def test_type_match_int(self): - assert(not self.s.type_match(5)) - - @dec.slow - def test_type_match_float(self): - assert(not self.s.type_match(5.)) - - @dec.slow - def test_type_match_complex(self): - assert(not self.s.type_match(5.+1j)) - - @dec.slow - def test_type_match_complex(self): - assert(not self.s.type_match(5.+1j)) - - @dec.slow - def test_type_match_wxframe(self): - f=wx.Frame(None,-1,'bob') - assert(self.s.type_match(f)) - - @dec.slow - def test_var_in(self): - mod = ext_tools.ext_module('wx_var_in',compiler='') - mod.customize.add_header('') - mod.customize.add_extra_compile_arg(' '.join(self.s.extra_compile_args)) - mod.customize.add_extra_link_arg(' '.join(self.s.extra_link_args)) - - a = wx.Frame(None,-1,'bob') - code = """ - py::tuple args(1); - args[0] = py::object("jim"); - a.mcall("SetTitle",args); - """ - test = ext_tools.ext_function('test',code,['a'],locals(),globals()) - mod.add_function(test) - mod.compile() - import wx_var_in - b=a - wx_var_in.test(b) - assert(b.GetTitle() == "jim") - try: - b = 1. - wx_var_in.test(b) - except AttributeError: - pass - try: - b = 1 - wx_var_in.test(b) - except AttributeError: - pass - - @dec.slow - def no_check_var_local(self): - mod = ext_tools.ext_module('wx_var_local') - a = 'string' - code = 'a="hello";' - var_specs = ext_tools.assign_variable_types(['a'],locals()) - test = ext_tools.ext_function_from_specs('test',code,var_specs) - mod.add_function(test) - mod.compile() - import wx_var_local - b='bub' - q={} - wx_var_local.test(b,q) - assert('a' == 'string') - - @dec.slow - def no_test_no_check_return(self): - mod = ext_tools.ext_module('wx_return') - a = 'string' - code = """ - a= Py::wx("hello"); - return_val = Py::new_reference_to(a); - """ - test = ext_tools.ext_function('test',code,['a'],locals()) - mod.add_function(test) - mod.compile() - import wx_return - b='bub' - c = wx_return.test(b) - assert(c == 'hello') - -decorate_methods(TestWxConverter, skip) - -if __name__ == "__main__": - nose.run(argv=['', __file__]) Deleted: branches/0.7.x/scipy/weave/vtk_spec.py =================================================================== --- branches/0.7.x/scipy/weave/vtk_spec.py 2009-01-08 07:51:00 UTC (rev 5378) +++ branches/0.7.x/scipy/weave/vtk_spec.py 2009-01-08 07:57:17 UTC (rev 5379) @@ -1,130 +0,0 @@ -""" -VTK type converter. - -This module handles conversion between VTK C++ and VTK Python objects -so that one can write inline C++ code to manipulate VTK Python -objects. It requires that you have VTK and the VTK-Python wrappers -installed. It has been tested with VTK 4.0 and above. The code is -based on wx_spec.py. You will need to call inline with include_dirs, -library_dirs and often even libraries appropriately set for this to -work without errors. Sometimes you might need to include additional -headers. - -Distributed under the SciPy License. - -Authors: - Prabhu Ramachandran - Eric Jones -""" - -from c_spec import common_base_converter - - -vtk_py_to_c_template = \ -""" -class %(type_name)s_handler -{ -public: - %(c_type)s convert_to_%(type_name)s(PyObject* py_obj, const char* name) - { - %(c_type)s vtk_ptr = (%(c_type)s) vtkPythonGetPointerFromObject(py_obj, "%(type_name)s"); - if (!vtk_ptr) - handle_conversion_error(py_obj,"%(type_name)s", name); - %(inc_ref_count)s - return vtk_ptr; - } - - %(c_type)s py_to_%(type_name)s(PyObject* py_obj, const char* name) - { - %(c_type)s vtk_ptr = (%(c_type)s) vtkPythonGetPointerFromObject(py_obj, "%(type_name)s"); - if (!vtk_ptr) - handle_bad_type(py_obj,"%(type_name)s", name); - %(inc_ref_count)s - return vtk_ptr; - } -}; - -%(type_name)s_handler x__%(type_name)s_handler = %(type_name)s_handler(); -#define convert_to_%(type_name)s(py_obj,name) \\ - x__%(type_name)s_handler.convert_to_%(type_name)s(py_obj,name) -#define py_to_%(type_name)s(py_obj,name) \\ - x__%(type_name)s_handler.py_to_%(type_name)s(py_obj,name) - -""" - -vtk_c_to_py_template = \ -""" -PyObject* %(type_name)s_to_py(vtkObjectBase* obj) -{ - return vtkPythonGetObjectFromPointer(obj); -} -""" - - -class vtk_converter(common_base_converter): - def __init__(self,class_name="undefined"): - self.class_name = class_name - common_base_converter.__init__(self) - - def init_info(self): - common_base_converter.init_info(self) - # These are generated on the fly instead of defined at - # the class level. - self.type_name = self.class_name - self.c_type = self.class_name + "*" - self.return_type = self.c_type - self.to_c_return = None # not used - self.check_func = None # not used - hdr = self.class_name + ".h" - # Remember that you need both the quotes! - self.headers.extend(['"vtkPythonUtil.h"', '"vtkObject.h"', - '"%s"'%hdr]) - #self.include_dirs.extend(vtk_inc) - #self.define_macros.append(('SOME_VARIABLE', '1')) - #self.library_dirs.extend(vtk_lib) - self.libraries.extend(['vtkCommonPython', 'vtkCommon']) - #self.support_code.append(common_info.swig_support_code) - - def type_match(self,value): - is_match = 0 - try: - if value.IsA('vtkObject'): - is_match = 1 - except AttributeError: - pass - return is_match - - def generate_build_info(self): - if self.class_name != "undefined": - res = common_base_converter.generate_build_info(self) - else: - # if there isn't a class_name, we don't want the - # we don't want the support_code to be included - import base_info - res = base_info.base_info() - return res - - def py_to_c_code(self): - return vtk_py_to_c_template % self.template_vars() - - def c_to_py_code(self): - return vtk_c_to_py_template % self.template_vars() - - def type_spec(self,name,value): - # factory - class_name = value.__class__.__name__ - new_spec = self.__class__(class_name) - new_spec.name = name - return new_spec - - def __cmp__(self,other): - #only works for equal - res = -1 - try: - res = cmp(self.name,other.name) or \ - cmp(self.__class__, other.__class__) or \ - cmp(self.class_name, other.class_name) or \ - cmp(self.type_name,other.type_name) - except: - pass - return res Deleted: branches/0.7.x/scipy/weave/wx_spec.py =================================================================== --- branches/0.7.x/scipy/weave/wx_spec.py 2009-01-08 07:51:00 UTC (rev 5378) +++ branches/0.7.x/scipy/weave/wx_spec.py 2009-01-08 07:57:17 UTC (rev 5379) @@ -1,184 +0,0 @@ -import common_info -from c_spec import common_base_converter -import sys,os -import glob - -def find_base_dir(): - searched_locations = ['c:\third\wxpython*', - '/usr/lib/wx*'] - - candidate_locations = [] - for pattern in searched_locations: - candidate_locations.extend(glob.glob(pattern)) - candidate_locations.sort() - - if len(candidate_locations) == 0: - raise RuntimeError("Could not locate wxPython base directory.") - else: - return candidate_locations[-1] - -wx_base = find_base_dir() - -def get_wxconfig(flag): - wxconfig = os.path.join(wx_base,'bin','wx-config') - if not os.path.exists(wxconfig): - # Could not locate wx-config, assume it is on the path. - wxconfig = 'wx-config' - - import commands - res,settings = commands.getstatusoutput(wxconfig + ' --' + flag) - if res: - msg = wxconfig + ' failed. Impossible to learn wxPython settings' - raise RuntimeError, msg - return settings.split() - -wx_to_c_template = \ -""" -class %(type_name)s_handler -{ -public: - %(c_type)s convert_to_%(type_name)s(PyObject* py_obj, const char* name) - { - %(c_type)s wx_ptr; - // work on this error reporting... - if (SWIG_GetPtrObj(py_obj,(void **) &wx_ptr,"_%(type_name)s_p")) - handle_conversion_error(py_obj,"%(type_name)s", name); - %(inc_ref_count)s - return wx_ptr; - } - - %(c_type)s py_to_%(type_name)s(PyObject* py_obj,const char* name) - { - %(c_type)s wx_ptr; - // work on this error reporting... - if (SWIG_GetPtrObj(py_obj,(void **) &wx_ptr,"_%(type_name)s_p")) - handle_bad_type(py_obj,"%(type_name)s", name); - %(inc_ref_count)s - return wx_ptr; - } -}; - -%(type_name)s_handler x__%(type_name)s_handler = %(type_name)s_handler(); -#define convert_to_%(type_name)s(py_obj,name) \\ - x__%(type_name)s_handler.convert_to_%(type_name)s(py_obj,name) -#define py_to_%(type_name)s(py_obj,name) \\ - x__%(type_name)s_handler.py_to_%(type_name)s(py_obj,name) - -""" - -class wx_converter(common_base_converter): - def __init__(self,class_name="undefined"): - self.class_name = class_name - common_base_converter.__init__(self) - - def init_info(self): - common_base_converter.init_info(self) - # These are generated on the fly instead of defined at - # the class level. - self.type_name = self.class_name - self.c_type = self.class_name + "*" - self.return_type = self.class_name + "*" - self.to_c_return = None # not used - self.check_func = None # not used - self.headers.append('"wx/wx.h"') - if sys.platform == "win32": - # These will be used in many cases - self.headers.append('') - - # These are needed for linking. - self.libraries.extend(['kernel32','user32','gdi32','comdlg32', - 'winspool', 'winmm', 'shell32', - 'oldnames', 'comctl32', 'ctl3d32', - 'odbc32', 'ole32', 'oleaut32', - 'uuid', 'rpcrt4', 'advapi32', 'wsock32']) - - # not sure which of these macros are needed. - self.define_macros.append(('WIN32', '1')) - self.define_macros.append(('__WIN32__', '1')) - self.define_macros.append(('_WINDOWS', '1')) - self.define_macros.append(('STRICT', '1')) - # I think this will only work on NT/2000/XP set - # set to 0x0400 for earlier versions. - # Hmmm. setting this breaks stuff - #self.define_macros.append(('WINVER', '0x0350')) - - self.library_dirs.append(os.path.join(wx_base,'lib')) - #self.include_dirs.append(os.path.join(wx_base,'include')) - self.include_dirs.append(wx_base) - self.include_dirs.append(os.path.join(wx_base,'include')) - self.include_dirs.append(os.path.join(wx_base,'include','msw')) - # how do I discover unicode or not unicode?? - # non-unicode - self.libraries.append('wxmsw24h') - self.include_dirs.append(os.path.join(wx_base,'lib')) - - # unicode - #self.libraries.append('wxmswuh') - #self.include_dirs.append(os.path.join(wx_base,'lib','mswdlluh')) - #self.define_macros.append(('UNICODE', '1')) - else: - # make sure the gtk files are available - # ?? Do I need to link to them? - self.headers.append('"gdk/gdk.h"') - # !! This shouldn't be hard coded. - self.include_dirs.append("/usr/include/gtk-1.2") - self.include_dirs.append("/usr/include/glib-1.2") - self.include_dirs.append("/usr/lib/glib/include") - cxxflags = get_wxconfig('cxxflags') - libflags = get_wxconfig('libs') + get_wxconfig('gl-libs') - - #older versions of wx do not support the ldflags. - try: - ldflags = get_wxconfig('ldflags') - except RuntimeError: - ldflags = [] - - self.extra_compile_args.extend(cxxflags) - self.extra_link_args.extend(libflags) - self.extra_link_args.extend(ldflags) - self.support_code.append(common_info.swig_support_code) - - def type_match(self,value): - is_match = 0 - try: - wx_class = str(value.this).split('_')[-1] - if wx_class[:2] == 'wx': - is_match = 1 - except AttributeError: - pass - return is_match - - def generate_build_info(self): - if self.class_name != "undefined": - res = common_base_converter.generate_build_info(self) - else: - # if there isn't a class_name, we don't want the - # we don't want the support_code to be included - import base_info - res = base_info.base_info() - return res - - def py_to_c_code(self): - return wx_to_c_template % self.template_vars() - - #def c_to_py_code(self): - # return simple_c_to_py_template % self.template_vars() - - def type_spec(self,name,value): - # factory - class_name = str(value.this).split('_')[-1] - new_spec = self.__class__(class_name) - new_spec.name = name - return new_spec - - def __cmp__(self,other): - #only works for equal - res = -1 - try: - res = cmp(self.name,other.name) or \ - cmp(self.__class__, other.__class__) or \ - cmp(self.class_name, other.class_name) or \ - cmp(self.type_name,other.type_name) - except: - pass - return res From scipy-svn at scipy.org Thu Jan 8 02:58:11 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 01:58:11 -0600 (CST) Subject: [Scipy-svn] r5380 - branches/0.7.x/scipy/weave Message-ID: <20090108075811.66F23C7C040@scipy.org> Author: jarrod.millman Date: 2009-01-08 01:58:10 -0600 (Thu, 08 Jan 2009) New Revision: 5380 Modified: branches/0.7.x/scipy/weave/blitz_spec.py Log: Backport r5377 Modified: branches/0.7.x/scipy/weave/blitz_spec.py =================================================================== --- branches/0.7.x/scipy/weave/blitz_spec.py 2009-01-08 07:57:17 UTC (rev 5379) +++ branches/0.7.x/scipy/weave/blitz_spec.py 2009-01-08 07:58:10 UTC (rev 5380) @@ -27,7 +27,6 @@ { blitz::TinyVector shape(0); blitz::TinyVector strides(0); - int stride_acc = 1; //for (int i = N-1; i >=0; i--) for (int i = 0; i < N; i++) { @@ -45,7 +44,6 @@ blitz::TinyVector shape(0); blitz::TinyVector strides(0); - int stride_acc = 1; //for (int i = N-1; i >=0; i--) for (int i = 0; i < N; i++) { From scipy-svn at scipy.org Thu Jan 8 02:58:53 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 01:58:53 -0600 (CST) Subject: [Scipy-svn] r5381 - branches/0.7.x/scipy/weave Message-ID: <20090108075853.100E8C7C020@scipy.org> Author: jarrod.millman Date: 2009-01-08 01:58:52 -0600 (Thu, 08 Jan 2009) New Revision: 5381 Modified: branches/0.7.x/scipy/weave/inline_tools.py Log: Backport r5378 Modified: branches/0.7.x/scipy/weave/inline_tools.py =================================================================== --- branches/0.7.x/scipy/weave/inline_tools.py 2009-01-08 07:58:10 UTC (rev 5380) +++ branches/0.7.x/scipy/weave/inline_tools.py 2009-01-08 07:58:52 UTC (rev 5381) @@ -81,9 +81,11 @@ try_code = 'try \n' \ '{ \n' \ - ' PyObject* raw_locals = py_to_raw_dict(' \ + ' PyObject* raw_locals __attribute__ ((unused));\n' \ + ' raw_locals = py_to_raw_dict(' \ 'py__locals,"_locals");\n' \ - ' PyObject* raw_globals = py_to_raw_dict(' \ + ' PyObject* raw_globals __attribute__ ((unused));\n' \ + ' raw_globals = py_to_raw_dict(' \ 'py__globals,"_globals");\n' + \ ' /* argument conversion code */ \n' + \ decl_code + \ From scipy-svn at scipy.org Thu Jan 8 03:11:05 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 02:11:05 -0600 (CST) Subject: [Scipy-svn] r5382 - trunk/scipy/weave/tests Message-ID: <20090108081105.751DDC7C020@scipy.org> Author: stefan Date: 2009-01-08 02:10:55 -0600 (Thu, 08 Jan 2009) New Revision: 5382 Modified: trunk/scipy/weave/tests/test_ext_tools.py Log: Import nose for running weave tests stand alone. Modified: trunk/scipy/weave/tests/test_ext_tools.py =================================================================== --- trunk/scipy/weave/tests/test_ext_tools.py 2009-01-08 07:58:52 UTC (rev 5381) +++ trunk/scipy/weave/tests/test_ext_tools.py 2009-01-08 08:10:55 UTC (rev 5382) @@ -1,3 +1,4 @@ +import nose from numpy.testing import * from scipy.weave import ext_tools, c_spec From scipy-svn at scipy.org Thu Jan 8 03:11:43 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 02:11:43 -0600 (CST) Subject: [Scipy-svn] r5383 - trunk/scipy/weave/tests Message-ID: <20090108081143.B5181C7C040@scipy.org> Author: stefan Date: 2009-01-08 02:11:29 -0600 (Thu, 08 Jan 2009) New Revision: 5383 Modified: trunk/scipy/weave/tests/test_ext_tools.py Log: Suppress stream output during testing. Modified: trunk/scipy/weave/tests/test_ext_tools.py =================================================================== --- trunk/scipy/weave/tests/test_ext_tools.py 2009-01-08 08:10:55 UTC (rev 5382) +++ trunk/scipy/weave/tests/test_ext_tools.py 2009-01-08 08:11:29 UTC (rev 5383) @@ -46,8 +46,10 @@ # function 2 --> a little more complex expression var_specs = ext_tools.assign_variable_types(['a'],locals(),globals()) code = """ + std::cout.clear(std::ios_base::badbit); std::cout << std::endl; std::cout << "test printing a value:" << a << std::endl; + std::cout.clear(std::ios_base::goodbit); """ test = ext_tools.ext_function_from_specs('test',code,var_specs) mod.add_function(test) From scipy-svn at scipy.org Thu Jan 8 03:12:15 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 02:12:15 -0600 (CST) Subject: [Scipy-svn] r5384 - trunk/scipy/weave/tests Message-ID: <20090108081215.E2B67C7C046@scipy.org> Author: stefan Date: 2009-01-08 02:12:06 -0600 (Thu, 08 Jan 2009) New Revision: 5384 Modified: trunk/scipy/weave/tests/test_scxx_object.py Log: Mark more variables as unused in weave test suite. Modified: trunk/scipy/weave/tests/test_scxx_object.py =================================================================== --- trunk/scipy/weave/tests/test_scxx_object.py 2009-01-08 08:11:29 UTC (rev 5383) +++ trunk/scipy/weave/tests/test_scxx_object.py 2009-01-08 08:12:06 UTC (rev 5384) @@ -115,36 +115,36 @@ def test_int_cast(self): code = """ py::object val = 1; - int raw_val = val; + int raw_val __attribute__ ((unused)) = val; """ inline_tools.inline(code) @dec.slow def test_double_cast(self): code = """ py::object val = 1.0; - double raw_val = val; + double raw_val __attribute__ ((unused)) = val; """ inline_tools.inline(code) @dec.slow def test_float_cast(self): code = """ py::object val = 1.0; - float raw_val = val; + float raw_val __attribute__ ((unused)) = val; """ inline_tools.inline(code) @dec.slow def test_complex_cast(self): code = """ - std::complex num = std::complex(1.0,1.0); + std::complex num = std::complex(1.0, 1.0); py::object val = num; - std::complex raw_val = val; + std::complex raw_val __attribute__ ((unused)) = val; """ inline_tools.inline(code) @dec.slow def test_string_cast(self): code = """ py::object val = "hello"; - std::string raw_val = val; + std::string raw_val __attribute__ ((unused)) = val; """ inline_tools.inline(code) From scipy-svn at scipy.org Thu Jan 8 03:24:33 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 02:24:33 -0600 (CST) Subject: [Scipy-svn] r5385 - trunk/scipy/weave/tests Message-ID: <20090108082433.7431BC7C020@scipy.org> Author: stefan Date: 2009-01-08 02:24:22 -0600 (Thu, 08 Jan 2009) New Revision: 5385 Modified: trunk/scipy/weave/tests/test_scxx_object.py Log: Remove test that required visual verification. Modified: trunk/scipy/weave/tests/test_scxx_object.py =================================================================== --- trunk/scipy/weave/tests/test_scxx_object.py 2009-01-08 08:12:06 UTC (rev 5384) +++ trunk/scipy/weave/tests/test_scxx_object.py 2009-01-08 08:24:22 UTC (rev 5385) @@ -77,14 +77,6 @@ # Check the object print protocol. #------------------------------------------------------------------------ @dec.slow - def test_stdout(self): - code = """ - py::object val = "how now brown cow"; - val.print(stdout); - """ - res = inline_tools.inline(code) - # visual check on this one. - @dec.slow def test_stringio(self): import cStringIO file_imposter = cStringIO.StringIO() From scipy-svn at scipy.org Thu Jan 8 03:25:07 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 02:25:07 -0600 (CST) Subject: [Scipy-svn] r5386 - trunk/scipy/weave/tests Message-ID: <20090108082507.89C32C7C040@scipy.org> Author: stefan Date: 2009-01-08 02:24:56 -0600 (Thu, 08 Jan 2009) New Revision: 5386 Modified: trunk/scipy/weave/tests/test_scxx_object.py Log: Import nose for running tests stand alone. Modified: trunk/scipy/weave/tests/test_scxx_object.py =================================================================== --- trunk/scipy/weave/tests/test_scxx_object.py 2009-01-08 08:24:22 UTC (rev 5385) +++ trunk/scipy/weave/tests/test_scxx_object.py 2009-01-08 08:24:56 UTC (rev 5386) @@ -3,6 +3,7 @@ import sys +import nose from numpy.testing import * from scipy.weave import inline_tools From scipy-svn at scipy.org Thu Jan 8 04:23:02 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 03:23:02 -0600 (CST) Subject: [Scipy-svn] r5387 - trunk/scipy/fftpack Message-ID: <20090108092302.23756C7C020@scipy.org> Author: cdavid Date: 2009-01-08 03:22:52 -0600 (Thu, 08 Jan 2009) New Revision: 5387 Modified: trunk/scipy/fftpack/setup.py Log: Update fftpack setup.py after fftpack code reorganization. Modified: trunk/scipy/fftpack/setup.py =================================================================== --- trunk/scipy/fftpack/setup.py 2009-01-08 08:24:56 UTC (rev 5386) +++ trunk/scipy/fftpack/setup.py 2009-01-08 09:22:52 UTC (rev 5387) @@ -22,8 +22,7 @@ config.add_extension('_fftpack', sources=sources, - libraries=['dfftpack', 'fftpack'], - depends=[]) + libraries=['dfftpack', 'fftpack']) config.add_extension('convolve', sources=['convolve.pyf','src/convolve.c'], From scipy-svn at scipy.org Thu Jan 8 04:23:30 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 03:23:30 -0600 (CST) Subject: [Scipy-svn] r5388 - trunk/scipy/spatial/tests Message-ID: <20090108092330.6BCC2C7C040@scipy.org> Author: cdavid Date: 2009-01-08 03:23:19 -0600 (Thu, 08 Jan 2009) New Revision: 5388 Modified: trunk/scipy/spatial/tests/test_distance.py Log: Remove print statement in tests. Modified: trunk/scipy/spatial/tests/test_distance.py =================================================================== --- trunk/scipy/spatial/tests/test_distance.py 2009-01-08 09:22:52 UTC (rev 5387) +++ trunk/scipy/spatial/tests/test_distance.py 2009-01-08 09:23:19 UTC (rev 5388) @@ -1467,7 +1467,6 @@ a = set([]) for n in xrange(2, 16): a.add(n*(n-1)/2) - print a for i in xrange(5, 105): if i not in a: self.failUnlessRaises(ValueError, self.bad_y, i) @@ -1690,3 +1689,6 @@ def correct_n_by_n(self, n): y = np.random.rand(n*(n-1)/2) return y + +if __name__=="__main__": + run_module_suite() From scipy-svn at scipy.org Thu Jan 8 04:23:56 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 03:23:56 -0600 (CST) Subject: [Scipy-svn] r5389 - trunk/scipy/spatial/tests Message-ID: <20090108092356.3383EC7C046@scipy.org> Author: cdavid Date: 2009-01-08 03:23:44 -0600 (Thu, 08 Jan 2009) New Revision: 5389 Modified: trunk/scipy/spatial/tests/test_distance.py Log: Another print statement was there in scipy.spatial tests. Modified: trunk/scipy/spatial/tests/test_distance.py =================================================================== --- trunk/scipy/spatial/tests/test_distance.py 2009-01-08 09:23:19 UTC (rev 5388) +++ trunk/scipy/spatial/tests/test_distance.py 2009-01-08 09:23:44 UTC (rev 5389) @@ -1677,7 +1677,6 @@ a = set([]) for n in xrange(2, 16): a.add(n*(n-1)/2) - print a for i in xrange(5, 105): if i not in a: self.failUnlessRaises(ValueError, self.bad_y, i) From scipy-svn at scipy.org Thu Jan 8 07:27:32 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 06:27:32 -0600 (CST) Subject: [Scipy-svn] r5390 - branches/0.7.x/scipy/stats Message-ID: <20090108122732.237BDC7C00C@scipy.org> Author: cdavid Date: 2009-01-08 06:27:18 -0600 (Thu, 08 Jan 2009) New Revision: 5390 Modified: branches/0.7.x/scipy/stats/stats.py Log: Fix deprecation warning message: I got bias/ddof relationship backward. Modified: branches/0.7.x/scipy/stats/stats.py =================================================================== --- branches/0.7.x/scipy/stats/stats.py 2009-01-08 09:23:44 UTC (rev 5389) +++ branches/0.7.x/scipy/stats/stats.py 2009-01-08 12:27:18 UTC (rev 5390) @@ -1300,7 +1300,8 @@ - numpy.var axis argument defaults to None, not 0 - numpy.var has a ddof argument to replace bias in a more general manner. scipy.stats.var(a, bias=True) can be replaced by numpy.var(x, -axis=0, ddof=1).""", DeprecationWarning) + axis=0, ddof=0), scipy.stats.var(a, bias=False) by var(x, axis=0, + ddof=1).""", DeprecationWarning) a, axis = _chk_asarray(a, axis) mn = np.expand_dims(mean(a,axis),axis) deviations = a - mn @@ -1323,7 +1324,8 @@ - numpy.std axis argument defaults to None, not 0 - numpy.std has a ddof argument to replace bias in a more general manner. scipy.stats.std(a, bias=True) can be replaced by numpy.std(x, -axis=0, ddof=1).""", DeprecationWarning) + axis=0, ddof=0), scipy.stats.std(a, bias=False) by numpy.std(x, axis=0, + ddof=1).""", DeprecationWarning) return np.sqrt(var(a,axis,bias)) From scipy-svn at scipy.org Thu Jan 8 07:31:27 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 06:31:27 -0600 (CST) Subject: [Scipy-svn] r5391 - trunk/scipy/stats Message-ID: <20090108123127.4E52AC7C00C@scipy.org> Author: cdavid Date: 2009-01-08 06:31:22 -0600 (Thu, 08 Jan 2009) New Revision: 5391 Modified: trunk/scipy/stats/stats.py Log: Backport fixed deprecation warnings for stats.std and stats.var. Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2009-01-08 12:27:18 UTC (rev 5390) +++ trunk/scipy/stats/stats.py 2009-01-08 12:31:22 UTC (rev 5391) @@ -1300,7 +1300,8 @@ - numpy.var axis argument defaults to None, not 0 - numpy.var has a ddof argument to replace bias in a more general manner. scipy.stats.var(a, bias=True) can be replaced by numpy.var(x, -axis=0, ddof=1).""", DeprecationWarning) + axis=0, ddof=0), scipy.stats.var(a, bias=False) by var(x, axis=0, + ddof=1).""", DeprecationWarning) a, axis = _chk_asarray(a, axis) mn = np.expand_dims(mean(a,axis),axis) deviations = a - mn @@ -1323,7 +1324,8 @@ - numpy.std axis argument defaults to None, not 0 - numpy.std has a ddof argument to replace bias in a more general manner. scipy.stats.std(a, bias=True) can be replaced by numpy.std(x, -axis=0, ddof=1).""", DeprecationWarning) + axis=0, ddof=0), scipy.stats.std(a, bias=False) by numpy.std(x, axis=0, + ddof=1).""", DeprecationWarning) return np.sqrt(var(a,axis,bias)) From scipy-svn at scipy.org Thu Jan 8 07:36:56 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 06:36:56 -0600 (CST) Subject: [Scipy-svn] r5392 - trunk/scipy/linalg Message-ID: <20090108123656.59C90C7C00C@scipy.org> Author: cdavid Date: 2009-01-08 06:36:51 -0600 (Thu, 08 Jan 2009) New Revision: 5392 Modified: trunk/scipy/linalg/atlas_version.c Log: Do not display atlas build info when importing atlas_version; add a function which does so instead. Modified: trunk/scipy/linalg/atlas_version.c =================================================================== --- trunk/scipy/linalg/atlas_version.c 2009-01-08 12:31:22 UTC (rev 5391) +++ trunk/scipy/linalg/atlas_version.c 2009-01-08 12:36:51 UTC (rev 5392) @@ -1,24 +1,33 @@ -#ifdef __CPLUSPLUS__ -extern "C" { -#endif #include "Python.h" -static PyMethodDef module_methods[] = { {NULL,NULL} }; -PyMODINIT_FUNC initatlas_version(void) { - PyObject *m = NULL; + +static PyObject* version(PyObject* self, PyObject* dummy) +{ #if defined(NO_ATLAS_INFO) - printf("NO ATLAS INFO AVAILABLE\n"); + printf("NO ATLAS INFO AVAILABLE\n"); #else - void ATL_buildinfo(void); - ATL_buildinfo(); + void ATL_buildinfo(void); + ATL_buildinfo(); #endif - m = Py_InitModule("atlas_version", module_methods); + + Py_INCREF(Py_None); + return Py_None; +} + +static char version_doc[] = "Print the build info from atlas."; + +static PyMethodDef module_methods[] = { + {"version", version, METH_VARARGS, version_doc}, + {NULL, NULL, 0, NULL} +}; + +PyMODINIT_FUNC initatlas_version(void) +{ + PyObject *m = NULL; + m = Py_InitModule("atlas_version", module_methods); #if defined(ATLAS_INFO) - { - PyObject *d = PyModule_GetDict(m); - PyDict_SetItemString(d,"ATLAS_VERSION",PyString_FromString(ATLAS_INFO)); - } + { + PyObject *d = PyModule_GetDict(m); + PyDict_SetItemString(d,"ATLAS_VERSION",PyString_FromString(ATLAS_INFO)); + } #endif } -#ifdef __CPLUSCPLUS__ -} -#endif From scipy-svn at scipy.org Thu Jan 8 07:37:12 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 06:37:12 -0600 (CST) Subject: [Scipy-svn] r5393 - in trunk/scipy/stats: . tests Message-ID: <20090108123712.13674C7C046@scipy.org> Author: cdavid Date: 2009-01-08 06:37:06 -0600 (Thu, 08 Jan 2009) New Revision: 5393 Modified: trunk/scipy/stats/morestats.py trunk/scipy/stats/stats.py trunk/scipy/stats/tests/test_stats.py Log: Do not use stats.mean anymore anywhere in scipy. Modified: trunk/scipy/stats/morestats.py =================================================================== --- trunk/scipy/stats/morestats.py 2009-01-08 12:36:51 UTC (rev 5392) +++ trunk/scipy/stats/morestats.py 2009-01-08 12:37:06 UTC (rev 5393) @@ -332,7 +332,7 @@ """ N = len(data) y = boxcox(data,lmb) - my = stats.mean(y) + my = np.mean(y, axis=0) f = (lmb-1)*sum(log(data),axis=0) f -= N/2.0*log(sum((y-my)**2.0/N,axis=0)) return f @@ -499,7 +499,7 @@ if not dist in ['norm','expon','gumbel','extreme1','logistic']: raise ValueError, "Invalid distribution." y = sort(x) - xbar = stats.mean(x) + xbar = np.mean(x, axis=0) N = len(y) if dist == 'norm': s = stats.std(x) @@ -721,7 +721,7 @@ if center == 'median': func = stats.median elif center == 'mean': - func = stats.mean + func = lambda x: np.mean(x, axis=0) else: func = stats.trim_mean for j in range(k): @@ -737,7 +737,7 @@ Zbari = zeros(k,'d') Zbar = 0.0 for i in range(k): - Zbari[i] = stats.mean(Zij[i]) + Zbari[i] = np.mean(Zij[i], axis=0) Zbar += Zbari[i]*Ni[i] Zbar /= Ntot @@ -843,7 +843,7 @@ if center == 'median': func = stats.median elif center == 'mean': - func = stats.mean + func = lambda x: np.mean(x, axis=0) else: func = stats.trim_mean @@ -862,7 +862,7 @@ # compute Aibar Aibar = _apply_func(a,g,sum) / Ni - anbar = stats.mean(a) + anbar = stats.mean(a, axis=0) varsq = stats.var(a) Xsq = sum(Ni*(asarray(Aibar)-anbar)**2.0,axis=0)/varsq @@ -921,8 +921,8 @@ evar = 0 Ni = array([len(args[i]) for i in range(k)]) - Mi = array([stats.mean(args[i]) for i in range(k)]) - Vi = array([stats.var(args[i]) for i in range(k)]) + Mi = array([np.mean(args[i], axis=0) for i in range(k)]) + Vi = array([np.var(args[i]) for i in range(k)]) Wi = Ni / Vi swi = sum(Wi,axis=0) N = sum(Ni,axis=0) @@ -1068,7 +1068,7 @@ """Compute the circular mean for samples assumed to be in the range [low to high] """ ang = (samples - low)*2*pi / (high-low) - res = angle(stats.mean(exp(1j*ang))) + res = angle(np.mean(exp(1j*ang), axis=0)) if (res < 0): res = res + 2*pi return res*(high-low)/2.0/pi + low @@ -1077,7 +1077,7 @@ """Compute the circular variance for samples assumed to be in the range [low to high] """ ang = (samples - low)*2*pi / (high-low) - res = stats.mean(exp(1j*ang)) + res = np.mean(exp(1j*ang), axis=0) V = 1-abs(res) return ((high-low)/2.0/pi)**2 * V @@ -1085,7 +1085,7 @@ """Compute the circular standard deviation for samples assumed to be in the range [low to high] """ ang = (samples - low)*2*pi / (high-low) - res = stats.mean(exp(1j*ang)) + res = np.mean(exp(1j*ang), axis=0) V = 1-abs(res) return ((high-low)/2.0/pi) * sqrt(V) Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2009-01-08 12:36:51 UTC (rev 5392) +++ trunk/scipy/stats/stats.py 2009-01-08 12:37:06 UTC (rev 5393) @@ -394,8 +394,6 @@ return size / np.sum(1.0/a, axis) def mean(a, axis=0): - # fixme: This seems to be redundant with numpy.mean(,axis=0) or even - # the ndarray.mean() method. """Returns the arithmetic mean of m along the given dimension. That is: (x1 + x2 + .. + xn) / n @@ -411,15 +409,13 @@ all values in the array if axis=None. The return value will have a floating point dtype even if the input data are integers. """ - warnings.warn("""\ + raise DeprecationWarning("""\ scipy.stats.mean is deprecated; please update your code to use numpy.mean. Please note that: - numpy.mean axis argument defaults to None, not 0 - numpy.mean has a ddof argument to replace bias in a more general manner. scipy.stats.mean(a, bias=True) can be replaced by numpy.mean(x, -axis=0, ddof=1).""", DeprecationWarning) - a, axis = _chk_asarray(a, axis) - return a.mean(axis) +axis=0, ddof=1).""") def cmedian(a, numbins=1000): # fixme: numpy.median() always seems to be a better choice. @@ -1261,7 +1257,7 @@ an integer (the axis over which to operate) """ a, axis = _chk_asarray(a, axis) - mn = np.expand_dims(mean(a, axis), axis) + mn = np.expand_dims(np.mean(a, axis), axis) deviations = a - mn n = a.shape[axis] svar = ss(deviations,axis) / float(n) @@ -1284,7 +1280,7 @@ Returns: array containing the value of (mean/stdev) along axis, or 0 when stdev=0 """ - m = mean(instack,axis) + m = np.mean(instack,axis) sd = samplestd(instack,axis) return np.where(sd == 0, 0, m/sd) @@ -1303,7 +1299,7 @@ axis=0, ddof=0), scipy.stats.var(a, bias=False) by var(x, axis=0, ddof=1).""", DeprecationWarning) a, axis = _chk_asarray(a, axis) - mn = np.expand_dims(mean(a,axis),axis) + mn = np.expand_dims(np.mean(a,axis),axis) deviations = a - mn n = a.shape[axis] vals = sum(abs(deviations)**2,axis)/(n-1.0) @@ -1358,7 +1354,7 @@ arrays > 1D. """ - z = (score-mean(a,None)) / samplestd(a) + z = (score-np.mean(a,None)) / samplestd(a) return z @@ -1368,7 +1364,7 @@ computed relative to the passed array. """ - mu = mean(a,None) + mu = np.mean(a,None) sigma = samplestd(a) return (array(a)-mu)/sigma @@ -1780,8 +1776,8 @@ x = asarray(args[0]) y = asarray(args[1]) n = len(x) - xmean = mean(x,None) - ymean = mean(y,None) + xmean = np.mean(x,None) + ymean = np.mean(y,None) xm,ym = x-xmean, y-ymean r_num = np.add.reduce(xm*ym) r_den = np.sqrt(ss(xm)*ss(ym)) @@ -1956,7 +1952,7 @@ n2 = b.shape[axis] df = n1+n2-2 - d = mean(a,axis) - mean(b,axis) + d = np.mean(a,axis) - np.mean(b,axis) svar = ((n1-1)*v1+(n2-1)*v2) / float(df) t = d/np.sqrt(svar*(1.0/n1 + 1.0/n2)) Modified: trunk/scipy/stats/tests/test_stats.py =================================================================== --- trunk/scipy/stats/tests/test_stats.py 2009-01-08 12:36:51 UTC (rev 5392) +++ trunk/scipy/stats/tests/test_stats.py 2009-01-08 12:37:06 UTC (rev 5393) @@ -105,7 +105,7 @@ """ def test_meanX(self): - y = stats.mean(X) + y = np.mean(X) assert_almost_equal(y, 5.0) def test_stdX(self): @@ -125,7 +125,7 @@ assert_almost_equal(y, 2.1602468994692865) def test_meanZERO(self): - y = stats.mean(ZERO) + y = np.mean(ZERO) assert_almost_equal(y, 0.0) def test_stdZERO(self): @@ -134,7 +134,7 @@ ## Really need to write these tests to handle missing values properly ## def test_meanMISS(self): -## y = stats.mean(MISS) +## y = np.mean(MISS) ## assert_almost_equal(y, 0.0) ## ## def test_stdMISS(self): @@ -142,7 +142,7 @@ ## assert_almost_equal(y, 0.0) def test_meanBIG(self): - y = stats.mean(BIG) + y = np.mean(BIG) assert_almost_equal(y, 99999995.00) @@ -151,7 +151,7 @@ assert_almost_equal(y, 2.738612788) def test_meanLITTLE(self): - y = stats.mean(LITTLE) + y = np.mean(LITTLE) assert_approx_equal(y, 0.999999950) def test_stdLITTLE(self): @@ -159,7 +159,7 @@ assert_approx_equal(y, 2.738612788e-8) def test_meanHUGE(self): - y = stats.mean(HUGE) + y = np.mean(HUGE) assert_approx_equal(y, 5.00000e+12) def test_stdHUGE(self): @@ -167,7 +167,7 @@ assert_approx_equal(y, 2.738612788e12) def test_meanTINY(self): - y = stats.mean(TINY) + y = np.mean(TINY) assert_almost_equal(y, 0.0) def test_stdTINY(self): @@ -175,7 +175,7 @@ assert_almost_equal(y, 0.0) def test_meanROUND(self): - y = stats.mean(ROUND) + y = np.mean(ROUND) assert_approx_equal(y, 4.500000000) def test_stdROUND(self): @@ -595,11 +595,11 @@ mn1 = 0.0 for el in a: mn1 += el / float(Na) - assert_almost_equal(stats.mean(a),mn1,11) + assert_almost_equal(np.mean(a),mn1,11) mn2 = 0.0 for el in af: mn2 += el / float(Naf) - assert_almost_equal(stats.mean(af),mn2,11) + assert_almost_equal(np.mean(af),mn2,11) def test_2d(self): a = [[1.0, 2.0, 3.0], @@ -610,20 +610,19 @@ mn1 = zeros(N2, dtype=float) for k in range(N1): mn1 += A[k,:] / N1 - assert_almost_equal(stats.mean(a, axis=0), mn1, decimal=13) - assert_almost_equal(stats.mean(a), mn1, decimal=13) + assert_almost_equal(np.mean(a, axis=0), mn1, decimal=13) mn2 = zeros(N1, dtype=float) for k in range(N2): mn2 += A[:,k] mn2 /= N2 - assert_almost_equal(stats.mean(a, axis=1), mn2, decimal=13) + assert_almost_equal(np.mean(a, axis=1), mn2, decimal=13) def test_ravel(self): a = rand(5,3,5) A = 0 for val in ravel(a): A += val - assert_almost_equal(stats.mean(a,axis=None),A/(5*3.0*5)) + assert_almost_equal(np.mean(a,axis=None),A/(5*3.0*5)) class TestPercentile(TestCase): def setUp(self): @@ -773,7 +772,7 @@ not in R, so used (10-mean(testcase,axis=0))/sqrt(var(testcase)*3/4) """ - y = stats.z(self.testcase,stats.mean(self.testcase)) + y = stats.z(self.testcase,np.mean(self.testcase, axis=0)) assert_almost_equal(y,0.0) def test_zs(self): From scipy-svn at scipy.org Thu Jan 8 07:37:33 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 06:37:33 -0600 (CST) Subject: [Scipy-svn] r5394 - in trunk/scipy/stats: . tests Message-ID: <20090108123733.2A1A7C7C055@scipy.org> Author: cdavid Date: 2009-01-08 06:37:27 -0600 (Thu, 08 Jan 2009) New Revision: 5394 Modified: trunk/scipy/stats/morestats.py trunk/scipy/stats/stats.py trunk/scipy/stats/tests/test_stats.py Log: Do not use stats.median anymore anywhere. Modified: trunk/scipy/stats/morestats.py =================================================================== --- trunk/scipy/stats/morestats.py 2009-01-08 12:37:06 UTC (rev 5393) +++ trunk/scipy/stats/morestats.py 2009-01-08 12:37:27 UTC (rev 5394) @@ -719,7 +719,7 @@ raise ValueError, "Keyword argument
must be 'mean', 'median'"\ + "or 'trimmed'." if center == 'median': - func = stats.median + func = lambda x: np.median(x, axis=0) elif center == 'mean': func = lambda x: np.mean(x, axis=0) else: @@ -841,7 +841,7 @@ raise ValueError, "Keyword argument
must be 'mean', 'median'"\ + "or 'trimmed'." if center == 'median': - func = stats.median + func = lambda x: np.median(x, axis=0) elif center == 'mean': func = lambda x: np.mean(x, axis=0) else: Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2009-01-08 12:37:06 UTC (rev 5393) +++ trunk/scipy/stats/stats.py 2009-01-08 12:37:27 UTC (rev 5394) @@ -330,7 +330,7 @@ x = np.sort(np.compress(cond,arr1d,axis=-1)) if x.size == 0: return np.nan - return median(x) + return np.median(x) def nanmedian(x, axis=0): """ Compute the median along the given axis ignoring nan values @@ -485,14 +485,13 @@ The median of each remaining axis, or of all of the values in the array if axis is None. """ - warnings.warn("""\ + raise DeprecationWarning("""\ scipy.stats.median is deprecated; please update your code to use numpy.median. Please note that: - numpy.median axis argument defaults to None, not 0 - numpy.median has a ddof argument to replace bias in a more general manner. scipy.stats.median(a, bias=True) can be replaced by numpy.median(x, -axis=0, ddof=1).""", DeprecationWarning) - return np.median(a, axis) +axis=0, ddof=1).""") def mode(a, axis=0): """Returns an array of the modal (most common) value in the passed array. Modified: trunk/scipy/stats/tests/test_stats.py =================================================================== --- trunk/scipy/stats/tests/test_stats.py 2009-01-08 12:37:06 UTC (rev 5393) +++ trunk/scipy/stats/tests/test_stats.py 2009-01-08 12:37:27 UTC (rev 5394) @@ -228,12 +228,12 @@ def test_nanmedian_none(self): """Check nanmedian when no values are nan.""" m = stats.nanmedian(self.X) - assert_approx_equal(m, stats.median(self.X)) + assert_approx_equal(m, np.median(self.X)) def test_nanmedian_some(self): """Check nanmedian when some values only are nan.""" m = stats.nanmedian(self.Xsome) - assert_approx_equal(m, stats.median(self.Xsomet)) + assert_approx_equal(m, np.median(self.Xsomet)) def test_nanmedian_all(self): """Check nanmedian when all values are nan.""" @@ -631,9 +631,9 @@ self.a3 = [3.,4,5,10,-3,-5,-6,7.0] def test_median(self): - assert_equal(stats.median(self.a1), 4) - assert_equal(stats.median(self.a2), 2.5) - assert_equal(stats.median(self.a3), 3.5) + assert_equal(np.median(self.a1), 4) + assert_equal(np.median(self.a2), 2.5) + assert_equal(np.median(self.a3), 3.5) def test_percentile(self): x = arange(8) * 0.5 @@ -681,22 +681,23 @@ def test_basic(self): data1 = [1,3,5,2,3,1,19,-10,2,4.0] data2 = [3,5,1,10,23,-10,3,-2,6,8,15] - assert_almost_equal(stats.median(data1),2.5) - assert_almost_equal(stats.median(data2),5) + assert_almost_equal(np.median(data1),2.5) + assert_almost_equal(np.median(data2),5) def test_basic2(self): a1 = [3,4,5,10,-3,-5,6] a2 = [3,-6,-2,8,7,4,2,1] a3 = [3.,4,5,10,-3,-5,-6,7.0] - assert_equal(stats.median(a1),4) - assert_equal(stats.median(a2),2.5) - assert_equal(stats.median(a3),3.5) + assert_equal(np.median(a1),4) + assert_equal(np.median(a2),2.5) + assert_equal(np.median(a3),3.5) def test_axis(self): """Regression test for #760.""" a1 = np.array([[3,4,5], [10,-3,-5]]) - assert_equal(stats.median(a1), np.array([6.5, 0.5, 0.])) - assert_equal(stats.median(a1, axis=-1), np.array([4., -3])) + assert_equal(np.median(a1), 3.5) + assert_equal(np.median(a1, axis=0), np.array([6.5, 0.5, 0.])) + assert_equal(np.median(a1, axis=-1), np.array([4., -3])) class TestMode(TestCase): def test_basic(self): From scipy-svn at scipy.org Thu Jan 8 07:37:49 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 06:37:49 -0600 (CST) Subject: [Scipy-svn] r5395 - in trunk/scipy/stats: . tests Message-ID: <20090108123749.8F8B5C7C05E@scipy.org> Author: cdavid Date: 2009-01-08 06:37:43 -0600 (Thu, 08 Jan 2009) New Revision: 5395 Modified: trunk/scipy/stats/morestats.py trunk/scipy/stats/stats.py trunk/scipy/stats/tests/test_stats.py Log: Do not use stats.var anymore in stats. Modified: trunk/scipy/stats/morestats.py =================================================================== --- trunk/scipy/stats/morestats.py 2009-01-08 12:37:27 UTC (rev 5394) +++ trunk/scipy/stats/morestats.py 2009-01-08 12:37:43 UTC (rev 5395) @@ -667,7 +667,7 @@ ssq = zeros(k,'d') for j in range(k): Ni[j] = len(args[j]) - ssq[j] = stats.var(args[j]) + ssq[j] = np.var(args[j], ddof=1) Ntot = sum(Ni,axis=0) spsq = sum((Ni-1)*ssq,axis=0)/(1.0*(Ntot-k)) numer = (Ntot*1.0-k)*log(spsq) - sum((Ni-1.0)*log(ssq),axis=0) Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2009-01-08 12:37:27 UTC (rev 5394) +++ trunk/scipy/stats/stats.py 2009-01-08 12:37:43 UTC (rev 5395) @@ -1289,23 +1289,14 @@ array (i.e., N-1). Axis can equal None (ravel array first), or an integer (the axis over which to operate). """ - warnings.warn("""\ + raise DeprecationWarning("""\ scipy.stats.var is deprecated; please update your code to use numpy.var. Please note that: - numpy.var axis argument defaults to None, not 0 - numpy.var has a ddof argument to replace bias in a more general manner. scipy.stats.var(a, bias=True) can be replaced by numpy.var(x, axis=0, ddof=0), scipy.stats.var(a, bias=False) by var(x, axis=0, - ddof=1).""", DeprecationWarning) - a, axis = _chk_asarray(a, axis) - mn = np.expand_dims(np.mean(a,axis),axis) - deviations = a - mn - n = a.shape[axis] - vals = sum(abs(deviations)**2,axis)/(n-1.0) - if bias: - return vals * (n-1.0)/n - else: - return vals + ddof=1).""") def std(a, axis=0, bias=False): """ @@ -1320,8 +1311,7 @@ - numpy.std has a ddof argument to replace bias in a more general manner. scipy.stats.std(a, bias=True) can be replaced by numpy.std(x, axis=0, ddof=0), scipy.stats.std(a, bias=False) by numpy.std(x, axis=0, - ddof=1).""", DeprecationWarning) - return np.sqrt(var(a,axis,bias)) + ddof=1).""") def stderr(a, axis=0): Modified: trunk/scipy/stats/tests/test_stats.py =================================================================== --- trunk/scipy/stats/tests/test_stats.py 2009-01-08 12:37:27 UTC (rev 5394) +++ trunk/scipy/stats/tests/test_stats.py 2009-01-08 12:37:43 UTC (rev 5395) @@ -721,7 +721,9 @@ var(testcase) = 1.666666667 """ #y = stats.var(self.shoes[0]) #assert_approx_equal(y,6.009) - y = stats.var(self.testcase) + y = np.var(self.testcase) + assert_approx_equal(y,1.25) + y = np.var(self.testcase, ddof=1) assert_approx_equal(y,1.666666667) def test_samplevar(self): From scipy-svn at scipy.org Thu Jan 8 07:38:09 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 06:38:09 -0600 (CST) Subject: [Scipy-svn] r5396 - in trunk/scipy/stats: . tests Message-ID: <20090108123809.B605AC7C00C@scipy.org> Author: cdavid Date: 2009-01-08 06:38:03 -0600 (Thu, 08 Jan 2009) New Revision: 5396 Modified: trunk/scipy/stats/morestats.py trunk/scipy/stats/stats.py trunk/scipy/stats/tests/test_stats.py Log: Do not use scipy.stats.std anymore. Modified: trunk/scipy/stats/morestats.py =================================================================== --- trunk/scipy/stats/morestats.py 2009-01-08 12:37:43 UTC (rev 5395) +++ trunk/scipy/stats/morestats.py 2009-01-08 12:38:03 UTC (rev 5396) @@ -502,7 +502,7 @@ xbar = np.mean(x, axis=0) N = len(y) if dist == 'norm': - s = stats.std(x) + s = np.std(x, ddof=1, axis=0) w = (y-xbar)/s z = distributions.norm.cdf(w) sig = array([15,10,5,2.5,1]) @@ -520,7 +520,7 @@ val = [sum(1.0/(1+tmp2),axis=0)-0.5*N, sum(tmp*(1.0-tmp2)/(1+tmp2),axis=0)+N] return array(val) - sol0=array([xbar,stats.std(x)]) + sol0=array([xbar,np.std(x, ddof=1, axis=0)]) sol = optimize.fsolve(rootfunc,sol0,args=(x,N),xtol=1e-5) w = (y-sol[0])/sol[1] z = distributions.logistic.cdf(w) Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2009-01-08 12:37:43 UTC (rev 5395) +++ trunk/scipy/stats/stats.py 2009-01-08 12:38:03 UTC (rev 5396) @@ -1304,7 +1304,7 @@ the passed array (i.e., N-1). Axis can equal None (ravel array first), or an integer (the axis over which to operate). """ - warnings.warn("""\ + raise DeprecationWarning("""\ scipy.stats.std is deprecated; please update your code to use numpy.std. Please note that: - numpy.std axis argument defaults to None, not 0 @@ -1321,7 +1321,7 @@ first), or an integer (the axis over which to operate). """ a, axis = _chk_asarray(a, axis) - return std(a,axis) / float(np.sqrt(a.shape[axis])) + return np.std(a,axis,ddof=1) / float(np.sqrt(a.shape[axis])) def sem(a, axis=0): Modified: trunk/scipy/stats/tests/test_stats.py =================================================================== --- trunk/scipy/stats/tests/test_stats.py 2009-01-08 12:37:43 UTC (rev 5395) +++ trunk/scipy/stats/tests/test_stats.py 2009-01-08 12:38:03 UTC (rev 5396) @@ -109,7 +109,7 @@ assert_almost_equal(y, 5.0) def test_stdX(self): - y = stats.std(X) + y = np.std(X, ddof=1) assert_almost_equal(y, 2.738612788) def test_tmeanX(self): @@ -129,7 +129,7 @@ assert_almost_equal(y, 0.0) def test_stdZERO(self): - y = stats.std(ZERO) + y = np.std(ZERO, ddof=1) assert_almost_equal(y, 0.0) ## Really need to write these tests to handle missing values properly @@ -147,7 +147,7 @@ assert_almost_equal(y, 99999995.00) def test_stdBIG(self): - y = stats.std(BIG) + y = np.std(BIG, ddof=1) assert_almost_equal(y, 2.738612788) def test_meanLITTLE(self): @@ -155,7 +155,7 @@ assert_approx_equal(y, 0.999999950) def test_stdLITTLE(self): - y = stats.std(LITTLE) + y = np.std(LITTLE, ddof=1) assert_approx_equal(y, 2.738612788e-8) def test_meanHUGE(self): @@ -163,7 +163,7 @@ assert_approx_equal(y, 5.00000e+12) def test_stdHUGE(self): - y = stats.std(HUGE) + y = np.std(HUGE, ddof=1) assert_approx_equal(y, 2.738612788e12) def test_meanTINY(self): @@ -171,7 +171,7 @@ assert_almost_equal(y, 0.0) def test_stdTINY(self): - y = stats.std(TINY) + y = np.std(TINY, ddof=1) assert_almost_equal(y, 0.0) def test_meanROUND(self): @@ -179,7 +179,7 @@ assert_approx_equal(y, 4.500000000) def test_stdROUND(self): - y = stats.std(ROUND) + y = np.std(ROUND, ddof=1) assert_approx_equal(y, 2.738612788) class TestNanFunc(TestCase): @@ -213,12 +213,12 @@ def test_nanstd_none(self): """Check nanstd when no values are nan.""" s = stats.nanstd(self.X) - assert_approx_equal(s, stats.std(self.X)) + assert_approx_equal(s, np.std(self.X, ddof=1)) def test_nanstd_some(self): """Check nanstd when some values only are nan.""" s = stats.nanstd(self.Xsome) - assert_approx_equal(s, stats.std(self.Xsomet)) + assert_approx_equal(s, np.std(self.Xsomet, ddof=1)) def test_nanstd_all(self): """Check nanstd when all values are nan.""" @@ -655,8 +655,8 @@ def test_basic(self): a = [3,4,5,10,-3,-5,6] b = [3,4,5,10,-3,-5,-6] - assert_almost_equal(stats.std(a),5.2098807225172772,11) - assert_almost_equal(stats.std(b),5.9281411203561225,11) + assert_almost_equal(np.std(a, ddof=1),5.2098807225172772,11) + assert_almost_equal(np.std(b, ddof=1),5.9281411203561225,11) def test_2d(self): a = [[1.0, 2.0, 3.0], @@ -665,9 +665,8 @@ b1 = array((3.7859388972001824, 5.2915026221291814, 2.0816659994661335)) b2 = array((1.0,2.0,2.64575131106)) - assert_array_almost_equal(stats.std(a),b1,11) - assert_array_almost_equal(stats.std(a,axis=0),b1,11) - assert_array_almost_equal(stats.std(a,axis=1),b2,11) + assert_array_almost_equal(np.std(a,ddof=1,axis=0),b1,11) + assert_array_almost_equal(np.std(a,ddof=1,axis=1),b2,11) class TestCMedian(TestCase): @@ -713,7 +712,7 @@ """ testcase = [1,2,3,4] def test_std(self): - y = stats.std(self.testcase) + y = np.std(self.testcase, ddof=1) assert_approx_equal(y,1.290994449) def test_var(self): From scipy-svn at scipy.org Thu Jan 8 09:46:13 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 08:46:13 -0600 (CST) Subject: [Scipy-svn] r5397 - branches/0.7.x/scipy/weave Message-ID: <20090108144613.3CCB0C7C040@scipy.org> Author: cdavid Date: 2009-01-08 08:46:09 -0600 (Thu, 08 Jan 2009) New Revision: 5397 Modified: branches/0.7.x/scipy/weave/build_tools.py Log: get_devstudio_version is not available in python since at least 2.4 :). Modified: branches/0.7.x/scipy/weave/build_tools.py =================================================================== --- branches/0.7.x/scipy/weave/build_tools.py 2009-01-08 12:38:03 UTC (rev 5396) +++ branches/0.7.x/scipy/weave/build_tools.py 2009-01-08 14:46:09 UTC (rev 5397) @@ -372,7 +372,7 @@ except: #assume we're ok if devstudio exists import distutils.msvccompiler - version = distutils.msvccompiler.get_devstudio_version() + version = distutils.msvccompiler.get_build_version() if version: result = 1 return result From scipy-svn at scipy.org Thu Jan 8 09:52:45 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 08:52:45 -0600 (CST) Subject: [Scipy-svn] r5398 - branches/0.7.x/scipy/weave Message-ID: <20090108145245.B50C7C7C040@scipy.org> Author: cdavid Date: 2009-01-08 08:52:42 -0600 (Thu, 08 Jan 2009) New Revision: 5398 Modified: branches/0.7.x/scipy/weave/build_tools.py Log: Fix syntax error. Modified: branches/0.7.x/scipy/weave/build_tools.py =================================================================== --- branches/0.7.x/scipy/weave/build_tools.py 2009-01-08 14:46:09 UTC (rev 5397) +++ branches/0.7.x/scipy/weave/build_tools.py 2009-01-08 14:52:42 UTC (rev 5398) @@ -355,7 +355,7 @@ # the path variable. and will occasionlly mess things up # so much that gcc is lost in the path. (Occurs in test # scripts) - result = not os.system(cmd) + result = not os.system(" ".join(cmd)) return result def msvc_exists(): From scipy-svn at scipy.org Thu Jan 8 09:59:00 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 08:59:00 -0600 (CST) Subject: [Scipy-svn] r5399 - trunk/scipy/weave Message-ID: <20090108145900.E29C3C7C00C@scipy.org> Author: cdavid Date: 2009-01-08 08:58:57 -0600 (Thu, 08 Jan 2009) New Revision: 5399 Modified: trunk/scipy/weave/build_tools.py Log: Backport a couple of trivial fixes from 0.7.x (5397:5398). Modified: trunk/scipy/weave/build_tools.py =================================================================== --- trunk/scipy/weave/build_tools.py 2009-01-08 14:52:42 UTC (rev 5398) +++ trunk/scipy/weave/build_tools.py 2009-01-08 14:58:57 UTC (rev 5399) @@ -355,7 +355,7 @@ # the path variable. and will occasionlly mess things up # so much that gcc is lost in the path. (Occurs in test # scripts) - result = not os.system(cmd) + result = not os.system(" ".join(cmd)) return result def msvc_exists(): @@ -372,7 +372,7 @@ except: #assume we're ok if devstudio exists import distutils.msvccompiler - version = distutils.msvccompiler.get_devstudio_version() + version = distutils.msvccompiler.get_build_version() if version: result = 1 return result From scipy-svn at scipy.org Thu Jan 8 10:01:51 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 09:01:51 -0600 (CST) Subject: [Scipy-svn] r5400 - trunk/scipy/weave/blitz/blitz Message-ID: <20090108150151.E2CE5C7C00C@scipy.org> Author: stefan Date: 2009-01-08 09:01:34 -0600 (Thu, 08 Jan 2009) New Revision: 5400 Modified: trunk/scipy/weave/blitz/blitz/funcs.h trunk/scipy/weave/blitz/blitz/mathfunc.h Log: Include cstdio to provide `labs` to gcc 4.3. Modified: trunk/scipy/weave/blitz/blitz/funcs.h =================================================================== --- trunk/scipy/weave/blitz/blitz/funcs.h 2009-01-08 14:58:57 UTC (rev 5399) +++ trunk/scipy/weave/blitz/blitz/funcs.h 2009-01-08 15:01:34 UTC (rev 5400) @@ -25,10 +25,12 @@ #include #include +#include + BZ_NAMESPACE(blitz) - + /* Helper functions */ - + template inline T blitz_sqr(T x) { return x*x; } @@ -59,7 +61,7 @@ /* Unary functions that return same type as argument */ - + #define BZ_DEFINE_UNARY_FUNC(name,fun) \ template \ struct name { \ @@ -68,7 +70,7 @@ static inline T_numtype \ apply(T_numtype1 a) \ { return fun(a); } \ - \ + \ template \ static inline void prettyPrint(BZ_STD_SCOPE(string) &str, \ prettyPrintFormat& format, const T1& t1) \ @@ -114,13 +116,13 @@ BZ_DEFINE_UNARY_FUNC(Fn_y0,BZ_IEEEMATHFN_SCOPE(y0)) BZ_DEFINE_UNARY_FUNC(Fn_y1,BZ_IEEEMATHFN_SCOPE(y1)) #endif - + #ifdef BZ_HAVE_SYSTEM_V_MATH BZ_DEFINE_UNARY_FUNC(Fn__class,BZ_IEEEMATHFN_SCOPE(_class)) BZ_DEFINE_UNARY_FUNC(Fn_nearest,BZ_IEEEMATHFN_SCOPE(nearest)) BZ_DEFINE_UNARY_FUNC(Fn_rsqrt,BZ_IEEEMATHFN_SCOPE(rsqrt)) #endif - + BZ_DEFINE_UNARY_FUNC(Fn_sqr,BZ_BLITZ_SCOPE(blitz_sqr)) BZ_DEFINE_UNARY_FUNC(Fn_cube,BZ_BLITZ_SCOPE(blitz_cube)) BZ_DEFINE_UNARY_FUNC(Fn_pow4,BZ_BLITZ_SCOPE(blitz_pow4)) @@ -130,7 +132,7 @@ BZ_DEFINE_UNARY_FUNC(Fn_pow8,BZ_BLITZ_SCOPE(blitz_pow8)) /* Unary functions that return a specified type */ - + #define BZ_DEFINE_UNARY_FUNC_RET(name,fun,ret) \ template \ struct name { \ @@ -139,7 +141,7 @@ static inline T_numtype \ apply(T_numtype1 a) \ { return fun(a); } \ - \ + \ template \ static inline void prettyPrint(BZ_STD_SCOPE(string) &str, \ prettyPrintFormat& format, const T1& t1) \ @@ -154,16 +156,16 @@ #ifdef BZ_HAVE_IEEE_MATH BZ_DEFINE_UNARY_FUNC_RET(Fn_ilogb,BZ_IEEEMATHFN_SCOPE(ilogb),int) #endif - + #ifdef BZ_HAVE_SYSTEM_V_MATH BZ_DEFINE_UNARY_FUNC_RET(Fn_itrunc,BZ_IEEEMATHFN_SCOPE(itrunc),int) BZ_DEFINE_UNARY_FUNC_RET(Fn_uitrunc,BZ_IEEEMATHFN_SCOPE(uitrunc),unsigned int) #endif - - + + #ifdef BZ_HAVE_COMPLEX /* Specialization of unary functor for complex type */ - + #define BZ_DEFINE_UNARY_CFUNC(name,fun) \ template \ struct name< complex > { \ @@ -173,7 +175,7 @@ static inline T_numtype \ apply(T_numtype1 a) \ { return fun(a); } \ - \ + \ template \ static inline void prettyPrint(BZ_STD_SCOPE(string) &str, \ prettyPrintFormat& format, const T1& t1) \ @@ -211,7 +213,7 @@ BZ_DEFINE_UNARY_CFUNC(Fn_pow8,BZ_BLITZ_SCOPE(blitz_pow8)) /* Unary functions that apply only to complex and return T */ - + #define BZ_DEFINE_UNARY_CFUNC2(name,fun) \ template \ struct name; \ @@ -224,7 +226,7 @@ static inline T_numtype \ apply(T_numtype1 a) \ { return fun(a); } \ - \ + \ template \ static inline void prettyPrint(BZ_STD_SCOPE(string) &str, \ prettyPrintFormat& format, const T1& t1) \ @@ -242,11 +244,11 @@ BZ_DEFINE_UNARY_CFUNC2(Fn_norm,BZ_CMATHFN_SCOPE(norm)) BZ_DEFINE_UNARY_CFUNC2(Fn_real,BZ_CMATHFN_SCOPE(real)) #endif // BZ_HAVE_COMPLEX_FCNS - + #endif // BZ_HAVE_COMPLEX - + /* Binary functions that return type based on type promotion */ - + #define BZ_DEFINE_BINARY_FUNC(name,fun) \ template \ struct name { \ @@ -255,7 +257,7 @@ static inline T_numtype \ apply(T_numtype1 a, T_numtype2 b) \ { return fun(a,b); } \ - \ + \ template \ static inline void prettyPrint(BZ_STD_SCOPE(string) &str, \ prettyPrintFormat& format, const T1& t1, \ @@ -273,7 +275,7 @@ BZ_DEFINE_BINARY_FUNC(Fn_atan2,BZ_MATHFN_SCOPE(atan2)) BZ_DEFINE_BINARY_FUNC(Fn_fmod,BZ_MATHFN_SCOPE(fmod)) BZ_DEFINE_BINARY_FUNC(Fn_pow,BZ_MATHFN_SCOPE(pow)) - + #ifdef BZ_HAVE_SYSTEM_V_MATH BZ_DEFINE_BINARY_FUNC(Fn_copysign,BZ_IEEEMATHFN_SCOPE(copysign)) BZ_DEFINE_BINARY_FUNC(Fn_drem,BZ_IEEEMATHFN_SCOPE(drem)) @@ -282,9 +284,9 @@ BZ_DEFINE_BINARY_FUNC(Fn_remainder,BZ_IEEEMATHFN_SCOPE(remainder)) BZ_DEFINE_BINARY_FUNC(Fn_scalb,BZ_IEEEMATHFN_SCOPE(scalb)) #endif - + /* Binary functions that return a specified type */ - + #define BZ_DEFINE_BINARY_FUNC_RET(name,fun,ret) \ template \ struct name { \ @@ -293,7 +295,7 @@ static inline T_numtype \ apply(T_numtype1 a, T_numtype2 b) \ { return fun(a,b); } \ - \ + \ template \ static inline void prettyPrint(BZ_STD_SCOPE(string) &str, \ prettyPrintFormat& format, const T1& t1, \ @@ -311,10 +313,10 @@ #ifdef BZ_HAVE_SYSTEM_V_MATH BZ_DEFINE_BINARY_FUNC_RET(Fn_unordered,BZ_IEEEMATHFN_SCOPE(unordered),int) #endif - + #ifdef BZ_HAVE_COMPLEX /* Specialization of binary functor for complex type */ - + #define BZ_DEFINE_BINARY_CFUNC(name,fun) \ template \ struct name< complex, complex > { \ @@ -325,7 +327,7 @@ static inline T_numtype \ apply(T_numtype1 a, T_numtype2 b) \ { return fun(a,b); } \ - \ + \ template \ static inline void prettyPrint(BZ_STD_SCOPE(string) &str, \ prettyPrintFormat& format, const T1& t1, \ @@ -349,7 +351,7 @@ static inline T_numtype \ apply(T_numtype1 a, T_numtype2 b) \ { return fun(a,b); } \ - \ + \ template \ static inline void prettyPrint(BZ_STD_SCOPE(string) &str, \ prettyPrintFormat& format, const T1& t1, \ @@ -373,7 +375,7 @@ static inline T_numtype \ apply(T_numtype1 a, T_numtype2 b) \ { return fun(a,b); } \ - \ + \ template \ static inline void prettyPrint(BZ_STD_SCOPE(string) &str, \ prettyPrintFormat& format, const T1& t1, \ @@ -393,7 +395,7 @@ #endif /* Binary functions that apply only to T and return complex */ - + #define BZ_DEFINE_BINARY_FUNC_CRET(name,fun) \ template \ struct name; \ @@ -407,7 +409,7 @@ static inline T_numtype \ apply(T_numtype1 a, T_numtype2 b) \ { return fun(a,b); } \ - \ + \ template \ static inline void prettyPrint(BZ_STD_SCOPE(string) &str, \ prettyPrintFormat& format, const T1& t1, \ @@ -425,11 +427,11 @@ #ifdef BZ_HAVE_COMPLEX_FCNS BZ_DEFINE_BINARY_FUNC_CRET(Fn_polar,BZ_CMATHFN_SCOPE(polar)) #endif - + #endif // BZ_HAVE_COMPLEX - + /* Ternary functions that return type based on type promotion */ - + #define BZ_DEFINE_TERNARY_FUNC(name,fun) \ template \ @@ -458,7 +460,7 @@ }; /* Ternary functions that return a specified type */ - + #define BZ_DEFINE_TERNARY_FUNC_RET(name,fun,ret) \ template \ @@ -485,9 +487,9 @@ } \ }; - + /* These functions don't quite fit the usual patterns */ - + // abs() Absolute value template struct Fn_abs; @@ -497,11 +499,11 @@ struct Fn_abs< int > { typedef int T_numtype1; typedef int T_numtype; - + static inline T_numtype apply(T_numtype1 a) { return BZ_MATHFN_SCOPE(abs)(a); } - + template static inline void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& t1) @@ -518,11 +520,11 @@ struct Fn_abs< long int > { typedef long int T_numtype1; typedef long int T_numtype; - + static inline T_numtype apply(T_numtype1 a) { return BZ_MATHFN_SCOPE(labs)(a); } - + template static inline void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& t1) @@ -539,11 +541,11 @@ struct Fn_abs< float > { typedef float T_numtype1; typedef float T_numtype; - + static inline T_numtype apply(T_numtype1 a) { return BZ_MATHFN_SCOPE(fabs)(a); } - + template static inline void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& t1) @@ -560,11 +562,11 @@ struct Fn_abs< double > { typedef double T_numtype1; typedef double T_numtype; - + static inline T_numtype apply(T_numtype1 a) { return BZ_MATHFN_SCOPE(fabs)(a); } - + template static inline void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& t1) @@ -581,11 +583,11 @@ struct Fn_abs< long double > { typedef long double T_numtype1; typedef long double T_numtype; - + static inline T_numtype apply(T_numtype1 a) { return BZ_MATHFN_SCOPE(fabs)(a); } - + template static inline void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& t1) @@ -603,11 +605,11 @@ struct Fn_abs< complex > { typedef complex T_numtype1; typedef T T_numtype; - + static inline T_numtype apply(T_numtype1 a) { return BZ_CMATHFN_SCOPE(abs)(a); } - + template static inline void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& t1) @@ -626,7 +628,7 @@ template struct Fn_isnan { typedef int T_numtype; - + static inline T_numtype apply(T_numtype1 a) { @@ -636,7 +638,7 @@ return BZ_IEEEMATHFN_SCOPE(isnan)(a); #endif } - + template static inline void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& t1) @@ -654,7 +656,7 @@ template struct Cast { typedef T_cast T_numtype; - + static inline T_numtype apply(T_numtype1 a) { return T_numtype(a); } Modified: trunk/scipy/weave/blitz/blitz/mathfunc.h =================================================================== --- trunk/scipy/weave/blitz/blitz/mathfunc.h 2009-01-08 14:58:57 UTC (rev 5399) +++ trunk/scipy/weave/blitz/blitz/mathfunc.h 2009-01-08 15:01:34 UTC (rev 5400) @@ -12,6 +12,8 @@ #include #endif +#include + BZ_NAMESPACE(blitz) // abs(P_numtype1) Absolute value From scipy-svn at scipy.org Thu Jan 8 10:02:55 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 09:02:55 -0600 (CST) Subject: [Scipy-svn] r5401 - in trunk/scipy/weave: . tests Message-ID: <20090108150255.02421C7C00C@scipy.org> Author: stefan Date: 2009-01-08 09:02:29 -0600 (Thu, 08 Jan 2009) New Revision: 5401 Added: trunk/scipy/weave/vtk_spec.py Modified: trunk/scipy/weave/c_spec.py trunk/scipy/weave/converters.py trunk/scipy/weave/ext_tools.py trunk/scipy/weave/tests/test_c_spec.py Log: Fix gcc 4.3 warnings in weave. Modified: trunk/scipy/weave/c_spec.py =================================================================== --- trunk/scipy/weave/c_spec.py 2009-01-08 15:01:34 UTC (rev 5400) +++ trunk/scipy/weave/c_spec.py 2009-01-08 15:02:29 UTC (rev 5401) @@ -266,9 +266,12 @@ def c_to_py_code(self): # !! Need to dedent returned code. code = """ - PyObject* file_to_py(FILE* file, char* name, char* mode) + PyObject* file_to_py(FILE* file, const char* name, + const char* mode) { - return (PyObject*) PyFile_FromFile(file, name, mode, fclose); + return (PyObject*) PyFile_FromFile(file, + const_cast(name), + const_cast(mode), fclose); } """ return code Modified: trunk/scipy/weave/converters.py =================================================================== --- trunk/scipy/weave/converters.py 2009-01-08 15:01:34 UTC (rev 5400) +++ trunk/scipy/weave/converters.py 2009-01-08 15:02:29 UTC (rev 5401) @@ -41,6 +41,16 @@ pass #---------------------------------------------------------------------------- +# Add VTK support +#---------------------------------------------------------------------------- + +try: + import vtk_spec + default.insert(0,vtk_spec.vtk_converter()) +except IndexError: + pass + +#---------------------------------------------------------------------------- # Add "sentinal" catchall converter # # if everything else fails, this one is the last hope (it always works) Modified: trunk/scipy/weave/ext_tools.py =================================================================== --- trunk/scipy/weave/ext_tools.py 2009-01-08 15:01:34 UTC (rev 5400) +++ trunk/scipy/weave/ext_tools.py 2009-01-08 15:02:29 UTC (rev 5401) @@ -47,7 +47,8 @@ arg_string_list = self.arg_specs.variable_as_strings() + ['"local_dict"'] arg_strings = ','.join(arg_string_list) if arg_strings: arg_strings += ',' - declare_kwlist = 'static char *kwlist[] = {%s NULL};\n' % arg_strings + declare_kwlist = 'static const char *kwlist[] = {%s NULL};\n' % \ + arg_strings py_objects = ', '.join(self.arg_specs.py_pointers()) init_flags = ', '.join(self.arg_specs.init_flags()) @@ -74,7 +75,8 @@ format = "O"* len(self.arg_specs) + "|O" + ':' + self.name parse_tuple = 'if(!PyArg_ParseTupleAndKeywords(args,' \ - 'kywds,"%s",kwlist,%s))\n' % (format,ref_string) + 'kywds,"%s",const_cast(kwlist),%s))\n' % \ + (format,ref_string) parse_tuple += ' return NULL;\n' return declare_return + declare_kwlist + declare_py_objects \ Modified: trunk/scipy/weave/tests/test_c_spec.py =================================================================== --- trunk/scipy/weave/tests/test_c_spec.py 2009-01-08 15:01:34 UTC (rev 5400) +++ trunk/scipy/weave/tests/test_c_spec.py 2009-01-08 15:02:29 UTC (rev 5401) @@ -254,9 +254,9 @@ # not sure I like Py::String as default -- might move to std::sting # or just plain char* code = """ - char* _file_name = (char*) file_name.c_str(); - FILE* file = fopen(_file_name,"w"); - return_val = file_to_py(file,_file_name,"w"); + const char* _file_name = file_name.c_str(); + FILE* file = fopen(_file_name, "w"); + return_val = file_to_py(file, _file_name, "w"); """ file = inline_tools.inline(code,['file_name'], compiler=self.compiler, force=1) Added: trunk/scipy/weave/vtk_spec.py =================================================================== --- trunk/scipy/weave/vtk_spec.py 2009-01-08 15:01:34 UTC (rev 5400) +++ trunk/scipy/weave/vtk_spec.py 2009-01-08 15:02:29 UTC (rev 5401) @@ -0,0 +1,129 @@ +""" +VTK type converter. + +This module handles conversion between VTK C++ and VTK Python objects +so that one can write inline C++ code to manipulate VTK Python +objects. It requires that you have VTK and the VTK-Python wrappers +installed. It has been tested with VTK 4.0 and above. You will need +to call inline with include_dirs, library_dirs and often even +libraries appropriately set for this to work without errors. +Sometimes you might need to include additional headers. + +Distributed under the SciPy License. + +Authors: + Prabhu Ramachandran + Eric Jones +""" + +from c_spec import common_base_converter + + +vtk_py_to_c_template = \ +""" +class %(type_name)s_handler +{ +public: + %(c_type)s convert_to_%(type_name)s(PyObject* py_obj, const char* name) + { + %(c_type)s vtk_ptr = (%(c_type)s) vtkPythonGetPointerFromObject(py_obj, "%(type_name)s"); + if (!vtk_ptr) + handle_conversion_error(py_obj,"%(type_name)s", name); + %(inc_ref_count)s + return vtk_ptr; + } + + %(c_type)s py_to_%(type_name)s(PyObject* py_obj, const char* name) + { + %(c_type)s vtk_ptr = (%(c_type)s) vtkPythonGetPointerFromObject(py_obj, "%(type_name)s"); + if (!vtk_ptr) + handle_bad_type(py_obj,"%(type_name)s", name); + %(inc_ref_count)s + return vtk_ptr; + } +}; + +%(type_name)s_handler x__%(type_name)s_handler = %(type_name)s_handler(); +#define convert_to_%(type_name)s(py_obj,name) \\ + x__%(type_name)s_handler.convert_to_%(type_name)s(py_obj,name) +#define py_to_%(type_name)s(py_obj,name) \\ + x__%(type_name)s_handler.py_to_%(type_name)s(py_obj,name) + +""" + +vtk_c_to_py_template = \ +""" +PyObject* %(type_name)s_to_py(vtkObjectBase* obj) +{ + return vtkPythonGetObjectFromPointer(obj); +} +""" + + +class vtk_converter(common_base_converter): + def __init__(self,class_name="undefined"): + self.class_name = class_name + common_base_converter.__init__(self) + + def init_info(self): + common_base_converter.init_info(self) + # These are generated on the fly instead of defined at + # the class level. + self.type_name = self.class_name + self.c_type = self.class_name + "*" + self.return_type = self.c_type + self.to_c_return = None # not used + self.check_func = None # not used + hdr = self.class_name + ".h" + # Remember that you need both the quotes! + self.headers.extend(['"vtkPythonUtil.h"', '"vtkObject.h"', + '"%s"'%hdr]) + #self.include_dirs.extend(vtk_inc) + #self.define_macros.append(('SOME_VARIABLE', '1')) + #self.library_dirs.extend(vtk_lib) + self.libraries.extend(['vtkCommonPython', 'vtkCommon']) + #self.support_code.append(common_info.swig_support_code) + + def type_match(self,value): + is_match = 0 + try: + if value.IsA('vtkObject'): + is_match = 1 + except AttributeError: + pass + return is_match + + def generate_build_info(self): + if self.class_name != "undefined": + res = common_base_converter.generate_build_info(self) + else: + # if there isn't a class_name, we don't want the + # we don't want the support_code to be included + import base_info + res = base_info.base_info() + return res + + def py_to_c_code(self): + return vtk_py_to_c_template % self.template_vars() + + def c_to_py_code(self): + return vtk_c_to_py_template % self.template_vars() + + def type_spec(self,name,value): + # factory + class_name = value.__class__.__name__ + new_spec = self.__class__(class_name) + new_spec.name = name + return new_spec + + def __cmp__(self,other): + #only works for equal + res = -1 + try: + res = cmp(self.name,other.name) or \ + cmp(self.__class__, other.__class__) or \ + cmp(self.class_name, other.class_name) or \ + cmp(self.type_name,other.type_name) + except: + pass + return res From scipy-svn at scipy.org Thu Jan 8 10:14:01 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 09:14:01 -0600 (CST) Subject: [Scipy-svn] r5402 - trunk/scipy/weave/tests Message-ID: <20090108151401.A9575C7C00C@scipy.org> Author: stefan Date: 2009-01-08 09:13:46 -0600 (Thu, 08 Jan 2009) New Revision: 5402 Modified: trunk/scipy/weave/tests/test_inline_tools.py Log: Disable weave tests that cause compilation failure, since this causes distutils to do a SystemExit, which break the test suite. Modified: trunk/scipy/weave/tests/test_inline_tools.py =================================================================== --- trunk/scipy/weave/tests/test_inline_tools.py 2009-01-08 15:02:29 UTC (rev 5401) +++ trunk/scipy/weave/tests/test_inline_tools.py 2009-01-08 15:13:46 UTC (rev 5402) @@ -21,21 +21,25 @@ result = inline_tools.inline(code,['a']) assert(result == 4) - try: - a = 1 - result = inline_tools.inline(code,['a']) - assert(1) # should've thrown a ValueError - except ValueError: - pass +## Unfortunately, it is not always possible to catch distutils compiler +## errors, since SystemExit is used. Until that is fixed, these tests +## cannot be run in the same process as the test suite. - from distutils.errors import DistutilsError, CompileError - try: - a = 'string' - result = inline_tools.inline(code,['a']) - assert(1) # should've gotten an error - except: - # ?CompileError is the error reported, but catching it doesn't work - pass +## try: +## a = 1 +## result = inline_tools.inline(code,['a']) +## assert(1) # should've thrown a ValueError +## except ValueError: +## pass +## from distutils.errors import DistutilsError, CompileError +## try: +## a = 'string' +## result = inline_tools.inline(code,['a']) +## assert(1) # should've gotten an error +## except: +## # ?CompileError is the error reported, but catching it doesn't work +## pass + if __name__ == "__main__": nose.run(argv=['', __file__]) From scipy-svn at scipy.org Thu Jan 8 10:26:04 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 09:26:04 -0600 (CST) Subject: [Scipy-svn] r5403 - trunk/scipy/weave/scxx Message-ID: <20090108152604.43632C7C00C@scipy.org> Author: stefan Date: 2009-01-08 09:25:50 -0600 (Thu, 08 Jan 2009) New Revision: 5403 Modified: trunk/scipy/weave/scxx/sequence.h Log: Use static strings to avoid warnings under gcc 4.3. Modified: trunk/scipy/weave/scxx/sequence.h =================================================================== --- trunk/scipy/weave/scxx/sequence.h 2009-01-08 15:13:46 UTC (rev 5402) +++ trunk/scipy/weave/scxx/sequence.h 2009-01-08 15:25:50 UTC (rev 5403) @@ -90,11 +90,11 @@ object val = value; return count(val); }; - int count(char* value) const { + int count(const char* value) const { object val = value; return count(val); }; - int count(std::string& value) const { + int count(const std::string& value) const { object val = value.c_str(); return count(val); }; From scipy-svn at scipy.org Thu Jan 8 12:48:03 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 11:48:03 -0600 (CST) Subject: [Scipy-svn] r5404 - trunk/scipy/weave Message-ID: <20090108174803.DA8C0C7C009@scipy.org> Author: cdavid Date: 2009-01-08 11:47:52 -0600 (Thu, 08 Jan 2009) New Revision: 5404 Modified: trunk/scipy/weave/build_tools.py Log: Fix msvc detection in weave. Modified: trunk/scipy/weave/build_tools.py =================================================================== --- trunk/scipy/weave/build_tools.py 2009-01-08 15:25:50 UTC (rev 5403) +++ trunk/scipy/weave/build_tools.py 2009-01-08 17:47:52 UTC (rev 5404) @@ -372,9 +372,11 @@ except: #assume we're ok if devstudio exists import distutils.msvccompiler - version = distutils.msvccompiler.get_build_version() - if version: + try: + distutils.msvccompiler.MSVCCompiler().initialize result = 1 + except distutils.errors.DistutilsPlatformError: + pass return result if os.name == 'nt': From scipy-svn at scipy.org Thu Jan 8 13:17:59 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 12:17:59 -0600 (CST) Subject: [Scipy-svn] r5405 - branches/0.7.x/scipy/weave Message-ID: <20090108181759.8A208C7C00C@scipy.org> Author: cdavid Date: 2009-01-08 12:17:51 -0600 (Thu, 08 Jan 2009) New Revision: 5405 Modified: branches/0.7.x/scipy/weave/build_tools.py Log: Detecting MS compiler is not enough; distutils cannot tell us if it can be run at all, so we try to run it by ourselves to see if that works. Modified: branches/0.7.x/scipy/weave/build_tools.py =================================================================== --- branches/0.7.x/scipy/weave/build_tools.py 2009-01-08 17:47:52 UTC (rev 5404) +++ branches/0.7.x/scipy/weave/build_tools.py 2009-01-08 18:17:51 UTC (rev 5405) @@ -372,9 +372,15 @@ except: #assume we're ok if devstudio exists import distutils.msvccompiler - version = distutils.msvccompiler.get_build_version() - if version: + try: + cc = distutils.msvccompiler.MSVCCompiler() + cc.initialize() + p = subprocess.Popen([cc.cc]) result = 1 + except distutils.errors.DistutilsPlatformError: + pass + except WindowsError: + pass return result if os.name == 'nt': From scipy-svn at scipy.org Thu Jan 8 13:21:14 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 12:21:14 -0600 (CST) Subject: [Scipy-svn] r5406 - trunk/scipy/weave Message-ID: <20090108182114.7FBD0C7C00C@scipy.org> Author: cdavid Date: 2009-01-08 12:21:08 -0600 (Thu, 08 Jan 2009) New Revision: 5406 Modified: trunk/scipy/weave/build_tools.py Log: Merge back fixed weave problem when VS 2003 is installed. Modified: trunk/scipy/weave/build_tools.py =================================================================== --- trunk/scipy/weave/build_tools.py 2009-01-08 18:17:51 UTC (rev 5405) +++ trunk/scipy/weave/build_tools.py 2009-01-08 18:21:08 UTC (rev 5406) @@ -373,10 +373,14 @@ #assume we're ok if devstudio exists import distutils.msvccompiler try: - distutils.msvccompiler.MSVCCompiler().initialize + cc = distutils.msvccompiler.MSVCCompiler() + cc.initialize() + p = subprocess.Popen([cc.cc]) result = 1 except distutils.errors.DistutilsPlatformError: pass + except WindowsError: + pass return result if os.name == 'nt': From scipy-svn at scipy.org Thu Jan 8 14:49:19 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 13:49:19 -0600 (CST) Subject: [Scipy-svn] r5407 - branches/0.7.x/scipy/weave Message-ID: <20090108194919.0AD16C7C009@scipy.org> Author: jarrod.millman Date: 2009-01-08 13:49:18 -0600 (Thu, 08 Jan 2009) New Revision: 5407 Added: branches/0.7.x/scipy/weave/vtk_spec.py Modified: branches/0.7.x/scipy/weave/converters.py Log: adding back vtk weave support per Prabhu's request Modified: branches/0.7.x/scipy/weave/converters.py =================================================================== --- branches/0.7.x/scipy/weave/converters.py 2009-01-08 18:21:08 UTC (rev 5406) +++ branches/0.7.x/scipy/weave/converters.py 2009-01-08 19:49:18 UTC (rev 5407) @@ -41,6 +41,16 @@ pass #---------------------------------------------------------------------------- +# Add VTK support +#---------------------------------------------------------------------------- + +try: + import vtk_spec + default.insert(0,vtk_spec.vtk_converter()) +except IndexError: + pass + +#---------------------------------------------------------------------------- # Add "sentinal" catchall converter # # if everything else fails, this one is the last hope (it always works) Added: branches/0.7.x/scipy/weave/vtk_spec.py =================================================================== --- branches/0.7.x/scipy/weave/vtk_spec.py 2009-01-08 18:21:08 UTC (rev 5406) +++ branches/0.7.x/scipy/weave/vtk_spec.py 2009-01-08 19:49:18 UTC (rev 5407) @@ -0,0 +1,129 @@ +""" +VTK type converter. + +This module handles conversion between VTK C++ and VTK Python objects +so that one can write inline C++ code to manipulate VTK Python +objects. It requires that you have VTK and the VTK-Python wrappers +installed. It has been tested with VTK 4.0 and above. You will need +to call inline with include_dirs, library_dirs and often even +libraries appropriately set for this to work without errors. +Sometimes you might need to include additional headers. + +Distributed under the SciPy License. + +Authors: + Prabhu Ramachandran + Eric Jones +""" + +from c_spec import common_base_converter + + +vtk_py_to_c_template = \ +""" +class %(type_name)s_handler +{ +public: + %(c_type)s convert_to_%(type_name)s(PyObject* py_obj, const char* name) + { + %(c_type)s vtk_ptr = (%(c_type)s) vtkPythonGetPointerFromObject(py_obj, "%(type_name)s"); + if (!vtk_ptr) + handle_conversion_error(py_obj,"%(type_name)s", name); + %(inc_ref_count)s + return vtk_ptr; + } + + %(c_type)s py_to_%(type_name)s(PyObject* py_obj, const char* name) + { + %(c_type)s vtk_ptr = (%(c_type)s) vtkPythonGetPointerFromObject(py_obj, "%(type_name)s"); + if (!vtk_ptr) + handle_bad_type(py_obj,"%(type_name)s", name); + %(inc_ref_count)s + return vtk_ptr; + } +}; + +%(type_name)s_handler x__%(type_name)s_handler = %(type_name)s_handler(); +#define convert_to_%(type_name)s(py_obj,name) \\ + x__%(type_name)s_handler.convert_to_%(type_name)s(py_obj,name) +#define py_to_%(type_name)s(py_obj,name) \\ + x__%(type_name)s_handler.py_to_%(type_name)s(py_obj,name) + +""" + +vtk_c_to_py_template = \ +""" +PyObject* %(type_name)s_to_py(vtkObjectBase* obj) +{ + return vtkPythonGetObjectFromPointer(obj); +} +""" + + +class vtk_converter(common_base_converter): + def __init__(self,class_name="undefined"): + self.class_name = class_name + common_base_converter.__init__(self) + + def init_info(self): + common_base_converter.init_info(self) + # These are generated on the fly instead of defined at + # the class level. + self.type_name = self.class_name + self.c_type = self.class_name + "*" + self.return_type = self.c_type + self.to_c_return = None # not used + self.check_func = None # not used + hdr = self.class_name + ".h" + # Remember that you need both the quotes! + self.headers.extend(['"vtkPythonUtil.h"', '"vtkObject.h"', + '"%s"'%hdr]) + #self.include_dirs.extend(vtk_inc) + #self.define_macros.append(('SOME_VARIABLE', '1')) + #self.library_dirs.extend(vtk_lib) + self.libraries.extend(['vtkCommonPython', 'vtkCommon']) + #self.support_code.append(common_info.swig_support_code) + + def type_match(self,value): + is_match = 0 + try: + if value.IsA('vtkObject'): + is_match = 1 + except AttributeError: + pass + return is_match + + def generate_build_info(self): + if self.class_name != "undefined": + res = common_base_converter.generate_build_info(self) + else: + # if there isn't a class_name, we don't want the + # we don't want the support_code to be included + import base_info + res = base_info.base_info() + return res + + def py_to_c_code(self): + return vtk_py_to_c_template % self.template_vars() + + def c_to_py_code(self): + return vtk_c_to_py_template % self.template_vars() + + def type_spec(self,name,value): + # factory + class_name = value.__class__.__name__ + new_spec = self.__class__(class_name) + new_spec.name = name + return new_spec + + def __cmp__(self,other): + #only works for equal + res = -1 + try: + res = cmp(self.name,other.name) or \ + cmp(self.__class__, other.__class__) or \ + cmp(self.class_name, other.class_name) or \ + cmp(self.type_name,other.type_name) + except: + pass + return res From scipy-svn at scipy.org Thu Jan 8 14:54:42 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 13:54:42 -0600 (CST) Subject: [Scipy-svn] r5408 - branches/0.7.x/scipy/weave/tests Message-ID: <20090108195442.0BC58C7C009@scipy.org> Author: jarrod.millman Date: 2009-01-08 13:54:42 -0600 (Thu, 08 Jan 2009) New Revision: 5408 Modified: branches/0.7.x/scipy/weave/tests/test_scxx_object.py Log: Backport r5385 Modified: branches/0.7.x/scipy/weave/tests/test_scxx_object.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_scxx_object.py 2009-01-08 19:49:18 UTC (rev 5407) +++ branches/0.7.x/scipy/weave/tests/test_scxx_object.py 2009-01-08 19:54:42 UTC (rev 5408) @@ -77,14 +77,6 @@ # Check the object print protocol. #------------------------------------------------------------------------ @dec.slow - def test_stdout(self): - code = """ - py::object val = "how now brown cow"; - val.print(stdout); - """ - res = inline_tools.inline(code) - # visual check on this one. - @dec.slow def test_stringio(self): import cStringIO file_imposter = cStringIO.StringIO() From scipy-svn at scipy.org Thu Jan 8 21:15:56 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 20:15:56 -0600 (CST) Subject: [Scipy-svn] r5409 - trunk Message-ID: <20090109021556.5C788C7C009@scipy.org> Author: jarrod.millman Date: 2009-01-08 20:15:55 -0600 (Thu, 08 Jan 2009) New Revision: 5409 Modified: trunk/LICENSE.txt Log: updated license file Modified: trunk/LICENSE.txt =================================================================== --- trunk/LICENSE.txt 2009-01-08 19:54:42 UTC (rev 5408) +++ trunk/LICENSE.txt 2009-01-09 02:15:55 UTC (rev 5409) @@ -1,5 +1,7 @@ Copyright (c) 2001, 2002 Enthought, Inc. +All rights reserved. +Copyright (c) 2003-2009 SciPy Developers. All rights reserved. Redistribution and use in source and binary forms, with or without From scipy-svn at scipy.org Thu Jan 8 21:17:31 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 8 Jan 2009 20:17:31 -0600 (CST) Subject: [Scipy-svn] r5410 - branches/0.7.x Message-ID: <20090109021731.6EAC3C7C009@scipy.org> Author: jarrod.millman Date: 2009-01-08 20:17:30 -0600 (Thu, 08 Jan 2009) New Revision: 5410 Modified: branches/0.7.x/LICENSE.txt Log: Backport r5409 Modified: branches/0.7.x/LICENSE.txt =================================================================== --- branches/0.7.x/LICENSE.txt 2009-01-09 02:15:55 UTC (rev 5409) +++ branches/0.7.x/LICENSE.txt 2009-01-09 02:17:30 UTC (rev 5410) @@ -1,5 +1,7 @@ Copyright (c) 2001, 2002 Enthought, Inc. +All rights reserved. +Copyright (c) 2003-2009 SciPy Developers. All rights reserved. Redistribution and use in source and binary forms, with or without From scipy-svn at scipy.org Fri Jan 9 05:15:59 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 9 Jan 2009 04:15:59 -0600 (CST) Subject: [Scipy-svn] r5411 - branches/0.7.x/scipy/weave Message-ID: <20090109101559.DF0D1C7C009@scipy.org> Author: cdavid Date: 2009-01-09 04:15:55 -0600 (Fri, 09 Jan 2009) New Revision: 5411 Modified: branches/0.7.x/scipy/weave/build_tools.py Log: Fix indentation. Modified: branches/0.7.x/scipy/weave/build_tools.py =================================================================== --- branches/0.7.x/scipy/weave/build_tools.py 2009-01-09 02:17:30 UTC (rev 5410) +++ branches/0.7.x/scipy/weave/build_tools.py 2009-01-09 10:15:55 UTC (rev 5411) @@ -374,7 +374,7 @@ import distutils.msvccompiler try: cc = distutils.msvccompiler.MSVCCompiler() - cc.initialize() + cc.initialize() p = subprocess.Popen([cc.cc]) result = 1 except distutils.errors.DistutilsPlatformError: From scipy-svn at scipy.org Fri Jan 9 05:46:23 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 9 Jan 2009 04:46:23 -0600 (CST) Subject: [Scipy-svn] r5412 - branches/0.7.x/scipy/weave/tests Message-ID: <20090109104623.2317BC7C009@scipy.org> Author: cdavid Date: 2009-01-09 04:46:20 -0600 (Fri, 09 Jan 2009) New Revision: 5412 Modified: branches/0.7.x/scipy/weave/tests/test_inline_tools.py Log: Backport 5402. Modified: branches/0.7.x/scipy/weave/tests/test_inline_tools.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_inline_tools.py 2009-01-09 10:15:55 UTC (rev 5411) +++ branches/0.7.x/scipy/weave/tests/test_inline_tools.py 2009-01-09 10:46:20 UTC (rev 5412) @@ -21,21 +21,25 @@ result = inline_tools.inline(code,['a']) assert(result == 4) - try: - a = 1 - result = inline_tools.inline(code,['a']) - assert(1) # should've thrown a ValueError - except ValueError: - pass +## Unfortunately, it is not always possible to catch distutils compiler +## errors, since SystemExit is used. Until that is fixed, these tests +## cannot be run in the same process as the test suite. - from distutils.errors import DistutilsError, CompileError - try: - a = 'string' - result = inline_tools.inline(code,['a']) - assert(1) # should've gotten an error - except: - # ?CompileError is the error reported, but catching it doesn't work - pass +## try: +## a = 1 +## result = inline_tools.inline(code,['a']) +## assert(1) # should've thrown a ValueError +## except ValueError: +## pass +## from distutils.errors import DistutilsError, CompileError +## try: +## a = 'string' +## result = inline_tools.inline(code,['a']) +## assert(1) # should've gotten an error +## except: +## # ?CompileError is the error reported, but catching it doesn't work +## pass + if __name__ == "__main__": nose.run(argv=['', __file__]) From scipy-svn at scipy.org Fri Jan 9 07:05:59 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 9 Jan 2009 06:05:59 -0600 (CST) Subject: [Scipy-svn] r5413 - trunk/scipy/interpolate Message-ID: <20090109120559.2601DC7C046@scipy.org> Author: rkern Date: 2009-01-09 06:05:57 -0600 (Fri, 09 Jan 2009) New Revision: 5413 Modified: trunk/scipy/interpolate/rbf.py Log: DOC: correct docstring per #840. Thank you, fghorow. Modified: trunk/scipy/interpolate/rbf.py =================================================================== --- trunk/scipy/interpolate/rbf.py 2009-01-09 10:46:20 UTC (rev 5412) +++ trunk/scipy/interpolate/rbf.py 2009-01-09 12:05:57 UTC (rev 5413) @@ -87,8 +87,8 @@ return sqrt( ((x1 - x2)**2).sum(axis=0) ) which is called with x1=x1[ndims,newaxis,:] and - x2=x2[ndims,:,newaxis] such that the result is a symmetric, square - matrix of the distances between each point to each other point. + x2=x2[ndims,:,newaxis] such that the result is a matrix of the distances + from each point in x1 to each point in x2. Examples -------- From scipy-svn at scipy.org Sat Jan 10 00:33:54 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 9 Jan 2009 23:33:54 -0600 (CST) Subject: [Scipy-svn] r5414 - in trunk/scipy: . linsolve Message-ID: <20090110053354.23823C7C009@scipy.org> Author: cdavid Date: 2009-01-09 23:33:48 -0600 (Fri, 09 Jan 2009) New Revision: 5414 Removed: trunk/scipy/linsolve/__init__.py Modified: trunk/scipy/setup.py trunk/scipy/setupscons.py Log: Remove deprecated linsolve. Deleted: trunk/scipy/linsolve/__init__.py =================================================================== --- trunk/scipy/linsolve/__init__.py 2009-01-09 12:05:57 UTC (rev 5413) +++ trunk/scipy/linsolve/__init__.py 2009-01-10 05:33:48 UTC (rev 5414) @@ -1,6 +0,0 @@ - -from warnings import warn - -warn('scipy.linsolve has moved to scipy.sparse.linalg.dsolve', DeprecationWarning) - -from scipy.sparse.linalg.dsolve import * Modified: trunk/scipy/setup.py =================================================================== --- trunk/scipy/setup.py 2009-01-09 12:05:57 UTC (rev 5413) +++ trunk/scipy/setup.py 2009-01-10 05:33:48 UTC (rev 5414) @@ -10,7 +10,6 @@ config.add_subpackage('io') config.add_subpackage('lib') config.add_subpackage('linalg') - config.add_subpackage('linsolve') config.add_subpackage('maxentropy') config.add_subpackage('misc') config.add_subpackage('odr') Modified: trunk/scipy/setupscons.py =================================================================== --- trunk/scipy/setupscons.py 2009-01-09 12:05:57 UTC (rev 5413) +++ trunk/scipy/setupscons.py 2009-01-10 05:33:48 UTC (rev 5414) @@ -15,7 +15,6 @@ config.add_subpackage('io') config.add_subpackage('lib') config.add_subpackage('linalg') - config.add_subpackage('linsolve') config.add_subpackage('maxentropy') config.add_subpackage('misc') config.add_subpackage('odr') From scipy-svn at scipy.org Sat Jan 10 01:58:49 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 10 Jan 2009 00:58:49 -0600 (CST) Subject: [Scipy-svn] r5415 - branches/0.7.x/scipy/interpolate Message-ID: <20090110065849.1BC1AC7C009@scipy.org> Author: jarrod.millman Date: 2009-01-10 00:58:47 -0600 (Sat, 10 Jan 2009) New Revision: 5415 Modified: branches/0.7.x/scipy/interpolate/rbf.py Log: Backport r5413 Modified: branches/0.7.x/scipy/interpolate/rbf.py =================================================================== --- branches/0.7.x/scipy/interpolate/rbf.py 2009-01-10 05:33:48 UTC (rev 5414) +++ branches/0.7.x/scipy/interpolate/rbf.py 2009-01-10 06:58:47 UTC (rev 5415) @@ -87,8 +87,8 @@ return sqrt( ((x1 - x2)**2).sum(axis=0) ) which is called with x1=x1[ndims,newaxis,:] and - x2=x2[ndims,:,newaxis] such that the result is a symmetric, square - matrix of the distances between each point to each other point. + x2=x2[ndims,:,newaxis] such that the result is a matrix of the distances + from each point in x1 to each point in x2. Examples -------- From scipy-svn at scipy.org Sat Jan 10 04:07:34 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 10 Jan 2009 03:07:34 -0600 (CST) Subject: [Scipy-svn] r5416 - trunk/doc/release Message-ID: <20090110090734.4CF80C7C009@scipy.org> Author: jarrod.millman Date: 2009-01-10 03:07:33 -0600 (Sat, 10 Jan 2009) New Revision: 5416 Modified: trunk/doc/release/0.7.0-notes.rst Log: updated release notes Modified: trunk/doc/release/0.7.0-notes.rst =================================================================== --- trunk/doc/release/0.7.0-notes.rst 2009-01-10 06:58:47 UTC (rev 5415) +++ trunk/doc/release/0.7.0-notes.rst 2009-01-10 09:07:33 UTC (rev 5416) @@ -4,107 +4,118 @@ .. contents:: -This new minor release comes almost one year after the 0.6.0 release +SciPy 0.7.0 is the culmination of 16 months of hard work and and contains many new features, numerous bug-fixes, improved test coverage, and better documentation. There have been a number of deprecations and API changes in this release, which are documented -below. While NumPy is an extremely stable, production-ready package, -SciPy is still under rapid development. Every effort is made to ensure -that our code is as stable and bug-free as possible (e.g., this release -almost doubles the number of unit tests compared to 0.6.0). However, as -we work toward the first stable, production-ready release (1.0.0), we -will be adding new modules and packages and we reserve the right to modify -SciPy's API and move code around to make the overall code organization -as intuitive as possible for new users. +below. All users are encouraged to upgrade to this release as +there are a large number of bug-fixes and optimizations. Moreover, +our development attention will now shift to bug-fix releases on the +0.7.x branch and new feature on the development trunk. This release +requires Python 2.4 or 2.5 and NumPy 1.2 or greater. -All users are encouraged to upgrade to this release as there are a large -number of bug-fixes and optimizations. Moreover, our development attention -will now shift to bug-fix releases on the 0.7.x branch and new feature on -the development trunk. +Please note that SciPy is still considered "Beta" status as we work +toward a SciPy 1.0.0 release. The 1.0.0 release will mark a major +step in the development of SciPy after which changing the package +structure or API will be much more difficult. While these pre-1.0 +releases are considered "Beta" status, we are committed to making +them as bug-free as possible. For example, in addition to fixing +numerous bugs in this release, we have also doubled the number +of unit tests since the last release. -Please note that unlike previous versions of SciPy, this release -requires Python 2.4 or 2.5. This release also requires NumPy 1.2.0 -or greater. +However, until the 1.0 release we are aggressively reviewing and +refining the functionality, organization, and interface in an effort +to make the package as coherent, intuitive, and useful as possible. +To achieve this, we need help from the community of users. Specifically, +we need feedback about all aspects of the project--everything from which +algorithms we implement to details about our function's call signatures. +Over the last year, we have seen an rapid increase in community involvement +and numerous infrastructure improvements to lower the barrier to contributions +(e.g., more explicit coding standards, improved testing infrastructure, better +documentation tools). Over the next year, we hope to see this trend continue +and invite everyone to become more involved. + Python 2.6 and 3.0 ------------------ +A significant amount of work has gone into making SciPy compatible with +Python 2.6; however, there are still some issues in this regard. +The main issue with 2.6 support is NumPy. On UNIX (including Mac OS X), +NumPy 1.2.1 mostly works, with a few caveats. On Windows, there are problems +related to the compilation process. The upcoming NumPy 1.3 release will fix +these issues. Any remaining issues with 2.6 support for SciPy 0.7 will +be addressed in a bug-fix release. + Python 3.0 is not supported at all: it requires NumPy to be ported to Python 3.0, which is a massive effort, since a lot of C code has to be -ported. It will happen, but not anytime soon. +ported. We are still considering how to make the transition to 3.0, but we +currently don't have any timeline or roadmap for this transition. -The main issue with 2.6 support is NumPy. On UNIX (including Mac OS X), NumPy -1.2.1 mostly works, with a few caveats. On Windows, there are some problems -related to the compilation process. The upcoming 1.3 version of NumPy will fix -those. - Sparse Matrices --------------- -* added support for integer dtypes such ``int8``, ``uint32``, etc. +Sparse matrices have seen extensive improvements. There is now support for integer +dtypes such ``int8``, ``uint32``, etc. Two new sparse formats were added: + * new class ``dia_matrix`` : the sparse DIAgonal format * new class ``bsr_matrix`` : the Block CSR format -* new sparse matrix construction functions - * ``sparse.kron`` : sparse Kronecker product - * ``sparse.bmat`` : sparse version of ``numpy.bmat`` - * ``sparse.vstack`` : sparse version of ``numpy.vstack`` - * ``sparse.hstack`` : sparse version of ``numpy.hstack`` +Several new sparse matrix construction functions were added: -* extraction of submatrices and nonzero values +* ``sparse.kron`` : sparse Kronecker product +* ``sparse.bmat`` : sparse version of ``numpy.bmat`` +* ``sparse.vstack`` : sparse version of ``numpy.vstack`` +* ``sparse.hstack`` : sparse version of ``numpy.hstack`` - * ``sparse.tril`` : extract lower triangle - * ``sparse.triu`` : extract upper triangle - * ``sparse.find`` : nonzero values and their indices +Extraction of submatrices and nonzero values have been added: -* ``csr_matrix`` and ``csc_matrix`` now support slicing and fancy indexing +* ``sparse.tril`` : extract lower triangle +* ``sparse.triu`` : extract upper triangle +* ``sparse.find`` : nonzero values and their indices - * e.g. ``A[1:3, 4:7]`` and ``A[[3,2,6,8],:]`` +``csr_matrix`` and ``csc_matrix`` now support slicing and fancy indexing +(e.g., ``A[1:3, 4:7]`` and ``A[[3,2,6,8],:]``). Conversions among all +sparse formats are now possible: -* conversions among all sparse formats are now possible +* using member functions such as ``.tocsr()`` and ``.tolil()`` +* using the ``.asformat()`` member function, e.g. ``A.asformat('csr')`` +* using constructors ``A = lil_matrix([[1,2]]); B = csr_matrix(A)`` - * using member functions such as ``.tocsr()`` and ``.tolil()`` - * using the ``.asformat()`` member function, e.g. ``A.asformat('csr')`` - * using constructors ``A = lil_matrix([[1,2]]); B = csr_matrix(A)`` +All sparse constructors now accept dense matrices and lists of lists. For +example: -* all sparse constructors now accept dense matrices and lists of lists +* ``A = csr_matrix( rand(3,3) )`` and ``B = lil_matrix( [[1,2],[3,4]] )`` - * e.g. ``A = csr_matrix( rand(3,3) )`` and ``B = lil_matrix( [[1,2],[3,4]] )`` +Numerous efficiency improvements to format conversions and sparse matrix +arithmetic. Finally, this release contains numerous bugfixes. -* efficiency improvements to: - - * format conversions - * sparse matrix arithmetic - -* numerous bugfixes - Reworking of IO package ----------------------- The IO code in both NumPy and SciPy is undergoing a major reworking. NumPy will be where basic code for reading and writing NumPy arrays is located, while SciPy will house file readers and writers for various data formats -(data, audio, video, images, matlab, excel, etc.). This reworking started -NumPy 1.1.0 and will take place over many release. SciPy 0.7.0 has several -changes including: +(data, audio, video, images, matlab, etc.). -* Several functions in ``scipy.io`` have been deprecated and will be removed - in the 0.8.0 release including ``npfile``, ``save``, ``load``, ``create_module``, - ``create_shelf``, ``objload``, ``objsave``, ``fopen``, ``read_array``, - ``write_array``, ``fread``, ``fwrite``, ``bswap``, ``packbits``, ``unpackbits``, - and ``convert_objectarray``. Some of these functions have been replaced by - NumPy's raw reading and writing capabilities, memory-mapping capabilities, - or array methods. Others have been moved from SciPy to NumPy, since basic - array reading and writing capability is now handled by NumPy. -* the Matlab (TM) file readers/writers have a number of improvements: +Several functions in ``scipy.io`` have been deprecated and will be removed +in the 0.8.0 release including ``npfile``, ``save``, ``load``, ``create_module``, +``create_shelf``, ``objload``, ``objsave``, ``fopen``, ``read_array``, +``write_array``, ``fread``, ``fwrite``, ``bswap``, ``packbits``, ``unpackbits``, +and ``convert_objectarray``. Some of these functions have been replaced by +NumPy's raw reading and writing capabilities, memory-mapping capabilities, +or array methods. Others have been moved from SciPy to NumPy, since basic +array reading and writing capability is now handled by NumPy. - * default version 5 - * v5 writers for structures, cell arrays, and objects - * v5 readers/writers for function handles and 64-bit integers - * new struct_as_record keyword argument to ``loadmat``, which loads - struct arrays in matlab as record arrays in numpy - * string arrays have ``dtype='U...'`` instead of ``dtype=object`` +The Matlab (TM) file readers/writers have a number of improvements: +* default version 5 +* v5 writers for structures, cell arrays, and objects +* v5 readers/writers for function handles and 64-bit integers +* new struct_as_record keyword argument to ``loadmat``, which loads + struct arrays in matlab as record arrays in numpy +* string arrays have ``dtype='U...'`` instead of ``dtype=object`` + New Hierarchical Clustering module ---------------------------------- @@ -173,9 +184,6 @@ the relative precision, in that order. All constants are in SI units unless otherwise stated. Several helper functions are provided. -The list is not meant to be comprehensive, but just a convenient list -for everyday use. - New Radial Basis Function module -------------------------------- @@ -226,11 +234,7 @@ The shape of return values from ``scipy.interpolate.interp1d`` used to be incorrect if interpolated data had more than 2 dimensions and -the axis keyword was set to a non-default value. This is fixed in 0.7.0: - - - http://projects.scipy.org/scipy/scipy/ticket/289 - - http://projects.scipy.org/scipy/scipy/ticket/660 - +the axis keyword was set to a non-default value. This has been fixed. Users of ``scipy.interpolate.interp1d`` may need to revise their code if it relies on the incorrect behavior. @@ -238,36 +242,39 @@ ------------------ Statistical functions for masked arrays have been added and are accessible -through scipy.stats.mstats. The functions are similar to their counterparts -in scipy.stats but they have not yet been verified for identical interfaces +through ``scipy.stats.mstats``. The functions are similar to their counterparts +in ``scipy.stats`` but they have not yet been verified for identical interfaces and algorithms. -Several bugs were fixed for statistical functions, of those, kstest and percentileofscore -gained new keyword arguments. +Several bugs were fixed for statistical functions, of those, ``kstest`` and +``percentileofscore`` gained new keyword arguments. -Added deprecation warning for mean, median, var, std, cov and corrcoef. These functions -should be replaced by their numpy counterparts. Note, however, that some of the default -options differ between the scipy.stats and numpy versions of these functions. +Added deprecation warning for ``mean``, ``median``, ``var``, ``std``, +``cov``, and ``corrcoef``. These functions should be replaced by their +numpy counterparts. Note, however, that some of the default options differ +between the ``scipy.stats`` and numpy versions of these functions. -Numerous bug fixes to stats.distributions: all generic methods work now correctly, several -methods in individual distributions were corrected. However, a few issues remain with -higher moments (skew, kurtosis) and entropy. The maximum likelihood estimator, fit, does not -work out-of-the-box for some distributions, in some cases, starting values have to be -carefully chosen, in other cases, the generic implementation of the maximum likelihood -method might not be the numerically appropriate estimation method. +Numerous bug fixes to ``stats.distributions``: all generic methods now work +correctly, several methods in individual distributions were corrected. However, +a few issues remain with higher moments (``skew``, ``kurtosis``) and entropy. +The maximum likelihood estimator, ``fit``, does not work out-of-the-box for +some distributions, in some cases, starting values have to be +carefully chosen, in other cases, the generic implementation of the maximum +likelihood method might not be the numerically appropriate estimation method. -We expect more bugfixes, increases in numerical precision and enhancements in the next -release of scipy. +We expect more bugfixes, increases in numerical precision and enhancements in +the next release of scipy. Running Tests ------------- NumPy 1.2 introduced a new testing framework based on `nose -`__. Starting with this release SciPy now -uses the new NumPy test framework as well. To take advantage of the new testing framework -requires nose version 0.10 or later. One major advantage of the new framework is that -it greatly reduces the difficulty of writing unit tests, which has all ready paid off given -the rapid increase in tests. To run the full test suite:: +`__. Starting with this release SciPy +now uses the new NumPy test framework as well. To take advantage of the new +testing framework requires ``nose`` version 0.10 or later. One major advantage +of the new framework is that it greatly reduces the difficulty of writing unit +tests, which has all ready paid off given the rapid increase in tests. To run +the full test suite:: >>> import scipy >>> scipy.test('full') @@ -275,8 +282,9 @@ For more information, please see `The NumPy/SciPy Testing Guide `__. -We have also greatly improved our test coverage. There were just over 2,000 unit tests in -the 0.6.0 release; this release nearly doubles that number with just under 4,000 unit tests. +We have also greatly improved our test coverage. There were just over 2,000 unit +tests in the 0.6.0 release; this release nearly doubles that number with just over +4,000 unit tests. Building SciPy -------------- @@ -284,20 +292,28 @@ Support for NumScons has been added. NumScons is a tentative new build system for NumPy/SciPy, using `SCons `__ at its core. -SCons is a next-generation build system meant to replace the venerable ``Make`` with -the integrated functionality of ``autoconf``/``automake`` and ``ccache``. Scons is -written in Python and its configuration files are Python scripts. NumScons is meant -to replace NumPy's custom version of ``distutils`` providing more advanced functionality -such as autoconf, improved fortran support, more tools, and support for -``numpy.distutils``/``scons`` cooperation. +SCons is a next-generation build system meant to replace the venerable ``Make`` +with the integrated functionality of ``autoconf``/``automake`` and ``ccache``. +Scons is written in Python and its configuration files are Python scripts. +NumScons is meant to replace NumPy's custom version of ``distutils`` providing +more advanced functionality such as ``autoconf``, improved fortran support, +more tools, and support for ``numpy.distutils``/``scons`` cooperation. +Weave clean up +-------------- + +There were numerous improvements to ``scipy.weave``. ``blitz++`` was +relicensed by the author to be compatible with the SciPy license. +``wx_spec.py`` was removed. + Sandbox Removed --------------- -While porting SciPy to NumPy in 2005, several packages and modules were moved into -``scipy.sandbox``. The sandbox was a staging ground for packages that were undergoing -rapid development and whose APIs were in flux. It was also a place where broken code -could live. The sandbox has served its purpose well and was starting to create confusion, -so ``scipy.sandbox`` was removed. Most of the code was moved into ``scipy``, some code was -made into a ``scikit``, and the remaining code was just deleted as the functionality had +While porting SciPy to NumPy in 2005, several packages and modules were +moved into ``scipy.sandbox``. The sandbox was a staging ground for packages +that were undergoing rapid development and whose APIs were in flux. It was +also a place where broken code could live. The sandbox has served its purpose +well and was starting to create confusion, so ``scipy.sandbox`` was removed. +Most of the code was moved into ``scipy``, some code was made into a +``scikit``, and the remaining code was just deleted as the functionality had been replaced by other code. From scipy-svn at scipy.org Sat Jan 10 04:15:43 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 10 Jan 2009 03:15:43 -0600 (CST) Subject: [Scipy-svn] r5417 - branches/0.7.x/doc/release Message-ID: <20090110091543.E9186C7C009@scipy.org> Author: jarrod.millman Date: 2009-01-10 03:15:42 -0600 (Sat, 10 Jan 2009) New Revision: 5417 Modified: branches/0.7.x/doc/release/0.7.0-notes.rst Log: Backport r5416 Modified: branches/0.7.x/doc/release/0.7.0-notes.rst =================================================================== --- branches/0.7.x/doc/release/0.7.0-notes.rst 2009-01-10 09:07:33 UTC (rev 5416) +++ branches/0.7.x/doc/release/0.7.0-notes.rst 2009-01-10 09:15:42 UTC (rev 5417) @@ -4,107 +4,118 @@ .. contents:: -This new minor release comes almost one year after the 0.6.0 release +SciPy 0.7.0 is the culmination of 16 months of hard work and and contains many new features, numerous bug-fixes, improved test coverage, and better documentation. There have been a number of deprecations and API changes in this release, which are documented -below. While NumPy is an extremely stable, production-ready package, -SciPy is still under rapid development. Every effort is made to ensure -that our code is as stable and bug-free as possible (e.g., this release -almost doubles the number of unit tests compared to 0.6.0). However, as -we work toward the first stable, production-ready release (1.0.0), we -will be adding new modules and packages and we reserve the right to modify -SciPy's API and move code around to make the overall code organization -as intuitive as possible for new users. +below. All users are encouraged to upgrade to this release as +there are a large number of bug-fixes and optimizations. Moreover, +our development attention will now shift to bug-fix releases on the +0.7.x branch and new feature on the development trunk. This release +requires Python 2.4 or 2.5 and NumPy 1.2 or greater. -All users are encouraged to upgrade to this release as there are a large -number of bug-fixes and optimizations. Moreover, our development attention -will now shift to bug-fix releases on the 0.7.x branch and new feature on -the development trunk. +Please note that SciPy is still considered "Beta" status as we work +toward a SciPy 1.0.0 release. The 1.0.0 release will mark a major +step in the development of SciPy after which changing the package +structure or API will be much more difficult. While these pre-1.0 +releases are considered "Beta" status, we are committed to making +them as bug-free as possible. For example, in addition to fixing +numerous bugs in this release, we have also doubled the number +of unit tests since the last release. -Please note that unlike previous versions of SciPy, this release -requires Python 2.4 or 2.5. This release also requires NumPy 1.2.0 -or greater. +However, until the 1.0 release we are aggressively reviewing and +refining the functionality, organization, and interface in an effort +to make the package as coherent, intuitive, and useful as possible. +To achieve this, we need help from the community of users. Specifically, +we need feedback about all aspects of the project--everything from which +algorithms we implement to details about our function's call signatures. +Over the last year, we have seen an rapid increase in community involvement +and numerous infrastructure improvements to lower the barrier to contributions +(e.g., more explicit coding standards, improved testing infrastructure, better +documentation tools). Over the next year, we hope to see this trend continue +and invite everyone to become more involved. + Python 2.6 and 3.0 ------------------ +A significant amount of work has gone into making SciPy compatible with +Python 2.6; however, there are still some issues in this regard. +The main issue with 2.6 support is NumPy. On UNIX (including Mac OS X), +NumPy 1.2.1 mostly works, with a few caveats. On Windows, there are problems +related to the compilation process. The upcoming NumPy 1.3 release will fix +these issues. Any remaining issues with 2.6 support for SciPy 0.7 will +be addressed in a bug-fix release. + Python 3.0 is not supported at all: it requires NumPy to be ported to Python 3.0, which is a massive effort, since a lot of C code has to be -ported. It will happen, but not anytime soon. +ported. We are still considering how to make the transition to 3.0, but we +currently don't have any timeline or roadmap for this transition. -The main issue with 2.6 support is NumPy. On UNIX (including Mac OS X), NumPy -1.2.1 mostly works, with a few caveats. On Windows, there are some problems -related to the compilation process. The upcoming 1.3 version of NumPy will fix -those. - Sparse Matrices --------------- -* added support for integer dtypes such ``int8``, ``uint32``, etc. +Sparse matrices have seen extensive improvements. There is now support for integer +dtypes such ``int8``, ``uint32``, etc. Two new sparse formats were added: + * new class ``dia_matrix`` : the sparse DIAgonal format * new class ``bsr_matrix`` : the Block CSR format -* new sparse matrix construction functions - * ``sparse.kron`` : sparse Kronecker product - * ``sparse.bmat`` : sparse version of ``numpy.bmat`` - * ``sparse.vstack`` : sparse version of ``numpy.vstack`` - * ``sparse.hstack`` : sparse version of ``numpy.hstack`` +Several new sparse matrix construction functions were added: -* extraction of submatrices and nonzero values +* ``sparse.kron`` : sparse Kronecker product +* ``sparse.bmat`` : sparse version of ``numpy.bmat`` +* ``sparse.vstack`` : sparse version of ``numpy.vstack`` +* ``sparse.hstack`` : sparse version of ``numpy.hstack`` - * ``sparse.tril`` : extract lower triangle - * ``sparse.triu`` : extract upper triangle - * ``sparse.find`` : nonzero values and their indices +Extraction of submatrices and nonzero values have been added: -* ``csr_matrix`` and ``csc_matrix`` now support slicing and fancy indexing +* ``sparse.tril`` : extract lower triangle +* ``sparse.triu`` : extract upper triangle +* ``sparse.find`` : nonzero values and their indices - * e.g. ``A[1:3, 4:7]`` and ``A[[3,2,6,8],:]`` +``csr_matrix`` and ``csc_matrix`` now support slicing and fancy indexing +(e.g., ``A[1:3, 4:7]`` and ``A[[3,2,6,8],:]``). Conversions among all +sparse formats are now possible: -* conversions among all sparse formats are now possible +* using member functions such as ``.tocsr()`` and ``.tolil()`` +* using the ``.asformat()`` member function, e.g. ``A.asformat('csr')`` +* using constructors ``A = lil_matrix([[1,2]]); B = csr_matrix(A)`` - * using member functions such as ``.tocsr()`` and ``.tolil()`` - * using the ``.asformat()`` member function, e.g. ``A.asformat('csr')`` - * using constructors ``A = lil_matrix([[1,2]]); B = csr_matrix(A)`` +All sparse constructors now accept dense matrices and lists of lists. For +example: -* all sparse constructors now accept dense matrices and lists of lists +* ``A = csr_matrix( rand(3,3) )`` and ``B = lil_matrix( [[1,2],[3,4]] )`` - * e.g. ``A = csr_matrix( rand(3,3) )`` and ``B = lil_matrix( [[1,2],[3,4]] )`` +Numerous efficiency improvements to format conversions and sparse matrix +arithmetic. Finally, this release contains numerous bugfixes. -* efficiency improvements to: - - * format conversions - * sparse matrix arithmetic - -* numerous bugfixes - Reworking of IO package ----------------------- The IO code in both NumPy and SciPy is undergoing a major reworking. NumPy will be where basic code for reading and writing NumPy arrays is located, while SciPy will house file readers and writers for various data formats -(data, audio, video, images, matlab, excel, etc.). This reworking started -NumPy 1.1.0 and will take place over many release. SciPy 0.7.0 has several -changes including: +(data, audio, video, images, matlab, etc.). -* Several functions in ``scipy.io`` have been deprecated and will be removed - in the 0.8.0 release including ``npfile``, ``save``, ``load``, ``create_module``, - ``create_shelf``, ``objload``, ``objsave``, ``fopen``, ``read_array``, - ``write_array``, ``fread``, ``fwrite``, ``bswap``, ``packbits``, ``unpackbits``, - and ``convert_objectarray``. Some of these functions have been replaced by - NumPy's raw reading and writing capabilities, memory-mapping capabilities, - or array methods. Others have been moved from SciPy to NumPy, since basic - array reading and writing capability is now handled by NumPy. -* the Matlab (TM) file readers/writers have a number of improvements: +Several functions in ``scipy.io`` have been deprecated and will be removed +in the 0.8.0 release including ``npfile``, ``save``, ``load``, ``create_module``, +``create_shelf``, ``objload``, ``objsave``, ``fopen``, ``read_array``, +``write_array``, ``fread``, ``fwrite``, ``bswap``, ``packbits``, ``unpackbits``, +and ``convert_objectarray``. Some of these functions have been replaced by +NumPy's raw reading and writing capabilities, memory-mapping capabilities, +or array methods. Others have been moved from SciPy to NumPy, since basic +array reading and writing capability is now handled by NumPy. - * default version 5 - * v5 writers for structures, cell arrays, and objects - * v5 readers/writers for function handles and 64-bit integers - * new struct_as_record keyword argument to ``loadmat``, which loads - struct arrays in matlab as record arrays in numpy - * string arrays have ``dtype='U...'`` instead of ``dtype=object`` +The Matlab (TM) file readers/writers have a number of improvements: +* default version 5 +* v5 writers for structures, cell arrays, and objects +* v5 readers/writers for function handles and 64-bit integers +* new struct_as_record keyword argument to ``loadmat``, which loads + struct arrays in matlab as record arrays in numpy +* string arrays have ``dtype='U...'`` instead of ``dtype=object`` + New Hierarchical Clustering module ---------------------------------- @@ -173,9 +184,6 @@ the relative precision, in that order. All constants are in SI units unless otherwise stated. Several helper functions are provided. -The list is not meant to be comprehensive, but just a convenient list -for everyday use. - New Radial Basis Function module -------------------------------- @@ -226,11 +234,7 @@ The shape of return values from ``scipy.interpolate.interp1d`` used to be incorrect if interpolated data had more than 2 dimensions and -the axis keyword was set to a non-default value. This is fixed in 0.7.0: - - - http://projects.scipy.org/scipy/scipy/ticket/289 - - http://projects.scipy.org/scipy/scipy/ticket/660 - +the axis keyword was set to a non-default value. This has been fixed. Users of ``scipy.interpolate.interp1d`` may need to revise their code if it relies on the incorrect behavior. @@ -238,36 +242,39 @@ ------------------ Statistical functions for masked arrays have been added and are accessible -through scipy.stats.mstats. The functions are similar to their counterparts -in scipy.stats but they have not yet been verified for identical interfaces +through ``scipy.stats.mstats``. The functions are similar to their counterparts +in ``scipy.stats`` but they have not yet been verified for identical interfaces and algorithms. -Several bugs were fixed for statistical functions, of those, kstest and percentileofscore -gained new keyword arguments. +Several bugs were fixed for statistical functions, of those, ``kstest`` and +``percentileofscore`` gained new keyword arguments. -Added deprecation warning for mean, median, var, std, cov and corrcoef. These functions -should be replaced by their numpy counterparts. Note, however, that some of the default -options differ between the scipy.stats and numpy versions of these functions. +Added deprecation warning for ``mean``, ``median``, ``var``, ``std``, +``cov``, and ``corrcoef``. These functions should be replaced by their +numpy counterparts. Note, however, that some of the default options differ +between the ``scipy.stats`` and numpy versions of these functions. -Numerous bug fixes to stats.distributions: all generic methods work now correctly, several -methods in individual distributions were corrected. However, a few issues remain with -higher moments (skew, kurtosis) and entropy. The maximum likelihood estimator, fit, does not -work out-of-the-box for some distributions, in some cases, starting values have to be -carefully chosen, in other cases, the generic implementation of the maximum likelihood -method might not be the numerically appropriate estimation method. +Numerous bug fixes to ``stats.distributions``: all generic methods now work +correctly, several methods in individual distributions were corrected. However, +a few issues remain with higher moments (``skew``, ``kurtosis``) and entropy. +The maximum likelihood estimator, ``fit``, does not work out-of-the-box for +some distributions, in some cases, starting values have to be +carefully chosen, in other cases, the generic implementation of the maximum +likelihood method might not be the numerically appropriate estimation method. -We expect more bugfixes, increases in numerical precision and enhancements in the next -release of scipy. +We expect more bugfixes, increases in numerical precision and enhancements in +the next release of scipy. Running Tests ------------- NumPy 1.2 introduced a new testing framework based on `nose -`__. Starting with this release SciPy now -uses the new NumPy test framework as well. To take advantage of the new testing framework -requires nose version 0.10 or later. One major advantage of the new framework is that -it greatly reduces the difficulty of writing unit tests, which has all ready paid off given -the rapid increase in tests. To run the full test suite:: +`__. Starting with this release SciPy +now uses the new NumPy test framework as well. To take advantage of the new +testing framework requires ``nose`` version 0.10 or later. One major advantage +of the new framework is that it greatly reduces the difficulty of writing unit +tests, which has all ready paid off given the rapid increase in tests. To run +the full test suite:: >>> import scipy >>> scipy.test('full') @@ -275,8 +282,9 @@ For more information, please see `The NumPy/SciPy Testing Guide `__. -We have also greatly improved our test coverage. There were just over 2,000 unit tests in -the 0.6.0 release; this release nearly doubles that number with just under 4,000 unit tests. +We have also greatly improved our test coverage. There were just over 2,000 unit +tests in the 0.6.0 release; this release nearly doubles that number with just over +4,000 unit tests. Building SciPy -------------- @@ -284,20 +292,28 @@ Support for NumScons has been added. NumScons is a tentative new build system for NumPy/SciPy, using `SCons `__ at its core. -SCons is a next-generation build system meant to replace the venerable ``Make`` with -the integrated functionality of ``autoconf``/``automake`` and ``ccache``. Scons is -written in Python and its configuration files are Python scripts. NumScons is meant -to replace NumPy's custom version of ``distutils`` providing more advanced functionality -such as autoconf, improved fortran support, more tools, and support for -``numpy.distutils``/``scons`` cooperation. +SCons is a next-generation build system meant to replace the venerable ``Make`` +with the integrated functionality of ``autoconf``/``automake`` and ``ccache``. +Scons is written in Python and its configuration files are Python scripts. +NumScons is meant to replace NumPy's custom version of ``distutils`` providing +more advanced functionality such as ``autoconf``, improved fortran support, +more tools, and support for ``numpy.distutils``/``scons`` cooperation. +Weave clean up +-------------- + +There were numerous improvements to ``scipy.weave``. ``blitz++`` was +relicensed by the author to be compatible with the SciPy license. +``wx_spec.py`` was removed. + Sandbox Removed --------------- -While porting SciPy to NumPy in 2005, several packages and modules were moved into -``scipy.sandbox``. The sandbox was a staging ground for packages that were undergoing -rapid development and whose APIs were in flux. It was also a place where broken code -could live. The sandbox has served its purpose well and was starting to create confusion, -so ``scipy.sandbox`` was removed. Most of the code was moved into ``scipy``, some code was -made into a ``scikit``, and the remaining code was just deleted as the functionality had +While porting SciPy to NumPy in 2005, several packages and modules were +moved into ``scipy.sandbox``. The sandbox was a staging ground for packages +that were undergoing rapid development and whose APIs were in flux. It was +also a place where broken code could live. The sandbox has served its purpose +well and was starting to create confusion, so ``scipy.sandbox`` was removed. +Most of the code was moved into ``scipy``, some code was made into a +``scikit``, and the remaining code was just deleted as the functionality had been replaced by other code. From scipy-svn at scipy.org Sat Jan 10 04:36:37 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 10 Jan 2009 03:36:37 -0600 (CST) Subject: [Scipy-svn] r5418 - trunk Message-ID: <20090110093637.BCC40C7C009@scipy.org> Author: jarrod.millman Date: 2009-01-10 03:36:36 -0600 (Sat, 10 Jan 2009) New Revision: 5418 Modified: trunk/INSTALL.txt trunk/README.txt Log: updating documentation Modified: trunk/INSTALL.txt =================================================================== --- trunk/INSTALL.txt 2009-01-10 09:15:42 UTC (rev 5417) +++ trunk/INSTALL.txt 2009-01-10 09:36:36 UTC (rev 5418) @@ -4,12 +4,6 @@ Building and installing SciPy +++++++++++++++++++++++++++++ -:Authors: Pearu Peterson -:Modified by: Ed Schofield -:Last changed: $Date$ -:Revision: $Revision$ -:Discussions to: scipy-user at scipy.org - See http://www.scipy.org/scipy/scipy/wiki/GetCode for updates of this document. @@ -240,12 +234,11 @@ To test SciPy after installation (highly recommended), execute in Python >>> import scipy - >>> scipy.test(level=1) + >>> scipy.test() -where the test level can be varied from 1 to 10. To get detailed -messages about what tests are being executed, use +To run the full test suite use - >>> scipy.test(level=1, verbosity=2) + >>> scipy.test('full') COMPILER NOTES Modified: trunk/README.txt =================================================================== --- trunk/README.txt 2009-01-10 09:15:42 UTC (rev 5417) +++ trunk/README.txt 2009-01-10 09:36:36 UTC (rev 5418) @@ -1,27 +1,18 @@ -.. -*- rest -*- - ================================================= Developing SciPy ================================================= -:Author: Pearu Peterson -:Modified by: Ed Schofield -:Modified by: Jarrod Millman -:Last changed: $Date$ -:Revision: $Revision$ -:Discussions to: scipy-dev at scipy.org - .. Contents:: -What is SciPY? +What is SciPy? -------------- SciPy (pronounced "Sigh Pie") is open-source software for mathematics, science, and engineering. It includes modules for statistics, optimization, integration, linear algebra, Fourier transforms, signal and image processing, -genetic algorithms, ODE solvers, and more. It is also the name of a very -popular conference on scientific programming with Python. +ODE solvers, and more. It is also the name of a very popular conference on +scientific programming with Python. The SciPy library depends on NumPy, which provides convenient and fast N-dimensional array manipulation. The SciPy library is built to work with @@ -105,58 +96,9 @@ Documentation ------------- -This is an important feature where SciPy is currently lacking. A few -SciPy modules have some documentation but they use different formats -and are mostly out of date. We could use some help with this. +The documentation site is here + http://docs.scipy.org -Currently there are - -* A SciPy tutorial by Travis E. Oliphant. This is maintained using LyX. - The main advantage of this approach is that one can use mathematical - formulas in documentation. - -* I (Pearu) have used reStructuredText formated .txt files to document - various bits of software. This is mainly because ``docutils`` might - become a standard tool to document Python modules. The disadvantage - is that it does not support mathematical formulas (though, we might - add this feature ourself using e.g. LaTeX syntax). - -* Various text files with almost no formatting and mostly badly out - dated. - -* Documentation strings of Python functions, classes, and modules. - Some SciPy modules are well-documented in this sense, others are very - poorly documented. Another issue is that there is no consensus on how - to format documentation strings, mainly because we haven't decided - which tool to use to generate, for instance, HTML pages of - documentation strings. - -So, we need unique rules for documenting SciPy modules. Here are some -requirements that documentation tools should satsify: - -* Easy to use. This is important to lower the threshold of developers - to use the same documentation utilities. - -* In general, all functions that are visible to SciPy end-users, must - have well-maintained documentation strings. - -* Support for mathematical formulas. Since SciPy is a tool for - scientific work, it is hard to avoid formulas to describe how its - modules are good for. So, documentation tools should support LaTeX. - -* Documentation of a feature should be closely related to its - interface and implementation. This is important for keeping - documentation up to date. One option would be to maintain - documentation in source files (and have a tool that extracts - documentation from sources). The main disadvantage with that is the - lack of convenience writing documentation as the editor would be in - different mode (e.g. Python mode) from the mode suitable for - documentation. - -* Differentiation of implementation (e.g. from scanning sources) and - concept (e.g. tutorial, users guide, manual) based docs. - - Web sites --------- From scipy-svn at scipy.org Sat Jan 10 04:38:02 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 10 Jan 2009 03:38:02 -0600 (CST) Subject: [Scipy-svn] r5419 - branches/0.7.x Message-ID: <20090110093802.4453CC7C009@scipy.org> Author: jarrod.millman Date: 2009-01-10 03:38:01 -0600 (Sat, 10 Jan 2009) New Revision: 5419 Modified: branches/0.7.x/INSTALL.txt branches/0.7.x/README.txt Log: Backport r5418 Modified: branches/0.7.x/INSTALL.txt =================================================================== --- branches/0.7.x/INSTALL.txt 2009-01-10 09:36:36 UTC (rev 5418) +++ branches/0.7.x/INSTALL.txt 2009-01-10 09:38:01 UTC (rev 5419) @@ -4,12 +4,6 @@ Building and installing SciPy +++++++++++++++++++++++++++++ -:Authors: Pearu Peterson -:Modified by: Ed Schofield -:Last changed: $Date$ -:Revision: $Revision$ -:Discussions to: scipy-user at scipy.org - See http://www.scipy.org/scipy/scipy/wiki/GetCode for updates of this document. @@ -240,12 +234,11 @@ To test SciPy after installation (highly recommended), execute in Python >>> import scipy - >>> scipy.test(level=1) + >>> scipy.test() -where the test level can be varied from 1 to 10. To get detailed -messages about what tests are being executed, use +To run the full test suite use - >>> scipy.test(level=1, verbosity=2) + >>> scipy.test('full') COMPILER NOTES Modified: branches/0.7.x/README.txt =================================================================== --- branches/0.7.x/README.txt 2009-01-10 09:36:36 UTC (rev 5418) +++ branches/0.7.x/README.txt 2009-01-10 09:38:01 UTC (rev 5419) @@ -1,27 +1,18 @@ -.. -*- rest -*- - ================================================= Developing SciPy ================================================= -:Author: Pearu Peterson -:Modified by: Ed Schofield -:Modified by: Jarrod Millman -:Last changed: $Date$ -:Revision: $Revision$ -:Discussions to: scipy-dev at scipy.org - .. Contents:: -What is SciPY? +What is SciPy? -------------- SciPy (pronounced "Sigh Pie") is open-source software for mathematics, science, and engineering. It includes modules for statistics, optimization, integration, linear algebra, Fourier transforms, signal and image processing, -genetic algorithms, ODE solvers, and more. It is also the name of a very -popular conference on scientific programming with Python. +ODE solvers, and more. It is also the name of a very popular conference on +scientific programming with Python. The SciPy library depends on NumPy, which provides convenient and fast N-dimensional array manipulation. The SciPy library is built to work with @@ -105,58 +96,9 @@ Documentation ------------- -This is an important feature where SciPy is currently lacking. A few -SciPy modules have some documentation but they use different formats -and are mostly out of date. We could use some help with this. +The documentation site is here + http://docs.scipy.org -Currently there are - -* A SciPy tutorial by Travis E. Oliphant. This is maintained using LyX. - The main advantage of this approach is that one can use mathematical - formulas in documentation. - -* I (Pearu) have used reStructuredText formated .txt files to document - various bits of software. This is mainly because ``docutils`` might - become a standard tool to document Python modules. The disadvantage - is that it does not support mathematical formulas (though, we might - add this feature ourself using e.g. LaTeX syntax). - -* Various text files with almost no formatting and mostly badly out - dated. - -* Documentation strings of Python functions, classes, and modules. - Some SciPy modules are well-documented in this sense, others are very - poorly documented. Another issue is that there is no consensus on how - to format documentation strings, mainly because we haven't decided - which tool to use to generate, for instance, HTML pages of - documentation strings. - -So, we need unique rules for documenting SciPy modules. Here are some -requirements that documentation tools should satsify: - -* Easy to use. This is important to lower the threshold of developers - to use the same documentation utilities. - -* In general, all functions that are visible to SciPy end-users, must - have well-maintained documentation strings. - -* Support for mathematical formulas. Since SciPy is a tool for - scientific work, it is hard to avoid formulas to describe how its - modules are good for. So, documentation tools should support LaTeX. - -* Documentation of a feature should be closely related to its - interface and implementation. This is important for keeping - documentation up to date. One option would be to maintain - documentation in source files (and have a tool that extracts - documentation from sources). The main disadvantage with that is the - lack of convenience writing documentation as the editor would be in - different mode (e.g. Python mode) from the mode suitable for - documentation. - -* Differentiation of implementation (e.g. from scanning sources) and - concept (e.g. tutorial, users guide, manual) based docs. - - Web sites --------- From scipy-svn at scipy.org Sat Jan 10 04:47:20 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 10 Jan 2009 03:47:20 -0600 (CST) Subject: [Scipy-svn] r5420 - trunk Message-ID: <20090110094720.B75A1C7C009@scipy.org> Author: jarrod.millman Date: 2009-01-10 03:47:20 -0600 (Sat, 10 Jan 2009) New Revision: 5420 Modified: trunk/INSTALL.txt Log: documentation update Modified: trunk/INSTALL.txt =================================================================== --- trunk/INSTALL.txt 2009-01-10 09:38:01 UTC (rev 5419) +++ trunk/INSTALL.txt 2009-01-10 09:47:20 UTC (rev 5420) @@ -1,6 +1,3 @@ -.. -*- rest -*- -.. NB! Keep this document a valid restructured document. - Building and installing SciPy +++++++++++++++++++++++++++++ @@ -240,7 +237,12 @@ >>> scipy.test('full') +Please note that you must have version 0.10 or later of the 'nose' test +framework installed in order to run the tests. More information about nose is +available here: +http://somethingaboutorange.com/mrl/projects/nose/ + COMPILER NOTES ============== From scipy-svn at scipy.org Sat Jan 10 04:48:34 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 10 Jan 2009 03:48:34 -0600 (CST) Subject: [Scipy-svn] r5421 - branches/0.7.x Message-ID: <20090110094834.02864C7C009@scipy.org> Author: jarrod.millman Date: 2009-01-10 03:48:34 -0600 (Sat, 10 Jan 2009) New Revision: 5421 Modified: branches/0.7.x/INSTALL.txt Log: Backport r5420 Modified: branches/0.7.x/INSTALL.txt =================================================================== --- branches/0.7.x/INSTALL.txt 2009-01-10 09:47:20 UTC (rev 5420) +++ branches/0.7.x/INSTALL.txt 2009-01-10 09:48:34 UTC (rev 5421) @@ -1,6 +1,3 @@ -.. -*- rest -*- -.. NB! Keep this document a valid restructured document. - Building and installing SciPy +++++++++++++++++++++++++++++ @@ -240,7 +237,12 @@ >>> scipy.test('full') +Please note that you must have version 0.10 or later of the 'nose' test +framework installed in order to run the tests. More information about nose is +available here: +http://somethingaboutorange.com/mrl/projects/nose/ + COMPILER NOTES ============== From scipy-svn at scipy.org Sat Jan 10 05:57:52 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 10 Jan 2009 04:57:52 -0600 (CST) Subject: [Scipy-svn] r5422 - branches/0.7.x/doc/release Message-ID: <20090110105752.66495C7C009@scipy.org> Author: cdavid Date: 2009-01-10 04:57:49 -0600 (Sat, 10 Jan 2009) New Revision: 5422 Modified: branches/0.7.x/doc/release/0.7.0-notes.rst Log: Add a note on known failures. Modified: branches/0.7.x/doc/release/0.7.0-notes.rst =================================================================== --- branches/0.7.x/doc/release/0.7.0-notes.rst 2009-01-10 09:48:34 UTC (rev 5421) +++ branches/0.7.x/doc/release/0.7.0-notes.rst 2009-01-10 10:57:49 UTC (rev 5422) @@ -317,3 +317,14 @@ Most of the code was moved into ``scipy``, some code was made into a ``scikit``, and the remaining code was just deleted as the functionality had been replaced by other code. + +Known problems +============== + +Here are known problems with scipy 0.7.0: + - weave test failures on windows: those are known, and are being worked + on. + - weave test failure with gcc 4.3 (std::labs): this is a gcc 4.3 bug. A + workaround is to add #include in + scipy/weave/blitz/blitz/funcs.h (line 27). You can make the change in + the installed scipy (in site-packages). From scipy-svn at scipy.org Sat Jan 10 06:01:30 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 10 Jan 2009 05:01:30 -0600 (CST) Subject: [Scipy-svn] r5423 - branches/0.7.x/doc/release Message-ID: <20090110110130.78451C7C026@scipy.org> Author: jarrod.millman Date: 2009-01-10 05:01:29 -0600 (Sat, 10 Jan 2009) New Revision: 5423 Modified: branches/0.7.x/doc/release/0.7.0-notes.rst Log: formatting Modified: branches/0.7.x/doc/release/0.7.0-notes.rst =================================================================== --- branches/0.7.x/doc/release/0.7.0-notes.rst 2009-01-10 10:57:49 UTC (rev 5422) +++ branches/0.7.x/doc/release/0.7.0-notes.rst 2009-01-10 11:01:29 UTC (rev 5423) @@ -319,12 +319,13 @@ been replaced by other code. Known problems -============== +-------------- Here are known problems with scipy 0.7.0: - - weave test failures on windows: those are known, and are being worked - on. - - weave test failure with gcc 4.3 (std::labs): this is a gcc 4.3 bug. A - workaround is to add #include in - scipy/weave/blitz/blitz/funcs.h (line 27). You can make the change in - the installed scipy (in site-packages). + +* weave test failures on windows: those are known, and are being worked + on. +* weave test failure with gcc 4.3 (std::labs): this is a gcc 4.3 bug. A + workaround is to add #include in + scipy/weave/blitz/blitz/funcs.h (line 27). You can make the change in + the installed scipy (in site-packages). From scipy-svn at scipy.org Sat Jan 10 06:06:05 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 10 Jan 2009 05:06:05 -0600 (CST) Subject: [Scipy-svn] r5424 - trunk Message-ID: <20090110110605.0D03BC7C009@scipy.org> Author: jarrod.millman Date: 2009-01-10 05:06:05 -0600 (Sat, 10 Jan 2009) New Revision: 5424 Removed: trunk/FORMAT_GUIDELINES.txt Log: removing old file Deleted: trunk/FORMAT_GUIDELINES.txt =================================================================== --- trunk/FORMAT_GUIDELINES.txt 2009-01-10 11:01:29 UTC (rev 5423) +++ trunk/FORMAT_GUIDELINES.txt 2009-01-10 11:06:05 UTC (rev 5424) @@ -1,27 +0,0 @@ -Follow the standard Python formatting rules when writing code for SciPy. Guido -describes them "here":http://www.python.org/doc/essays/styleguide.html. A few -reminders follow: - - o Use 4 spaces for indentation levels. Do not use tabs as they can result - in indentation confusion. Most editors have a feature that will insert 4 - spaces when the tab key is hit. Also, many editors will automatically - search/replace leading tabs with 4 spaces. - - o Only 80 characters on a line. - - o use all lowercase function names with underscore separated words: - - def set_some_value() - - instead of: - - def setSomeValue() - - - o use CamelCase class names: - - def BaseClass() - - instead of: - - def base_class() From scipy-svn at scipy.org Sat Jan 10 06:07:33 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 10 Jan 2009 05:07:33 -0600 (CST) Subject: [Scipy-svn] r5425 - branches/0.7.x Message-ID: <20090110110733.35BE2C7C009@scipy.org> Author: jarrod.millman Date: 2009-01-10 05:07:32 -0600 (Sat, 10 Jan 2009) New Revision: 5425 Removed: branches/0.7.x/FORMAT_GUIDELINES.txt Log: Backport r5424 Deleted: branches/0.7.x/FORMAT_GUIDELINES.txt =================================================================== --- branches/0.7.x/FORMAT_GUIDELINES.txt 2009-01-10 11:06:05 UTC (rev 5424) +++ branches/0.7.x/FORMAT_GUIDELINES.txt 2009-01-10 11:07:32 UTC (rev 5425) @@ -1,27 +0,0 @@ -Follow the standard Python formatting rules when writing code for SciPy. Guido -describes them "here":http://www.python.org/doc/essays/styleguide.html. A few -reminders follow: - - o Use 4 spaces for indentation levels. Do not use tabs as they can result - in indentation confusion. Most editors have a feature that will insert 4 - spaces when the tab key is hit. Also, many editors will automatically - search/replace leading tabs with 4 spaces. - - o Only 80 characters on a line. - - o use all lowercase function names with underscore separated words: - - def set_some_value() - - instead of: - - def setSomeValue() - - - o use CamelCase class names: - - def BaseClass() - - instead of: - - def base_class() From scipy-svn at scipy.org Sat Jan 10 06:09:41 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 10 Jan 2009 05:09:41 -0600 (CST) Subject: [Scipy-svn] r5426 - trunk/doc/release Message-ID: <20090110110941.C3414C7C009@scipy.org> Author: jarrod.millman Date: 2009-01-10 05:09:40 -0600 (Sat, 10 Jan 2009) New Revision: 5426 Modified: trunk/doc/release/0.7.0-notes.rst Log: Backport r5422-r5423 Modified: trunk/doc/release/0.7.0-notes.rst =================================================================== --- trunk/doc/release/0.7.0-notes.rst 2009-01-10 11:07:32 UTC (rev 5425) +++ trunk/doc/release/0.7.0-notes.rst 2009-01-10 11:09:40 UTC (rev 5426) @@ -317,3 +317,15 @@ Most of the code was moved into ``scipy``, some code was made into a ``scikit``, and the remaining code was just deleted as the functionality had been replaced by other code. + +Known problems +-------------- + +Here are known problems with scipy 0.7.0: + +* weave test failures on windows: those are known, and are being worked + on. +* weave test failure with gcc 4.3 (std::labs): this is a gcc 4.3 bug. A + workaround is to add #include in + scipy/weave/blitz/blitz/funcs.h (line 27). You can make the change in + the installed scipy (in site-packages). From scipy-svn at scipy.org Sat Jan 10 06:15:59 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 10 Jan 2009 05:15:59 -0600 (CST) Subject: [Scipy-svn] r5427 - branches/0.7.x/scipy/spatial/tests Message-ID: <20090110111559.C72ABC7C009@scipy.org> Author: cdavid Date: 2009-01-10 05:15:55 -0600 (Sat, 10 Jan 2009) New Revision: 5427 Modified: branches/0.7.x/scipy/spatial/tests/test_distance.py Log: Remove debug print from tests. Modified: branches/0.7.x/scipy/spatial/tests/test_distance.py =================================================================== --- branches/0.7.x/scipy/spatial/tests/test_distance.py 2009-01-10 11:09:40 UTC (rev 5426) +++ branches/0.7.x/scipy/spatial/tests/test_distance.py 2009-01-10 11:15:55 UTC (rev 5427) @@ -1467,7 +1467,6 @@ a = set([]) for n in xrange(2, 16): a.add(n*(n-1)/2) - print a for i in xrange(5, 105): if i not in a: self.failUnlessRaises(ValueError, self.bad_y, i) @@ -1678,7 +1677,6 @@ a = set([]) for n in xrange(2, 16): a.add(n*(n-1)/2) - print a for i in xrange(5, 105): if i not in a: self.failUnlessRaises(ValueError, self.bad_y, i) From scipy-svn at scipy.org Sat Jan 10 06:32:42 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 10 Jan 2009 05:32:42 -0600 (CST) Subject: [Scipy-svn] r5428 - branches/0.7.x/scipy/sparse/linalg/isolve/tests Message-ID: <20090110113242.7F843C7C009@scipy.org> Author: cdavid Date: 2009-01-10 05:32:37 -0600 (Sat, 10 Jan 2009) New Revision: 5428 Modified: branches/0.7.x/scipy/sparse/linalg/isolve/tests/test_iterative.py Log: Tag #842 failure on windows as known failures. Modified: branches/0.7.x/scipy/sparse/linalg/isolve/tests/test_iterative.py =================================================================== --- branches/0.7.x/scipy/sparse/linalg/isolve/tests/test_iterative.py 2009-01-10 11:15:55 UTC (rev 5427) +++ branches/0.7.x/scipy/sparse/linalg/isolve/tests/test_iterative.py 2009-01-10 11:32:37 UTC (rev 5428) @@ -1,6 +1,7 @@ #!/usr/bin/env python """ Test functions for the sparse.linalg.isolve module """ +import sys from numpy.testing import * @@ -63,6 +64,7 @@ #A = spdiags( data, [0,-1], 10, 10, format='csr') #self.cases.append( (A,False,True) ) + @dec.knownfailureif(sys.platform=='win32', "This test is known to fail on windows") def test_maxiter(self): """test whether maxiter is respected""" @@ -82,6 +84,7 @@ assert_equal(len(residuals), 3) assert_equal(info, 3) + @dec.knownfailureif(sys.platform=='win32', "This test is known to fail on windows") def test_convergence(self): """test whether all methods converge""" @@ -102,6 +105,7 @@ assert( norm(b - A*x) < tol*norm(b) ) + @dec.knownfailureif(sys.platform=='win32', "This test is known to fail on windows") def test_precond(self): """test whether all methods accept a trivial preconditioner""" From scipy-svn at scipy.org Sat Jan 10 07:10:18 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 10 Jan 2009 06:10:18 -0600 (CST) Subject: [Scipy-svn] r5429 - trunk/doc/release Message-ID: <20090110121018.4A304C7C011@scipy.org> Author: jarrod.millman Date: 2009-01-10 06:10:16 -0600 (Sat, 10 Jan 2009) New Revision: 5429 Modified: trunk/doc/release/0.7.0-notes.rst Log: reorganize release notes Modified: trunk/doc/release/0.7.0-notes.rst =================================================================== --- trunk/doc/release/0.7.0-notes.rst 2009-01-10 11:32:37 UTC (rev 5428) +++ trunk/doc/release/0.7.0-notes.rst 2009-01-10 12:10:16 UTC (rev 5429) @@ -52,6 +52,72 @@ ported. We are still considering how to make the transition to 3.0, but we currently don't have any timeline or roadmap for this transition. +Major documentation improvements +-------------------------------- + +SciPy documentation is greatly improved; you can +view a HTML reference manual `online `__ or +download it as a PDF file. The new reference guide was built using +the popular `Sphinx tool `__. + +This release also includes an updated tutorial, which hadn't been +available since SciPy was ported to NumPy in 2005. While not +comprehensive, the tutorial shows how to use several essential +parts of Scipy. It also includes the ``ndimage`` documentation +from the ``numarray`` manual. + +Nevertheless, more effort is still needed on the documentation front. +Luckily, contributing to Scipy documentation is now easier than +before: if you find that a part of it requires improvements, and want +to help us out, please register a user name in our web-based +documentation editor at http://docs.scipy.org/ and correct the issues. + +Running Tests +------------- + +NumPy 1.2 introduced a new testing framework based on `nose +`__. Starting with this release SciPy +now uses the new NumPy test framework as well. To take advantage of the new +testing framework requires ``nose`` version 0.10 or later. One major advantage +of the new framework is that it greatly reduces the difficulty of writing unit +tests, which has all ready paid off given the rapid increase in tests. To run +the full test suite:: + + >>> import scipy + >>> scipy.test('full') + +For more information, please see `The NumPy/SciPy Testing Guide +`__. + +We have also greatly improved our test coverage. There were just over 2,000 unit +tests in the 0.6.0 release; this release nearly doubles that number with just over +4,000 unit tests. + +Building SciPy +-------------- + +Support for NumScons has been added. NumScons is a tentative new +build system for NumPy/SciPy, using `SCons `__ at its core. + +SCons is a next-generation build system meant to replace the venerable ``Make`` +with the integrated functionality of ``autoconf``/``automake`` and ``ccache``. +Scons is written in Python and its configuration files are Python scripts. +NumScons is meant to replace NumPy's custom version of ``distutils`` providing +more advanced functionality such as ``autoconf``, improved fortran support, +more tools, and support for ``numpy.distutils``/``scons`` cooperation. + +Sandbox Removed +--------------- + +While porting SciPy to NumPy in 2005, several packages and modules were +moved into ``scipy.sandbox``. The sandbox was a staging ground for packages +that were undergoing rapid development and whose APIs were in flux. It was +also a place where broken code could live. The sandbox has served its purpose +well and was starting to create confusion, so ``scipy.sandbox`` was removed. +Most of the code was moved into ``scipy``, some code was made into a +``scikit``, and the remaining code was just deleted as the functionality had +been replaced by other code. + Sparse Matrices --------------- @@ -90,6 +156,33 @@ Numerous efficiency improvements to format conversions and sparse matrix arithmetic. Finally, this release contains numerous bugfixes. +Statistics package +------------------ + +Statistical functions for masked arrays have been added and are accessible +through ``scipy.stats.mstats``. The functions are similar to their counterparts +in ``scipy.stats`` but they have not yet been verified for identical interfaces +and algorithms. + +Several bugs were fixed for statistical functions, of those, ``kstest`` and +``percentileofscore`` gained new keyword arguments. + +Added deprecation warning for ``mean``, ``median``, ``var``, ``std``, +``cov``, and ``corrcoef``. These functions should be replaced by their +numpy counterparts. Note, however, that some of the default options differ +between the ``scipy.stats`` and numpy versions of these functions. + +Numerous bug fixes to ``stats.distributions``: all generic methods now work +correctly, several methods in individual distributions were corrected. However, +a few issues remain with higher moments (``skew``, ``kurtosis``) and entropy. +The maximum likelihood estimator, ``fit``, does not work out-of-the-box for +some distributions, in some cases, starting values have to be +carefully chosen, in other cases, the generic implementation of the maximum +likelihood method might not be the numerically appropriate estimation method. + +We expect more bugfixes, increases in numerical precision and enhancements in +the next release of scipy. + Reworking of IO package ----------------------- @@ -209,26 +302,6 @@ of increased memory usage. The signature of the ``scipy.linalg.eigh`` changed accordingly. -Major documentation improvements --------------------------------- - -SciPy documentation is greatly improved; you can -view a HTML reference manual `online `__ or -download it as a PDF file. The new reference guide was built using -the popular `Sphinx tool `__. - -This release also includes an updated tutorial, which hadn't been -available since SciPy was ported to NumPy in 2005. While not -comprehensive, the tutorial shows how to use several essential -parts of Scipy. It also includes the ``ndimage`` documentation -from the ``numarray`` manual. - -Nevertheless, more effort is still needed on the documentation front. -Luckily, contributing to Scipy documentation is now easier than -before: if you find that a part of it requires improvements, and want -to help us out, please register a user name in our web-based -documentation editor at http://docs.scipy.org/ and correct the issues. - Bug fixes in the interpolation package -------------------------------------- @@ -238,67 +311,6 @@ Users of ``scipy.interpolate.interp1d`` may need to revise their code if it relies on the incorrect behavior. -Statistics package ------------------- - -Statistical functions for masked arrays have been added and are accessible -through ``scipy.stats.mstats``. The functions are similar to their counterparts -in ``scipy.stats`` but they have not yet been verified for identical interfaces -and algorithms. - -Several bugs were fixed for statistical functions, of those, ``kstest`` and -``percentileofscore`` gained new keyword arguments. - -Added deprecation warning for ``mean``, ``median``, ``var``, ``std``, -``cov``, and ``corrcoef``. These functions should be replaced by their -numpy counterparts. Note, however, that some of the default options differ -between the ``scipy.stats`` and numpy versions of these functions. - -Numerous bug fixes to ``stats.distributions``: all generic methods now work -correctly, several methods in individual distributions were corrected. However, -a few issues remain with higher moments (``skew``, ``kurtosis``) and entropy. -The maximum likelihood estimator, ``fit``, does not work out-of-the-box for -some distributions, in some cases, starting values have to be -carefully chosen, in other cases, the generic implementation of the maximum -likelihood method might not be the numerically appropriate estimation method. - -We expect more bugfixes, increases in numerical precision and enhancements in -the next release of scipy. - -Running Tests -------------- - -NumPy 1.2 introduced a new testing framework based on `nose -`__. Starting with this release SciPy -now uses the new NumPy test framework as well. To take advantage of the new -testing framework requires ``nose`` version 0.10 or later. One major advantage -of the new framework is that it greatly reduces the difficulty of writing unit -tests, which has all ready paid off given the rapid increase in tests. To run -the full test suite:: - - >>> import scipy - >>> scipy.test('full') - -For more information, please see `The NumPy/SciPy Testing Guide -`__. - -We have also greatly improved our test coverage. There were just over 2,000 unit -tests in the 0.6.0 release; this release nearly doubles that number with just over -4,000 unit tests. - -Building SciPy --------------- - -Support for NumScons has been added. NumScons is a tentative new -build system for NumPy/SciPy, using `SCons `__ at its core. - -SCons is a next-generation build system meant to replace the venerable ``Make`` -with the integrated functionality of ``autoconf``/``automake`` and ``ccache``. -Scons is written in Python and its configuration files are Python scripts. -NumScons is meant to replace NumPy's custom version of ``distutils`` providing -more advanced functionality such as ``autoconf``, improved fortran support, -more tools, and support for ``numpy.distutils``/``scons`` cooperation. - Weave clean up -------------- @@ -306,18 +318,6 @@ relicensed by the author to be compatible with the SciPy license. ``wx_spec.py`` was removed. -Sandbox Removed ---------------- - -While porting SciPy to NumPy in 2005, several packages and modules were -moved into ``scipy.sandbox``. The sandbox was a staging ground for packages -that were undergoing rapid development and whose APIs were in flux. It was -also a place where broken code could live. The sandbox has served its purpose -well and was starting to create confusion, so ``scipy.sandbox`` was removed. -Most of the code was moved into ``scipy``, some code was made into a -``scikit``, and the remaining code was just deleted as the functionality had -been replaced by other code. - Known problems -------------- From scipy-svn at scipy.org Sat Jan 10 07:12:59 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 10 Jan 2009 06:12:59 -0600 (CST) Subject: [Scipy-svn] r5430 - branches/0.7.x/doc/release Message-ID: <20090110121259.188DDC7C011@scipy.org> Author: jarrod.millman Date: 2009-01-10 06:12:58 -0600 (Sat, 10 Jan 2009) New Revision: 5430 Modified: branches/0.7.x/doc/release/0.7.0-notes.rst Log: Backport r5429 Modified: branches/0.7.x/doc/release/0.7.0-notes.rst =================================================================== --- branches/0.7.x/doc/release/0.7.0-notes.rst 2009-01-10 12:10:16 UTC (rev 5429) +++ branches/0.7.x/doc/release/0.7.0-notes.rst 2009-01-10 12:12:58 UTC (rev 5430) @@ -52,6 +52,72 @@ ported. We are still considering how to make the transition to 3.0, but we currently don't have any timeline or roadmap for this transition. +Major documentation improvements +-------------------------------- + +SciPy documentation is greatly improved; you can +view a HTML reference manual `online `__ or +download it as a PDF file. The new reference guide was built using +the popular `Sphinx tool `__. + +This release also includes an updated tutorial, which hadn't been +available since SciPy was ported to NumPy in 2005. While not +comprehensive, the tutorial shows how to use several essential +parts of Scipy. It also includes the ``ndimage`` documentation +from the ``numarray`` manual. + +Nevertheless, more effort is still needed on the documentation front. +Luckily, contributing to Scipy documentation is now easier than +before: if you find that a part of it requires improvements, and want +to help us out, please register a user name in our web-based +documentation editor at http://docs.scipy.org/ and correct the issues. + +Running Tests +------------- + +NumPy 1.2 introduced a new testing framework based on `nose +`__. Starting with this release SciPy +now uses the new NumPy test framework as well. To take advantage of the new +testing framework requires ``nose`` version 0.10 or later. One major advantage +of the new framework is that it greatly reduces the difficulty of writing unit +tests, which has all ready paid off given the rapid increase in tests. To run +the full test suite:: + + >>> import scipy + >>> scipy.test('full') + +For more information, please see `The NumPy/SciPy Testing Guide +`__. + +We have also greatly improved our test coverage. There were just over 2,000 unit +tests in the 0.6.0 release; this release nearly doubles that number with just over +4,000 unit tests. + +Building SciPy +-------------- + +Support for NumScons has been added. NumScons is a tentative new +build system for NumPy/SciPy, using `SCons `__ at its core. + +SCons is a next-generation build system meant to replace the venerable ``Make`` +with the integrated functionality of ``autoconf``/``automake`` and ``ccache``. +Scons is written in Python and its configuration files are Python scripts. +NumScons is meant to replace NumPy's custom version of ``distutils`` providing +more advanced functionality such as ``autoconf``, improved fortran support, +more tools, and support for ``numpy.distutils``/``scons`` cooperation. + +Sandbox Removed +--------------- + +While porting SciPy to NumPy in 2005, several packages and modules were +moved into ``scipy.sandbox``. The sandbox was a staging ground for packages +that were undergoing rapid development and whose APIs were in flux. It was +also a place where broken code could live. The sandbox has served its purpose +well and was starting to create confusion, so ``scipy.sandbox`` was removed. +Most of the code was moved into ``scipy``, some code was made into a +``scikit``, and the remaining code was just deleted as the functionality had +been replaced by other code. + Sparse Matrices --------------- @@ -90,6 +156,33 @@ Numerous efficiency improvements to format conversions and sparse matrix arithmetic. Finally, this release contains numerous bugfixes. +Statistics package +------------------ + +Statistical functions for masked arrays have been added and are accessible +through ``scipy.stats.mstats``. The functions are similar to their counterparts +in ``scipy.stats`` but they have not yet been verified for identical interfaces +and algorithms. + +Several bugs were fixed for statistical functions, of those, ``kstest`` and +``percentileofscore`` gained new keyword arguments. + +Added deprecation warning for ``mean``, ``median``, ``var``, ``std``, +``cov``, and ``corrcoef``. These functions should be replaced by their +numpy counterparts. Note, however, that some of the default options differ +between the ``scipy.stats`` and numpy versions of these functions. + +Numerous bug fixes to ``stats.distributions``: all generic methods now work +correctly, several methods in individual distributions were corrected. However, +a few issues remain with higher moments (``skew``, ``kurtosis``) and entropy. +The maximum likelihood estimator, ``fit``, does not work out-of-the-box for +some distributions, in some cases, starting values have to be +carefully chosen, in other cases, the generic implementation of the maximum +likelihood method might not be the numerically appropriate estimation method. + +We expect more bugfixes, increases in numerical precision and enhancements in +the next release of scipy. + Reworking of IO package ----------------------- @@ -209,26 +302,6 @@ of increased memory usage. The signature of the ``scipy.linalg.eigh`` changed accordingly. -Major documentation improvements --------------------------------- - -SciPy documentation is greatly improved; you can -view a HTML reference manual `online `__ or -download it as a PDF file. The new reference guide was built using -the popular `Sphinx tool `__. - -This release also includes an updated tutorial, which hadn't been -available since SciPy was ported to NumPy in 2005. While not -comprehensive, the tutorial shows how to use several essential -parts of Scipy. It also includes the ``ndimage`` documentation -from the ``numarray`` manual. - -Nevertheless, more effort is still needed on the documentation front. -Luckily, contributing to Scipy documentation is now easier than -before: if you find that a part of it requires improvements, and want -to help us out, please register a user name in our web-based -documentation editor at http://docs.scipy.org/ and correct the issues. - Bug fixes in the interpolation package -------------------------------------- @@ -238,67 +311,6 @@ Users of ``scipy.interpolate.interp1d`` may need to revise their code if it relies on the incorrect behavior. -Statistics package ------------------- - -Statistical functions for masked arrays have been added and are accessible -through ``scipy.stats.mstats``. The functions are similar to their counterparts -in ``scipy.stats`` but they have not yet been verified for identical interfaces -and algorithms. - -Several bugs were fixed for statistical functions, of those, ``kstest`` and -``percentileofscore`` gained new keyword arguments. - -Added deprecation warning for ``mean``, ``median``, ``var``, ``std``, -``cov``, and ``corrcoef``. These functions should be replaced by their -numpy counterparts. Note, however, that some of the default options differ -between the ``scipy.stats`` and numpy versions of these functions. - -Numerous bug fixes to ``stats.distributions``: all generic methods now work -correctly, several methods in individual distributions were corrected. However, -a few issues remain with higher moments (``skew``, ``kurtosis``) and entropy. -The maximum likelihood estimator, ``fit``, does not work out-of-the-box for -some distributions, in some cases, starting values have to be -carefully chosen, in other cases, the generic implementation of the maximum -likelihood method might not be the numerically appropriate estimation method. - -We expect more bugfixes, increases in numerical precision and enhancements in -the next release of scipy. - -Running Tests -------------- - -NumPy 1.2 introduced a new testing framework based on `nose -`__. Starting with this release SciPy -now uses the new NumPy test framework as well. To take advantage of the new -testing framework requires ``nose`` version 0.10 or later. One major advantage -of the new framework is that it greatly reduces the difficulty of writing unit -tests, which has all ready paid off given the rapid increase in tests. To run -the full test suite:: - - >>> import scipy - >>> scipy.test('full') - -For more information, please see `The NumPy/SciPy Testing Guide -`__. - -We have also greatly improved our test coverage. There were just over 2,000 unit -tests in the 0.6.0 release; this release nearly doubles that number with just over -4,000 unit tests. - -Building SciPy --------------- - -Support for NumScons has been added. NumScons is a tentative new -build system for NumPy/SciPy, using `SCons `__ at its core. - -SCons is a next-generation build system meant to replace the venerable ``Make`` -with the integrated functionality of ``autoconf``/``automake`` and ``ccache``. -Scons is written in Python and its configuration files are Python scripts. -NumScons is meant to replace NumPy's custom version of ``distutils`` providing -more advanced functionality such as ``autoconf``, improved fortran support, -more tools, and support for ``numpy.distutils``/``scons`` cooperation. - Weave clean up -------------- @@ -306,18 +318,6 @@ relicensed by the author to be compatible with the SciPy license. ``wx_spec.py`` was removed. -Sandbox Removed ---------------- - -While porting SciPy to NumPy in 2005, several packages and modules were -moved into ``scipy.sandbox``. The sandbox was a staging ground for packages -that were undergoing rapid development and whose APIs were in flux. It was -also a place where broken code could live. The sandbox has served its purpose -well and was starting to create confusion, so ``scipy.sandbox`` was removed. -Most of the code was moved into ``scipy``, some code was made into a -``scikit``, and the remaining code was just deleted as the functionality had -been replaced by other code. - Known problems -------------- From scipy-svn at scipy.org Sat Jan 10 09:04:49 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 10 Jan 2009 08:04:49 -0600 (CST) Subject: [Scipy-svn] r5431 - branches/0.7.x/scipy/weave/tests Message-ID: <20090110140449.728B0C7C011@scipy.org> Author: cdavid Date: 2009-01-10 08:04:45 -0600 (Sat, 10 Jan 2009) New Revision: 5431 Modified: branches/0.7.x/scipy/weave/tests/test_scxx_dict.py Log: Tag some known failures with weave on windows. Modified: branches/0.7.x/scipy/weave/tests/test_scxx_dict.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_scxx_dict.py 2009-01-10 12:12:58 UTC (rev 5430) +++ branches/0.7.x/scipy/weave/tests/test_scxx_dict.py 2009-01-10 14:04:45 UTC (rev 5431) @@ -26,6 +26,7 @@ class TestDictHasKey(TestCase): + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_obj(self): class Foo: @@ -38,6 +39,7 @@ """ res = inline_tools.inline(code,['a','key']) assert res + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_int(self): a = {} @@ -47,6 +49,7 @@ """ res = inline_tools.inline(code,['a']) assert res + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_double(self): a = {} @@ -56,6 +59,7 @@ """ res = inline_tools.inline(code,['a']) assert res + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_complex(self): a = {} @@ -67,6 +71,7 @@ res = inline_tools.inline(code,['a','key']) assert res + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_string(self): a = {} @@ -76,6 +81,7 @@ """ res = inline_tools.inline(code,['a']) assert res + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_std_string(self): a = {} @@ -86,6 +92,7 @@ """ res = inline_tools.inline(code,['a','key_name']) assert res + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_string_fail(self): a = {} @@ -105,6 +112,7 @@ res = inline_tools.inline(code,args) assert res == a['b'] + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_char(self): self.generic_get('return_val = a["b"];') @@ -119,11 +127,13 @@ except KeyError: pass + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_string(self): self.generic_get('return_val = a[std::string("b")];') + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_obj(self): code = """ @@ -177,22 +187,27 @@ assert before == after assert before_overwritten == after_overwritten + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_new_int_int(self): key,val = 1234,12345 self.generic_new(key,val) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_new_double_int(self): key,val = 1234.,12345 self.generic_new(key,val) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_new_std_string_int(self): key,val = "hello",12345 self.generic_new(key,val) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_new_complex_int(self): key,val = 1+1j,12345 self.generic_new(key,val) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_new_obj_int(self): class Foo: @@ -200,22 +215,27 @@ key,val = Foo(),12345 self.generic_new(key,val) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_overwrite_int_int(self): key,val = 1234,12345 self.generic_overwrite(key,val) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_overwrite_double_int(self): key,val = 1234.,12345 self.generic_overwrite(key,val) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_overwrite_std_string_int(self): key,val = "hello",12345 self.generic_overwrite(key,val) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_overwrite_complex_int(self): key,val = 1+1j,12345 self.generic_overwrite(key,val) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_overwrite_obj_int(self): class Foo: @@ -239,22 +259,27 @@ after = sys.getrefcount(a), sys.getrefcount(key) assert before[0] == after[0] assert before[1] == after[1] + 1 + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_int(self): key = 1234 self.generic(key) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_double(self): key = 1234. self.generic(key) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_std_string(self): key = "hello" self.generic(key) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_complex(self): key = 1+1j self.generic(key) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_obj(self): class Foo: @@ -263,30 +288,35 @@ self.generic(key) class TestDictOthers(TestCase): + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_clear(self): a = {} a["hello"] = 1 inline_tools.inline("a.clear();",['a']) assert not a + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_items(self): a = {} a["hello"] = 1 items = inline_tools.inline("return_val = a.items();",['a']) assert items == a.items() + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_values(self): a = {} a["hello"] = 1 values = inline_tools.inline("return_val = a.values();",['a']) assert values == a.values() + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_keys(self): a = {} a["hello"] = 1 keys = inline_tools.inline("return_val = a.keys();",['a']) assert keys == a.keys() + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_update(self): a,b = {},{} @@ -296,4 +326,4 @@ assert a == b if __name__ == "__main__": - nose.run(argv=['', __file__]) + run_module_suite() From scipy-svn at scipy.org Sat Jan 10 12:49:37 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 10 Jan 2009 11:49:37 -0600 (CST) Subject: [Scipy-svn] r5432 - branches/0.7.x/scipy/weave/tests Message-ID: <20090110174937.88779C7C011@scipy.org> Author: cdavid Date: 2009-01-10 11:49:21 -0600 (Sat, 10 Jan 2009) New Revision: 5432 Modified: branches/0.7.x/scipy/weave/tests/test_ast_tools.py branches/0.7.x/scipy/weave/tests/test_blitz_tools.py branches/0.7.x/scipy/weave/tests/test_build_tools.py branches/0.7.x/scipy/weave/tests/test_c_spec.py branches/0.7.x/scipy/weave/tests/test_catalog.py branches/0.7.x/scipy/weave/tests/test_ext_tools.py branches/0.7.x/scipy/weave/tests/test_inline_tools.py branches/0.7.x/scipy/weave/tests/test_numpy_scalar_spec.py branches/0.7.x/scipy/weave/tests/test_scxx_dict.py branches/0.7.x/scipy/weave/tests/test_scxx_object.py branches/0.7.x/scipy/weave/tests/test_scxx_sequence.py branches/0.7.x/scipy/weave/tests/test_size_check.py branches/0.7.x/scipy/weave/tests/test_slice_handler.py branches/0.7.x/scipy/weave/tests/test_standard_array_spec.py Log: Fix missing nose import. Modified: branches/0.7.x/scipy/weave/tests/test_ast_tools.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_ast_tools.py 2009-01-10 14:04:45 UTC (rev 5431) +++ branches/0.7.x/scipy/weave/tests/test_ast_tools.py 2009-01-10 17:49:21 UTC (rev 5432) @@ -23,4 +23,5 @@ self.generic_check(expr,desired) if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) Modified: branches/0.7.x/scipy/weave/tests/test_blitz_tools.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_blitz_tools.py 2009-01-10 14:04:45 UTC (rev 5431) +++ branches/0.7.x/scipy/weave/tests/test_blitz_tools.py 2009-01-10 17:49:21 UTC (rev 5432) @@ -178,4 +178,5 @@ self.generic_2d(expr,complex128) if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) Modified: branches/0.7.x/scipy/weave/tests/test_build_tools.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_build_tools.py 2009-01-10 14:04:45 UTC (rev 5431) +++ branches/0.7.x/scipy/weave/tests/test_build_tools.py 2009-01-10 17:49:21 UTC (rev 5432) @@ -62,4 +62,5 @@ assert(pre_argv == sys.argv[:]) if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) Modified: branches/0.7.x/scipy/weave/tests/test_c_spec.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_c_spec.py 2009-01-10 14:04:45 UTC (rev 5431) +++ branches/0.7.x/scipy/weave/tests/test_c_spec.py 2009-01-10 17:49:21 UTC (rev 5432) @@ -740,4 +740,5 @@ # if _n[:7]=='TestGcc': exec 'del '+_n # if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) Modified: branches/0.7.x/scipy/weave/tests/test_catalog.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_catalog.py 2009-01-10 14:04:45 UTC (rev 5431) +++ branches/0.7.x/scipy/weave/tests/test_catalog.py 2009-01-10 17:49:21 UTC (rev 5432) @@ -328,4 +328,5 @@ if __name__ == '__main__': + import nose nose.run(argv=['', __file__]) Modified: branches/0.7.x/scipy/weave/tests/test_ext_tools.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_ext_tools.py 2009-01-10 14:04:45 UTC (rev 5431) +++ branches/0.7.x/scipy/weave/tests/test_ext_tools.py 2009-01-10 17:49:21 UTC (rev 5432) @@ -139,4 +139,5 @@ assert_equal(actual,desired) if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) Modified: branches/0.7.x/scipy/weave/tests/test_inline_tools.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_inline_tools.py 2009-01-10 14:04:45 UTC (rev 5431) +++ branches/0.7.x/scipy/weave/tests/test_inline_tools.py 2009-01-10 17:49:21 UTC (rev 5432) @@ -42,4 +42,5 @@ ## pass if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) Modified: branches/0.7.x/scipy/weave/tests/test_numpy_scalar_spec.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_numpy_scalar_spec.py 2009-01-10 14:04:45 UTC (rev 5431) +++ branches/0.7.x/scipy/weave/tests/test_numpy_scalar_spec.py 2009-01-10 17:49:21 UTC (rev 5432) @@ -151,4 +151,5 @@ if _n[:7]=='TestGcc': exec 'del '+_n if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) Modified: branches/0.7.x/scipy/weave/tests/test_scxx_dict.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_scxx_dict.py 2009-01-10 14:04:45 UTC (rev 5431) +++ branches/0.7.x/scipy/weave/tests/test_scxx_dict.py 2009-01-10 17:49:21 UTC (rev 5432) @@ -326,4 +326,5 @@ assert a == b if __name__ == "__main__": - run_module_suite() + import nose + nose.run(argv=['', __file__]) Modified: branches/0.7.x/scipy/weave/tests/test_scxx_object.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_scxx_object.py 2009-01-10 14:04:45 UTC (rev 5431) +++ branches/0.7.x/scipy/weave/tests/test_scxx_object.py 2009-01-10 17:49:21 UTC (rev 5432) @@ -891,4 +891,5 @@ assert_equal(a['first'],a['second']) if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) Modified: branches/0.7.x/scipy/weave/tests/test_scxx_sequence.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_scxx_sequence.py 2009-01-10 14:04:45 UTC (rev 5431) +++ branches/0.7.x/scipy/weave/tests/test_scxx_sequence.py 2009-01-10 17:49:21 UTC (rev 5432) @@ -450,4 +450,5 @@ assert b == desired if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) Modified: branches/0.7.x/scipy/weave/tests/test_size_check.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_size_check.py 2009-01-10 14:04:45 UTC (rev 5431) +++ branches/0.7.x/scipy/weave/tests/test_size_check.py 2009-01-10 17:49:21 UTC (rev 5432) @@ -365,4 +365,5 @@ if __name__ == "__main__": + import nose run_module_suite() Modified: branches/0.7.x/scipy/weave/tests/test_slice_handler.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_slice_handler.py 2009-01-10 14:04:45 UTC (rev 5431) +++ branches/0.7.x/scipy/weave/tests/test_slice_handler.py 2009-01-10 17:49:21 UTC (rev 5432) @@ -144,4 +144,5 @@ if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) Modified: branches/0.7.x/scipy/weave/tests/test_standard_array_spec.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_standard_array_spec.py 2009-01-10 14:04:45 UTC (rev 5431) +++ branches/0.7.x/scipy/weave/tests/test_standard_array_spec.py 2009-01-10 17:49:21 UTC (rev 5432) @@ -21,4 +21,5 @@ assert(s.type_match(arange(4))) if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) From scipy-svn at scipy.org Sat Jan 10 12:58:53 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 10 Jan 2009 11:58:53 -0600 (CST) Subject: [Scipy-svn] r5433 - trunk/scipy/weave/tests Message-ID: <20090110175853.8E3F0C7C016@scipy.org> Author: cdavid Date: 2009-01-10 11:58:41 -0600 (Sat, 10 Jan 2009) New Revision: 5433 Modified: trunk/scipy/weave/tests/test_ast_tools.py trunk/scipy/weave/tests/test_blitz_tools.py trunk/scipy/weave/tests/test_build_tools.py trunk/scipy/weave/tests/test_c_spec.py trunk/scipy/weave/tests/test_catalog.py trunk/scipy/weave/tests/test_ext_tools.py trunk/scipy/weave/tests/test_inline_tools.py trunk/scipy/weave/tests/test_numpy_scalar_spec.py trunk/scipy/weave/tests/test_scxx_dict.py trunk/scipy/weave/tests/test_scxx_object.py trunk/scipy/weave/tests/test_scxx_sequence.py trunk/scipy/weave/tests/test_size_check.py trunk/scipy/weave/tests/test_slice_handler.py trunk/scipy/weave/tests/test_standard_array_spec.py Log: 'forward'-port missing nose imports from 0.7.x branch (r5432). Modified: trunk/scipy/weave/tests/test_ast_tools.py =================================================================== --- trunk/scipy/weave/tests/test_ast_tools.py 2009-01-10 17:49:21 UTC (rev 5432) +++ trunk/scipy/weave/tests/test_ast_tools.py 2009-01-10 17:58:41 UTC (rev 5433) @@ -23,4 +23,5 @@ self.generic_check(expr,desired) if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) Modified: trunk/scipy/weave/tests/test_blitz_tools.py =================================================================== --- trunk/scipy/weave/tests/test_blitz_tools.py 2009-01-10 17:49:21 UTC (rev 5432) +++ trunk/scipy/weave/tests/test_blitz_tools.py 2009-01-10 17:58:41 UTC (rev 5433) @@ -178,4 +178,5 @@ self.generic_2d(expr,complex128) if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) Modified: trunk/scipy/weave/tests/test_build_tools.py =================================================================== --- trunk/scipy/weave/tests/test_build_tools.py 2009-01-10 17:49:21 UTC (rev 5432) +++ trunk/scipy/weave/tests/test_build_tools.py 2009-01-10 17:58:41 UTC (rev 5433) @@ -62,4 +62,5 @@ assert(pre_argv == sys.argv[:]) if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) Modified: trunk/scipy/weave/tests/test_c_spec.py =================================================================== --- trunk/scipy/weave/tests/test_c_spec.py 2009-01-10 17:49:21 UTC (rev 5432) +++ trunk/scipy/weave/tests/test_c_spec.py 2009-01-10 17:58:41 UTC (rev 5433) @@ -740,4 +740,5 @@ # if _n[:7]=='TestGcc': exec 'del '+_n # if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) Modified: trunk/scipy/weave/tests/test_catalog.py =================================================================== --- trunk/scipy/weave/tests/test_catalog.py 2009-01-10 17:49:21 UTC (rev 5432) +++ trunk/scipy/weave/tests/test_catalog.py 2009-01-10 17:58:41 UTC (rev 5433) @@ -328,4 +328,5 @@ if __name__ == '__main__': + import nose nose.run(argv=['', __file__]) Modified: trunk/scipy/weave/tests/test_ext_tools.py =================================================================== --- trunk/scipy/weave/tests/test_ext_tools.py 2009-01-10 17:49:21 UTC (rev 5432) +++ trunk/scipy/weave/tests/test_ext_tools.py 2009-01-10 17:58:41 UTC (rev 5433) @@ -138,4 +138,5 @@ assert_equal(actual,desired) if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) Modified: trunk/scipy/weave/tests/test_inline_tools.py =================================================================== --- trunk/scipy/weave/tests/test_inline_tools.py 2009-01-10 17:49:21 UTC (rev 5432) +++ trunk/scipy/weave/tests/test_inline_tools.py 2009-01-10 17:58:41 UTC (rev 5433) @@ -42,4 +42,5 @@ ## pass if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) Modified: trunk/scipy/weave/tests/test_numpy_scalar_spec.py =================================================================== --- trunk/scipy/weave/tests/test_numpy_scalar_spec.py 2009-01-10 17:49:21 UTC (rev 5432) +++ trunk/scipy/weave/tests/test_numpy_scalar_spec.py 2009-01-10 17:58:41 UTC (rev 5433) @@ -151,4 +151,5 @@ if _n[:7]=='TestGcc': exec 'del '+_n if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) Modified: trunk/scipy/weave/tests/test_scxx_dict.py =================================================================== --- trunk/scipy/weave/tests/test_scxx_dict.py 2009-01-10 17:49:21 UTC (rev 5432) +++ trunk/scipy/weave/tests/test_scxx_dict.py 2009-01-10 17:58:41 UTC (rev 5433) @@ -296,4 +296,5 @@ assert a == b if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) Modified: trunk/scipy/weave/tests/test_scxx_object.py =================================================================== --- trunk/scipy/weave/tests/test_scxx_object.py 2009-01-10 17:49:21 UTC (rev 5432) +++ trunk/scipy/weave/tests/test_scxx_object.py 2009-01-10 17:58:41 UTC (rev 5433) @@ -892,4 +892,5 @@ assert_equal(a['first'],a['second']) if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) Modified: trunk/scipy/weave/tests/test_scxx_sequence.py =================================================================== --- trunk/scipy/weave/tests/test_scxx_sequence.py 2009-01-10 17:49:21 UTC (rev 5432) +++ trunk/scipy/weave/tests/test_scxx_sequence.py 2009-01-10 17:58:41 UTC (rev 5433) @@ -450,4 +450,5 @@ assert b == desired if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) Modified: trunk/scipy/weave/tests/test_size_check.py =================================================================== --- trunk/scipy/weave/tests/test_size_check.py 2009-01-10 17:49:21 UTC (rev 5432) +++ trunk/scipy/weave/tests/test_size_check.py 2009-01-10 17:58:41 UTC (rev 5433) @@ -365,4 +365,5 @@ if __name__ == "__main__": + import nose run_module_suite() Modified: trunk/scipy/weave/tests/test_slice_handler.py =================================================================== --- trunk/scipy/weave/tests/test_slice_handler.py 2009-01-10 17:49:21 UTC (rev 5432) +++ trunk/scipy/weave/tests/test_slice_handler.py 2009-01-10 17:58:41 UTC (rev 5433) @@ -144,4 +144,5 @@ if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) Modified: trunk/scipy/weave/tests/test_standard_array_spec.py =================================================================== --- trunk/scipy/weave/tests/test_standard_array_spec.py 2009-01-10 17:49:21 UTC (rev 5432) +++ trunk/scipy/weave/tests/test_standard_array_spec.py 2009-01-10 17:58:41 UTC (rev 5433) @@ -21,4 +21,5 @@ assert(s.type_match(arange(4))) if __name__ == "__main__": + import nose nose.run(argv=['', __file__]) From scipy-svn at scipy.org Sun Jan 11 12:58:00 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 11 Jan 2009 11:58:00 -0600 (CST) Subject: [Scipy-svn] r5434 - branches/0.7.x/doc/release Message-ID: <20090111175800.DA92AC7C011@scipy.org> Author: stefan Date: 2009-01-11 11:57:52 -0600 (Sun, 11 Jan 2009) New Revision: 5434 Modified: branches/0.7.x/doc/release/0.7.0-notes.rst Log: Backport language review of release notes. Modified: branches/0.7.x/doc/release/0.7.0-notes.rst =================================================================== --- branches/0.7.x/doc/release/0.7.0-notes.rst 2009-01-10 17:58:41 UTC (rev 5433) +++ branches/0.7.x/doc/release/0.7.0-notes.rst 2009-01-11 17:57:52 UTC (rev 5434) @@ -4,33 +4,33 @@ .. contents:: -SciPy 0.7.0 is the culmination of 16 months of hard work and -and contains many new features, numerous bug-fixes, improved test -coverage, and better documentation. There have been a number of +SciPy 0.7.0 is the culmination of 16 months of hard work. It contains many new features, numerous bug-fixes, improved test +coverage and better documentation. There have been a number of deprecations and API changes in this release, which are documented -below. All users are encouraged to upgrade to this release as +below. All users are encouraged to upgrade to this release, as there are a large number of bug-fixes and optimizations. Moreover, our development attention will now shift to bug-fix releases on the -0.7.x branch and new feature on the development trunk. This release +0.7.x branch, and on adding new features on the development trunk. This release requires Python 2.4 or 2.5 and NumPy 1.2 or greater. -Please note that SciPy is still considered "Beta" status as we work +Please note that SciPy is still considered to have "Beta" status, as we work toward a SciPy 1.0.0 release. The 1.0.0 release will mark a major -step in the development of SciPy after which changing the package -structure or API will be much more difficult. While these pre-1.0 -releases are considered "Beta" status, we are committed to making +milestone in the development of SciPy, after which changing the package +structure or API will be much more difficult. Whilst these pre-1.0 +releases are considered to have "Beta" status, we are committed to making them as bug-free as possible. For example, in addition to fixing numerous bugs in this release, we have also doubled the number of unit tests since the last release. -However, until the 1.0 release we are aggressively reviewing and -refining the functionality, organization, and interface in an effort +However, until the 1.0 release, we are aggressively reviewing and +refining the functionality, organization, and interface. This is being +done in an effort to make the package as coherent, intuitive, and useful as possible. To achieve this, we need help from the community of users. Specifically, -we need feedback about all aspects of the project--everything from which -algorithms we implement to details about our function's call signatures. +we need feedback regarding all aspects of the project - everything - from which +algorithms we implement, to details about our function's call signatures. -Over the last year, we have seen an rapid increase in community involvement +Over the last year, we have seen a rapid increase in community involvement, and numerous infrastructure improvements to lower the barrier to contributions (e.g., more explicit coding standards, improved testing infrastructure, better documentation tools). Over the next year, we hope to see this trend continue @@ -44,13 +44,12 @@ The main issue with 2.6 support is NumPy. On UNIX (including Mac OS X), NumPy 1.2.1 mostly works, with a few caveats. On Windows, there are problems related to the compilation process. The upcoming NumPy 1.3 release will fix -these issues. Any remaining issues with 2.6 support for SciPy 0.7 will +these problems. Any remaining issues with 2.6 support for SciPy 0.7 will be addressed in a bug-fix release. -Python 3.0 is not supported at all: it requires NumPy to be ported to -Python 3.0, which is a massive effort, since a lot of C code has to be -ported. We are still considering how to make the transition to 3.0, but we -currently don't have any timeline or roadmap for this transition. +Python 3.0 is not supported at all; it requires NumPy to be ported to +Python 3.0. This requires immense effort, since a lot of C code has to be +ported. The transition to 3.0 is still under consideration; currently, we don't have any timeline or roadmap for this transition. Major documentation improvements -------------------------------- @@ -61,12 +60,12 @@ the popular `Sphinx tool `__. This release also includes an updated tutorial, which hadn't been -available since SciPy was ported to NumPy in 2005. While not +available since SciPy was ported to NumPy in 2005. Though not comprehensive, the tutorial shows how to use several essential parts of Scipy. It also includes the ``ndimage`` documentation from the ``numarray`` manual. -Nevertheless, more effort is still needed on the documentation front. +Nevertheless, more effort is needed on the documentation front. Luckily, contributing to Scipy documentation is now easier than before: if you find that a part of it requires improvements, and want to help us out, please register a user name in our web-based @@ -76,11 +75,11 @@ ------------- NumPy 1.2 introduced a new testing framework based on `nose -`__. Starting with this release SciPy -now uses the new NumPy test framework as well. To take advantage of the new -testing framework requires ``nose`` version 0.10 or later. One major advantage -of the new framework is that it greatly reduces the difficulty of writing unit -tests, which has all ready paid off given the rapid increase in tests. To run +`__. Starting with this release, SciPy +now uses the new NumPy test framework as well. Taking advantage of the new +testing framework requires ``nose`` version 0.10, or later. One major advantage +of the new framework is that it greatly simplifies writing unit +tests - which has all ready paid off, given the rapid increase in tests. To run the full test suite:: >>> import scipy @@ -90,7 +89,7 @@ `__. We have also greatly improved our test coverage. There were just over 2,000 unit -tests in the 0.6.0 release; this release nearly doubles that number with just over +tests in the 0.6.0 release; this release nearly doubles that number, with just over 4,000 unit tests. Building SciPy @@ -99,11 +98,11 @@ Support for NumScons has been added. NumScons is a tentative new build system for NumPy/SciPy, using `SCons `__ at its core. -SCons is a next-generation build system meant to replace the venerable ``Make`` +SCons is a next-generation build system, intended to replace the venerable ``Make`` with the integrated functionality of ``autoconf``/``automake`` and ``ccache``. Scons is written in Python and its configuration files are Python scripts. NumScons is meant to replace NumPy's custom version of ``distutils`` providing -more advanced functionality such as ``autoconf``, improved fortran support, +more advanced functionality, such as ``autoconf``, improved fortran support, more tools, and support for ``numpy.distutils``/``scons`` cooperation. Sandbox Removed @@ -113,9 +112,9 @@ moved into ``scipy.sandbox``. The sandbox was a staging ground for packages that were undergoing rapid development and whose APIs were in flux. It was also a place where broken code could live. The sandbox has served its purpose -well and was starting to create confusion, so ``scipy.sandbox`` was removed. +well, but was starting to create confusion. Thus ``scipy.sandbox`` was removed. Most of the code was moved into ``scipy``, some code was made into a -``scikit``, and the remaining code was just deleted as the functionality had +``scikit``, and the remaining code was just deleted, as the functionality had been replaced by other code. Sparse Matrices @@ -154,12 +153,12 @@ * ``A = csr_matrix( rand(3,3) )`` and ``B = lil_matrix( [[1,2],[3,4]] )`` Numerous efficiency improvements to format conversions and sparse matrix -arithmetic. Finally, this release contains numerous bugfixes. +arithmetic have been made. Finally, this release contains numerous bugfixes. Statistics package ------------------ -Statistical functions for masked arrays have been added and are accessible +Statistical functions for masked arrays have been added, and are accessible through ``scipy.stats.mstats``. The functions are similar to their counterparts in ``scipy.stats`` but they have not yet been verified for identical interfaces and algorithms. @@ -176,7 +175,7 @@ correctly, several methods in individual distributions were corrected. However, a few issues remain with higher moments (``skew``, ``kurtosis``) and entropy. The maximum likelihood estimator, ``fit``, does not work out-of-the-box for -some distributions, in some cases, starting values have to be +some distributions - in some cases, starting values have to be carefully chosen, in other cases, the generic implementation of the maximum likelihood method might not be the numerically appropriate estimation method. @@ -186,7 +185,7 @@ Reworking of IO package ----------------------- -The IO code in both NumPy and SciPy is undergoing a major reworking. NumPy +The IO code in both NumPy and SciPy is being extensively reworked. NumPy will be where basic code for reading and writing NumPy arrays is located, while SciPy will house file readers and writers for various data formats (data, audio, video, images, matlab, etc.). @@ -224,26 +223,26 @@ between descendants. The ``fcluster`` and ``fclusterdata`` functions transform a hierarchical clustering into a set of flat clusters. Since these flat clusters are generated by cutting the tree into a forest of -trees, the ``leaders`` function takes a linkage and a flat clustering +trees, the ``leaders`` function takes a linkage and a flat clustering, and finds the root of each tree in the forest. The ``ClusterNode`` class represents a hierarchical clusterings as a field-navigable tree object. ``to_tree`` converts a matrix-encoded hierarchical clustering to a ``ClusterNode`` object. Routines for converting between MATLAB and SciPy linkage encodings are provided. Finally, a ``dendrogram`` -function plots hierarchical clusterings as a dendrogram using +function plots hierarchical clusterings as a dendrogram, using matplotlib. New Spatial package ------------------- -Collection of spatial algorithms and data structures useful for spatial -statistics and clustering applications. Includes fast compiled code for +The new spatial package contains a collection of spatial algorithms and data structures, useful for spatial +statistics and clustering applications. It includes rapidly compiled code for computing exact and approximate nearest neighbors, as well as a pure-python -kd-tree with the same interface but that supports annotation and a variety -of other algorithms. The API for both modules may change somewhat as user +kd-tree with the same interface, but that supports annotation and a variety +of other algorithms. The API for both modules may change somewhat, as user requirements become clearer. -Also includes a ``distance`` module containing a collection of +It also includes a ``distance`` module, containing a collection of distance and dissimilarity functions for computing distances between vectors, which is useful for spatial statistics, clustering, and kd-trees. Distance and dissimilarity functions provided include @@ -256,7 +255,7 @@ unordered pairs of vectors in a set of vectors. The ``cdist`` computes the distance on all pairs of vectors in the Cartesian product of two sets of vectors. Pairwise distance matrices are stored in condensed -form, only the upper triangular is stored. ``squareform`` converts +form; only the upper triangular is stored. ``squareform`` converts distance matrices between square and condensed forms. Reworked fftpack package @@ -264,7 +263,7 @@ FFTW2, FFTW3, MKL and DJBFFT wrappers have been removed. Only (NETLIB) fftpack remains. By focusing on one backend, we hope to add new -features -- like float32 support -- more easily. +features - like float32 support - more easily. New Constants package --------------------- @@ -274,7 +273,7 @@ Values of the Fundamental Physical Constants: 2002. They may be found at physics.nist.gov/constants. The values are stored in the dictionary physical_constants as a tuple containing the value, the units, and -the relative precision, in that order. All constants are in SI units +the relative precision - in that order. All constants are in SI units, unless otherwise stated. Several helper functions are provided. New Radial Basis Function module @@ -297,8 +296,8 @@ ``scipy.linalg.eigh`` now contains wrappers for more LAPACK symmetric and hermitian eigenvalue problem solvers. Users -can now solve generalized problems, select just a range of -eigenvalues, and choose to use a faster algorithm at the expense +can now solve generalized problems, select a range of +eigenvalues only, and choose to use a faster algorithm at the expense of increased memory usage. The signature of the ``scipy.linalg.eigh`` changed accordingly. @@ -306,7 +305,7 @@ -------------------------------------- The shape of return values from ``scipy.interpolate.interp1d`` used -to be incorrect if interpolated data had more than 2 dimensions and +to be incorrect, if interpolated data had more than 2 dimensions and the axis keyword was set to a non-default value. This has been fixed. Users of ``scipy.interpolate.interp1d`` may need to revise their code if it relies on the incorrect behavior. @@ -323,8 +322,7 @@ Here are known problems with scipy 0.7.0: -* weave test failures on windows: those are known, and are being worked - on. +* weave test failures on windows: those are known, and are being revised. * weave test failure with gcc 4.3 (std::labs): this is a gcc 4.3 bug. A workaround is to add #include in scipy/weave/blitz/blitz/funcs.h (line 27). You can make the change in From scipy-svn at scipy.org Sun Jan 11 22:36:48 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 11 Jan 2009 21:36:48 -0600 (CST) Subject: [Scipy-svn] r5435 - in trunk/scipy/stsci: . image image/lib image/tests Message-ID: <20090112033648.3DC7EC7C016@scipy.org> Author: chanley Date: 2009-01-11 21:36:28 -0600 (Sun, 11 Jan 2009) New Revision: 5435 Added: trunk/scipy/stsci/image/tests/ trunk/scipy/stsci/image/tests/test_average.py trunk/scipy/stsci/image/tests/test_median.py trunk/scipy/stsci/image/tests/test_minimum.py trunk/scipy/stsci/image/tests/test_threshold.py Modified: trunk/scipy/stsci/__init__.py trunk/scipy/stsci/image/lib/__init__.py trunk/scipy/stsci/image/setup.py Log: Adding nose tests for stsci.stsci.image module Modified: trunk/scipy/stsci/__init__.py =================================================================== --- trunk/scipy/stsci/__init__.py 2009-01-11 17:57:52 UTC (rev 5434) +++ trunk/scipy/stsci/__init__.py 2009-01-12 03:36:28 UTC (rev 5435) @@ -4,5 +4,4 @@ __all__ = ['convolve','image'] from numpy.testing import Tester -test = Tester().test - +test = Tester().test \ No newline at end of file Modified: trunk/scipy/stsci/image/lib/__init__.py =================================================================== --- trunk/scipy/stsci/image/lib/__init__.py 2009-01-11 17:57:52 UTC (rev 5434) +++ trunk/scipy/stsci/image/lib/__init__.py 2009-01-12 03:36:28 UTC (rev 5435) @@ -3,27 +3,8 @@ from combine import * __version__ = '2.0' -if sys.version_info < (2,4): - def test(): - import doctest, _image, combine - t = doctest.Tester(globs = globals()) +def test(level=1, verbosity=1): + from numpy.testing import Tester + return Tester().test(level,verbosity) - t.rundict(_image.__dict__, "_image") - t.rundict(combine.__dict__, "combine") - - return t.summarize() - -else: - def test(): - import doctest, _image, combine - - finder=doctest.DocTestFinder() - tests=finder.find(_image) - tests.extend(finder.find(combine)) - - runner=doctest.DocTestRunner(verbose=False) - - for test in tests: - runner.run(test) - return runner.summarize() Modified: trunk/scipy/stsci/image/setup.py =================================================================== --- trunk/scipy/stsci/image/setup.py 2009-01-11 17:57:52 UTC (rev 5434) +++ trunk/scipy/stsci/image/setup.py 2009-01-12 03:36:28 UTC (rev 5435) @@ -9,6 +9,7 @@ sources=["src/_combinemodule.c"], define_macros = [('NUMPY', '1')], include_dirs = [numpy.get_numarray_include()]) + config.add_data_dir('tests') return config if __name__ == "__main__": Added: trunk/scipy/stsci/image/tests/test_average.py =================================================================== --- trunk/scipy/stsci/image/tests/test_average.py 2009-01-11 17:57:52 UTC (rev 5434) +++ trunk/scipy/stsci/image/tests/test_average.py 2009-01-12 03:36:28 UTC (rev 5435) @@ -0,0 +1,88 @@ +#!/usr/bin/env python +import numpy as np +import nose +from scipy.stsci.image import * +from numpy.testing import * + +def test_average1(): + """ + average() nominally computes the average pixel value for a stack of + identically shaped images. + + arrays specifies a sequence of inputs arrays, which are nominally a + stack of identically shaped images. + + output may be used to specify the output array. If none is specified, + either arrays[0] is copied or a new array of type 'outtype' + is created. + + outtype specifies the type of the output array when no 'output' is + specified. + + nlow specifies the number of pixels to be excluded from average + on the low end of the pixel stack. + + nhigh specifies the number of pixels to be excluded from average + on the high end of the pixel stack. + + badmasks specifies boolean arrays corresponding to 'arrays', where true + indicates that a particular pixel is not to be included in the + average calculation. + """ + a = np.arange(4) + a = a.reshape((2,2)) + arrays = [a*16, a*4, a*2, a*8] + result = average(arrays) + test = np.array([[ 0, 7], + [15, 22]]) + assert_equal(result,test) + +def test_average2(): + a = np.arange(4) + a = a.reshape((2,2)) + arrays = [a*16, a*4, a*2, a*8] + result = average(arrays, nhigh=1) + test = np.array([[ 0, 4], + [ 9, 14]]) + assert_equal(result,test) + +def test_average3(): + a = np.arange(4) + a = a.reshape((2,2)) + arrays = [a*16, a*4, a*2, a*8] + result = average(arrays, nlow=1) + test = np.array([[ 0, 9], + [18, 28]]) + assert_equal(result,test) + +def test_average4(): + a = np.arange(4) + a = a.reshape((2,2)) + arrays = [a*16, a*4, a*2, a*8] + result = average(arrays, outtype=np.float32) + test = np.array([[ 0. , 7.5], + [ 15. , 22.5]], dtype=np.float32) + assert_equal(result,test) + +def test_average5(): + a = np.arange(4) + a = a.reshape((2,2)) + arrays = [a*16, a*4, a*2, a*8] + bm = np.zeros((4,2,2), dtype=np.bool8) + bm[2,...] = 1 + result = average(arrays, badmasks=bm) + test = np.array([[ 0, 9], + [18, 28]]) + assert_equal(result,test) + +def test_average6(): + a = np.arange(4) + a = a.reshape((2,2)) + arrays = [a*16, a*4, a*2, a*8] + result = average(arrays, badmasks=threshhold(arrays, high=25)) + test = np.array([[ 0, 7], + [ 9, 14]]) + assert_equal(result,test) + +if __name__ == "__main__": + run_module_suite() Added: trunk/scipy/stsci/image/tests/test_median.py =================================================================== --- trunk/scipy/stsci/image/tests/test_median.py 2009-01-11 17:57:52 UTC (rev 5434) +++ trunk/scipy/stsci/image/tests/test_median.py 2009-01-12 03:36:28 UTC (rev 5435) @@ -0,0 +1,88 @@ +#!/usr/bin/env python +import numpy as np +import nose +from scipy.stsci.image import * +from numpy.testing import * + +def test_median1(): + """ + median() nominally computes the median pixels for a stack of + identically shaped images. + + arrays specifies a sequence of inputs arrays, which are nominally a + stack of identically shaped images. + + output may be used to specify the output array. If none is specified, + either arrays[0] is copied or a new array of type 'outtype' + is created. + + outtype specifies the type of the output array when no 'output' is + specified. + + nlow specifies the number of pixels to be excluded from median + on the low end of the pixel stack. + + nhigh specifies the number of pixels to be excluded from median + on the high end of the pixel stack. + + badmasks specifies boolean arrays corresponding to 'arrays', where true + indicates that a particular pixel is not to be included in the + median calculation. + """ + a = np.arange(4) + a = a.reshape((2,2)) + arrays = [a*16, a*4, a*2, a*8] + result = median(arrays) + test = np.array([[ 0, 6], + [12, 18]]) + assert_equal(result,test) + +def test_median2(): + a = np.arange(4) + a = a.reshape((2,2)) + arrays = [a*16, a*4, a*2, a*8] + result = median(arrays, nhigh=1) + test = np.array([[ 0, 4], + [ 8, 12]]) + assert_equal(result,test) + +def test_median3(): + a = np.arange(4) + a = a.reshape((2,2)) + arrays = [a*16, a*4, a*2, a*8] + result = median(arrays, nlow=1) + test = np.array([[ 0, 8], + [16, 24]]) + assert_equal(result,test) + +def test_median4(): + a = np.arange(4) + a = a.reshape((2,2)) + arrays = [a*16, a*4, a*2, a*8] + result = median(arrays, outtype=np.float32) + test = np.array([[ 0., 6.], + [ 12., 18.]], dtype=np.float32) + assert_equal(result,test) + +def test_median5(): + a = np.arange(4) + a = a.reshape((2,2)) + arrays = [a*16, a*4, a*2, a*8] + bm = np.zeros((4,2,2), dtype=np.bool8) + bm[2,...] = 1 + result = median(arrays, badmasks=bm) + test = np.array([[ 0, 8], + [16, 24]]) + assert_equal(result,test) + +def test_median6(): + a = np.arange(4) + a = a.reshape((2,2)) + arrays = [a*16, a*4, a*2, a*8] + result = median(arrays, badmasks=threshhold(arrays, high=25)) + test = np.array([[ 0, 6], + [ 8, 12]]) + assert_equal(result,test) + +if __name__ == "__main__": + run_module_suite() Added: trunk/scipy/stsci/image/tests/test_minimum.py =================================================================== --- trunk/scipy/stsci/image/tests/test_minimum.py 2009-01-11 17:57:52 UTC (rev 5434) +++ trunk/scipy/stsci/image/tests/test_minimum.py 2009-01-12 03:36:28 UTC (rev 5435) @@ -0,0 +1,89 @@ +#!/usr/bin/env python +import numpy as np +import nose +from scipy.stsci.image import * +from numpy.testing import * + +def test_minimum1(): + """ + minimum() nominally computes the minimum pixel value for a stack of + identically shaped images. + + arrays specifies a sequence of inputs arrays, which are nominally a + stack of identically shaped images. + + output may be used to specify the output array. If none is specified, + either arrays[0] is copied or a new array of type 'outtype' + is created. + + outtype specifies the type of the output array when no 'output' is + specified. + + nlow specifies the number of pixels to be excluded from minimum + on the low end of the pixel stack. + + nhigh specifies the number of pixels to be excluded from minimum + on the high end of the pixel stack. + + badmasks specifies boolean arrays corresponding to 'arrays', where true + indicates that a particular pixel is not to be included in the + minimum calculation. + """ + a = np.arange(4) + a = a.reshape((2,2)) + arrays = [a*16, a*4, a*2, a*8] + result = minimum(arrays) + test = np.array([[0, 2], + [4, 6]]) + assert_equal(result,test) + +def test_minimum2(): + a = np.arange(4) + a = a.reshape((2,2)) + arrays = [a*16, a*4, a*2, a*8] + result = minimum(arrays, nhigh=1) + test = np.array([[0, 2], + [4, 6]]) + assert_equal(result,test) + +def test_minimum3(): + a = np.arange(4) + a = a.reshape((2,2)) + arrays = [a*16, a*4, a*2, a*8] + result = minimum(arrays, nlow=1) + test = np.array([[ 0, 4], + [ 8, 12]]) + assert_equal(result,test) + +def test_minimum4(): + a = np.arange(4) + a = a.reshape((2,2)) + arrays = [a*16, a*4, a*2, a*8] + result = minimum(arrays, outtype=np.float32) + test = np.array([[ 0., 2.], + [ 4., 6.]], dtype=np.float32) + assert_equal(result,test) + +def test_minimum5(): + a = np.arange(4) + a = a.reshape((2,2)) + arrays = [a*16, a*4, a*2, a*8] + bm = np.zeros((4,2,2), dtype=np.bool8) + bm[2,...] = 1 + result = minimum(arrays, badmasks=bm) + test = np.array([[ 0, 4], + [ 8, 12]]) + assert_equal(result,test) + +def test_minimum6(): + a = np.arange(4) + a = a.reshape((2,2)) + arrays = [a*16, a*4, a*2, a*8] + result = minimum(arrays, badmasks=threshhold(arrays, low=10)) + test = np.array([[ 0, 16], + [16, 12]]) + assert_equal(result,test) + + +if __name__ == "__main__": + run_module_suite() Added: trunk/scipy/stsci/image/tests/test_threshold.py =================================================================== --- trunk/scipy/stsci/image/tests/test_threshold.py 2009-01-11 17:57:52 UTC (rev 5434) +++ trunk/scipy/stsci/image/tests/test_threshold.py 2009-01-12 03:36:28 UTC (rev 5435) @@ -0,0 +1,78 @@ +#!/usr/bin/env python +import numpy as np +import nose +from scipy.stsci.image import * +from numpy.testing import * + +def test_threshhold1(): + """ + threshhold() computes a boolean array 'outputs' with + corresponding elements for each element of arrays. The + boolean value is true where each of the arrays values + is < the low or >= the high threshholds. + """ + + a=np.arange(100) + a=a.reshape((10,10)) + result = (threshhold(a, 1, 50)).astype(np.int8) + test = np.array([[1, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], dtype=np.int8) + assert_equal(result,test) + +def test_threshold2(): + a=np.arange(100) + a=a.reshape((10,10)) + result = (threshhold([ range(10)]*10, 3, 7)).astype(np.int8) + test = np.array([[1, 1, 1, 0, 0, 0, 0, 1, 1, 1], + [1, 1, 1, 0, 0, 0, 0, 1, 1, 1], + [1, 1, 1, 0, 0, 0, 0, 1, 1, 1], + [1, 1, 1, 0, 0, 0, 0, 1, 1, 1], + [1, 1, 1, 0, 0, 0, 0, 1, 1, 1], + [1, 1, 1, 0, 0, 0, 0, 1, 1, 1], + [1, 1, 1, 0, 0, 0, 0, 1, 1, 1], + [1, 1, 1, 0, 0, 0, 0, 1, 1, 1], + [1, 1, 1, 0, 0, 0, 0, 1, 1, 1], + [1, 1, 1, 0, 0, 0, 0, 1, 1, 1]], dtype=np.int8) + assert_equal(result,test) + +def test_threshold3(): + a=np.arange(100) + a=a.reshape((10,10)) + result = (threshhold(a, high=50)).astype(np.int8) + test = np.array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], dtype=np.int8) + assert_equal(result,test) + +def test_threshold4(): + a=np.arange(100) + a=a.reshape((10,10)) + result = (threshhold(a, low=50)).astype(np.int8) + test = np.array([[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], dtype=np.int8) + +if __name__ == "__main__": + run_module_suite() From scipy-svn at scipy.org Mon Jan 12 00:26:16 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 11 Jan 2009 23:26:16 -0600 (CST) Subject: [Scipy-svn] r5436 - in trunk/scipy/stsci/convolve: . lib tests Message-ID: <20090112052616.7FA48C7C00B@scipy.org> Author: chanley Date: 2009-01-11 23:25:58 -0600 (Sun, 11 Jan 2009) New Revision: 5436 Added: trunk/scipy/stsci/convolve/tests/ trunk/scipy/stsci/convolve/tests/test_convolve.py trunk/scipy/stsci/convolve/tests/test_irafframe.py Modified: trunk/scipy/stsci/convolve/lib/__init__.py trunk/scipy/stsci/convolve/setup.py Log: Adding nose tests for convolve package in scipy.stsci Modified: trunk/scipy/stsci/convolve/lib/__init__.py =================================================================== --- trunk/scipy/stsci/convolve/lib/__init__.py 2009-01-12 03:36:28 UTC (rev 5435) +++ trunk/scipy/stsci/convolve/lib/__init__.py 2009-01-12 05:25:58 UTC (rev 5436) @@ -1,3 +1,9 @@ -__version__ = '2.0' +import sys from Convolve import * import iraf_frame + +__version__ = '2.0' + +def test(level=1, verbosity=1): + from numpy.testing import Tester + return Tester().test(level,verbosity) Modified: trunk/scipy/stsci/convolve/setup.py =================================================================== --- trunk/scipy/stsci/convolve/setup.py 2009-01-12 03:36:28 UTC (rev 5435) +++ trunk/scipy/stsci/convolve/setup.py 2009-01-12 05:25:58 UTC (rev 5436) @@ -14,6 +14,7 @@ sources=["src/_lineshapemodule.c"], define_macros = [('NUMPY', '1')], include_dirs = [numpy.get_numarray_include()]) + config.add_data_dir('tests') return config if __name__ == "__main__": Added: trunk/scipy/stsci/convolve/tests/test_convolve.py =================================================================== --- trunk/scipy/stsci/convolve/tests/test_convolve.py 2009-01-12 03:36:28 UTC (rev 5435) +++ trunk/scipy/stsci/convolve/tests/test_convolve.py 2009-01-12 05:25:58 UTC (rev 5436) @@ -0,0 +1,269 @@ +#!/usr/bin/env python +import numpy as np +import nose +from scipy.stsci.convolve import * +from numpy.testing import * +import scipy.stsci.convolve._correlate as _correlate +import scipy.stsci.convolve.iraf_frame as iraf_frame +import numpy.fft as dft + + +def test_correlate1(): + """ + correlate(data, kernel, mode=FULL) + """ + result = correlate(np.arange(8), [1, 2], mode=VALID) + test = np.array([ 2, 5, 8, 11, 14, 17, 20]) + assert_equal(result,test) + +def test_correlate2(): + result = correlate(np.arange(8), [1, 2], mode=SAME) + test = np.array([ 0, 2, 5, 8, 11, 14, 17, 20]) + assert_equal(result,test) + +def test_correlate3(): + result = correlate(np.arange(8), [1, 2], mode=FULL) + test = np.array([ 0, 2, 5, 8, 11, 14, 17, 20, 7]) + assert_equal(result,test) + +def test_correlate4(): + test = correlate(np.arange(8), [1, 2, 3], mode=VALID) + result = np.array([ 8, 14, 20, 26, 32, 38]) + assert_equal(result,test) + +def test_correlate5(): + test = correlate(np.arange(8), [1, 2, 3], mode=SAME) + result = np.array([ 3, 8, 14, 20, 26, 32, 38, 20]) + assert_equal(result,test) + +def test_correlate6(): + test = correlate(np.arange(8), [1, 2, 3], mode=FULL) + result = np.array([ 0, 3, 8, 14, 20, 26, 32, 38, 20, 7]) + assert_equal(result,test) + +def test_correlate7(): + test = correlate(np.arange(8), [1, 2, 3, 4, 5, 6], mode=VALID) + result = np.array([ 70, 91, 112]) + assert_equal(result,test) + +def test_correlate8(): + test = correlate(np.arange(8), [1, 2, 3, 4, 5, 6], mode=SAME) + result = np.array([ 17, 32, 50, 70, 91, 112, 85, 60]) + assert_equal(result,test) + +def test_correlate9(): + test = correlate(np.arange(8), [1, 2, 3, 4, 5, 6], mode=FULL) + result = np.array([ 0, 6, 17, 32, 50, 70, 91, 112, 85, 60, 38, 20, 7]) + assert_equal(result,test) + +def test_correlate10(): + test = False + try: + result = correlate(np.arange(8), 1+1j) + except TypeError: + test=True + assert_equal(test,True) + +def test_convolve1(): + """ + convolve(data, kernel, mode=FULL) + Returns the discrete, linear convolution of 1-D + sequences a and v; mode can be 0 (VALID), 1 (SAME), or 2 (FULL) + to specify size of the resulting sequence. + """ + result = convolve(np.arange(8), [1, 2], mode=VALID) + test = np.array([ 1, 4, 7, 10, 13, 16, 19]) + assert_equal(result,test) + +def test_convolve2(): + result = convolve(np.arange(8), [1, 2], mode=SAME) + test = np.array([ 0, 1, 4, 7, 10, 13, 16, 19]) + assert_equal(result,test) + +def test_convolve3(): + result = convolve(np.arange(8), [1, 2], mode=FULL) + test = np.array([ 0, 1, 4, 7, 10, 13, 16, 19, 14]) + assert_equal(result,test) + +def test_convolve4(): + result = convolve(np.arange(8), [1, 2, 3], mode=VALID) + test = np.array([ 4, 10, 16, 22, 28, 34]) + assert_equal(result,test) + +def test_convolve5(): + result = convolve(np.arange(8), [1, 2, 3], mode=SAME) + test = np.array([ 1, 4, 10, 16, 22, 28, 34, 32]) + assert_equal(result,test) + +def test_convolve6(): + result = convolve(np.arange(8), [1, 2, 3], mode=FULL) + test = np.array([ 0, 1, 4, 10, 16, 22, 28, 34, 32, 21]) + assert_equal(result,test) + +def test_convolve7(): + result = convolve(np.arange(8), [1, 2, 3, 4, 5, 6], mode=VALID) + test = np.array([35, 56, 77]) + assert_equal(result,test) + +def test_convolve8(): + result = convolve(np.arange(8), [1, 2, 3, 4, 5, 6], mode=SAME) + test = np.array([ 4, 10, 20, 35, 56, 77, 90, 94]) + assert_equal(result,test) + +def test_convolve9(): + result = convolve(np.arange(8), [1, 2, 3, 4, 5, 6], mode=FULL) + test = np.array([ 0, 1, 4, 10, 20, 35, 56, 77, 90, 94, 88, 71, 42]) + assert_equal(result,test) + +def test_convolve10(): + result = convolve([1.,2.], np.arange(10.)) + test = np.array([ 0., 1., 4., 7., 10., 13., 16., 19., 22., 25., 18.]) + assert_equal(result,test) + +def test_correlate2d(): + """ + correlate2d does 2d correlation of 'data' with 'kernel', storing + the result in 'output'. + + supported 'mode's include: + 'nearest' elements beyond boundary come from nearest edge pixel. + 'wrap' elements beyond boundary come from the opposite array edge. + 'reflect' elements beyond boundary come from reflection on same array edge. + 'constant' elements beyond boundary are set to 'cval' + + If fft is True, the correlation is performed using the FFT, else the + correlation is performed using the naive approach. + """ + a = np.arange(20*20) + a = a.reshape((20,20)) + b = np.ones((5,5), dtype=np.float64) + rn = correlate2d(a, b, fft=0) + rf = correlate2d(a, b, fft=1) + result = np.alltrue(np.ravel(rn-rf<1e-10)) + test = True + assert_equal(result,test) + +def test_boxcar1(): + """ + boxcar computes a 1D or 2D boxcar filter on every 1D or 2D subarray of data. + + 'boxshape' is a tuple of integers specifying the dimensions of the filter: e.g. (3,3) + + if 'output' is specified, it should be the same shape as 'data' and + None will be returned. + + supported 'mode's include: + 'nearest' elements beyond boundary come from nearest edge pixel. + 'wrap' elements beyond boundary come from the opposite array edge. + 'reflect' elements beyond boundary come from reflection on same array edge. + 'constant' elements beyond boundary are set to 'cval' + """ + result = boxcar(np.array([10, 0, 0, 0, 0, 0, 1000]), (3,), mode="nearest").astype(np.longlong) + test = np.array([ 6, 3, 0, 0, 0, 333, 666], dtype=np.int64) + assert_equal(result,test) + +def test_boxcar2(): + result = boxcar(np.array([10, 0, 0, 0, 0, 0, 1000]), (3,), mode="wrap").astype(np.longlong) + test = np.array([336, 3, 0, 0, 0, 333, 336], dtype=np.int64) + assert_equal(result,test) + +def test_boxcar3(): + result = boxcar(np.array([10, 0, 0, 0, 0, 0, 1000]), (3,), mode="reflect").astype(np.longlong) + test = np.array([ 6, 3, 0, 0, 0, 333, 666], dtype=np.int64) + assert_equal(result,test) + +def test_boxcar4(): + result = boxcar(np.array([10, 0, 0, 0, 0, 0, 1000]), (3,), mode="constant").astype(np.longlong) + test = np.array([ 3, 3, 0, 0, 0, 333, 333], dtype=np.int64) + assert_equal(result,test) + +def test_boxcar5(): + a = np.zeros((10,10)) + a[0,0] = 100 + a[5,5] = 1000 + a[9,9] = 10000 + result = boxcar(a, (3,3)).astype(np.longlong) + test = np.array([[ 44, 22, 0, 0, 0, 0, 0, 0, 0, 0], + [ 22, 11, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 111, 111, 111, 0, 0, 0], + [ 0, 0, 0, 0, 111, 111, 111, 0, 0, 0], + [ 0, 0, 0, 0, 111, 111, 111, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 1111, 2222], + [ 0, 0, 0, 0, 0, 0, 0, 0, 2222, 4444]], dtype=np.int64) + assert_equal(result,test) + +def test_boxcar6(): + a = np.zeros((10,10)) + a[0,0] = 100 + a[5,5] = 1000 + a[9,9] = 10000 + result = boxcar(a, (3,3), mode="wrap").astype(np.longlong) + test = np.array([[1122, 11, 0, 0, 0, 0, 0, 0, 1111, 1122], + [ 11, 11, 0, 0, 0, 0, 0, 0, 0, 11], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 111, 111, 111, 0, 0, 0], + [ 0, 0, 0, 0, 111, 111, 111, 0, 0, 0], + [ 0, 0, 0, 0, 111, 111, 111, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [1111, 0, 0, 0, 0, 0, 0, 0, 1111, 1111], + [1122, 11, 0, 0, 0, 0, 0, 0, 1111, 1122]], dtype=np.int64) + assert_equal(result,test) + +def test_boxcar7(): + a = np.zeros((10,10)) + a[0,0] = 100 + a[5,5] = 1000 + a[9,9] = 10000 + result = boxcar(a, (3,3), mode="reflect").astype(np.longlong) + test = np.array([[ 44, 22, 0, 0, 0, 0, 0, 0, 0, 0], + [ 22, 11, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 111, 111, 111, 0, 0, 0], + [ 0, 0, 0, 0, 111, 111, 111, 0, 0, 0], + [ 0, 0, 0, 0, 111, 111, 111, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 1111, 2222], + [ 0, 0, 0, 0, 0, 0, 0, 0, 2222, 4444]], dtype=np.int64) + assert_equal(result,test) + +def test_boxcar8(): + a = np.zeros((10,10)) + a[0,0] = 100 + a[5,5] = 1000 + a[9,9] = 10000 + result = boxcar(a, (3,3), mode="constant").astype(np.longlong) + test = np.array([[ 11, 11, 0, 0, 0, 0, 0, 0, 0, 0], + [ 11, 11, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 111, 111, 111, 0, 0, 0], + [ 0, 0, 0, 0, 111, 111, 111, 0, 0, 0], + [ 0, 0, 0, 0, 111, 111, 111, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 1111, 1111], + [ 0, 0, 0, 0, 0, 0, 0, 0, 1111, 1111]], dtype=np.int64) + assert_equal(result,test) + +def test_boxcar9(): + a = np.zeros((10,10)) + a[3:6,3:6] = 111 + result = boxcar(a, (3,3)).astype(np.longlong) + test = np.array([[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 12, 24, 37, 24, 12, 0, 0, 0], + [ 0, 0, 24, 49, 74, 49, 24, 0, 0, 0], + [ 0, 0, 37, 74, 111, 74, 37, 0, 0, 0], + [ 0, 0, 24, 49, 74, 49, 24, 0, 0, 0], + [ 0, 0, 12, 24, 37, 24, 12, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], dtype=np.int64) + assert_equal(result,test) + +if __name__ == "__main__": + run_module_suite() Added: trunk/scipy/stsci/convolve/tests/test_irafframe.py =================================================================== --- trunk/scipy/stsci/convolve/tests/test_irafframe.py 2009-01-12 03:36:28 UTC (rev 5435) +++ trunk/scipy/stsci/convolve/tests/test_irafframe.py 2009-01-12 05:25:58 UTC (rev 5436) @@ -0,0 +1,86 @@ +#!/usr/bin/env python +import numpy as np +import nose +from scipy.stsci.convolve import * +from scipy.stsci.convolve.iraf_frame import * +from numpy.testing import * + +def test_frame_nearest(): + """ + frame_nearest creates an oversized copy of 'a' with new 'shape' + and the contents of 'a' in the center. The boundary pixels are + copied from the nearest edge pixel in 'a'. + """ + a = np.arange(16) + a.shape=(4,4) + result = frame_nearest(a, (8,8)) + test = np.array([[ 0, 0, 0, 1, 2, 3, 3, 3], + [ 0, 0, 0, 1, 2, 3, 3, 3], + [ 0, 0, 0, 1, 2, 3, 3, 3], + [ 4, 4, 4, 5, 6, 7, 7, 7], + [ 8, 8, 8, 9, 10, 11, 11, 11], + [12, 12, 12, 13, 14, 15, 15, 15], + [12, 12, 12, 13, 14, 15, 15, 15], + [12, 12, 12, 13, 14, 15, 15, 15]]) + assert_equal(result,test) + +def test_frame_reflect(): + """ + frame_reflect creates an oversized copy of 'a' with new 'shape' + and the contents of 'a' in the center. The boundary pixels are + reflected from the nearest edge pixels in 'a'. + """ + a = np.arange(16) + a.shape = (4,4) + result = frame_reflect(a, (8,8)) + test = np.array([[ 5, 4, 4, 5, 6, 7, 7, 6], + [ 1, 0, 0, 1, 2, 3, 3, 2], + [ 1, 0, 0, 1, 2, 3, 3, 2], + [ 5, 4, 4, 5, 6, 7, 7, 6], + [ 9, 8, 8, 9, 10, 11, 11, 10], + [13, 12, 12, 13, 14, 15, 15, 14], + [13, 12, 12, 13, 14, 15, 15, 14], + [ 9, 8, 8, 9, 10, 11, 11, 10]]) + assert_equal(result,test) + +def test_frame_wrap(): + """ + frame_wrap creates an oversized copy of 'a' with new 'shape' + and the contents of 'a' in the center. The boundary pixels are + wrapped around to the opposite edge pixels in 'a'. + """ + a = np.arange(16) + a.shape=(4,4) + result = frame_wrap(a, (8,8)) + test=np.array([[10, 11, 8, 9, 10, 11, 8, 9], + [14, 15, 12, 13, 14, 15, 12, 13], + [ 2, 3, 0, 1, 2, 3, 0, 1], + [ 6, 7, 4, 5, 6, 7, 4, 5], + [10, 11, 8, 9, 10, 11, 8, 9], + [14, 15, 12, 13, 14, 15, 12, 13], + [ 2, 3, 0, 1, 2, 3, 0, 1], + [ 6, 7, 4, 5, 6, 7, 4, 5]]) + assert_equal(result,test) + +def test_frame_constant(): + """ + frame_nearest creates an oversized copy of 'a' with new 'shape' + and the contents of 'a' in the center. The boundary pixels are + copied from the nearest edge pixel in 'a'. + """ + a = np.arange(16) + a.shape=(4,4) + result = frame_constant(a, (8,8), cval=42) + test = np.array([[42, 42, 42, 42, 42, 42, 42, 42], + [42, 42, 42, 42, 42, 42, 42, 42], + [42, 42, 0, 1, 2, 3, 42, 42], + [42, 42, 4, 5, 6, 7, 42, 42], + [42, 42, 8, 9, 10, 11, 42, 42], + [42, 42, 12, 13, 14, 15, 42, 42], + [42, 42, 42, 42, 42, 42, 42, 42], + [42, 42, 42, 42, 42, 42, 42, 42]]) + assert_equal(result,test) + +if __name__ == "__main__": + run_module_suite() + From scipy-svn at scipy.org Mon Jan 12 01:55:52 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 12 Jan 2009 00:55:52 -0600 (CST) Subject: [Scipy-svn] r5437 - branches/0.7.x/scipy/weave/tests Message-ID: <20090112065552.AA7B9C7C017@scipy.org> Author: cdavid Date: 2009-01-12 00:55:47 -0600 (Mon, 12 Jan 2009) New Revision: 5437 Modified: branches/0.7.x/scipy/weave/tests/test_blitz_tools.py Log: Tag 3 known failures of weave with gcc 4.3. Modified: branches/0.7.x/scipy/weave/tests/test_blitz_tools.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_blitz_tools.py 2009-01-12 05:25:58 UTC (rev 5436) +++ branches/0.7.x/scipy/weave/tests/test_blitz_tools.py 2009-01-12 06:55:47 UTC (rev 5437) @@ -131,6 +131,7 @@ # """ result = a + b""" # expr = "result = a + b" # self.generic_2d(expr) + @dec.knownfailureif(True) @dec.slow def test_5point_avg_2d_float(self): """ result[1:-1,1:-1] = (b[1:-1,1:-1] + b[2:,1:-1] + b[:-2,1:-1] @@ -140,6 +141,7 @@ "+ b[1:-1,2:] + b[1:-1,:-2]) / 5." self.generic_2d(expr,float32) + @dec.knownfailureif(True) @dec.slow def test_5point_avg_2d_double(self): """ result[1:-1,1:-1] = (b[1:-1,1:-1] + b[2:,1:-1] + b[:-2,1:-1] @@ -168,6 +170,7 @@ "+ b[1:-1,2:] + b[1:-1,:-2]) / 5." self.generic_2d(expr,complex64) + @dec.knownfailureif(True) @dec.slow def test_5point_avg_2d_complex_double(self): """ result[1:-1,1:-1] = (b[1:-1,1:-1] + b[2:,1:-1] + b[:-2,1:-1] From scipy-svn at scipy.org Mon Jan 12 02:26:13 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 12 Jan 2009 01:26:13 -0600 (CST) Subject: [Scipy-svn] r5438 - branches/0.7.x/scipy/weave Message-ID: <20090112072613.56971C7C00B@scipy.org> Author: cdavid Date: 2009-01-12 01:26:09 -0600 (Mon, 12 Jan 2009) New Revision: 5438 Modified: branches/0.7.x/scipy/weave/build_tools.py Log: Do not use close_fds - not supported on windows. Modified: branches/0.7.x/scipy/weave/build_tools.py =================================================================== --- branches/0.7.x/scipy/weave/build_tools.py 2009-01-12 06:55:47 UTC (rev 5437) +++ branches/0.7.x/scipy/weave/build_tools.py 2009-01-12 07:26:09 UTC (rev 5438) @@ -344,8 +344,8 @@ result = 0 cmd = [str(name), '-v'] try: - p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, close_fds=True) + p = subprocess.Popen(cmd, True, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) str_result = p.stdout.read() #print str_result if 'Reading specs' in str_result: @@ -364,7 +364,7 @@ result = 0 try: p = subprocess.Popen(['cl'], shell=True, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, close_fds=True) + stderr=subprocess.STDOUT) str_result = p.stdout.read() #print str_result if 'Microsoft' in str_result: @@ -387,7 +387,7 @@ def run_command(command): """ not sure how to get exit status on nt. """ p = subprocess.Popen(['cl'], shell=True, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, close_fds=True) + stderr=subprocess.STDOUT) text = p.stdout.read() return 0, text else: @@ -465,7 +465,7 @@ if self.gcc_version is None: import re p = subprocess.Popen(['gcc', ' -dumpversion'], shell=True, - stdout=subprocess.PIPE, close_fds=True) + stdout=subprocess.PIPE) out_string = p.stdout.read() result = re.search('(\d+\.\d+)',out_string) if result: From scipy-svn at scipy.org Mon Jan 12 02:29:55 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 12 Jan 2009 01:29:55 -0600 (CST) Subject: [Scipy-svn] r5439 - trunk/scipy/weave Message-ID: <20090112072955.12FC7C7C00B@scipy.org> Author: cdavid Date: 2009-01-12 01:29:52 -0600 (Mon, 12 Jan 2009) New Revision: 5439 Modified: trunk/scipy/weave/build_tools.py Log: Do not use close_fds arg of Popen - not supported on windows. Modified: trunk/scipy/weave/build_tools.py =================================================================== --- trunk/scipy/weave/build_tools.py 2009-01-12 07:26:09 UTC (rev 5438) +++ trunk/scipy/weave/build_tools.py 2009-01-12 07:29:52 UTC (rev 5439) @@ -344,8 +344,8 @@ result = 0 cmd = [str(name), '-v'] try: - p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, close_fds=True) + p = subprocess.Popen(cmd, True, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) str_result = p.stdout.read() #print str_result if 'Reading specs' in str_result: @@ -364,7 +364,7 @@ result = 0 try: p = subprocess.Popen(['cl'], shell=True, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, close_fds=True) + stderr=subprocess.STDOUT) str_result = p.stdout.read() #print str_result if 'Microsoft' in str_result: @@ -387,7 +387,7 @@ def run_command(command): """ not sure how to get exit status on nt. """ p = subprocess.Popen(['cl'], shell=True, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, close_fds=True) + stderr=subprocess.STDOUT) text = p.stdout.read() return 0, text else: @@ -465,7 +465,7 @@ if self.gcc_version is None: import re p = subprocess.Popen(['gcc', ' -dumpversion'], shell=True, - stdout=subprocess.PIPE, close_fds=True) + stdout=subprocess.PIPE) out_string = p.stdout.read() result = re.search('(\d+\.\d+)',out_string) if result: From scipy-svn at scipy.org Mon Jan 12 03:43:28 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 12 Jan 2009 02:43:28 -0600 (CST) Subject: [Scipy-svn] r5440 - branches/0.7.x/scipy/weave/tests Message-ID: <20090112084328.AA404C7C00B@scipy.org> Author: cdavid Date: 2009-01-12 02:43:23 -0600 (Mon, 12 Jan 2009) New Revision: 5440 Modified: branches/0.7.x/scipy/weave/tests/test_c_spec.py branches/0.7.x/scipy/weave/tests/test_scxx_sequence.py Log: More known failures on windows. Modified: branches/0.7.x/scipy/weave/tests/test_c_spec.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_c_spec.py 2009-01-12 07:29:52 UTC (rev 5439) +++ branches/0.7.x/scipy/weave/tests/test_c_spec.py 2009-01-12 08:43:23 UTC (rev 5440) @@ -49,22 +49,27 @@ class IntConverter(TestCase): compiler = '' + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_string(self): s = c_spec.int_converter() assert( not s.type_match('string') ) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_int(self): s = c_spec.int_converter() assert(s.type_match(5)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_float(self): s = c_spec.int_converter() assert(not s.type_match(5.)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_complex(self): s = c_spec.int_converter() assert(not s.type_match(5.+1j)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_var_in(self): mod_name = 'int_var_in' + self.compiler @@ -89,6 +94,7 @@ except TypeError: pass + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_int_return(self): mod_name = sys._getframe().f_code.co_name + self.compiler @@ -110,22 +116,27 @@ class FloatConverter(TestCase): compiler = '' + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_string(self): s = c_spec.float_converter() assert( not s.type_match('string')) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_int(self): s = c_spec.float_converter() assert(not s.type_match(5)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_float(self): s = c_spec.float_converter() assert(s.type_match(5.)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_complex(self): s = c_spec.float_converter() assert(not s.type_match(5.+1j)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_float_var_in(self): mod_name = sys._getframe().f_code.co_name + self.compiler @@ -151,6 +162,7 @@ pass + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_float_return(self): mod_name = sys._getframe().f_code.co_name + self.compiler @@ -171,22 +183,27 @@ class ComplexConverter(TestCase): compiler = '' + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_string(self): s = c_spec.complex_converter() assert( not s.type_match('string') ) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_int(self): s = c_spec.complex_converter() assert(not s.type_match(5)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_float(self): s = c_spec.complex_converter() assert(not s.type_match(5.)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_complex(self): s = c_spec.complex_converter() assert(s.type_match(5.+1j)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_complex_var_in(self): mod_name = sys._getframe().f_code.co_name + self.compiler @@ -211,6 +228,7 @@ except TypeError: pass + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_complex_return(self): mod_name = sys._getframe().f_code.co_name + self.compiler @@ -235,6 +253,7 @@ class FileConverter(TestCase): compiler = '' + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_py_to_file(self): import tempfile @@ -247,6 +266,7 @@ file.close() file = open(file_name,'r') assert(file.read() == "hello bob") + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_file_to_py(self): import tempfile @@ -278,6 +298,7 @@ class CallableConverter(TestCase): compiler='' + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_call_function(self): import string @@ -299,18 +320,22 @@ class SequenceConverter(TestCase): compiler = '' + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_convert_to_dict(self): d = {} inline_tools.inline("",['d'],compiler=self.compiler,force=1) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_convert_to_list(self): l = [] inline_tools.inline("",['l'],compiler=self.compiler,force=1) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_convert_to_string(self): s = 'hello' inline_tools.inline("",['s'],compiler=self.compiler,force=1) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_convert_to_tuple(self): t = () @@ -318,22 +343,27 @@ class StringConverter(TestCase): compiler = '' + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_string(self): s = c_spec.string_converter() assert( s.type_match('string') ) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_int(self): s = c_spec.string_converter() assert(not s.type_match(5)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_float(self): s = c_spec.string_converter() assert(not s.type_match(5.)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_complex(self): s = c_spec.string_converter() assert(not s.type_match(5.+1j)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_var_in(self): mod_name = 'string_var_in'+self.compiler @@ -359,6 +389,7 @@ except TypeError: pass + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_return(self): mod_name = 'string_return'+self.compiler @@ -379,16 +410,19 @@ class ListConverter(TestCase): compiler = '' + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_bad(self): s = c_spec.list_converter() objs = [{},(),'',1,1.,1+1j] for i in objs: assert( not s.type_match(i) ) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_good(self): s = c_spec.list_converter() assert(s.type_match([])) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_var_in(self): mod_name = 'list_var_in'+self.compiler @@ -413,6 +447,7 @@ except TypeError: pass + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_return(self): mod_name = 'list_return'+self.compiler @@ -432,6 +467,7 @@ c = test(b) assert( c == ['hello']) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_speed(self): mod_name = 'list_speed'+self.compiler @@ -495,16 +531,19 @@ class TupleConverter(TestCase): compiler = '' + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_bad(self): s = c_spec.tuple_converter() objs = [{},[],'',1,1.,1+1j] for i in objs: assert( not s.type_match(i) ) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_good(self): s = c_spec.tuple_converter() assert(s.type_match((1,))) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_var_in(self): mod_name = 'tuple_var_in'+self.compiler @@ -529,6 +568,7 @@ except TypeError: pass + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_return(self): mod_name = 'tuple_return'+self.compiler @@ -560,16 +600,19 @@ # so that it can run on its own. compiler='' + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_bad(self): s = c_spec.dict_converter() objs = [[],(),'',1,1.,1+1j] for i in objs: assert( not s.type_match(i) ) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_good(self): s = c_spec.dict_converter() assert(s.type_match({})) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_var_in(self): mod_name = 'dict_var_in'+self.compiler @@ -594,6 +637,7 @@ except TypeError: pass + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_return(self): mod_name = 'dict_return'+self.compiler Modified: branches/0.7.x/scipy/weave/tests/test_scxx_sequence.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_scxx_sequence.py 2009-01-12 07:29:52 UTC (rev 5439) +++ branches/0.7.x/scipy/weave/tests/test_scxx_sequence.py 2009-01-12 08:43:23 UTC (rev 5440) @@ -21,6 +21,7 @@ class _TestSequenceBase(TestCase): seq_type = None + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_conversion(self): a = self.seq_type([1]) @@ -34,6 +35,7 @@ #print '2nd,3rd:', before, after assert(after == before) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_in(self): """ Test the "in" method for lists. We'll assume @@ -87,6 +89,7 @@ res = inline_tools.inline(code,['a']) assert res == 0 + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_count(self): """ Test the "count" method for lists. We'll assume @@ -122,6 +125,7 @@ res = inline_tools.inline(code,['a']) assert res == 1 + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_access_speed(self): N = 1000000 @@ -153,6 +157,7 @@ print 'weave:', t2 - t1 # Fails + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_access_set_speed(self): N = 1000000 @@ -184,6 +189,7 @@ class TestTuple(_TestSequenceBase): seq_type = tuple + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_set_item_operator_equal_fail(self): # Tuples should only allow setting of variables @@ -193,6 +199,7 @@ inline_tools.inline("a[1] = 1234;",['a']) except TypeError: pass + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_set_item_operator_equal(self): code = """ @@ -207,6 +214,7 @@ # returned value should only have a single refcount assert sys.getrefcount(a) == 2 + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_set_item_index_error(self): code = """ @@ -219,6 +227,7 @@ assert 0 except IndexError: pass + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_get_item_operator_index_error(self): code = """ @@ -233,6 +242,7 @@ class TestList(_TestSequenceBase): seq_type = list + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_append_passed_item(self): a = [] @@ -251,6 +261,7 @@ after2 = sys.getrefcount(item) assert after1 == before1 assert after2 == before2 + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_append(self): a = [] @@ -286,6 +297,7 @@ after1 = sys.getrefcount(a) assert after1 == before1 + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_insert(self): a = [1,2,3] @@ -326,6 +338,7 @@ after1 = sys.getrefcount(a) assert after1 == before1 + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_set_item_operator_equal(self): a = self.seq_type([1,2,3]) @@ -359,6 +372,7 @@ after1 = sys.getrefcount(a) assert after1 == before1 + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_set_item_operator_equal_created(self): code = """ @@ -372,6 +386,7 @@ assert a == [1,2,3] # returned value should only have a single refcount assert sys.getrefcount(a) == 2 + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_set_item_index_error(self): code = """ @@ -383,6 +398,7 @@ assert 0 except IndexError: pass + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_get_item_index_error(self): code = """ @@ -395,6 +411,7 @@ except IndexError: pass + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_string_add_speed(self): N = 1000000 @@ -422,6 +439,7 @@ t2 = time.time() print 'weave:', t2 - t1 assert b == desired + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_int_add_speed(self): N = 1000000 From scipy-svn at scipy.org Mon Jan 12 03:47:57 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 12 Jan 2009 02:47:57 -0600 (CST) Subject: [Scipy-svn] r5441 - branches/0.7.x/scipy/weave/tests Message-ID: <20090112084757.A12A6C7C00B@scipy.org> Author: cdavid Date: 2009-01-12 02:47:53 -0600 (Mon, 12 Jan 2009) New Revision: 5441 Modified: branches/0.7.x/scipy/weave/tests/test_scxx_object.py Log: More known failures for windows. Modified: branches/0.7.x/scipy/weave/tests/test_scxx_object.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_scxx_object.py 2009-01-12 08:43:23 UTC (rev 5440) +++ branches/0.7.x/scipy/weave/tests/test_scxx_object.py 2009-01-12 08:47:53 UTC (rev 5441) @@ -13,6 +13,7 @@ # Check that construction from basic types is allowed and have correct # reference counts #------------------------------------------------------------------------ + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_int(self): # strange int value used to try and make sure refcount is 2. @@ -23,6 +24,7 @@ res = inline_tools.inline(code) assert_equal(sys.getrefcount(res),2) assert_equal(res,1001) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_float(self): code = """ @@ -32,6 +34,7 @@ res = inline_tools.inline(code) assert_equal(sys.getrefcount(res),2) assert_equal(res,1.0) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_double(self): code = """ @@ -41,6 +44,7 @@ res = inline_tools.inline(code) assert_equal(sys.getrefcount(res),2) assert_equal(res,1.0) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_complex(self): code = """ @@ -51,6 +55,7 @@ res = inline_tools.inline(code) assert_equal(sys.getrefcount(res),2) assert_equal(res,1.0+1.0j) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_string(self): code = """ @@ -61,6 +66,7 @@ assert_equal(sys.getrefcount(res),2) assert_equal(res,"hello") + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_std_string(self): code = """ @@ -76,6 +82,7 @@ #------------------------------------------------------------------------ # Check the object print protocol. #------------------------------------------------------------------------ + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_stringio(self): import cStringIO @@ -88,7 +95,8 @@ print file_imposter.getvalue() assert_equal(file_imposter.getvalue(),"'how now brown cow'") -## @dec.slow +## @dec.knownfailureif(sys.platform=='win32') + @dec.slow ## def test_failure(self): ## code = """ ## FILE* file = 0; @@ -103,6 +111,7 @@ class TestObjectCast(TestCase): + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_int_cast(self): code = """ @@ -110,6 +119,7 @@ int raw_val = val; """ inline_tools.inline(code) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_double_cast(self): code = """ @@ -117,6 +127,7 @@ double raw_val = val; """ inline_tools.inline(code) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_float_cast(self): code = """ @@ -124,6 +135,7 @@ float raw_val = val; """ inline_tools.inline(code) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_complex_cast(self): code = """ @@ -132,6 +144,7 @@ std::complex raw_val = val; """ inline_tools.inline(code) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_string_cast(self): code = """ @@ -154,6 +167,7 @@ # return "b" class TestObjectHasattr(TestCase): + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_string(self): a = Foo() @@ -163,6 +177,7 @@ """ res = inline_tools.inline(code,['a']) assert res + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_std_string(self): a = Foo() @@ -173,6 +188,7 @@ """ res = inline_tools.inline(code,['a','attr_name']) assert res + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_string_fail(self): a = Foo() @@ -182,6 +198,7 @@ """ res = inline_tools.inline(code,['a']) assert not res + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_inline(self): """ THIS NEEDS TO MOVE TO THE INLINE TEST SUITE @@ -204,6 +221,7 @@ print 'before, after, after2:', before, after, after2 pass + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_func(self): a = Foo() @@ -227,10 +245,12 @@ after = sys.getrefcount(a.b) assert_equal(after,before) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_char(self): self.generic_attr('return_val = a.attr("b");') + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_char_fail(self): try: @@ -238,10 +258,12 @@ except AttributeError: pass + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_string(self): self.generic_attr('return_val = a.attr(std::string("b"));') + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_string_fail(self): try: @@ -249,6 +271,7 @@ except AttributeError: pass + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_obj(self): code = """ @@ -257,6 +280,7 @@ """ self.generic_attr(code,['a']) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_obj_fail(self): try: @@ -268,6 +292,7 @@ except AttributeError: pass + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_attr_call(self): a = Foo() @@ -294,18 +319,23 @@ res = inline_tools.inline(code,args) assert_equal(a.b,desired) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_existing_char(self): self.generic_existing('a.set_attr("b","hello");',"hello") + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_new_char(self): self.generic_new('a.set_attr("b","hello");',"hello") + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_existing_string(self): self.generic_existing('a.set_attr("b",std::string("hello"));',"hello") + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_new_string(self): self.generic_new('a.set_attr("b",std::string("hello"));',"hello") + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_existing_object(self): code = """ @@ -313,6 +343,7 @@ a.set_attr("b",obj); """ self.generic_existing(code,"hello") + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_new_object(self): code = """ @@ -320,6 +351,7 @@ a.set_attr("b",obj); """ self.generic_new(code,"hello") + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_new_fail(self): try: @@ -331,12 +363,15 @@ except: pass + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_existing_int(self): self.generic_existing('a.set_attr("b",1);',1) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_existing_double(self): self.generic_existing('a.set_attr("b",1.0);',1.0) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_existing_complex(self): code = """ @@ -344,9 +379,11 @@ a.set_attr("b",obj); """ self.generic_existing(code,1+1j) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_existing_char1(self): self.generic_existing('a.set_attr("b","hello");',"hello") + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_existing_string1(self): code = """ @@ -363,9 +400,11 @@ res = inline_tools.inline(code,args) assert not hasattr(a,"b") + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_char(self): self.generic('a.del("b");') + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_string(self): code = """ @@ -373,6 +412,7 @@ a.del(name); """ self.generic(code) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_object(self): code = """ @@ -382,11 +422,13 @@ self.generic(code) class TestObjectCmp(TestCase): + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_equal(self): a,b = 1,1 res = inline_tools.inline('return_val = (a == b);',['a','b']) assert_equal(res,(a == b)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_equal_objects(self): class Foo: @@ -397,56 +439,67 @@ a,b = Foo(1),Foo(2) res = inline_tools.inline('return_val = (a == b);',['a','b']) assert_equal(res,(a == b)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_lt(self): a,b = 1,2 res = inline_tools.inline('return_val = (a < b);',['a','b']) assert_equal(res,(a < b)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_gt(self): a,b = 1,2 res = inline_tools.inline('return_val = (a > b);',['a','b']) assert_equal(res,(a > b)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_gte(self): a,b = 1,2 res = inline_tools.inline('return_val = (a >= b);',['a','b']) assert_equal(res,(a >= b)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_lte(self): a,b = 1,2 res = inline_tools.inline('return_val = (a <= b);',['a','b']) assert_equal(res,(a <= b)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_not_equal(self): a,b = 1,2 res = inline_tools.inline('return_val = (a != b);',['a','b']) assert_equal(res,(a != b)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_int(self): a = 1 res = inline_tools.inline('return_val = (a == 1);',['a']) assert_equal(res,(a == 1)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_int2(self): a = 1 res = inline_tools.inline('return_val = (1 == a);',['a']) assert_equal(res,(a == 1)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_unsigned_long(self): a = 1 res = inline_tools.inline('return_val = (a == (unsigned long)1);',['a']) assert_equal(res,(a == 1)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_double(self): a = 1 res = inline_tools.inline('return_val = (a == 1.0);',['a']) assert_equal(res,(a == 1.0)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_char(self): a = "hello" res = inline_tools.inline('return_val = (a == "hello");',['a']) assert_equal(res,(a == "hello")) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_std_string(self): a = "hello" @@ -458,6 +511,7 @@ assert_equal(res,(a == "hello")) class TestObjectRepr(TestCase): + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_repr(self): class Foo: @@ -475,6 +529,7 @@ assert_equal(res,"repr return") class TestObjectStr(TestCase): + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_str(self): class Foo: @@ -494,6 +549,7 @@ class TestObjectUnicode(TestCase): # This ain't going to win awards for test of the year... + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_unicode(self): class Foo: @@ -511,6 +567,7 @@ assert_equal(res,"unicode") class TestObjectIsCallable(TestCase): + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_true(self): class Foo: @@ -519,6 +576,7 @@ a= Foo() res = inline_tools.inline('return_val = a.is_callable();',['a']) assert res + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_false(self): class Foo: @@ -528,6 +586,7 @@ assert not res class TestObjectCall(TestCase): + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_noargs(self): def Foo(): @@ -535,6 +594,7 @@ res = inline_tools.inline('return_val = Foo.call();',['Foo']) assert_equal(res,(1,2,3)) assert_equal(sys.getrefcount(res),3) # should be 2? + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_args(self): def Foo(val1,val2): @@ -548,6 +608,7 @@ res = inline_tools.inline(code,['Foo']) assert_equal(res,(1,"hello")) assert_equal(sys.getrefcount(res),2) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_args_kw(self): def Foo(val1,val2,val3=1): @@ -563,6 +624,7 @@ res = inline_tools.inline(code,['Foo']) assert_equal(res,(1,"hello",3)) assert_equal(sys.getrefcount(res),2) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_noargs_with_args(self): # calling a function that does take args with args @@ -588,6 +650,7 @@ assert_equal(second,third) class TestObjectMcall(TestCase): + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_noargs(self): a = Foo() @@ -599,6 +662,7 @@ assert_equal(res,"bar results") second = sys.getrefcount(res) assert_equal(first,second) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_args(self): a = Foo() @@ -611,6 +675,7 @@ res = inline_tools.inline(code,['a']) assert_equal(res,(1,"hello")) assert_equal(sys.getrefcount(res),2) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_args_kw(self): a = Foo() @@ -625,6 +690,7 @@ res = inline_tools.inline(code,['a']) assert_equal(res,(1,"hello",3)) assert_equal(sys.getrefcount(res),2) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_std_noargs(self): a = Foo() @@ -637,6 +703,7 @@ assert_equal(res,"bar results") second = sys.getrefcount(res) assert_equal(first,second) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_std_args(self): a = Foo() @@ -650,6 +717,7 @@ res = inline_tools.inline(code,['a','method']) assert_equal(res,(1,"hello")) assert_equal(sys.getrefcount(res),2) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_std_args_kw(self): a = Foo() @@ -665,6 +733,7 @@ res = inline_tools.inline(code,['a','method']) assert_equal(res,(1,"hello",3)) assert_equal(sys.getrefcount(res),2) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_noargs_with_args(self): # calling a function that does take args with args @@ -689,6 +758,7 @@ assert_equal(second,third) class TestObjectHash(TestCase): + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_hash(self): class Foo: @@ -700,6 +770,7 @@ assert_equal(res,123) class TestObjectIsTrue(TestCase): + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_true(self): class Foo: @@ -707,6 +778,7 @@ a= Foo() res = inline_tools.inline('return_val = a.is_true();',['a']) assert_equal(res,1) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_false(self): a= None @@ -714,6 +786,7 @@ assert_equal(res,0) class TestObjectType(TestCase): + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type(self): class Foo: @@ -723,6 +796,7 @@ assert_equal(res,type(a)) class TestObjectSize(TestCase): + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_size(self): class Foo: @@ -731,6 +805,7 @@ a= Foo() res = inline_tools.inline('return_val = a.size();',['a']) assert_equal(res,len(a)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_len(self): class Foo: @@ -739,6 +814,7 @@ a= Foo() res = inline_tools.inline('return_val = a.len();',['a']) assert_equal(res,len(a)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_length(self): class Foo: @@ -750,6 +826,7 @@ from UserList import UserList class TestObjectSetItemOpIndex(TestCase): + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_list_refcount(self): a = UserList([1,2,3]) @@ -758,30 +835,35 @@ before1 = sys.getrefcount(a) after1 = sys.getrefcount(a) assert_equal(after1,before1) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_set_int(self): a = UserList([1,2,3]) inline_tools.inline("a[1] = 1234;",['a']) assert_equal(sys.getrefcount(a[1]),2) assert_equal(a[1],1234) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_set_double(self): a = UserList([1,2,3]) inline_tools.inline("a[1] = 123.0;",['a']) assert_equal(sys.getrefcount(a[1]),2) assert_equal(a[1],123.0) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_set_char(self): a = UserList([1,2,3]) inline_tools.inline('a[1] = "bubba";',['a']) assert_equal(sys.getrefcount(a[1]),2) assert_equal(a[1],'bubba') + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_set_string(self): a = UserList([1,2,3]) inline_tools.inline('a[1] = std::string("sissy");',['a']) assert_equal(sys.getrefcount(a[1]),2) assert_equal(a[1],'sissy') + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_set_string(self): a = UserList([1,2,3]) @@ -791,6 +873,7 @@ from UserDict import UserDict class TestObjectSetItemOpKey(TestCase): + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_key_refcount(self): a = UserDict() @@ -826,6 +909,7 @@ assert_equal(val[0] + 1, val[1]) assert_equal(val[1], val[2]) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_set_double_exists(self): a = UserDict() @@ -840,6 +924,7 @@ assert_equal(sys.getrefcount(key),5) assert_equal(sys.getrefcount(a[key]),2) assert_equal(a[key],123.0) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_set_double_new(self): a = UserDict() @@ -848,6 +933,7 @@ assert_equal(sys.getrefcount(key),4) # should be 3 assert_equal(sys.getrefcount(a[key]),2) assert_equal(a[key],123.0) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_set_complex(self): a = UserDict() @@ -856,6 +942,7 @@ assert_equal(sys.getrefcount(key),4) # should be 3 assert_equal(sys.getrefcount(a[key]),2) assert_equal(a[key],1234) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_set_char(self): a = UserDict() @@ -863,6 +950,7 @@ assert_equal(sys.getrefcount(a["hello"]),2) assert_equal(a["hello"],123.0) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_set_class(self): a = UserDict() @@ -882,6 +970,7 @@ assert_equal(sys.getrefcount(key),4) assert_equal(sys.getrefcount(a[key]),2) assert_equal(a[key],'bubba') + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_set_from_member(self): a = UserDict() From scipy-svn at scipy.org Mon Jan 12 03:57:46 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 12 Jan 2009 02:57:46 -0600 (CST) Subject: [Scipy-svn] r5442 - branches/0.7.x/scipy/weave/tests Message-ID: <20090112085746.DA368C7C00B@scipy.org> Author: cdavid Date: 2009-01-12 02:57:38 -0600 (Mon, 12 Jan 2009) New Revision: 5442 Modified: branches/0.7.x/scipy/weave/tests/test_scxx_object.py Log: fix typo. Modified: branches/0.7.x/scipy/weave/tests/test_scxx_object.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_scxx_object.py 2009-01-12 08:47:53 UTC (rev 5441) +++ branches/0.7.x/scipy/weave/tests/test_scxx_object.py 2009-01-12 08:57:38 UTC (rev 5442) @@ -96,7 +96,7 @@ assert_equal(file_imposter.getvalue(),"'how now brown cow'") ## @dec.knownfailureif(sys.platform=='win32') - @dec.slow +## @dec.slow ## def test_failure(self): ## code = """ ## FILE* file = 0; From scipy-svn at scipy.org Mon Jan 12 03:58:40 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 12 Jan 2009 02:58:40 -0600 (CST) Subject: [Scipy-svn] r5443 - branches/0.7.x/scipy/weave/tests Message-ID: <20090112085840.6B046C7C00B@scipy.org> Author: cdavid Date: 2009-01-12 02:58:35 -0600 (Mon, 12 Jan 2009) New Revision: 5443 Modified: branches/0.7.x/scipy/weave/tests/test_numpy_scalar_spec.py branches/0.7.x/scipy/weave/tests/test_scxx_dict.py Log: more known failures on win32. Modified: branches/0.7.x/scipy/weave/tests/test_numpy_scalar_spec.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_numpy_scalar_spec.py 2009-01-12 08:57:38 UTC (rev 5442) +++ branches/0.7.x/scipy/weave/tests/test_numpy_scalar_spec.py 2009-01-12 08:58:35 UTC (rev 5443) @@ -38,19 +38,24 @@ def setUp(self): self.converter = numpy_complex_scalar_converter() + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_string(self): assert( not self.converter.type_match('string') ) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_int(self): assert( not self.converter.type_match(5)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_float(self): assert( not self.converter.type_match(5.)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_type_match_complex128(self): assert(self.converter.type_match(numpy.complex128(5.+1j))) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_complex_var_in(self): mod_name = sys._getframe().f_code.co_name + self.compiler @@ -75,6 +80,7 @@ except TypeError: pass + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_complex_return(self): mod_name = sys._getframe().f_code.co_name + self.compiler @@ -93,6 +99,7 @@ c = test(b) assert( c == 3.+3j) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_inline(self): a = numpy.complex128(1+1j) Modified: branches/0.7.x/scipy/weave/tests/test_scxx_dict.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_scxx_dict.py 2009-01-12 08:57:38 UTC (rev 5442) +++ branches/0.7.x/scipy/weave/tests/test_scxx_dict.py 2009-01-12 08:58:35 UTC (rev 5443) @@ -13,6 +13,7 @@ # Check that construction from basic types is allowed and have correct # reference counts #------------------------------------------------------------------------ + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_empty(self): # strange int value used to try and make sure refcount is 2. From scipy-svn at scipy.org Mon Jan 12 04:13:45 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 12 Jan 2009 03:13:45 -0600 (CST) Subject: [Scipy-svn] r5444 - branches/0.7.x/scipy/weave/tests Message-ID: <20090112091345.61764C7C00B@scipy.org> Author: cdavid Date: 2009-01-12 03:13:39 -0600 (Mon, 12 Jan 2009) New Revision: 5444 Modified: branches/0.7.x/scipy/weave/tests/test_ext_tools.py branches/0.7.x/scipy/weave/tests/test_inline_tools.py Log: And more test failures tagged as known on windows. Modified: branches/0.7.x/scipy/weave/tests/test_ext_tools.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_ext_tools.py 2009-01-12 08:58:35 UTC (rev 5443) +++ branches/0.7.x/scipy/weave/tests/test_ext_tools.py 2009-01-12 09:13:39 UTC (rev 5444) @@ -15,12 +15,14 @@ class TestExtModule(TestCase): #should really do some testing of where modules end up + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_simple(self): """ Simplest possible module """ mod = ext_tools.ext_module('simple_ext_module') mod.compile(location = build_dir) import simple_ext_module + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_multi_functions(self): mod = ext_tools.ext_module('module_multi_function') @@ -59,6 +61,7 @@ import ext_module_with_include ext_module_with_include.test(a) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_string_and_int(self): # decalaring variables @@ -76,6 +79,7 @@ c = ext_string_and_int.test(a,b) assert(c == len(b)) + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_return_tuple(self): # decalaring variables @@ -100,6 +104,7 @@ class TestExtFunction(TestCase): #should really do some testing of where modules end up + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_simple(self): """ Simplest possible function """ Modified: branches/0.7.x/scipy/weave/tests/test_inline_tools.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_inline_tools.py 2009-01-12 08:58:35 UTC (rev 5443) +++ branches/0.7.x/scipy/weave/tests/test_inline_tools.py 2009-01-12 09:13:39 UTC (rev 5444) @@ -1,3 +1,5 @@ +import sys + from numpy import * from numpy.testing import * @@ -8,6 +10,7 @@ I'd like to benchmark these things somehow. """ + @dec.knownfailureif(sys.platform=='win32') @dec.slow def test_exceptions(self): a = 3 From scipy-svn at scipy.org Mon Jan 12 04:50:59 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 12 Jan 2009 03:50:59 -0600 (CST) Subject: [Scipy-svn] r5445 - branches/0.7.x/scipy/weave/tests Message-ID: <20090112095059.7EA41C7C00B@scipy.org> Author: cdavid Date: 2009-01-12 03:50:54 -0600 (Mon, 12 Jan 2009) New Revision: 5445 Modified: branches/0.7.x/scipy/weave/tests/test_scxx_object.py Log: One more weave failure on linux 64 bits. Modified: branches/0.7.x/scipy/weave/tests/test_scxx_object.py =================================================================== --- branches/0.7.x/scipy/weave/tests/test_scxx_object.py 2009-01-12 09:13:39 UTC (rev 5444) +++ branches/0.7.x/scipy/weave/tests/test_scxx_object.py 2009-01-12 09:50:54 UTC (rev 5445) @@ -933,7 +933,7 @@ assert_equal(sys.getrefcount(key),4) # should be 3 assert_equal(sys.getrefcount(a[key]),2) assert_equal(a[key],123.0) - @dec.knownfailureif(sys.platform=='win32') + @dec.knownfailureif(True) @dec.slow def test_set_complex(self): a = UserDict() From scipy-svn at scipy.org Mon Jan 12 09:24:09 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 12 Jan 2009 08:24:09 -0600 (CST) Subject: [Scipy-svn] r5446 - trunk/scipy/stsci/image/lib Message-ID: <20090112142409.E8D1DC7C016@scipy.org> Author: chanley Date: 2009-01-12 08:24:07 -0600 (Mon, 12 Jan 2009) New Revision: 5446 Modified: trunk/scipy/stsci/image/lib/__init__.py trunk/scipy/stsci/image/lib/_image.py trunk/scipy/stsci/image/lib/combine.py Log: Fix imports for stsci.image Modified: trunk/scipy/stsci/image/lib/__init__.py =================================================================== --- trunk/scipy/stsci/image/lib/__init__.py 2009-01-12 09:50:54 UTC (rev 5445) +++ trunk/scipy/stsci/image/lib/__init__.py 2009-01-12 14:24:07 UTC (rev 5446) @@ -1,6 +1,6 @@ import sys -from _image import * -from combine import * +from scipy.stsci.image._image import * +from scipy.stsci.image.combine import * __version__ = '2.0' Modified: trunk/scipy/stsci/image/lib/_image.py =================================================================== --- trunk/scipy/stsci/image/lib/_image.py 2009-01-12 09:50:54 UTC (rev 5445) +++ trunk/scipy/stsci/image/lib/_image.py 2009-01-12 14:24:07 UTC (rev 5446) @@ -1,6 +1,6 @@ import numpy as np -import convolve -import convolve._correlate as _correlate +from scipy.stsci import convolve +from scipy.stsci.convolve import _correlate def _translate(a, dx, dy, output=None, mode="nearest", cval=0.0): """_translate does positive sub-pixel shifts using bilinear interpolation.""" Modified: trunk/scipy/stsci/image/lib/combine.py =================================================================== --- trunk/scipy/stsci/image/lib/combine.py 2009-01-12 09:50:54 UTC (rev 5445) +++ trunk/scipy/stsci/image/lib/combine.py 2009-01-12 14:24:07 UTC (rev 5446) @@ -1,5 +1,5 @@ import numpy as np -from _combine import combine as _comb +from scipy.stsci.image._combine import combine as _comb def _combine_f(funcstr, arrays, output=None, outtype=None, nlow=0, nhigh=0, badmasks=None): arrays = [ np.asarray(a) for a in arrays ] From scipy-svn at scipy.org Mon Jan 12 17:28:30 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 12 Jan 2009 16:28:30 -0600 (CST) Subject: [Scipy-svn] r5447 - trunk/doc/source Message-ID: <20090112222830.93CB0C7C028@scipy.org> Author: ptvirtan Date: 2009-01-12 16:28:15 -0600 (Mon, 12 Jan 2009) New Revision: 5447 Modified: trunk/doc/source/index.rst trunk/doc/source/stsci.rst Log: docs: fix stci -> stsci typo. Add stsci.rst to toctree Modified: trunk/doc/source/index.rst =================================================================== --- trunk/doc/source/index.rst 2009-01-12 14:24:07 UTC (rev 5446) +++ trunk/doc/source/index.rst 2009-01-12 22:28:15 UTC (rev 5447) @@ -39,4 +39,5 @@ spatial special stats + stsci weave Modified: trunk/doc/source/stsci.rst =================================================================== --- trunk/doc/source/stsci.rst 2009-01-12 14:24:07 UTC (rev 5446) +++ trunk/doc/source/stsci.rst 2009-01-12 22:28:15 UTC (rev 5447) @@ -2,12 +2,12 @@ Image Array Manipulation and Convolution (:mod:`scipy.stsci`) ============================================================= -.. module:: scipy.stci +.. module:: scipy.stsci Image Array manipulation Functions (:mod:`scipy.stsci.image`) ============================================================= -.. module:: scipy.stci.image +.. module:: scipy.stsci.image .. autosummary:: :toctree: generated/ @@ -23,7 +23,7 @@ Image Array Convolution Functions (:mod:`scipy.stsci.convolve`) =============================================================== -.. module:: scipy.stci.convolve +.. module:: scipy.stsci.convolve .. autosummary:: :toctree: generated/ @@ -37,4 +37,4 @@ cross_correlate dft iraf_frame - pix_modes \ No newline at end of file + pix_modes From scipy-svn at scipy.org Mon Jan 12 21:00:46 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 12 Jan 2009 20:00:46 -0600 (CST) Subject: [Scipy-svn] r5448 - trunk/scipy/fftpack/tests Message-ID: <20090113020046.F1790C7C028@scipy.org> Author: cdavid Date: 2009-01-12 20:00:41 -0600 (Mon, 12 Jan 2009) New Revision: 5448 Added: trunk/scipy/fftpack/tests/gendata.m trunk/scipy/fftpack/tests/test_real_transforms.py Log: Start test for DCT. Added: trunk/scipy/fftpack/tests/gendata.m =================================================================== --- trunk/scipy/fftpack/tests/gendata.m 2009-01-12 22:28:15 UTC (rev 5447) +++ trunk/scipy/fftpack/tests/gendata.m 2009-01-13 02:00:41 UTC (rev 5448) @@ -0,0 +1,21 @@ +x0 = linspace(0, 10, 11); +x1 = linspace(0, 10, 15); +x2 = linspace(0, 10, 16); +x3 = linspace(0, 10, 17); + +x4 = randn(32, 1); +x5 = randn(64, 1); +x6 = randn(128, 1); +x7 = randn(256, 1); + +y0 = dct(x0); +y1 = dct(x1); +y2 = dct(x2); +y3 = dct(x3); +y4 = dct(x4); +y5 = dct(x5); +y6 = dct(x6); +y7 = dct(x7); + +save('test.mat', 'x0', 'x1', 'x2', 'x3', 'x4', 'x5', 'x6', 'x7', ... + 'y0', 'y1', 'y2', 'y3', 'y4', 'y5', 'y6', 'y7'); Added: trunk/scipy/fftpack/tests/test_real_transforms.py =================================================================== --- trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-12 22:28:15 UTC (rev 5447) +++ trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-13 02:00:41 UTC (rev 5448) @@ -0,0 +1,42 @@ +#!/usr/bin/env python +from os.path import join, dirname + +import numpy as np +from numpy.fft import fft as numfft +from numpy.testing import assert_array_almost_equal + +from scipy.io import loadmat + +TDATA = loadmat(join(dirname(__file__), 'test.mat'), + squeeze_me=True, struct_as_record=True) +X = [TDATA['x%d' % i] for i in range(8)] +Y = [TDATA['y%d' % i] for i in range(8)] + +def direct_dct(x): + """Compute a Discrete Cosine Transform, type II. + + The DCT type II is defined as: + + \forall u \in 0...N-1, + dct(u) = a(u) sum_{i=0}^{N-1}{f(i)cos((i + 0.5)\pi u} + + Where a(0) = sqrt(1/(4N)), a(u) = sqrt(1/(2N)) for u > 0 + """ + x = np.asarray(x) + if not np.isrealobj(x): + raise ValueError("Complex input not supported") + n = x.size + y = np.zeros(n * 4, x.dtype) + y[1:2*n:2] = x + y[2*n+1::2] = x[-1::-1] + y = np.real(numfft(y))[:n] + y[0] *= np.sqrt(.25 / n) + y[1:] *= np.sqrt(.5 / n) + return y + +def test_ref(): + for i in range(len(X)): + assert_array_almost_equal(direct_dct(X[i]), Y[i]) + +if __name__ == "__main__": + np.testing.run_module_suite() From scipy-svn at scipy.org Mon Jan 12 21:01:12 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 12 Jan 2009 20:01:12 -0600 (CST) Subject: [Scipy-svn] r5449 - trunk/scipy/fftpack/tests Message-ID: <20090113020112.634E4C7C028@scipy.org> Author: cdavid Date: 2009-01-12 20:01:03 -0600 (Mon, 12 Jan 2009) New Revision: 5449 Modified: trunk/scipy/fftpack/tests/test_real_transforms.py Log: Few more tests. Modified: trunk/scipy/fftpack/tests/test_real_transforms.py =================================================================== --- trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-13 02:00:41 UTC (rev 5448) +++ trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-13 02:01:03 UTC (rev 5449) @@ -8,19 +8,26 @@ from scipy.io import loadmat TDATA = loadmat(join(dirname(__file__), 'test.mat'), - squeeze_me=True, struct_as_record=True) + squeeze_me=True, struct_as_record=True, mat_dtype=True) X = [TDATA['x%d' % i] for i in range(8)] Y = [TDATA['y%d' % i] for i in range(8)] -def direct_dct(x): +def direct_fft_dct(x, matlab=False): """Compute a Discrete Cosine Transform, type II. - The DCT type II is defined as: + The DCT type II is defined as (matlab=False): \forall u \in 0...N-1, - dct(u) = a(u) sum_{i=0}^{N-1}{f(i)cos((i + 0.5)\pi u} + dct(u) = 2 * sum_{i=0}^{N-1}{f(i)cos((i + 0.5)\pi u/N} - Where a(0) = sqrt(1/(4N)), a(u) = sqrt(1/(2N)) for u > 0 + Or (matlab=True) + + \forall u \in 0...N-1, + dct(u) = a(u) sum_{i=0}^{N-1}{f(i)cos((i + 0.5)\pi u/N} + + Where a(0) = sqrt(1/N), a(u) = sqrt(2/N) for u > 0 + + This is the exact same formula as Matlab. """ x = np.asarray(x) if not np.isrealobj(x): @@ -30,13 +37,74 @@ y[1:2*n:2] = x y[2*n+1::2] = x[-1::-1] y = np.real(numfft(y))[:n] - y[0] *= np.sqrt(.25 / n) - y[1:] *= np.sqrt(.5 / n) + if matlab: + y[0] *= np.sqrt(.25 / n) + y[1:] *= np.sqrt(.5 / n) return y -def test_ref(): +def direct_dct(x): + """Direct implementation (O(n^2)) of dct II. + + dct(u) = 2 * sum_{i=0}^{N-1}{f(i)cos((i + 0.5)\pi u/N} + + Note that it is not 'normalized' + """ + n = x.size + a = np.empty((n, n), dtype = x.dtype) + for i in xrange(n): + for j in xrange(n): + a[i, j] = x[j] * np.cos(np.pi * (0.5 + j) * i / n) + + return 2 * a.sum(axis = 1) + +def fdct(x): + """Compute a 'Fast' Discrete Cosine Transform, type II, using a N point fft + instead of a direct 4n point DFT + + \forall u \in 0...N-1, + dct(u) = sum_{i=0}^{N-1}{f(i)cos((i + 0.5)\pi u/N} + + See 'A Fast Cosine Transform in One and Two Dimensions', by J. Makhoul, in + IEEE Transactions on acoustics, speech and signal processing. + + Note that it is not 'normalized' + """ + x = np.asarray(x) + n = x.size + v = np.empty(x.size, x.dtype) + if (n/2) * 2 == n: + iseven = True + else: + iseven = False + cut = (n-1)/2 + 1 + v[:cut] = x[::2] + if iseven: + v[cut:] = x[-1:0:-2] + else: + v[cut:] = x[-2::-2] + t = 2 * numfft(v) * np.exp(-1j * np.pi * 0.5 / n * np.linspace(0, n-1, n)) + v[:n/2+1] = np.real(t)[:n/2+1] + if iseven: + v[n/2+1:] = -np.imag(t)[n/2-1:0:-1] + else: + v[n/2+1:] = -np.imag(t)[n/2:0:-1] + return v + +def test_refs(): for i in range(len(X)): - assert_array_almost_equal(direct_dct(X[i]), Y[i]) + assert_array_almost_equal(direct_fft_dct(X[i], matlab=True), Y[i]) + assert_array_almost_equal(direct_fft_dct(X[i], matlab=False), direct_dct(X[i])) + for i in range(len(X)): + x = X[i] + y = direct_fft_dct(x, matlab=True) + y[0] *= np.sqrt(x.size*4) + y[1:] *= np.sqrt(x.size*2) + assert_array_almost_equal(y, direct_dct(x)) + +def test_fdct(): + for i in range(len(X)): + assert_array_almost_equal(direct_dct(X[i]), fdct(X[i])) + if __name__ == "__main__": np.testing.run_module_suite() From scipy-svn at scipy.org Mon Jan 12 21:01:29 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 12 Jan 2009 20:01:29 -0600 (CST) Subject: [Scipy-svn] r5450 - trunk/scipy/fftpack/tests Message-ID: <20090113020129.F1092C7C028@scipy.org> Author: cdavid Date: 2009-01-12 20:01:23 -0600 (Mon, 12 Jan 2009) New Revision: 5450 Modified: trunk/scipy/fftpack/tests/test_real_transforms.py Log: Trailing spaces. Modified: trunk/scipy/fftpack/tests/test_real_transforms.py =================================================================== --- trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-13 02:01:03 UTC (rev 5449) +++ trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-13 02:01:23 UTC (rev 5450) @@ -7,7 +7,7 @@ from scipy.io import loadmat -TDATA = loadmat(join(dirname(__file__), 'test.mat'), +TDATA = loadmat(join(dirname(__file__), 'test.mat'), squeeze_me=True, struct_as_record=True, mat_dtype=True) X = [TDATA['x%d' % i] for i in range(8)] Y = [TDATA['y%d' % i] for i in range(8)] @@ -17,12 +17,12 @@ The DCT type II is defined as (matlab=False): - \forall u \in 0...N-1, + \forall u \in 0...N-1, dct(u) = 2 * sum_{i=0}^{N-1}{f(i)cos((i + 0.5)\pi u/N} Or (matlab=True) - \forall u \in 0...N-1, + \forall u \in 0...N-1, dct(u) = a(u) sum_{i=0}^{N-1}{f(i)cos((i + 0.5)\pi u/N} Where a(0) = sqrt(1/N), a(u) = sqrt(2/N) for u > 0 @@ -44,7 +44,7 @@ def direct_dct(x): """Direct implementation (O(n^2)) of dct II. - + dct(u) = 2 * sum_{i=0}^{N-1}{f(i)cos((i + 0.5)\pi u/N} Note that it is not 'normalized' @@ -61,12 +61,12 @@ """Compute a 'Fast' Discrete Cosine Transform, type II, using a N point fft instead of a direct 4n point DFT - \forall u \in 0...N-1, + \forall u \in 0...N-1, dct(u) = sum_{i=0}^{N-1}{f(i)cos((i + 0.5)\pi u/N} See 'A Fast Cosine Transform in One and Two Dimensions', by J. Makhoul, in IEEE Transactions on acoustics, speech and signal processing. - + Note that it is not 'normalized' """ x = np.asarray(x) From scipy-svn at scipy.org Mon Jan 12 21:01:47 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 12 Jan 2009 20:01:47 -0600 (CST) Subject: [Scipy-svn] r5451 - trunk/scipy/fftpack/tests Message-ID: <20090113020147.BA5A8C7C028@scipy.org> Author: cdavid Date: 2009-01-12 20:01:42 -0600 (Mon, 12 Jan 2009) New Revision: 5451 Modified: trunk/scipy/fftpack/tests/test_real_transforms.py Log: Rename dct to dct2 in tests. Modified: trunk/scipy/fftpack/tests/test_real_transforms.py =================================================================== --- trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-13 02:01:23 UTC (rev 5450) +++ trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-13 02:01:42 UTC (rev 5451) @@ -12,7 +12,7 @@ X = [TDATA['x%d' % i] for i in range(8)] Y = [TDATA['y%d' % i] for i in range(8)] -def direct_fft_dct(x, matlab=False): +def direct_fft_dct2(x, matlab=False): """Compute a Discrete Cosine Transform, type II. The DCT type II is defined as (matlab=False): @@ -42,7 +42,7 @@ y[1:] *= np.sqrt(.5 / n) return y -def direct_dct(x): +def direct_dct2(x): """Direct implementation (O(n^2)) of dct II. dct(u) = 2 * sum_{i=0}^{N-1}{f(i)cos((i + 0.5)\pi u/N} @@ -57,7 +57,7 @@ return 2 * a.sum(axis = 1) -def fdct(x): +def fdct2(x): """Compute a 'Fast' Discrete Cosine Transform, type II, using a N point fft instead of a direct 4n point DFT @@ -92,19 +92,19 @@ def test_refs(): for i in range(len(X)): - assert_array_almost_equal(direct_fft_dct(X[i], matlab=True), Y[i]) - assert_array_almost_equal(direct_fft_dct(X[i], matlab=False), direct_dct(X[i])) + assert_array_almost_equal(direct_fft_dct2(X[i], matlab=True), Y[i]) + assert_array_almost_equal(direct_fft_dct2(X[i], matlab=False), direct_dct2(X[i])) for i in range(len(X)): x = X[i] - y = direct_fft_dct(x, matlab=True) + y = direct_fft_dct2(x, matlab=True) y[0] *= np.sqrt(x.size*4) y[1:] *= np.sqrt(x.size*2) - assert_array_almost_equal(y, direct_dct(x)) + assert_array_almost_equal(y, direct_dct2(x)) -def test_fdct(): +def test_fdct2(): for i in range(len(X)): - assert_array_almost_equal(direct_dct(X[i]), fdct(X[i])) + assert_array_almost_equal(direct_dct2(X[i]), fdct2(X[i])) if __name__ == "__main__": np.testing.run_module_suite() From scipy-svn at scipy.org Mon Jan 12 21:02:08 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 12 Jan 2009 20:02:08 -0600 (CST) Subject: [Scipy-svn] r5452 - in trunk/scipy/fftpack: . src Message-ID: <20090113020208.D3AC0C7C028@scipy.org> Author: cdavid Date: 2009-01-12 20:01:59 -0600 (Mon, 12 Jan 2009) New Revision: 5452 Added: trunk/scipy/fftpack/src/dct.c Modified: trunk/scipy/fftpack/SConscript trunk/scipy/fftpack/fftpack.pyf trunk/scipy/fftpack/setup.py Log: Start working on dct wrappers of fftpack. Modified: trunk/scipy/fftpack/SConscript =================================================================== --- trunk/scipy/fftpack/SConscript 2009-01-13 02:01:42 UTC (rev 5451) +++ trunk/scipy/fftpack/SConscript 2009-01-13 02:01:59 UTC (rev 5452) @@ -1,4 +1,4 @@ -# Last Change: Sat Nov 01 10:00 PM 2008 J +# Last Change: Sat Jan 10 05:00 PM 2009 J # vim:syntax=python from os.path import join as pjoin @@ -26,7 +26,8 @@ env.PrependUnique(LIBPATH = ['.']) # Build _fftpack -src = ['src/zfft.c','src/drfft.c','src/zrfft.c', 'src/zfftnd.c', 'fftpack.pyf'] +src = ['src/zfft.c','src/drfft.c','src/zrfft.c', 'src/zfftnd.c', 'src/dct.c', + 'fftpack.pyf'] env.NumpyPythonExtension('_fftpack', src) # Build convolve Modified: trunk/scipy/fftpack/fftpack.pyf =================================================================== --- trunk/scipy/fftpack/fftpack.pyf 2009-01-13 02:01:42 UTC (rev 5451) +++ trunk/scipy/fftpack/fftpack.pyf 2009-01-13 02:01:59 UTC (rev 5452) @@ -163,6 +163,36 @@ intent(c) destroy_rfft_cache end subroutine destroy_rfft_cache + subroutine dct1(x,n,howmany,normalize) + ! y = dct1(x[,n,normalize,overwrite_x]) + intent(c) dct1 + real*8 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 dct1 + + subroutine dct2(x,n,howmany,normalize) + ! y = dct2(x[,n,normalize,overwrite_x]) + intent(c) dct2 + real*8 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 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/setup.py =================================================================== --- trunk/scipy/fftpack/setup.py 2009-01-13 02:01:42 UTC (rev 5451) +++ trunk/scipy/fftpack/setup.py 2009-01-13 02:01:59 UTC (rev 5452) @@ -18,7 +18,7 @@ sources=[join('src/fftpack','*.f')]) sources = ['fftpack.pyf','src/zfft.c','src/drfft.c','src/zrfft.c', - 'src/zfftnd.c'] + 'src/zfftnd.c', 'src/dct.c'] config.add_extension('_fftpack', sources=sources, Added: trunk/scipy/fftpack/src/dct.c =================================================================== --- trunk/scipy/fftpack/src/dct.c 2009-01-13 02:01:42 UTC (rev 5451) +++ trunk/scipy/fftpack/src/dct.c 2009-01-13 02:01:59 UTC (rev 5452) @@ -0,0 +1,71 @@ +/* + Interface to various FFT libraries. + Double complex FFT and IFFT. + Author: Pearu Peterson, August 2002 + */ + +#include "fftpack.h" + +extern void F_FUNC(dcosti,DCOSTI)(int*,double*); +extern void F_FUNC(dcost,DCOST)(int*,double*,double*); +extern void F_FUNC(dcosqi,DCOSQI)(int*,double*); +extern void F_FUNC(dcosqb,DCOSQB)(int*,double*,double*); +extern void F_FUNC(dcosqf,DCOSQF)(int*,double*,double*); + +GEN_CACHE(dct1,(int n) + ,double* wsave; + ,(caches_dct1[i].n==n) + ,caches_dct1[id].wsave = (double*)malloc(sizeof(double)*(3*n+15)); + F_FUNC(dcosti,DCOSTI)(&n,caches_dct1[id].wsave); + ,free(caches_dct1[id].wsave); + ,10) + +GEN_CACHE(dct2,(int n) + ,double* wsave; + ,(caches_dct2[i].n==n) + ,caches_dct2[id].wsave = (double*)malloc(sizeof(double)*(3*n+15)); + F_FUNC(dcosqi,DCOSQI)(&n,caches_dct2[id].wsave); + ,free(caches_dct2[id].wsave); + ,10) + +void dct1(double * inout, int n, int howmany, int normalize) +{ + int i; + double *ptr = inout; + double *wsave = NULL; + + wsave = caches_dct1[get_cache_id_dct1(n)].wsave; + + for (i = 0; i < howmany; ++i, ptr += n) { + dcost_(&n, (double*)(ptr), wsave); + } + + if (normalize) { + fprintf(stderr, "dct1: normalize not yet supported=%d\n", + normalize); + } else { + ptr = inout; + for (i = n * howmany - 1; i >= 0; --i, ++ptr) { + *((double *) (ptr)) *= 0.5; + } + } +} + +void dct2(double * inout, int n, int howmany, int normalize) +{ + int i; + double *ptr = inout; + double *wsave = NULL; + + wsave = caches_dct2[get_cache_id_dct2(n)].wsave; + + for (i = 0; i < howmany; ++i, ptr += n) { + dcosqb_(&n, (double *) (ptr), wsave); + + } + + if (normalize) { + fprintf(stderr, "dct2: normalize not yet supported=%d\n", + normalize); + } +} From scipy-svn at scipy.org Mon Jan 12 21:02:35 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 12 Jan 2009 20:02:35 -0600 (CST) Subject: [Scipy-svn] r5453 - trunk/scipy/fftpack Message-ID: <20090113020235.BAF3FC7C028@scipy.org> Author: cdavid Date: 2009-01-12 20:02:23 -0600 (Mon, 12 Jan 2009) New Revision: 5453 Added: trunk/scipy/fftpack/realtransforms.py Log: Add python wrapper around fftpack dct. Added: trunk/scipy/fftpack/realtransforms.py =================================================================== --- trunk/scipy/fftpack/realtransforms.py 2009-01-13 02:01:59 UTC (rev 5452) +++ trunk/scipy/fftpack/realtransforms.py 2009-01-13 02:02:23 UTC (rev 5453) @@ -0,0 +1,91 @@ +""" +Real spectrum tranforms (DCT, DST, MDCT) +""" + +__all__ = ['dct1', 'dct2'] + +import numpy as np +from scipy.fftpack import _fftpack + +import atexit +atexit.register(_fftpack.destroy_dct1_cache) +atexit.register(_fftpack.destroy_dct2_cache) + +def dct1(x, n=None): + """ + Return Discrete Cosine Transform (type I) of arbitrary type sequence x. + + Parameters + ---------- + x : array-like + input array. + n : int, optional + Length of the transform. + + Returns + ------- + y : real ndarray + """ + return _dct(x, 1, n) + +def dct2(x, n=None): + """ + Return Discrete Cosine Transform (type II) of arbitrary type sequence x. + + Parameters + ---------- + x : array-like + input array. + n : int, optional + Length of the transform. + + Returns + ------- + y : real ndarray + """ + return _dct(x, 2, n) + +def _dct(x, type, n=None, axis=-1, overwrite_x=0): + """ + Return Discrete Cosine Transform of arbitrary type sequence x. + + Parameters + ---------- + x : array-like + input array. + n : int, optional + Length of the transform. + axis : int, optional + Axis along which the dct is computed. (default=-1) + overwrite_x : bool, optional + If True the contents of x can be destroyed. (default=False) + + Returns + ------- + z : real ndarray + + """ + tmp = np.asarray(x) + if not np.isrealobj(tmp): + raise TypeError,"1st argument must be real sequence" + + if n is None: + n = tmp.shape[axis] + else: + raise NotImplemented("Padding/truncating not yet implemented") + + if type == 1: + f = _fftpack.dct1 + elif type == 2: + f = _fftpack.dct2 + else: + raise ValueError("Type %d not understood" % type) + + if axis == -1 or axis == len(tmp.shape) - 1: + return f(tmp, n, 0, overwrite_x) + else: + raise NotImplementedError("Axis arg not yet implemented") + + #tmp = swapaxes(tmp, axis, -1) + #tmp = work_function(tmp,n,1,0,overwrite_x) + #return swapaxes(tmp, axis, -1) From scipy-svn at scipy.org Tue Jan 13 03:07:34 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 13 Jan 2009 02:07:34 -0600 (CST) Subject: [Scipy-svn] r5454 - branches/0.7.x Message-ID: <20090113080734.A366EC7C019@scipy.org> Author: stefan Date: 2009-01-13 02:07:27 -0600 (Tue, 13 Jan 2009) New Revision: 5454 Modified: branches/0.7.x/THANKS.txt Log: Backport changes to THANKS. Modified: branches/0.7.x/THANKS.txt =================================================================== --- branches/0.7.x/THANKS.txt 2009-01-13 02:02:23 UTC (rev 5453) +++ branches/0.7.x/THANKS.txt 2009-01-13 08:07:27 UTC (rev 5454) @@ -26,7 +26,9 @@ Travis Vaught for numerous contributions to annual conference and community web-site and the initial work on stats module clean up. Jeff Whitaker for Mac OS X support. -David Cournapeau for bug-fixes, refactor of fftpack and cluster, numscons build. +David Cournapeau for bug-fixes, refactoring of fftpack and cluster, + implementing the numscons build, building Windows binaries and + adding single precision FFT. Damian Eads for hierarchical clustering, dendrogram plotting, distance functions in spatial package, vq documentation. Anne Archibald for kd-trees and nearest neighbor in scipy.spatial. @@ -55,6 +57,12 @@ Neilen Marais for testing and bug-fixing in the ARPACK wrappers. Johannes Loehnert and Bart Vandereycken for fixes in the linalg module. +David Huard for improvements to the interpolation interface. +David Warde-Farley for converting the ndimage docs to ReST. +Uwe Schmitt for wrapping non-negative least-squares. +Ondrej Certik for Debian packaging. +Paul Ivanov for porting Numeric-style C code to the new NumPy API. +Ariel Rokem for contributions on percentileofscore fixes and tests. Institutions From scipy-svn at scipy.org Tue Jan 13 03:11:47 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 13 Jan 2009 02:11:47 -0600 (CST) Subject: [Scipy-svn] r5455 - trunk/doc/release Message-ID: <20090113081147.680C4C7C019@scipy.org> Author: stefan Date: 2009-01-13 02:11:37 -0600 (Tue, 13 Jan 2009) New Revision: 5455 Modified: trunk/doc/release/0.7.0-notes.rst Log: Language review of release notes. Modified: trunk/doc/release/0.7.0-notes.rst =================================================================== --- trunk/doc/release/0.7.0-notes.rst 2009-01-13 08:07:27 UTC (rev 5454) +++ trunk/doc/release/0.7.0-notes.rst 2009-01-13 08:11:37 UTC (rev 5455) @@ -4,33 +4,33 @@ .. contents:: -SciPy 0.7.0 is the culmination of 16 months of hard work and -and contains many new features, numerous bug-fixes, improved test -coverage, and better documentation. There have been a number of +SciPy 0.7.0 is the culmination of 16 months of hard work. It contains many new features, numerous bug-fixes, improved test +coverage and better documentation. There have been a number of deprecations and API changes in this release, which are documented -below. All users are encouraged to upgrade to this release as +below. All users are encouraged to upgrade to this release, as there are a large number of bug-fixes and optimizations. Moreover, our development attention will now shift to bug-fix releases on the -0.7.x branch and new feature on the development trunk. This release +0.7.x branch, and on adding new features on the development trunk. This release requires Python 2.4 or 2.5 and NumPy 1.2 or greater. -Please note that SciPy is still considered "Beta" status as we work +Please note that SciPy is still considered to have "Beta" status, as we work toward a SciPy 1.0.0 release. The 1.0.0 release will mark a major -step in the development of SciPy after which changing the package -structure or API will be much more difficult. While these pre-1.0 -releases are considered "Beta" status, we are committed to making +milestone in the development of SciPy, after which changing the package +structure or API will be much more difficult. Whilst these pre-1.0 +releases are considered to have "Beta" status, we are committed to making them as bug-free as possible. For example, in addition to fixing numerous bugs in this release, we have also doubled the number of unit tests since the last release. -However, until the 1.0 release we are aggressively reviewing and -refining the functionality, organization, and interface in an effort +However, until the 1.0 release, we are aggressively reviewing and +refining the functionality, organization, and interface. This is being +done in an effort to make the package as coherent, intuitive, and useful as possible. To achieve this, we need help from the community of users. Specifically, -we need feedback about all aspects of the project--everything from which -algorithms we implement to details about our function's call signatures. +we need feedback regarding all aspects of the project - everything - from which +algorithms we implement, to details about our function's call signatures. -Over the last year, we have seen an rapid increase in community involvement +Over the last year, we have seen a rapid increase in community involvement, and numerous infrastructure improvements to lower the barrier to contributions (e.g., more explicit coding standards, improved testing infrastructure, better documentation tools). Over the next year, we hope to see this trend continue @@ -44,13 +44,12 @@ The main issue with 2.6 support is NumPy. On UNIX (including Mac OS X), NumPy 1.2.1 mostly works, with a few caveats. On Windows, there are problems related to the compilation process. The upcoming NumPy 1.3 release will fix -these issues. Any remaining issues with 2.6 support for SciPy 0.7 will +these problems. Any remaining issues with 2.6 support for SciPy 0.7 will be addressed in a bug-fix release. -Python 3.0 is not supported at all: it requires NumPy to be ported to -Python 3.0, which is a massive effort, since a lot of C code has to be -ported. We are still considering how to make the transition to 3.0, but we -currently don't have any timeline or roadmap for this transition. +Python 3.0 is not supported at all; it requires NumPy to be ported to +Python 3.0. This requires immense effort, since a lot of C code has to be +ported. The transition to 3.0 is still under consideration; currently, we don't have any timeline or roadmap for this transition. Major documentation improvements -------------------------------- @@ -61,12 +60,12 @@ the popular `Sphinx tool `__. This release also includes an updated tutorial, which hadn't been -available since SciPy was ported to NumPy in 2005. While not +available since SciPy was ported to NumPy in 2005. Though not comprehensive, the tutorial shows how to use several essential parts of Scipy. It also includes the ``ndimage`` documentation from the ``numarray`` manual. -Nevertheless, more effort is still needed on the documentation front. +Nevertheless, more effort is needed on the documentation front. Luckily, contributing to Scipy documentation is now easier than before: if you find that a part of it requires improvements, and want to help us out, please register a user name in our web-based @@ -76,11 +75,11 @@ ------------- NumPy 1.2 introduced a new testing framework based on `nose -`__. Starting with this release SciPy -now uses the new NumPy test framework as well. To take advantage of the new -testing framework requires ``nose`` version 0.10 or later. One major advantage -of the new framework is that it greatly reduces the difficulty of writing unit -tests, which has all ready paid off given the rapid increase in tests. To run +`__. Starting with this release, SciPy +now uses the new NumPy test framework as well. Taking advantage of the new +testing framework requires ``nose`` version 0.10, or later. One major advantage +of the new framework is that it greatly simplifies writing unit +tests - which has all ready paid off, given the rapid increase in tests. To run the full test suite:: >>> import scipy @@ -90,7 +89,7 @@ `__. We have also greatly improved our test coverage. There were just over 2,000 unit -tests in the 0.6.0 release; this release nearly doubles that number with just over +tests in the 0.6.0 release; this release nearly doubles that number, with just over 4,000 unit tests. Building SciPy @@ -99,11 +98,11 @@ Support for NumScons has been added. NumScons is a tentative new build system for NumPy/SciPy, using `SCons `__ at its core. -SCons is a next-generation build system meant to replace the venerable ``Make`` +SCons is a next-generation build system, intended to replace the venerable ``Make`` with the integrated functionality of ``autoconf``/``automake`` and ``ccache``. Scons is written in Python and its configuration files are Python scripts. NumScons is meant to replace NumPy's custom version of ``distutils`` providing -more advanced functionality such as ``autoconf``, improved fortran support, +more advanced functionality, such as ``autoconf``, improved fortran support, more tools, and support for ``numpy.distutils``/``scons`` cooperation. Sandbox Removed @@ -113,9 +112,9 @@ moved into ``scipy.sandbox``. The sandbox was a staging ground for packages that were undergoing rapid development and whose APIs were in flux. It was also a place where broken code could live. The sandbox has served its purpose -well and was starting to create confusion, so ``scipy.sandbox`` was removed. +well, but was starting to create confusion. Thus ``scipy.sandbox`` was removed. Most of the code was moved into ``scipy``, some code was made into a -``scikit``, and the remaining code was just deleted as the functionality had +``scikit``, and the remaining code was just deleted, as the functionality had been replaced by other code. Sparse Matrices @@ -154,12 +153,12 @@ * ``A = csr_matrix( rand(3,3) )`` and ``B = lil_matrix( [[1,2],[3,4]] )`` Numerous efficiency improvements to format conversions and sparse matrix -arithmetic. Finally, this release contains numerous bugfixes. +arithmetic have been made. Finally, this release contains numerous bugfixes. Statistics package ------------------ -Statistical functions for masked arrays have been added and are accessible +Statistical functions for masked arrays have been added, and are accessible through ``scipy.stats.mstats``. The functions are similar to their counterparts in ``scipy.stats`` but they have not yet been verified for identical interfaces and algorithms. @@ -176,7 +175,7 @@ correctly, several methods in individual distributions were corrected. However, a few issues remain with higher moments (``skew``, ``kurtosis``) and entropy. The maximum likelihood estimator, ``fit``, does not work out-of-the-box for -some distributions, in some cases, starting values have to be +some distributions - in some cases, starting values have to be carefully chosen, in other cases, the generic implementation of the maximum likelihood method might not be the numerically appropriate estimation method. @@ -186,7 +185,7 @@ Reworking of IO package ----------------------- -The IO code in both NumPy and SciPy is undergoing a major reworking. NumPy +The IO code in both NumPy and SciPy is being extensively reworked. NumPy will be where basic code for reading and writing NumPy arrays is located, while SciPy will house file readers and writers for various data formats (data, audio, video, images, matlab, etc.). @@ -224,26 +223,26 @@ between descendants. The ``fcluster`` and ``fclusterdata`` functions transform a hierarchical clustering into a set of flat clusters. Since these flat clusters are generated by cutting the tree into a forest of -trees, the ``leaders`` function takes a linkage and a flat clustering +trees, the ``leaders`` function takes a linkage and a flat clustering, and finds the root of each tree in the forest. The ``ClusterNode`` class represents a hierarchical clusterings as a field-navigable tree object. ``to_tree`` converts a matrix-encoded hierarchical clustering to a ``ClusterNode`` object. Routines for converting between MATLAB and SciPy linkage encodings are provided. Finally, a ``dendrogram`` -function plots hierarchical clusterings as a dendrogram using +function plots hierarchical clusterings as a dendrogram, using matplotlib. New Spatial package ------------------- -Collection of spatial algorithms and data structures useful for spatial -statistics and clustering applications. Includes fast compiled code for +The new spatial package contains a collection of spatial algorithms and data structures, useful for spatial +statistics and clustering applications. It includes rapidly compiled code for computing exact and approximate nearest neighbors, as well as a pure-python -kd-tree with the same interface but that supports annotation and a variety -of other algorithms. The API for both modules may change somewhat as user +kd-tree with the same interface, but that supports annotation and a variety +of other algorithms. The API for both modules may change somewhat, as user requirements become clearer. -Also includes a ``distance`` module containing a collection of +It also includes a ``distance`` module, containing a collection of distance and dissimilarity functions for computing distances between vectors, which is useful for spatial statistics, clustering, and kd-trees. Distance and dissimilarity functions provided include @@ -256,7 +255,7 @@ unordered pairs of vectors in a set of vectors. The ``cdist`` computes the distance on all pairs of vectors in the Cartesian product of two sets of vectors. Pairwise distance matrices are stored in condensed -form, only the upper triangular is stored. ``squareform`` converts +form; only the upper triangular is stored. ``squareform`` converts distance matrices between square and condensed forms. Reworked fftpack package @@ -264,7 +263,7 @@ FFTW2, FFTW3, MKL and DJBFFT wrappers have been removed. Only (NETLIB) fftpack remains. By focusing on one backend, we hope to add new -features -- like float32 support -- more easily. +features - like float32 support - more easily. New Constants package --------------------- @@ -274,7 +273,7 @@ Values of the Fundamental Physical Constants: 2002. They may be found at physics.nist.gov/constants. The values are stored in the dictionary physical_constants as a tuple containing the value, the units, and -the relative precision, in that order. All constants are in SI units +the relative precision - in that order. All constants are in SI units, unless otherwise stated. Several helper functions are provided. New Radial Basis Function module @@ -297,8 +296,8 @@ ``scipy.linalg.eigh`` now contains wrappers for more LAPACK symmetric and hermitian eigenvalue problem solvers. Users -can now solve generalized problems, select just a range of -eigenvalues, and choose to use a faster algorithm at the expense +can now solve generalized problems, select a range of +eigenvalues only, and choose to use a faster algorithm at the expense of increased memory usage. The signature of the ``scipy.linalg.eigh`` changed accordingly. @@ -306,7 +305,7 @@ -------------------------------------- The shape of return values from ``scipy.interpolate.interp1d`` used -to be incorrect if interpolated data had more than 2 dimensions and +to be incorrect, if interpolated data had more than 2 dimensions and the axis keyword was set to a non-default value. This has been fixed. Users of ``scipy.interpolate.interp1d`` may need to revise their code if it relies on the incorrect behavior. @@ -323,8 +322,7 @@ Here are known problems with scipy 0.7.0: -* weave test failures on windows: those are known, and are being worked - on. +* weave test failures on windows: those are known, and are being revised. * weave test failure with gcc 4.3 (std::labs): this is a gcc 4.3 bug. A workaround is to add #include in scipy/weave/blitz/blitz/funcs.h (line 27). You can make the change in From scipy-svn at scipy.org Tue Jan 13 03:12:10 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 13 Jan 2009 02:12:10 -0600 (CST) Subject: [Scipy-svn] r5456 - branches/0.7.x/doc/release Message-ID: <20090113081210.9F1E6C7C019@scipy.org> Author: stefan Date: 2009-01-13 02:11:58 -0600 (Tue, 13 Jan 2009) New Revision: 5456 Modified: branches/0.7.x/doc/release/0.7.0-notes.rst Log: Backport changes to release notes. Modified: branches/0.7.x/doc/release/0.7.0-notes.rst =================================================================== --- branches/0.7.x/doc/release/0.7.0-notes.rst 2009-01-13 08:11:37 UTC (rev 5455) +++ branches/0.7.x/doc/release/0.7.0-notes.rst 2009-01-13 08:11:58 UTC (rev 5456) @@ -4,66 +4,69 @@ .. contents:: -SciPy 0.7.0 is the culmination of 16 months of hard work. It contains many new features, numerous bug-fixes, improved test -coverage and better documentation. There have been a number of -deprecations and API changes in this release, which are documented -below. All users are encouraged to upgrade to this release, as -there are a large number of bug-fixes and optimizations. Moreover, -our development attention will now shift to bug-fix releases on the -0.7.x branch, and on adding new features on the development trunk. This release -requires Python 2.4 or 2.5 and NumPy 1.2 or greater. +SciPy 0.7.0 is the culmination of 16 months of hard work. It contains +many new features, numerous bug-fixes, improved test coverage and +better documentation. There have been a number of deprecations and +API changes in this release, which are documented below. All users +are encouraged to upgrade to this release, as there are a large number +of bug-fixes and optimizations. Moreover, our development attention +will now shift to bug-fix releases on the 0.7.x branch, and on adding +new features on the development trunk. This release requires Python +2.4 or 2.5 and NumPy 1.2 or greater. -Please note that SciPy is still considered to have "Beta" status, as we work -toward a SciPy 1.0.0 release. The 1.0.0 release will mark a major -milestone in the development of SciPy, after which changing the package -structure or API will be much more difficult. Whilst these pre-1.0 -releases are considered to have "Beta" status, we are committed to making -them as bug-free as possible. For example, in addition to fixing -numerous bugs in this release, we have also doubled the number -of unit tests since the last release. +Please note that SciPy is still considered to have "Beta" status, as +we work toward a SciPy 1.0.0 release. The 1.0.0 release will mark a +major milestone in the development of SciPy, after which changing the +package structure or API will be much more difficult. Whilst these +pre-1.0 releases are considered to have "Beta" status, we are +committed to making them as bug-free as possible. For example, in +addition to fixing numerous bugs in this release, we have also doubled +the number of unit tests since the last release. However, until the 1.0 release, we are aggressively reviewing and refining the functionality, organization, and interface. This is being -done in an effort -to make the package as coherent, intuitive, and useful as possible. -To achieve this, we need help from the community of users. Specifically, -we need feedback regarding all aspects of the project - everything - from which -algorithms we implement, to details about our function's call signatures. +done in an effort to make the package as coherent, intuitive, and +useful as possible. To achieve this, we need help from the community +of users. Specifically, we need feedback regarding all aspects of the +project - everything - from which algorithms we implement, to details +about our function's call signatures. -Over the last year, we have seen a rapid increase in community involvement, -and numerous infrastructure improvements to lower the barrier to contributions -(e.g., more explicit coding standards, improved testing infrastructure, better -documentation tools). Over the next year, we hope to see this trend continue -and invite everyone to become more involved. +Over the last year, we have seen a rapid increase in community +involvement, and numerous infrastructure improvements to lower the +barrier to contributions (e.g., more explicit coding standards, +improved testing infrastructure, better documentation tools). Over +the next year, we hope to see this trend continue and invite everyone +to become more involved. Python 2.6 and 3.0 ------------------ -A significant amount of work has gone into making SciPy compatible with -Python 2.6; however, there are still some issues in this regard. -The main issue with 2.6 support is NumPy. On UNIX (including Mac OS X), -NumPy 1.2.1 mostly works, with a few caveats. On Windows, there are problems -related to the compilation process. The upcoming NumPy 1.3 release will fix -these problems. Any remaining issues with 2.6 support for SciPy 0.7 will -be addressed in a bug-fix release. +A significant amount of work has gone into making SciPy compatible +with Python 2.6; however, there are still some issues in this regard. +The main issue with 2.6 support is NumPy. On UNIX (including Mac OS +X), NumPy 1.2.1 mostly works, with a few caveats. On Windows, there +are problems related to the compilation process. The upcoming NumPy +1.3 release will fix these problems. Any remaining issues with 2.6 +support for SciPy 0.7 will be addressed in a bug-fix release. Python 3.0 is not supported at all; it requires NumPy to be ported to -Python 3.0. This requires immense effort, since a lot of C code has to be -ported. The transition to 3.0 is still under consideration; currently, we don't have any timeline or roadmap for this transition. +Python 3.0. This requires immense effort, since a lot of C code has +to be ported. The transition to 3.0 is still under consideration; +currently, we don't have any timeline or roadmap for this transition. Major documentation improvements -------------------------------- -SciPy documentation is greatly improved; you can -view a HTML reference manual `online `__ or -download it as a PDF file. The new reference guide was built using -the popular `Sphinx tool `__. +SciPy documentation is greatly improved; you can view a HTML reference +manual `online `__ or download it as a PDF +file. The new reference guide was built using the popular `Sphinx tool +`__. This release also includes an updated tutorial, which hadn't been available since SciPy was ported to NumPy in 2005. Though not -comprehensive, the tutorial shows how to use several essential -parts of Scipy. It also includes the ``ndimage`` documentation -from the ``numarray`` manual. +comprehensive, the tutorial shows how to use several essential parts +of Scipy. It also includes the ``ndimage`` documentation from the +``numarray`` manual. Nevertheless, more effort is needed on the documentation front. Luckily, contributing to Scipy documentation is now easier than @@ -74,13 +77,13 @@ Running Tests ------------- -NumPy 1.2 introduced a new testing framework based on `nose -`__. Starting with this release, SciPy -now uses the new NumPy test framework as well. Taking advantage of the new -testing framework requires ``nose`` version 0.10, or later. One major advantage -of the new framework is that it greatly simplifies writing unit -tests - which has all ready paid off, given the rapid increase in tests. To run -the full test suite:: +NumPy 1.2 introduced a new testing framework based on `nose +`__. Starting with this +release, SciPy now uses the new NumPy test framework as well. Taking +advantage of the new testing framework requires ``nose`` version 0.10, +or later. One major advantage of the new framework is that it greatly +simplifies writing unit tests - which has all ready paid off, given +the rapid increase in tests. To run the full test suite:: >>> import scipy >>> scipy.test('full') @@ -88,40 +91,45 @@ For more information, please see `The NumPy/SciPy Testing Guide `__. -We have also greatly improved our test coverage. There were just over 2,000 unit -tests in the 0.6.0 release; this release nearly doubles that number, with just over -4,000 unit tests. +We have also greatly improved our test coverage. There were just over +2,000 unit tests in the 0.6.0 release; this release nearly doubles +that number, with just over 4,000 unit tests. Building SciPy -------------- -Support for NumScons has been added. NumScons is a tentative new -build system for NumPy/SciPy, using `SCons `__ at its core. +Support for NumScons has been added. NumScons is a tentative new build +system for NumPy/SciPy, using `SCons `__ at its +core. -SCons is a next-generation build system, intended to replace the venerable ``Make`` -with the integrated functionality of ``autoconf``/``automake`` and ``ccache``. -Scons is written in Python and its configuration files are Python scripts. -NumScons is meant to replace NumPy's custom version of ``distutils`` providing -more advanced functionality, such as ``autoconf``, improved fortran support, -more tools, and support for ``numpy.distutils``/``scons`` cooperation. +SCons is a next-generation build system, intended to replace the +venerable ``Make`` with the integrated functionality of +``autoconf``/``automake`` and ``ccache``. Scons is written in Python +and its configuration files are Python scripts. NumScons is meant to +replace NumPy's custom version of ``distutils`` providing more +advanced functionality, such as ``autoconf``, improved fortran +support, more tools, and support for ``numpy.distutils``/``scons`` +cooperation. Sandbox Removed --------------- -While porting SciPy to NumPy in 2005, several packages and modules were -moved into ``scipy.sandbox``. The sandbox was a staging ground for packages -that were undergoing rapid development and whose APIs were in flux. It was -also a place where broken code could live. The sandbox has served its purpose -well, but was starting to create confusion. Thus ``scipy.sandbox`` was removed. -Most of the code was moved into ``scipy``, some code was made into a -``scikit``, and the remaining code was just deleted, as the functionality had -been replaced by other code. +While porting SciPy to NumPy in 2005, several packages and modules +were moved into ``scipy.sandbox``. The sandbox was a staging ground +for packages that were undergoing rapid development and whose APIs +were in flux. It was also a place where broken code could live. The +sandbox has served its purpose well, but was starting to create +confusion. Thus ``scipy.sandbox`` was removed. Most of the code was +moved into ``scipy``, some code was made into a ``scikit``, and the +remaining code was just deleted, as the functionality had been +replaced by other code. Sparse Matrices --------------- -Sparse matrices have seen extensive improvements. There is now support for integer -dtypes such ``int8``, ``uint32``, etc. Two new sparse formats were added: +Sparse matrices have seen extensive improvements. There is now +support for integer dtypes such ``int8``, ``uint32``, etc. Two new +sparse formats were added: * new class ``dia_matrix`` : the sparse DIAgonal format * new class ``bsr_matrix`` : the Block CSR format @@ -139,65 +147,69 @@ * ``sparse.triu`` : extract upper triangle * ``sparse.find`` : nonzero values and their indices -``csr_matrix`` and ``csc_matrix`` now support slicing and fancy indexing -(e.g., ``A[1:3, 4:7]`` and ``A[[3,2,6,8],:]``). Conversions among all -sparse formats are now possible: +``csr_matrix`` and ``csc_matrix`` now support slicing and fancy +indexing (e.g., ``A[1:3, 4:7]`` and ``A[[3,2,6,8],:]``). Conversions +among all sparse formats are now possible: * using member functions such as ``.tocsr()`` and ``.tolil()`` * using the ``.asformat()`` member function, e.g. ``A.asformat('csr')`` * using constructors ``A = lil_matrix([[1,2]]); B = csr_matrix(A)`` -All sparse constructors now accept dense matrices and lists of lists. For -example: +All sparse constructors now accept dense matrices and lists of lists. +For example: * ``A = csr_matrix( rand(3,3) )`` and ``B = lil_matrix( [[1,2],[3,4]] )`` -Numerous efficiency improvements to format conversions and sparse matrix -arithmetic have been made. Finally, this release contains numerous bugfixes. +Numerous efficiency improvements to format conversions and sparse +matrix arithmetic have been made. Finally, this release contains +numerous bugfixes. Statistics package ------------------ -Statistical functions for masked arrays have been added, and are accessible -through ``scipy.stats.mstats``. The functions are similar to their counterparts -in ``scipy.stats`` but they have not yet been verified for identical interfaces -and algorithms. +Statistical functions for masked arrays have been added, and are +accessible through ``scipy.stats.mstats``. The functions are similar +to their counterparts in ``scipy.stats`` but they have not yet been +verified for identical interfaces and algorithms. -Several bugs were fixed for statistical functions, of those, ``kstest`` and -``percentileofscore`` gained new keyword arguments. +Several bugs were fixed for statistical functions, of those, +``kstest`` and ``percentileofscore`` gained new keyword arguments. Added deprecation warning for ``mean``, ``median``, ``var``, ``std``, ``cov``, and ``corrcoef``. These functions should be replaced by their -numpy counterparts. Note, however, that some of the default options differ -between the ``scipy.stats`` and numpy versions of these functions. +numpy counterparts. Note, however, that some of the default options +differ between the ``scipy.stats`` and numpy versions of these +functions. -Numerous bug fixes to ``stats.distributions``: all generic methods now work -correctly, several methods in individual distributions were corrected. However, -a few issues remain with higher moments (``skew``, ``kurtosis``) and entropy. -The maximum likelihood estimator, ``fit``, does not work out-of-the-box for -some distributions - in some cases, starting values have to be -carefully chosen, in other cases, the generic implementation of the maximum -likelihood method might not be the numerically appropriate estimation method. +Numerous bug fixes to ``stats.distributions``: all generic methods now +work correctly, several methods in individual distributions were +corrected. However, a few issues remain with higher moments (``skew``, +``kurtosis``) and entropy. The maximum likelihood estimator, ``fit``, +does not work out-of-the-box for some distributions - in some cases, +starting values have to be carefully chosen, in other cases, the +generic implementation of the maximum likelihood method might not be +the numerically appropriate estimation method. -We expect more bugfixes, increases in numerical precision and enhancements in -the next release of scipy. +We expect more bugfixes, increases in numerical precision and +enhancements in the next release of scipy. Reworking of IO package ----------------------- -The IO code in both NumPy and SciPy is being extensively reworked. NumPy -will be where basic code for reading and writing NumPy arrays is located, -while SciPy will house file readers and writers for various data formats -(data, audio, video, images, matlab, etc.). +The IO code in both NumPy and SciPy is being extensively +reworked. NumPy will be where basic code for reading and writing NumPy +arrays is located, while SciPy will house file readers and writers for +various data formats (data, audio, video, images, matlab, etc.). -Several functions in ``scipy.io`` have been deprecated and will be removed -in the 0.8.0 release including ``npfile``, ``save``, ``load``, ``create_module``, -``create_shelf``, ``objload``, ``objsave``, ``fopen``, ``read_array``, -``write_array``, ``fread``, ``fwrite``, ``bswap``, ``packbits``, ``unpackbits``, -and ``convert_objectarray``. Some of these functions have been replaced by -NumPy's raw reading and writing capabilities, memory-mapping capabilities, -or array methods. Others have been moved from SciPy to NumPy, since basic -array reading and writing capability is now handled by NumPy. +Several functions in ``scipy.io`` have been deprecated and will be +removed in the 0.8.0 release including ``npfile``, ``save``, ``load``, +``create_module``, ``create_shelf``, ``objload``, ``objsave``, +``fopen``, ``read_array``, ``write_array``, ``fread``, ``fwrite``, +``bswap``, ``packbits``, ``unpackbits``, and ``convert_objectarray``. +Some of these functions have been replaced by NumPy's raw reading and +writing capabilities, memory-mapping capabilities, or array methods. +Others have been moved from SciPy to NumPy, since basic array reading +and writing capability is now handled by NumPy. The Matlab (TM) file readers/writers have a number of improvements: @@ -235,12 +247,13 @@ New Spatial package ------------------- -The new spatial package contains a collection of spatial algorithms and data structures, useful for spatial -statistics and clustering applications. It includes rapidly compiled code for -computing exact and approximate nearest neighbors, as well as a pure-python -kd-tree with the same interface, but that supports annotation and a variety -of other algorithms. The API for both modules may change somewhat, as user -requirements become clearer. +The new spatial package contains a collection of spatial algorithms +and data structures, useful for spatial statistics and clustering +applications. It includes rapidly compiled code for computing exact +and approximate nearest neighbors, as well as a pure-python kd-tree +with the same interface, but that supports annotation and a variety of +other algorithms. The API for both modules may change somewhat, as +user requirements become clearer. It also includes a ``distance`` module, containing a collection of distance and dissimilarity functions for computing distances between @@ -272,41 +285,40 @@ conversion factors. These constants are taken from CODATA Recommended Values of the Fundamental Physical Constants: 2002. They may be found at physics.nist.gov/constants. The values are stored in the dictionary -physical_constants as a tuple containing the value, the units, and -the relative precision - in that order. All constants are in SI units, +physical_constants as a tuple containing the value, the units, and the +relative precision - in that order. All constants are in SI units, unless otherwise stated. Several helper functions are provided. New Radial Basis Function module -------------------------------- ``scipy.interpolate`` now contains a Radial Basis Function module. -Radial basis functions can be used for smoothing/interpolating scattered -data in n-dimensions, but should be used with caution for extrapolation -outside of the observed data range. +Radial basis functions can be used for smoothing/interpolating +scattered data in n-dimensions, but should be used with caution for +extrapolation outside of the observed data range. New complex ODE integrator -------------------------- ``scipy.integrate.ode`` now contains a wrapper for the ZVODE -complex-valued ordinary differential equation solver -(by Peter N. Brown, Alan C. Hindmarsh, and George D. Byrne). +complex-valued ordinary differential equation solver (by Peter +N. Brown, Alan C. Hindmarsh, and George D. Byrne). New generalized symmetric and hermitian eigenvalue problem solver ----------------------------------------------------------------- -``scipy.linalg.eigh`` now contains wrappers for more LAPACK -symmetric and hermitian eigenvalue problem solvers. Users -can now solve generalized problems, select a range of -eigenvalues only, and choose to use a faster algorithm at the expense -of increased memory usage. The signature of the ``scipy.linalg.eigh`` -changed accordingly. +``scipy.linalg.eigh`` now contains wrappers for more LAPACK symmetric +and hermitian eigenvalue problem solvers. Users can now solve +generalized problems, select a range of eigenvalues only, and choose +to use a faster algorithm at the expense of increased memory +usage. The signature of the ``scipy.linalg.eigh`` changed accordingly. Bug fixes in the interpolation package -------------------------------------- -The shape of return values from ``scipy.interpolate.interp1d`` used -to be incorrect, if interpolated data had more than 2 dimensions and -the axis keyword was set to a non-default value. This has been fixed. +The shape of return values from ``scipy.interpolate.interp1d`` used to +be incorrect, if interpolated data had more than 2 dimensions and the +axis keyword was set to a non-default value. This has been fixed. Users of ``scipy.interpolate.interp1d`` may need to revise their code if it relies on the incorrect behavior. From scipy-svn at scipy.org Tue Jan 13 03:12:21 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 13 Jan 2009 02:12:21 -0600 (CST) Subject: [Scipy-svn] r5457 - trunk Message-ID: <20090113081221.E0254C7C019@scipy.org> Author: stefan Date: 2009-01-13 02:12:08 -0600 (Tue, 13 Jan 2009) New Revision: 5457 Modified: trunk/THANKS.txt Log: Update THANKS. Modified: trunk/THANKS.txt =================================================================== --- trunk/THANKS.txt 2009-01-13 08:11:58 UTC (rev 5456) +++ trunk/THANKS.txt 2009-01-13 08:12:08 UTC (rev 5457) @@ -26,7 +26,9 @@ Travis Vaught for numerous contributions to annual conference and community web-site and the initial work on stats module clean up. Jeff Whitaker for Mac OS X support. -David Cournapeau for bug-fixes, refactor of fftpack and cluster, numscons build. +David Cournapeau for bug-fixes, refactoring of fftpack and cluster, + implementing the numscons build, building Windows binaries and + adding single precision FFT. Damian Eads for hierarchical clustering, dendrogram plotting, distance functions in spatial package, vq documentation. Anne Archibald for kd-trees and nearest neighbor in scipy.spatial. @@ -55,6 +57,12 @@ Neilen Marais for testing and bug-fixing in the ARPACK wrappers. Johannes Loehnert and Bart Vandereycken for fixes in the linalg module. +David Huard for improvements to the interpolation interface. +David Warde-Farley for converting the ndimage docs to ReST. +Uwe Schmitt for wrapping non-negative least-squares. +Ondrej Certik for Debian packaging. +Paul Ivanov for porting Numeric-style C code to the new NumPy API. +Ariel Rokem for contributions on percentileofscore fixes and tests. Institutions From scipy-svn at scipy.org Tue Jan 13 03:12:56 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 13 Jan 2009 02:12:56 -0600 (CST) Subject: [Scipy-svn] r5458 - trunk/doc/release Message-ID: <20090113081256.C7AD0C7C019@scipy.org> Author: stefan Date: 2009-01-13 02:12:45 -0600 (Tue, 13 Jan 2009) New Revision: 5458 Modified: trunk/doc/release/0.7.0-notes.rst Log: Wrap release notes to 78. Modified: trunk/doc/release/0.7.0-notes.rst =================================================================== --- trunk/doc/release/0.7.0-notes.rst 2009-01-13 08:12:08 UTC (rev 5457) +++ trunk/doc/release/0.7.0-notes.rst 2009-01-13 08:12:45 UTC (rev 5458) @@ -4,66 +4,69 @@ .. contents:: -SciPy 0.7.0 is the culmination of 16 months of hard work. It contains many new features, numerous bug-fixes, improved test -coverage and better documentation. There have been a number of -deprecations and API changes in this release, which are documented -below. All users are encouraged to upgrade to this release, as -there are a large number of bug-fixes and optimizations. Moreover, -our development attention will now shift to bug-fix releases on the -0.7.x branch, and on adding new features on the development trunk. This release -requires Python 2.4 or 2.5 and NumPy 1.2 or greater. +SciPy 0.7.0 is the culmination of 16 months of hard work. It contains +many new features, numerous bug-fixes, improved test coverage and +better documentation. There have been a number of deprecations and +API changes in this release, which are documented below. All users +are encouraged to upgrade to this release, as there are a large number +of bug-fixes and optimizations. Moreover, our development attention +will now shift to bug-fix releases on the 0.7.x branch, and on adding +new features on the development trunk. This release requires Python +2.4 or 2.5 and NumPy 1.2 or greater. -Please note that SciPy is still considered to have "Beta" status, as we work -toward a SciPy 1.0.0 release. The 1.0.0 release will mark a major -milestone in the development of SciPy, after which changing the package -structure or API will be much more difficult. Whilst these pre-1.0 -releases are considered to have "Beta" status, we are committed to making -them as bug-free as possible. For example, in addition to fixing -numerous bugs in this release, we have also doubled the number -of unit tests since the last release. +Please note that SciPy is still considered to have "Beta" status, as +we work toward a SciPy 1.0.0 release. The 1.0.0 release will mark a +major milestone in the development of SciPy, after which changing the +package structure or API will be much more difficult. Whilst these +pre-1.0 releases are considered to have "Beta" status, we are +committed to making them as bug-free as possible. For example, in +addition to fixing numerous bugs in this release, we have also doubled +the number of unit tests since the last release. However, until the 1.0 release, we are aggressively reviewing and refining the functionality, organization, and interface. This is being -done in an effort -to make the package as coherent, intuitive, and useful as possible. -To achieve this, we need help from the community of users. Specifically, -we need feedback regarding all aspects of the project - everything - from which -algorithms we implement, to details about our function's call signatures. +done in an effort to make the package as coherent, intuitive, and +useful as possible. To achieve this, we need help from the community +of users. Specifically, we need feedback regarding all aspects of the +project - everything - from which algorithms we implement, to details +about our function's call signatures. -Over the last year, we have seen a rapid increase in community involvement, -and numerous infrastructure improvements to lower the barrier to contributions -(e.g., more explicit coding standards, improved testing infrastructure, better -documentation tools). Over the next year, we hope to see this trend continue -and invite everyone to become more involved. +Over the last year, we have seen a rapid increase in community +involvement, and numerous infrastructure improvements to lower the +barrier to contributions (e.g., more explicit coding standards, +improved testing infrastructure, better documentation tools). Over +the next year, we hope to see this trend continue and invite everyone +to become more involved. Python 2.6 and 3.0 ------------------ -A significant amount of work has gone into making SciPy compatible with -Python 2.6; however, there are still some issues in this regard. -The main issue with 2.6 support is NumPy. On UNIX (including Mac OS X), -NumPy 1.2.1 mostly works, with a few caveats. On Windows, there are problems -related to the compilation process. The upcoming NumPy 1.3 release will fix -these problems. Any remaining issues with 2.6 support for SciPy 0.7 will -be addressed in a bug-fix release. +A significant amount of work has gone into making SciPy compatible +with Python 2.6; however, there are still some issues in this regard. +The main issue with 2.6 support is NumPy. On UNIX (including Mac OS +X), NumPy 1.2.1 mostly works, with a few caveats. On Windows, there +are problems related to the compilation process. The upcoming NumPy +1.3 release will fix these problems. Any remaining issues with 2.6 +support for SciPy 0.7 will be addressed in a bug-fix release. Python 3.0 is not supported at all; it requires NumPy to be ported to -Python 3.0. This requires immense effort, since a lot of C code has to be -ported. The transition to 3.0 is still under consideration; currently, we don't have any timeline or roadmap for this transition. +Python 3.0. This requires immense effort, since a lot of C code has +to be ported. The transition to 3.0 is still under consideration; +currently, we don't have any timeline or roadmap for this transition. Major documentation improvements -------------------------------- -SciPy documentation is greatly improved; you can -view a HTML reference manual `online `__ or -download it as a PDF file. The new reference guide was built using -the popular `Sphinx tool `__. +SciPy documentation is greatly improved; you can view a HTML reference +manual `online `__ or download it as a PDF +file. The new reference guide was built using the popular `Sphinx tool +`__. This release also includes an updated tutorial, which hadn't been available since SciPy was ported to NumPy in 2005. Though not -comprehensive, the tutorial shows how to use several essential -parts of Scipy. It also includes the ``ndimage`` documentation -from the ``numarray`` manual. +comprehensive, the tutorial shows how to use several essential parts +of Scipy. It also includes the ``ndimage`` documentation from the +``numarray`` manual. Nevertheless, more effort is needed on the documentation front. Luckily, contributing to Scipy documentation is now easier than @@ -74,13 +77,13 @@ Running Tests ------------- -NumPy 1.2 introduced a new testing framework based on `nose -`__. Starting with this release, SciPy -now uses the new NumPy test framework as well. Taking advantage of the new -testing framework requires ``nose`` version 0.10, or later. One major advantage -of the new framework is that it greatly simplifies writing unit -tests - which has all ready paid off, given the rapid increase in tests. To run -the full test suite:: +NumPy 1.2 introduced a new testing framework based on `nose +`__. Starting with this +release, SciPy now uses the new NumPy test framework as well. Taking +advantage of the new testing framework requires ``nose`` version 0.10, +or later. One major advantage of the new framework is that it greatly +simplifies writing unit tests - which has all ready paid off, given +the rapid increase in tests. To run the full test suite:: >>> import scipy >>> scipy.test('full') @@ -88,40 +91,45 @@ For more information, please see `The NumPy/SciPy Testing Guide `__. -We have also greatly improved our test coverage. There were just over 2,000 unit -tests in the 0.6.0 release; this release nearly doubles that number, with just over -4,000 unit tests. +We have also greatly improved our test coverage. There were just over +2,000 unit tests in the 0.6.0 release; this release nearly doubles +that number, with just over 4,000 unit tests. Building SciPy -------------- -Support for NumScons has been added. NumScons is a tentative new -build system for NumPy/SciPy, using `SCons `__ at its core. +Support for NumScons has been added. NumScons is a tentative new build +system for NumPy/SciPy, using `SCons `__ at its +core. -SCons is a next-generation build system, intended to replace the venerable ``Make`` -with the integrated functionality of ``autoconf``/``automake`` and ``ccache``. -Scons is written in Python and its configuration files are Python scripts. -NumScons is meant to replace NumPy's custom version of ``distutils`` providing -more advanced functionality, such as ``autoconf``, improved fortran support, -more tools, and support for ``numpy.distutils``/``scons`` cooperation. +SCons is a next-generation build system, intended to replace the +venerable ``Make`` with the integrated functionality of +``autoconf``/``automake`` and ``ccache``. Scons is written in Python +and its configuration files are Python scripts. NumScons is meant to +replace NumPy's custom version of ``distutils`` providing more +advanced functionality, such as ``autoconf``, improved fortran +support, more tools, and support for ``numpy.distutils``/``scons`` +cooperation. Sandbox Removed --------------- -While porting SciPy to NumPy in 2005, several packages and modules were -moved into ``scipy.sandbox``. The sandbox was a staging ground for packages -that were undergoing rapid development and whose APIs were in flux. It was -also a place where broken code could live. The sandbox has served its purpose -well, but was starting to create confusion. Thus ``scipy.sandbox`` was removed. -Most of the code was moved into ``scipy``, some code was made into a -``scikit``, and the remaining code was just deleted, as the functionality had -been replaced by other code. +While porting SciPy to NumPy in 2005, several packages and modules +were moved into ``scipy.sandbox``. The sandbox was a staging ground +for packages that were undergoing rapid development and whose APIs +were in flux. It was also a place where broken code could live. The +sandbox has served its purpose well, but was starting to create +confusion. Thus ``scipy.sandbox`` was removed. Most of the code was +moved into ``scipy``, some code was made into a ``scikit``, and the +remaining code was just deleted, as the functionality had been +replaced by other code. Sparse Matrices --------------- -Sparse matrices have seen extensive improvements. There is now support for integer -dtypes such ``int8``, ``uint32``, etc. Two new sparse formats were added: +Sparse matrices have seen extensive improvements. There is now +support for integer dtypes such ``int8``, ``uint32``, etc. Two new +sparse formats were added: * new class ``dia_matrix`` : the sparse DIAgonal format * new class ``bsr_matrix`` : the Block CSR format @@ -139,65 +147,69 @@ * ``sparse.triu`` : extract upper triangle * ``sparse.find`` : nonzero values and their indices -``csr_matrix`` and ``csc_matrix`` now support slicing and fancy indexing -(e.g., ``A[1:3, 4:7]`` and ``A[[3,2,6,8],:]``). Conversions among all -sparse formats are now possible: +``csr_matrix`` and ``csc_matrix`` now support slicing and fancy +indexing (e.g., ``A[1:3, 4:7]`` and ``A[[3,2,6,8],:]``). Conversions +among all sparse formats are now possible: * using member functions such as ``.tocsr()`` and ``.tolil()`` * using the ``.asformat()`` member function, e.g. ``A.asformat('csr')`` * using constructors ``A = lil_matrix([[1,2]]); B = csr_matrix(A)`` -All sparse constructors now accept dense matrices and lists of lists. For -example: +All sparse constructors now accept dense matrices and lists of lists. +For example: * ``A = csr_matrix( rand(3,3) )`` and ``B = lil_matrix( [[1,2],[3,4]] )`` -Numerous efficiency improvements to format conversions and sparse matrix -arithmetic have been made. Finally, this release contains numerous bugfixes. +Numerous efficiency improvements to format conversions and sparse +matrix arithmetic have been made. Finally, this release contains +numerous bugfixes. Statistics package ------------------ -Statistical functions for masked arrays have been added, and are accessible -through ``scipy.stats.mstats``. The functions are similar to their counterparts -in ``scipy.stats`` but they have not yet been verified for identical interfaces -and algorithms. +Statistical functions for masked arrays have been added, and are +accessible through ``scipy.stats.mstats``. The functions are similar +to their counterparts in ``scipy.stats`` but they have not yet been +verified for identical interfaces and algorithms. -Several bugs were fixed for statistical functions, of those, ``kstest`` and -``percentileofscore`` gained new keyword arguments. +Several bugs were fixed for statistical functions, of those, +``kstest`` and ``percentileofscore`` gained new keyword arguments. Added deprecation warning for ``mean``, ``median``, ``var``, ``std``, ``cov``, and ``corrcoef``. These functions should be replaced by their -numpy counterparts. Note, however, that some of the default options differ -between the ``scipy.stats`` and numpy versions of these functions. +numpy counterparts. Note, however, that some of the default options +differ between the ``scipy.stats`` and numpy versions of these +functions. -Numerous bug fixes to ``stats.distributions``: all generic methods now work -correctly, several methods in individual distributions were corrected. However, -a few issues remain with higher moments (``skew``, ``kurtosis``) and entropy. -The maximum likelihood estimator, ``fit``, does not work out-of-the-box for -some distributions - in some cases, starting values have to be -carefully chosen, in other cases, the generic implementation of the maximum -likelihood method might not be the numerically appropriate estimation method. +Numerous bug fixes to ``stats.distributions``: all generic methods now +work correctly, several methods in individual distributions were +corrected. However, a few issues remain with higher moments (``skew``, +``kurtosis``) and entropy. The maximum likelihood estimator, ``fit``, +does not work out-of-the-box for some distributions - in some cases, +starting values have to be carefully chosen, in other cases, the +generic implementation of the maximum likelihood method might not be +the numerically appropriate estimation method. -We expect more bugfixes, increases in numerical precision and enhancements in -the next release of scipy. +We expect more bugfixes, increases in numerical precision and +enhancements in the next release of scipy. Reworking of IO package ----------------------- -The IO code in both NumPy and SciPy is being extensively reworked. NumPy -will be where basic code for reading and writing NumPy arrays is located, -while SciPy will house file readers and writers for various data formats -(data, audio, video, images, matlab, etc.). +The IO code in both NumPy and SciPy is being extensively +reworked. NumPy will be where basic code for reading and writing NumPy +arrays is located, while SciPy will house file readers and writers for +various data formats (data, audio, video, images, matlab, etc.). -Several functions in ``scipy.io`` have been deprecated and will be removed -in the 0.8.0 release including ``npfile``, ``save``, ``load``, ``create_module``, -``create_shelf``, ``objload``, ``objsave``, ``fopen``, ``read_array``, -``write_array``, ``fread``, ``fwrite``, ``bswap``, ``packbits``, ``unpackbits``, -and ``convert_objectarray``. Some of these functions have been replaced by -NumPy's raw reading and writing capabilities, memory-mapping capabilities, -or array methods. Others have been moved from SciPy to NumPy, since basic -array reading and writing capability is now handled by NumPy. +Several functions in ``scipy.io`` have been deprecated and will be +removed in the 0.8.0 release including ``npfile``, ``save``, ``load``, +``create_module``, ``create_shelf``, ``objload``, ``objsave``, +``fopen``, ``read_array``, ``write_array``, ``fread``, ``fwrite``, +``bswap``, ``packbits``, ``unpackbits``, and ``convert_objectarray``. +Some of these functions have been replaced by NumPy's raw reading and +writing capabilities, memory-mapping capabilities, or array methods. +Others have been moved from SciPy to NumPy, since basic array reading +and writing capability is now handled by NumPy. The Matlab (TM) file readers/writers have a number of improvements: @@ -235,12 +247,13 @@ New Spatial package ------------------- -The new spatial package contains a collection of spatial algorithms and data structures, useful for spatial -statistics and clustering applications. It includes rapidly compiled code for -computing exact and approximate nearest neighbors, as well as a pure-python -kd-tree with the same interface, but that supports annotation and a variety -of other algorithms. The API for both modules may change somewhat, as user -requirements become clearer. +The new spatial package contains a collection of spatial algorithms +and data structures, useful for spatial statistics and clustering +applications. It includes rapidly compiled code for computing exact +and approximate nearest neighbors, as well as a pure-python kd-tree +with the same interface, but that supports annotation and a variety of +other algorithms. The API for both modules may change somewhat, as +user requirements become clearer. It also includes a ``distance`` module, containing a collection of distance and dissimilarity functions for computing distances between @@ -272,41 +285,40 @@ conversion factors. These constants are taken from CODATA Recommended Values of the Fundamental Physical Constants: 2002. They may be found at physics.nist.gov/constants. The values are stored in the dictionary -physical_constants as a tuple containing the value, the units, and -the relative precision - in that order. All constants are in SI units, +physical_constants as a tuple containing the value, the units, and the +relative precision - in that order. All constants are in SI units, unless otherwise stated. Several helper functions are provided. New Radial Basis Function module -------------------------------- ``scipy.interpolate`` now contains a Radial Basis Function module. -Radial basis functions can be used for smoothing/interpolating scattered -data in n-dimensions, but should be used with caution for extrapolation -outside of the observed data range. +Radial basis functions can be used for smoothing/interpolating +scattered data in n-dimensions, but should be used with caution for +extrapolation outside of the observed data range. New complex ODE integrator -------------------------- ``scipy.integrate.ode`` now contains a wrapper for the ZVODE -complex-valued ordinary differential equation solver -(by Peter N. Brown, Alan C. Hindmarsh, and George D. Byrne). +complex-valued ordinary differential equation solver (by Peter +N. Brown, Alan C. Hindmarsh, and George D. Byrne). New generalized symmetric and hermitian eigenvalue problem solver ----------------------------------------------------------------- -``scipy.linalg.eigh`` now contains wrappers for more LAPACK -symmetric and hermitian eigenvalue problem solvers. Users -can now solve generalized problems, select a range of -eigenvalues only, and choose to use a faster algorithm at the expense -of increased memory usage. The signature of the ``scipy.linalg.eigh`` -changed accordingly. +``scipy.linalg.eigh`` now contains wrappers for more LAPACK symmetric +and hermitian eigenvalue problem solvers. Users can now solve +generalized problems, select a range of eigenvalues only, and choose +to use a faster algorithm at the expense of increased memory +usage. The signature of the ``scipy.linalg.eigh`` changed accordingly. Bug fixes in the interpolation package -------------------------------------- -The shape of return values from ``scipy.interpolate.interp1d`` used -to be incorrect, if interpolated data had more than 2 dimensions and -the axis keyword was set to a non-default value. This has been fixed. +The shape of return values from ``scipy.interpolate.interp1d`` used to +be incorrect, if interpolated data had more than 2 dimensions and the +axis keyword was set to a non-default value. This has been fixed. Users of ``scipy.interpolate.interp1d`` may need to revise their code if it relies on the incorrect behavior. From scipy-svn at scipy.org Tue Jan 13 03:25:01 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 13 Jan 2009 02:25:01 -0600 (CST) Subject: [Scipy-svn] r5459 - in trunk/scipy: ndimage special Message-ID: <20090113082501.BD876C7C019@scipy.org> Author: stefan Date: 2009-01-13 02:24:40 -0600 (Tue, 13 Jan 2009) New Revision: 5459 Modified: trunk/scipy/ndimage/filters.py trunk/scipy/special/orthogonal.py Log: Apply documentation patch. Modified: trunk/scipy/ndimage/filters.py =================================================================== --- trunk/scipy/ndimage/filters.py 2009-01-13 08:12:45 UTC (rev 5458) +++ trunk/scipy/ndimage/filters.py 2009-01-13 08:24:40 UTC (rev 5459) @@ -520,19 +520,31 @@ @docfiller def convolve(input, weights, output = None, mode = 'reflect', cval = 0.0, origin = 0): - """Multi-dimensional convolution. + """ + Multi-dimensional convolution. The array is convolved with the given kernel. Parameters ---------- - %(input)s + input : array-like + input array to filter weights : ndarray array of weights, same number of dimensions as input - %(output)s - %(mode)s - %(cval)s - %(origin)s + output : array, optional + The ``output`` parameter passes an array in which to store the + filter output. + mode : {'reflect','constant','nearest','mirror', 'wrap'}, optional + The ``mode`` parameter determines how the array borders are + handled, where ``cval`` is the value when mode is equal to + 'constant'. Default is 'reflect' + cval : scalar, optional + Value to fill past edges of input if ``mode`` is 'constant'. Default + is 0.0 + origin : scalar, optional + The ``origin`` parameter controls the placement of the filter. + Default 0 + """ return _correlate_or_convolve(input, weights, output, mode, cval, origin, True) @@ -859,16 +871,40 @@ @docfiller def median_filter(input, size = None, footprint = None, output = None, mode = "reflect", cval = 0.0, origin = 0): - """Calculates a multi-dimensional median filter. + """ + Calculates a multi-dimensional median filter. Parameters ---------- - %(input)s - %(size_foot)s - %(output)s - %(mode)s - %(cval)s - %(origin)s + input : array-like + input array to filter + size : scalar or tuple, optional + See footprint, below + footprint : array, optional + Either ``size`` or ``footprint`` must be defined. ``size`` gives + the shape that is taken from the input array, at every element + position, to define the input to the filter function. + ``footprint`` is a boolean array that specifies (implicitly) a + shape, but also which of the elements within this shape will get + passed to the filter function. Thus ``size=(n,m)`` is equivalent + to ``footprint=np.ones((n,m))``. We adjust ``size`` to the number + of dimensions of the input array, so that, if the input array is + shape (10,10,10), and ``size`` is 2, then the actual size used is + (2,2,2). + output : array, optional + The ``output`` parameter passes an array in which to store the + filter output. + mode : {'reflect','constant','nearest','mirror', 'wrap'}, optional + The ``mode`` parameter determines how the array borders are + handled, where ``cval`` is the value when mode is equal to + 'constant'. Default is 'reflect' + cval : scalar, optional + Value to fill past edges of input if ``mode`` is 'constant'. Default + is 0.0 + origin : scalar, optional + The ``origin`` parameter controls the placement of the filter. + Default 0 + """ return _rank_filter(input, 0, size, footprint, output, mode, cval, origin, 'median') Modified: trunk/scipy/special/orthogonal.py =================================================================== --- trunk/scipy/special/orthogonal.py 2009-01-13 08:12:45 UTC (rev 5458) +++ trunk/scipy/special/orthogonal.py 2009-01-13 08:24:40 UTC (rev 5459) @@ -1,8 +1,3 @@ -#!/usr/bin/env python -# -# Author: Travis Oliphant 2000 -# Updated Sep. 2003 (fixed bugs --- tested to be accurate) - """ A collection of functions to find the weights and abscissas for Gaussian Quadrature. @@ -14,30 +9,44 @@ Many recursion relations for orthogonal polynomials are given: -a1n f_n+1 (x) = (a2n + a3n x ) f_n (x) - a4n f_n-1 (x) +.. math:: + a1n f_{n+1} (x) = (a2n + a3n x ) f_n (x) - a4n f_{n-1} (x) + The recursion relation of interest is -P_n+1 (x) = (x - A_n) P_n (x) - B_n P_n-1 (x) +.. math:: -where P has a different normalization than f. + P_{n+1} (x) = (x - A_n) P_n (x) - B_n P_{n-1} (x) +where :math:`P` has a different normalization than :math:`f`. + The coefficients can be found as: -A_n = -a2n / a3n +.. math:: -B_n = ( a4n / a3n sqrt(h_n-1 / h_n))**2 + A_n = -a2n / a3n + \\qquad + B_n = ( a4n / a3n \\sqrt{h_n-1 / h_n})^2 - where - h_n = int_a^b w(x) f_n(x)^2 +where + +.. math:: + + h_n = \\int_a^b w(x) f_n(x)^2 + assume: -P_0(x) = 1 -P_-1(x) == 0 +.. math:: + + P_0 (x) = 1 + \\qquad + P_{-1} (x) == 0 + For the mathematical background, see [golub.welsch-1969-mathcomp]_ and [abramowitz.stegun-1965]_. -Functions: +Functions:: gen_roots_and_weights -- Generic roots and weights. j_roots -- Jacobi @@ -66,7 +75,11 @@ Mathematical Functions: with Formulas, Graphs, and Mathematical Tables*. Gaithersburg, MD: National Bureau of Standards. http://www.math.sfu.ca/~cbm/aands/ + """ +# +# Author: Travis Oliphant 2000 +# Updated Sep. 2003 (fixed bugs --- tested to be accurate) # Scipy imports. import numpy as np From scipy-svn at scipy.org Tue Jan 13 03:33:08 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 13 Jan 2009 02:33:08 -0600 (CST) Subject: [Scipy-svn] r5460 - trunk/scipy/ndimage Message-ID: <20090113083308.340DCC7C019@scipy.org> Author: stefan Date: 2009-01-13 02:32:53 -0600 (Tue, 13 Jan 2009) New Revision: 5460 Modified: trunk/scipy/ndimage/filters.py Log: Revert doc changes to ndimage/filters to avoid breaking templates. Modified: trunk/scipy/ndimage/filters.py =================================================================== --- trunk/scipy/ndimage/filters.py 2009-01-13 08:24:40 UTC (rev 5459) +++ trunk/scipy/ndimage/filters.py 2009-01-13 08:32:53 UTC (rev 5460) @@ -520,31 +520,19 @@ @docfiller def convolve(input, weights, output = None, mode = 'reflect', cval = 0.0, origin = 0): - """ - Multi-dimensional convolution. + """Multi-dimensional convolution. The array is convolved with the given kernel. Parameters ---------- - input : array-like - input array to filter + %(input)s weights : ndarray array of weights, same number of dimensions as input - output : array, optional - The ``output`` parameter passes an array in which to store the - filter output. - mode : {'reflect','constant','nearest','mirror', 'wrap'}, optional - The ``mode`` parameter determines how the array borders are - handled, where ``cval`` is the value when mode is equal to - 'constant'. Default is 'reflect' - cval : scalar, optional - Value to fill past edges of input if ``mode`` is 'constant'. Default - is 0.0 - origin : scalar, optional - The ``origin`` parameter controls the placement of the filter. - Default 0 - + %(output)s + %(mode)s + %(cval)s + %(origin)s """ return _correlate_or_convolve(input, weights, output, mode, cval, origin, True) @@ -871,40 +859,16 @@ @docfiller def median_filter(input, size = None, footprint = None, output = None, mode = "reflect", cval = 0.0, origin = 0): - """ - Calculates a multi-dimensional median filter. + """Calculates a multi-dimensional median filter. Parameters ---------- - input : array-like - input array to filter - size : scalar or tuple, optional - See footprint, below - footprint : array, optional - Either ``size`` or ``footprint`` must be defined. ``size`` gives - the shape that is taken from the input array, at every element - position, to define the input to the filter function. - ``footprint`` is a boolean array that specifies (implicitly) a - shape, but also which of the elements within this shape will get - passed to the filter function. Thus ``size=(n,m)`` is equivalent - to ``footprint=np.ones((n,m))``. We adjust ``size`` to the number - of dimensions of the input array, so that, if the input array is - shape (10,10,10), and ``size`` is 2, then the actual size used is - (2,2,2). - output : array, optional - The ``output`` parameter passes an array in which to store the - filter output. - mode : {'reflect','constant','nearest','mirror', 'wrap'}, optional - The ``mode`` parameter determines how the array borders are - handled, where ``cval`` is the value when mode is equal to - 'constant'. Default is 'reflect' - cval : scalar, optional - Value to fill past edges of input if ``mode`` is 'constant'. Default - is 0.0 - origin : scalar, optional - The ``origin`` parameter controls the placement of the filter. - Default 0 - + %(input)s + %(size_foot)s + %(output)s + %(mode)s + %(cval)s + %(origin)s """ return _rank_filter(input, 0, size, footprint, output, mode, cval, origin, 'median') From scipy-svn at scipy.org Tue Jan 13 03:34:28 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 13 Jan 2009 02:34:28 -0600 (CST) Subject: [Scipy-svn] r5461 - branches/0.7.x/scipy/special Message-ID: <20090113083428.D10E0C7C019@scipy.org> Author: stefan Date: 2009-01-13 02:34:19 -0600 (Tue, 13 Jan 2009) New Revision: 5461 Modified: branches/0.7.x/scipy/special/orthogonal.py Log: Backport changes to orthogonal docs. Modified: branches/0.7.x/scipy/special/orthogonal.py =================================================================== --- branches/0.7.x/scipy/special/orthogonal.py 2009-01-13 08:32:53 UTC (rev 5460) +++ branches/0.7.x/scipy/special/orthogonal.py 2009-01-13 08:34:19 UTC (rev 5461) @@ -1,8 +1,3 @@ -#!/usr/bin/env python -# -# Author: Travis Oliphant 2000 -# Updated Sep. 2003 (fixed bugs --- tested to be accurate) - """ A collection of functions to find the weights and abscissas for Gaussian Quadrature. @@ -14,30 +9,44 @@ Many recursion relations for orthogonal polynomials are given: -a1n f_n+1 (x) = (a2n + a3n x ) f_n (x) - a4n f_n-1 (x) +.. math:: + a1n f_{n+1} (x) = (a2n + a3n x ) f_n (x) - a4n f_{n-1} (x) + The recursion relation of interest is -P_n+1 (x) = (x - A_n) P_n (x) - B_n P_n-1 (x) +.. math:: -where P has a different normalization than f. + P_{n+1} (x) = (x - A_n) P_n (x) - B_n P_{n-1} (x) +where :math:`P` has a different normalization than :math:`f`. + The coefficients can be found as: -A_n = -a2n / a3n +.. math:: -B_n = ( a4n / a3n sqrt(h_n-1 / h_n))**2 + A_n = -a2n / a3n + \\qquad + B_n = ( a4n / a3n \\sqrt{h_n-1 / h_n})^2 - where - h_n = int_a^b w(x) f_n(x)^2 +where + +.. math:: + + h_n = \\int_a^b w(x) f_n(x)^2 + assume: -P_0(x) = 1 -P_-1(x) == 0 +.. math:: + + P_0 (x) = 1 + \\qquad + P_{-1} (x) == 0 + For the mathematical background, see [golub.welsch-1969-mathcomp]_ and [abramowitz.stegun-1965]_. -Functions: +Functions:: gen_roots_and_weights -- Generic roots and weights. j_roots -- Jacobi @@ -66,7 +75,11 @@ Mathematical Functions: with Formulas, Graphs, and Mathematical Tables*. Gaithersburg, MD: National Bureau of Standards. http://www.math.sfu.ca/~cbm/aands/ + """ +# +# Author: Travis Oliphant 2000 +# Updated Sep. 2003 (fixed bugs --- tested to be accurate) # Scipy imports. import numpy as np From scipy-svn at scipy.org Tue Jan 13 11:09:19 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 13 Jan 2009 10:09:19 -0600 (CST) Subject: [Scipy-svn] r5462 - trunk/scipy/fftpack/tests Message-ID: <20090113160919.624F1C7C019@scipy.org> Author: cdavid Date: 2009-01-13 10:09:13 -0600 (Tue, 13 Jan 2009) New Revision: 5462 Added: trunk/scipy/fftpack/tests/test.mat Log: Forgot to add small matlab dataset for dct tests. Added: trunk/scipy/fftpack/tests/test.mat =================================================================== --- trunk/scipy/fftpack/tests/test.mat 2009-01-13 08:34:19 UTC (rev 5461) +++ trunk/scipy/fftpack/tests/test.mat 2009-01-13 16:09:13 UTC (rev 5462) @@ -0,0 +1,34 @@ +MATLAB 5.0 MAT-file, Platform: GLNX86, Created on: Sat Jan 10 14:39:34 2009 IM2x??c``pb6 ??? ? +?317?fb?0`?>#3 +;'X=3skfx??c``X?l@??A??gb~0??Pa??? dW0 ?????ro??????='?????? +?q?? :@t?@???@?6I?:07W?^*??????,\[x??c``??l@??A??gb0??Pa??? d70 @(???U ????????Pq ??T\*??+B????*??$?Yx??c``??l@??A??gbA0??Pa??? dw0??'?? ???Y 4'???? ?P??/?KB??P??vP??+B?JPy:? ;8x??c``0`d``? X?| fc&? +N????]?*?o???9g????G?;?=?:`?'0?+????????????tZ8?/?g{????.?}?o ??X??x??Q???????X4?O?:f???,(????/>S%?Z>??U?gV{??????? +????.=???M??,???{?????????????^???kf????\??g/z?????e ?_?w?j???u?v?L????????5????^&??i6?g??~Zl-ym?tg??d?/??3??????KN????[g?L?????H???;????eo?P*???^??Cx?8??0@x5  ????????????I?Q?????$???,e??lO{9? ??????C=??`;???C??W???O???}L?U?????C.?w??]?3(P???z?fk???,+??L???LH?vv???5?8&???????7???fk???]?]?G??M???????+???hsi????2t|?i???y??W1??[?u?????Il?T?????crW??~??QV%????8?????s??0e??? ?`??6U?*?W???p??"????rY5???????Zg????????/l??d???????}??C?n +????????????4n4??Q???~\??S??s(???|1}????c???&????:?9????= +??fR???yw??%??[?????m???^v???? ????xz[h????P??8???\?*7????]??#?? ?u?r?????????????????!?F?Q?????u?????y#L??????:?R?????%+?U????E????+ ??d??Ew???e?????8x?-? 0? ????J?#E???f???q?B? -N>?{? +?bN?? ?~?r?1U?????u????8??S???kE??|??O^EUM???????& q?????Y? ?? ?!?n4y?L??v??????)SSk????&?F???Hn~? ?????VOAI[?????B? +?m?????l?????-I?!l???}@???>?- ?????????9??,?/?[?wuV???qdk??`?m?>?;???E?n?O!?,?w?|r???aBFw??Q?" ?? ?-?):????0??O?N?I?|:???"?q?r??w1??}????????Q?l? M?h+?_-?E^???^?t?9Tx?-? 8??'??B#??????P?????(Y +q]?????P +)??u? cd??????~????y??}???${D?_???????????n????zn/??e??(y???d???V????????#?-?A????????4?mwJli7?s?????[? ???s?W???????+?pi???? V?? qb???????F,?'u??/???Tr~s_l/?L????+???/??z?h?-?P?????b_?; ?z_*??????Z6?y!? ?&??|??k????{??????/N ??E?!?|?hCA#,D??]^?A?.??????i?V?[cX??O??FL??-?????w?Vv6K@??^?? ??????8???Lf ?G??J!k.?H>?s???v}??? +?^P??V???W??Ncaf?`{??-nOz|3!?HV?+?????A?W?z{f????{V"???V???q???e? Z?e-??t\T?g?~?a)???? +?1???)????6?????F.??1?!??ZS??F??$N??{????5?0?iW??0.$p???!T?u??v???De??O?\?1Vl??? +!??c?|_????}?|J??_?Xg???}?15=?A??}?7(mYO????(=???????L!3??FAd?? ??A?"?????9?????KRP ???,m??;??@du???? -04???J???V8:z??r???????\?f?#? P??Xl+?Ei'??>?o???K ????d?u??a?]M`?U?????Y'?0?r28*?U3????=??|?c?x???!9!??yi:???y@?o6?c??t??SL]?YJL??"H}???f05??*??BK??M?Y?f??v????(g??d? -????">e?c????!n?5???L??W??L\?SU?c?o R?_?1????uM&??=? +???!??M?.n??)?,????+Q?l???,?b??5.????BVf??R=?hn +eA9S(V?h/2?%ovo?i??n:????o??>?u?U?FR?f"1??n:O??w?_??YIy+8_?C?D?lr|?????eR2???????????A_PG???,dd=:#?i-*???|?(???)?iK g?Gk?c????-??????E-2p?)???{?S?$N?8z?FyVS+?uk1{?P?:??????????Vt4a +??(?d?/?R????|??j???????[??X??r?????N?,??H?????r?Q??]g?~??7S?K???????mMO???~)?U??~???sO??78?c????????O?w{?D???[????R&??Yu?~????e??_??_?=??}U`???w/??.?????????Z??,??k?[K????|??c?????.???x???q??}?W???[??w??5'E2P??~?+????]???????_????7?Q??????U???????*??u???*?d???? ?t~????lO??@?g? Q???+ ???????????$??T????@g{ +???F??N?????o[E??o?{??????????Lx%?r??P?WW?????x2%????? ?K????N?Jc3?????G?8???.?0~?|?b???`????w#% ???~@t???????R?E???????????????J???????????%??~??/????y|????l?"_????~?????s???R????$??z???4m6 + ??"???????j??????y???????.?n???^:?*???*?=x?-? 0? ??y??Z?8??6?U??$?T?s??[????"{?8?? I?????W?????uu????b?Td[?"?v??????<?N?e??A???[AZ?(?o??E?n??^<>????Cr?pp?SO?b?=?7??[(?? ?7[)?t??%)n??Q?w?`X???y'?????r???x?su3?N??\?????? ?~???u?-?R ???9s?18?F ?? #0???1????f?:????A??5?H??t???}Bh1??X????V??_-A?????e????k??*pb#?G!E?R??T??\???????f???T???s?;?Y?f~Z??I b??> ?5????IP?Y???Ha? +p%?G7?????c??MV?n?_????>??)??????`x ?+? ?*?s?G?"??{??^??c??C;F????z?ujw?$??? z??;?????.?-w??L??T|:IX0?"?/?+?H?/Hp:vJ?????????6*????4?2?huZd???????qm0???v5K???? tV#???u6Q?(??O9y[??v:??LO?r?Pb?A8o??K?????YL??J?9sP=1?0?}?k??Qlo??O????#_?4?*0%???j?M???@7??#/F??e????% +I?Ot^?????Ek[?&?j????8=??7??9?3?o?e?}?e?/ ?/??o?7??}????????|????qe?o ?????7?i????[?????I????|z??*?#?V?????????? h????e????/???!?vw???'8?%?O?(P??^5?2?8???^t ??s?t?d<7???lE??l???<\m-G5??a??Jp???D+ +??1?????h?Rz2???LD?nj?M????sH8bU?$MB???u=C`N????;?????~?~?Xo?.????? +?g??L???Z??9\??J?????.??g?.z?b$???I?,^??\^?`M?-?;???P??3 ?k?&??3?bZG? R??3???V??#???????BD?/?`??E??98??]?&??)uY?th?s?>??a a!*&=?ok ?,'???? P??XS??@V?I??U??????????N?AC?cs?? ????? _??[?}M_ +?;z???7????h%?0?????8/?V nm??f?~x?\??=????;'????D?w?J????uB=? +K?H4P??????!????S?V?? ?,J?ko??b????hx??Xe_a????#T????,r"????5Up?E??uC?y?-U??????;??P????k[??? ?(t(X!??[???b??q? ?9?'O?f|????? \ No newline at end of file From scipy-svn at scipy.org Wed Jan 14 01:22:56 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 14 Jan 2009 00:22:56 -0600 (CST) Subject: [Scipy-svn] r5463 - branches/0.7.x/scipy/special/tests Message-ID: <20090114062256.9AEFBC7C040@scipy.org> Author: jarrod.millman Date: 2009-01-14 00:22:55 -0600 (Wed, 14 Jan 2009) New Revision: 5463 Modified: branches/0.7.x/scipy/special/tests/test_basic.py Log: was getting "FAIL: test_pbdv (test_basic.TestCephes)" on 64bit Ubuntu Modified: branches/0.7.x/scipy/special/tests/test_basic.py =================================================================== --- branches/0.7.x/scipy/special/tests/test_basic.py 2009-01-13 16:09:13 UTC (rev 5462) +++ branches/0.7.x/scipy/special/tests/test_basic.py 2009-01-14 06:22:55 UTC (rev 5463) @@ -28,7 +28,12 @@ from scipy.special import * import scipy.special._cephes as cephes +# Determine number of bits +import platform +_bits = {'32bit':32,'64bit':64} +platform_bits = _bits[platform.architecture()[0]] + class TestCephes(TestCase): def test_airy(self): cephes.airy(0) @@ -358,6 +363,7 @@ def test_obl_rad2_cv(self): cephes.obl_rad2_cv(1,1,1,1,0) + @dec.knownfailureif(platform_bits==64) def test_pbdv(self): assert_equal(cephes.pbdv(1,0),(0.0,0.0)) def test_pbvv(self): From scipy-svn at scipy.org Wed Jan 14 02:29:40 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 14 Jan 2009 01:29:40 -0600 (CST) Subject: [Scipy-svn] r5464 - trunk/doc/release Message-ID: <20090114072940.641DAC7C040@scipy.org> Author: jarrod.millman Date: 2009-01-14 01:29:39 -0600 (Wed, 14 Jan 2009) New Revision: 5464 Added: trunk/doc/release/0.8.0-notes.rst Log: start 0.8.0 release notes Added: trunk/doc/release/0.8.0-notes.rst =================================================================== --- trunk/doc/release/0.8.0-notes.rst 2009-01-14 06:22:55 UTC (rev 5463) +++ trunk/doc/release/0.8.0-notes.rst 2009-01-14 07:29:39 UTC (rev 5464) @@ -0,0 +1,45 @@ +========================= +SciPy 0.8.0 Release Notes +========================= + +.. contents:: + +SciPy 0.8.0 is the culmination of 6 months of hard work. It contains +many new features, numerous bug-fixes, improved test coverage and +better documentation. There have been a number of deprecations and +API changes in this release, which are documented below. All users +are encouraged to upgrade to this release, as there are a large number +of bug-fixes and optimizations. Moreover, our development attention +will now shift to bug-fix releases on the 0.8.x branch, and on adding +new features on the development trunk. This release requires Python +2.4 - 2.6 and NumPy 1.3 or greater. + +Please note that SciPy is still considered to have "Beta" status, as +we work toward a SciPy 1.0.0 release. The 1.0.0 release will mark a +major milestone in the development of SciPy, after which changing the +package structure or API will be much more difficult. Whilst these +pre-1.0 releases are considered to have "Beta" status, we are +committed to making them as bug-free as possible. For example, in +addition to fixing numerous bugs in this release, we have also doubled +the number of unit tests since the last release. + +However, until the 1.0 release, we are aggressively reviewing and +refining the functionality, organization, and interface. This is being +done in an effort to make the package as coherent, intuitive, and +useful as possible. To achieve this, we need help from the community +of users. Specifically, we need feedback regarding all aspects of the +project - everything - from which algorithms we implement, to details +about our function's call signatures. + +Python 3.0 +---------- + +Python 3.0 is not supported at all; it requires NumPy to be ported to +Python 3.0. This requires immense effort, since a lot of C code has +to be ported. The transition to 3.0 is still under consideration; +currently, we don't have any timeline or roadmap for this transition. + +Major documentation improvements +-------------------------------- + +SciPy documentation is greatly improved. From scipy-svn at scipy.org Thu Jan 15 19:04:27 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 15 Jan 2009 18:04:27 -0600 (CST) Subject: [Scipy-svn] r5465 - in trunk/scipy/special: specfun tests Message-ID: <20090116000427.18929C7C012@scipy.org> Author: ptvirtan Date: 2009-01-15 18:04:07 -0600 (Thu, 15 Jan 2009) New Revision: 5465 Modified: trunk/scipy/special/specfun/specfun.f trunk/scipy/special/tests/test_basic.py Log: Fix #679: specfun's STVHV used Y_|v| instead of Y_v => wrong results for v<0 specfun's STVHV uses asymptotic expansion to calculate H_v - Y_v, and adds Y_v to the result. But it actually added Y_|v| to the result, giving wrong results for v<0. This commit fixes this by computing Y_v for v<0 via symmetry (integer v) or via a relation between Y_v and Y_|v|, J_|v|. The Bessel function J_|v|(z) is calculated using forward recurrence, since this can be done easily. In general this would be numerically unstable; however, STVHV is restricted to range |v| < 12.5, and since the asymptotic expansion is triggered only for z > 20, the recurrence is stable enough. Accuracy 1e-8 appears to be guaranteed. Modified: trunk/scipy/special/specfun/specfun.f =================================================================== --- trunk/scipy/special/specfun/specfun.f 2009-01-14 07:29:39 UTC (rev 5464) +++ trunk/scipy/special/specfun/specfun.f 2009-01-16 00:04:07 UTC (rev 5465) @@ -12665,6 +12665,7 @@ C Input : v --- Order of Hv(x) ( -8.0 ? v ? 12.5 ) C x --- Argument of Hv(x) ( x ? 0 ) C Output: HV --- Hv(x) +C Note: numerically unstable away from the above range for `v` C Routine called: GAMMA2 to compute the gamma function C ===================================================== C @@ -12685,6 +12686,7 @@ QU0=0.0D0 PU0=0.0D0 IF (X.LE.20.0D0) THEN +C Power series for Hv (Abramowitz & Stegun 12.1.3) V0=V+1.5D0 CALL GAMMA2(V0,GA) S=2.0D0/(DSQRT(PI)*GA) @@ -12701,6 +12703,7 @@ 10 CONTINUE 15 HV=(0.5D0*X)**(V+1.0D0)*S ELSE +C Asymptotic large |z| expansion for Hv - Yv (Abm & Stg 12.1.29) SA=(0.5D0*X)**(V-1.0)/PI V0=V+0.5D0 CALL GAMMA2(V0,GA) @@ -12715,6 +12718,8 @@ S=S+R1*GA/GB 20 CONTINUE S0=SA*S + +C Compute Y_(|v|-N) (Abm & Stg 9.2.6) U=DABS(V) N=INT(U) U0=U-N @@ -12745,6 +12750,8 @@ SR=DSQRT(2.0D0/(PI*X)) BY0=SR*(PU0*DSIN(T0)+QU0*DCOS(T0)) BY1=SR*(PU1*DSIN(T1)+QU1*DCOS(T1)) + +C Compute Y_|v| (Abm & Stg 9.1.27) BF0=BY0 BF1=BY1 DO 40 K=2,N @@ -12754,6 +12761,37 @@ IF (N.EQ.0) BYV=BY0 IF (N.EQ.1) BYV=BY1 IF (N.GT.1) BYV=BF + +C Compute Y_v (handle the case v < 0 appropriately) + IF (V .LT. 0) THEN + IF (U0 .EQ. 0) THEN +C Use symmetry (Abm & Stg 9.1.5) + BYV=(-1)**N*BYV + ELSE +C Use relation between Yv & Jv (Abm & Stg 9.1.6) + +C Compute J_(|v|-N) (Abm & Stg 9.2.5) + BJ0=SR*(PU0*DCOS(T0)-QU0*DSIN(T0)) + BJ1=SR*(PU1*DCOS(T1)-QU1*DSIN(T1)) +C Forward recurrence for J_|v| (Abm & Stg 9.1.27) +C It's OK for the limited range -8.0 ? v ? 12.5, +C since x >= 20 here; but would be unstable for v <~ -20 + BF0=BJ0 + BF1=BJ1 + DO 50 K=2,N + BF=2.0D0*(K-1.0+U0)/X*BF1-BF0 + BF0=BF1 +50 BF1=BF + IF (N.EQ.0) BJV=BJ0 + IF (N.EQ.1) BJV=BJ1 + IF (N.GT.1) BJV=BF + +C Compute Y_v (Abm & Stg 9.1.6) + BYV = DCOS(V*PI)*BYV + DSIN(-V*PI)*BJV + END IF + END IF + +C Compute H_v HV=BYV+S0 ENDIF RETURN @@ -12762,4 +12800,3 @@ C ********************************** - Modified: trunk/scipy/special/tests/test_basic.py =================================================================== --- trunk/scipy/special/tests/test_basic.py 2009-01-14 07:29:39 UTC (rev 5464) +++ trunk/scipy/special/tests/test_basic.py 2009-01-16 00:04:07 UTC (rev 5465) @@ -24,7 +24,6 @@ from numpy import array from numpy.testing import * - from scipy.special import * import scipy.special._cephes as cephes @@ -2005,5 +2004,31 @@ sy3 = sph_yn(1,.2)[1][1] assert_almost_equal(sy3,sphpy,4) #compare correct derivative val. (correct =-system val). +class TestStruve(object): + def _series(self, v, z, n=100): + """Compute Struve function & error estimate from its power series.""" + k = arange(0, n) + r = (-1)**k * (.5*z)**(2*k+v+1)/gamma(k+1.5)/gamma(k+v+1.5) + err = abs(r).max() * finfo(float_).eps * n + return r.sum(), err + + def test_vs_series(self): + """Check Struve function versus its power series""" + for v in [-10, -7.99, -3.4, -1, 0, 1, 3.4, 12.49, 16]: + for z in [1, 10, 19, 21, 30]: + value, err = self._series(v, z) + assert allclose(struve(v, z), value, atol=err), (v, z) + + def test_some_values(self): + assert_almost_equal(struve(-7.99, 21), 0.0467547614113, decimal=8) + assert_almost_equal(struve(-8.01, 21), 0.0398716951023, decimal=9) + assert_almost_equal(struve(-3.0, 200), 0.0142134427432, decimal=13) + + def test_regression_679(self): + """Regression test for #679""" + assert_almost_equal(struve(-1.0, 20 - 1e-8), struve(-1.0, 20 + 1e-8)) + assert_almost_equal(struve(-2.0, 20 - 1e-8), struve(-2.0, 20 + 1e-8)) + assert_almost_equal(struve(-4.3, 20 - 1e-8), struve(-4.3, 20 + 1e-8)) + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Thu Jan 15 19:04:54 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 15 Jan 2009 18:04:54 -0600 (CST) Subject: [Scipy-svn] r5466 - in trunk/scipy/special: . tests Message-ID: <20090116000454.5F4F4C7C012@scipy.org> Author: ptvirtan Date: 2009-01-15 18:04:38 -0600 (Thu, 15 Jan 2009) New Revision: 5466 Modified: trunk/scipy/special/specfun_wrappers.c trunk/scipy/special/tests/test_basic.py Log: Ensure that STVHV is never called with x<0 Use symmetries for integer v, and return NaN for non-integer v (when the result would be complex). This works around bad accuracy in Cephes and Specfun. Modified: trunk/scipy/special/specfun_wrappers.c =================================================================== --- trunk/scipy/special/specfun_wrappers.c 2009-01-16 00:04:07 UTC (rev 5465) +++ trunk/scipy/special/specfun_wrappers.c 2009-01-16 00:04:38 UTC (rev 5466) @@ -212,27 +212,40 @@ double struve_wrap(double v, double x) { double out; + double rem; int flag=0; + if (x < 0) { + rem = fmod(v, 2.0); + if (rem == 0) { + x = -x; + flag = 1; + } else if (rem == 1 || rem == -1) { + x = -x; + flag = 0; + } else { + /* non-integer v and x < 0 => complex-valued */ + return NAN; + } + } + if ((v<-8.0) || (v>12.5)) { - return cephes_struve(v, x); /* from cephes */ + out = cephes_struve(v, x); /* from cephes */ } - if (v==0.0) { - if (x < 0) {x = -x; flag=1;} + else if (v==0.0) { F_FUNC(stvh0,STVH0)(&x,&out); CONVINF(out); - if (flag) out = -out; - return out; } - if (v==1.0) { - if (x < 0) x=-x; + else if (v==1.0) { F_FUNC(stvh1,STVH1)(&x,&out); CONVINF(out); - return out; } - F_FUNC(stvhv,STVHV)(&v,&x,&out); - CONVINF(out); - return out; + else { + F_FUNC(stvhv,STVHV)(&v,&x,&out); + CONVINF(out); + } + if (flag) out = -out; + return out; } double modstruve_wrap(double v, double x) { Modified: trunk/scipy/special/tests/test_basic.py =================================================================== --- trunk/scipy/special/tests/test_basic.py 2009-01-16 00:04:07 UTC (rev 5465) +++ trunk/scipy/special/tests/test_basic.py 2009-01-16 00:04:38 UTC (rev 5466) @@ -2014,7 +2014,7 @@ def test_vs_series(self): """Check Struve function versus its power series""" - for v in [-10, -7.99, -3.4, -1, 0, 1, 3.4, 12.49, 16]: + for v in [-20, -10, -7.99, -3.4, -1, 0, 1, 3.4, 12.49, 16]: for z in [1, 10, 19, 21, 30]: value, err = self._series(v, z) assert allclose(struve(v, z), value, atol=err), (v, z) @@ -2023,7 +2023,15 @@ assert_almost_equal(struve(-7.99, 21), 0.0467547614113, decimal=8) assert_almost_equal(struve(-8.01, 21), 0.0398716951023, decimal=9) assert_almost_equal(struve(-3.0, 200), 0.0142134427432, decimal=13) + assert_almost_equal(struve(-8.0, -41), 0.0192469727846, decimal=9) + assert_equal(struve(-12, -41), -struve(-12, 41)) + assert_equal(struve(+12, -41), -struve(+12, 41)) + assert_equal(struve(-11, -41), +struve(-11, 41)) + assert_equal(struve(+11, -41), +struve(+11, 41)) + assert isnan(struve(-7.1, -1)) + assert isnan(struve(-10.1, -1)) + def test_regression_679(self): """Regression test for #679""" assert_almost_equal(struve(-1.0, 20 - 1e-8), struve(-1.0, 20 + 1e-8)) From scipy-svn at scipy.org Fri Jan 16 02:34:15 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 16 Jan 2009 01:34:15 -0600 (CST) Subject: [Scipy-svn] r5467 - trunk/scipy/fftpack/src Message-ID: <20090116073415.88B16C7C07F@scipy.org> Author: cdavid Date: 2009-01-16 01:34:10 -0600 (Fri, 16 Jan 2009) New Revision: 5467 Modified: trunk/scipy/fftpack/src/dct.c Log: Divide every points of the DCT by 2 for dct2. Modified: trunk/scipy/fftpack/src/dct.c =================================================================== --- trunk/scipy/fftpack/src/dct.c 2009-01-16 00:04:38 UTC (rev 5466) +++ trunk/scipy/fftpack/src/dct.c 2009-01-16 07:34:10 UTC (rev 5467) @@ -41,7 +41,7 @@ } if (normalize) { - fprintf(stderr, "dct1: normalize not yet supported=%d\n", + fprintf(stderr, "dct1: normalize not yet supported=%d\n", normalize); } else { ptr = inout; @@ -65,7 +65,12 @@ } if (normalize) { - fprintf(stderr, "dct2: normalize not yet supported=%d\n", + fprintf(stderr, "dct2: normalize not yet supported=%d\n", normalize); - } + } else { + ptr = inout; + for (i = n * howmany - 1; i >= 0; --i, ++ptr) { + *((double *) (ptr)) *= 0.5; + } + } } From scipy-svn at scipy.org Fri Jan 16 02:34:29 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 16 Jan 2009 01:34:29 -0600 (CST) Subject: [Scipy-svn] r5468 - trunk/scipy/fftpack Message-ID: <20090116073429.AF1EBC7C07F@scipy.org> Author: cdavid Date: 2009-01-16 01:34:25 -0600 (Fri, 16 Jan 2009) New Revision: 5468 Modified: trunk/scipy/fftpack/realtransforms.py Log: Add definition of dct II we use, + refs. Modified: trunk/scipy/fftpack/realtransforms.py =================================================================== --- trunk/scipy/fftpack/realtransforms.py 2009-01-16 07:34:10 UTC (rev 5467) +++ trunk/scipy/fftpack/realtransforms.py 2009-01-16 07:34:25 UTC (rev 5468) @@ -31,7 +31,14 @@ def dct2(x, n=None): """ Return Discrete Cosine Transform (type II) of arbitrary type sequence x. + There are several definitions, we use the following: + N-1 + y[k] = 2* sum x[n]*cos(pi*k*(2n+1)/(2*N)), 0 <= k < N. + n=0 + + In particular, we do not normalize it by the number of points of the DCT N. + Parameters ---------- x : array-like @@ -42,6 +49,14 @@ Returns ------- y : real ndarray + + References + ---------- + + http://en.wikipedia.org/wiki/Discrete_cosine_transform + + 'A Fast Cosine Transform in One and Two Dimensions', by J. Makhoul, in IEEE + Transactions on acoustics, speech and signal processing. """ return _dct(x, 2, n) From scipy-svn at scipy.org Fri Jan 16 02:34:43 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 16 Jan 2009 01:34:43 -0600 (CST) Subject: [Scipy-svn] r5469 - trunk/scipy/fftpack/tests Message-ID: <20090116073443.BAE1FC7C07F@scipy.org> Author: cdavid Date: 2009-01-16 01:34:39 -0600 (Fri, 16 Jan 2009) New Revision: 5469 Modified: trunk/scipy/fftpack/tests/test_real_transforms.py Log: Add tests for wrapper around fftpack for DCT II. Modified: trunk/scipy/fftpack/tests/test_real_transforms.py =================================================================== --- trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-16 07:34:25 UTC (rev 5468) +++ trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-16 07:34:39 UTC (rev 5469) @@ -3,9 +3,10 @@ import numpy as np from numpy.fft import fft as numfft -from numpy.testing import assert_array_almost_equal +from numpy.testing import assert_array_almost_equal, TestCase from scipy.io import loadmat +from scipy.fftpack.realtransforms import dct1, dct2 TDATA = loadmat(join(dirname(__file__), 'test.mat'), squeeze_me=True, struct_as_record=True, mat_dtype=True) @@ -50,10 +51,12 @@ Note that it is not 'normalized' """ n = x.size - a = np.empty((n, n), dtype = x.dtype) - for i in xrange(n): - for j in xrange(n): - a[i, j] = x[j] * np.cos(np.pi * (0.5 + j) * i / n) + #a = np.empty((n, n), dtype = x.dtype) + #for i in xrange(n): + # for j in xrange(n): + # a[i, j] = x[j] * np.cos(np.pi * (0.5 + j) * i / n) + grd = np.outer(np.linspace(0, n - 1, n), np.linspace(0.5, 0.5 + n - 1, n)) + a = np.cos(np.pi / n * grd) * x return 2 * a.sum(axis = 1) @@ -106,5 +109,26 @@ for i in range(len(X)): assert_array_almost_equal(direct_dct2(X[i]), fdct2(X[i])) +class _TestDCTIIBase(TestCase): + def setUp(self): + self.rdt = None + + def test_definition(self): + for i in range(len(X)): + x = np.array(X[i], dtype=self.rdt) + yr = direct_dct2(x) + y = dct2(x) + self.failUnless(y.dtype == self.rdt, + "Output dtype is %s, expected %s" % (y.dtype, self.rdt)) + assert_array_almost_equal(y, yr) + +class TestDCTIIDouble(_TestDCTIIBase): + def setUp(self): + self.rdt = np.double + +class TestDCTIIFloat(_TestDCTIIBase): + def setUp(self): + self.rdt = np.double + if __name__ == "__main__": np.testing.run_module_suite() From scipy-svn at scipy.org Fri Jan 16 02:34:59 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 16 Jan 2009 01:34:59 -0600 (CST) Subject: [Scipy-svn] r5470 - in trunk/scipy/fftpack: . tests Message-ID: <20090116073459.F27DBC7C07F@scipy.org> Author: cdavid Date: 2009-01-16 01:34:55 -0600 (Fri, 16 Jan 2009) New Revision: 5470 Modified: trunk/scipy/fftpack/realtransforms.py trunk/scipy/fftpack/tests/test_real_transforms.py Log: Add support for the axis argument in dct. Modified: trunk/scipy/fftpack/realtransforms.py =================================================================== --- trunk/scipy/fftpack/realtransforms.py 2009-01-16 07:34:39 UTC (rev 5469) +++ trunk/scipy/fftpack/realtransforms.py 2009-01-16 07:34:55 UTC (rev 5470) @@ -11,7 +11,7 @@ atexit.register(_fftpack.destroy_dct1_cache) atexit.register(_fftpack.destroy_dct2_cache) -def dct1(x, n=None): +def dct1(x, n=None, axis=-1): """ Return Discrete Cosine Transform (type I) of arbitrary type sequence x. @@ -21,14 +21,16 @@ input array. n : int, optional Length of the transform. + axis : int, optional + axis over which to compute the transform. Returns ------- y : real ndarray """ - return _dct(x, 1, n) + return _dct(x, 1, n, axis) -def dct2(x, n=None): +def dct2(x, n=None, axis=-1): """ Return Discrete Cosine Transform (type II) of arbitrary type sequence x. There are several definitions, we use the following: @@ -45,6 +47,8 @@ input array. n : int, optional Length of the transform. + axis : int, optional + axis over which to compute the transform. Returns ------- @@ -58,7 +62,7 @@ 'A Fast Cosine Transform in One and Two Dimensions', by J. Makhoul, in IEEE Transactions on acoustics, speech and signal processing. """ - return _dct(x, 2, n) + return _dct(x, 2, n, axis) def _dct(x, type, n=None, axis=-1, overwrite_x=0): """ @@ -98,9 +102,9 @@ if axis == -1 or axis == len(tmp.shape) - 1: return f(tmp, n, 0, overwrite_x) - else: - raise NotImplementedError("Axis arg not yet implemented") + #else: + # raise NotImplementedError("Axis arg not yet implemented") - #tmp = swapaxes(tmp, axis, -1) - #tmp = work_function(tmp,n,1,0,overwrite_x) - #return swapaxes(tmp, axis, -1) + tmp = np.swapaxes(tmp, axis, -1) + tmp = f(tmp, n, 0, overwrite_x) + return np.swapaxes(tmp, axis, -1) Modified: trunk/scipy/fftpack/tests/test_real_transforms.py =================================================================== --- trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-16 07:34:39 UTC (rev 5469) +++ trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-16 07:34:55 UTC (rev 5470) @@ -122,6 +122,19 @@ "Output dtype is %s, expected %s" % (y.dtype, self.rdt)) assert_array_almost_equal(y, yr) + def test_axis(self): + nt = 2 + for i in [7, 8, 9, 16, 32, 64]: + x = np.random.randn(nt, i) + y = dct2(x) + for j in range(nt): + assert_array_almost_equal(y[j], dct2(x[j])) + + x = x.T + y = dct2(x, axis=0) + for j in range(nt): + assert_array_almost_equal(y[:,j], dct2(x[:,j])) + class TestDCTIIDouble(_TestDCTIIBase): def setUp(self): self.rdt = np.double From scipy-svn at scipy.org Sat Jan 17 00:12:54 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 16 Jan 2009 23:12:54 -0600 (CST) Subject: [Scipy-svn] r5471 - tags Message-ID: <20090117051254.ABA85C7C010@scipy.org> Author: jarrod.millman Date: 2009-01-16 23:12:52 -0600 (Fri, 16 Jan 2009) New Revision: 5471 Added: tags/0.7.0rc1/ Log: Create the new release tag. Copied: tags/0.7.0rc1 (from rev 5470, branches/0.7.x) From scipy-svn at scipy.org Sat Jan 17 00:16:27 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 16 Jan 2009 23:16:27 -0600 (CST) Subject: [Scipy-svn] r5472 - tags/0.7.0rc1/scipy Message-ID: <20090117051627.1AB05C7C011@scipy.org> Author: jarrod.millman Date: 2009-01-16 23:16:25 -0600 (Fri, 16 Jan 2009) New Revision: 5472 Modified: tags/0.7.0rc1/scipy/version.py Log: making the new release Modified: tags/0.7.0rc1/scipy/version.py =================================================================== --- tags/0.7.0rc1/scipy/version.py 2009-01-17 05:12:52 UTC (rev 5471) +++ tags/0.7.0rc1/scipy/version.py 2009-01-17 05:16:25 UTC (rev 5472) @@ -1,5 +1,5 @@ -version = '0.7.0' -release=False +version = '0.7.0rc1' +release=True if not release: import os From scipy-svn at scipy.org Sat Jan 17 06:09:01 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 17 Jan 2009 05:09:01 -0600 (CST) Subject: [Scipy-svn] r5473 - trunk/scipy/fftpack/src Message-ID: <20090117110901.DC654C7C010@scipy.org> Author: cdavid Date: 2009-01-17 05:08:51 -0600 (Sat, 17 Jan 2009) New Revision: 5473 Modified: trunk/scipy/fftpack/src/dct.c Log: Handle orthonormal mode for normalization (DCT matrix orthonormal). Modified: trunk/scipy/fftpack/src/dct.c =================================================================== --- trunk/scipy/fftpack/src/dct.c 2009-01-17 05:16:25 UTC (rev 5472) +++ trunk/scipy/fftpack/src/dct.c 2009-01-17 11:08:51 UTC (rev 5473) @@ -3,9 +3,15 @@ Double complex FFT and IFFT. Author: Pearu Peterson, August 2002 */ +#include #include "fftpack.h" +enum normalize { + DCT_NORMALIZE_NO = 0, + DCT_NORMALIZE_ORTHONORMAL = 1 +}; + extern void F_FUNC(dcosti,DCOSTI)(int*,double*); extern void F_FUNC(dcost,DCOST)(int*,double*,double*); extern void F_FUNC(dcosqi,DCOSQI)(int*,double*); @@ -45,6 +51,9 @@ normalize); } else { ptr = inout; + /* 0.5 coeff comes from fftpack defining DCT as + * 4 * sum(cos(something)), whereas most definition + * use 2 */ for (i = n * howmany - 1; i >= 0; --i, ++ptr) { *((double *) (ptr)) *= 0.5; } @@ -53,9 +62,10 @@ void dct2(double * inout, int n, int howmany, int normalize) { - int i; + int i, j; double *ptr = inout; double *wsave = NULL; + double n1, n2; wsave = caches_dct2[get_cache_id_dct2(n)].wsave; @@ -64,13 +74,33 @@ } - if (normalize) { - fprintf(stderr, "dct2: normalize not yet supported=%d\n", - normalize); - } else { - ptr = inout; - for (i = n * howmany - 1; i >= 0; --i, ++ptr) { - *((double *) (ptr)) *= 0.5; - } + switch (normalize) { + case DCT_NORMALIZE_NO: + ptr = inout; + /* 0.5 coeff comes from fftpack defining DCT as + * 4 * sum(cos(something)), whereas most definition + * use 2 */ + for (i = n * howmany - 1; i >= 0; --i, ++ptr) { + *((double *) (ptr)) *= 0.5; } + break; + case DCT_NORMALIZE_ORTHONORMAL: + ptr = inout; + /* 0.5 coeff comes from fftpack defining DCT as + * 4 * sum(cos(something)), whereas most definition + * use 2 */ + n1 = 0.25 * sqrt(1./n); + n2 = 0.25 * sqrt(2./n); + for (i = 0; i < howmany; ++i, ptr+=n) { + ptr[0] *= n1; + for (j = 1; j < n; ++j) { + ptr[j] *= n2; + } + } + break; + default: + fprintf(stderr, "dct2: normalize not yet supported=%d\n", + normalize); + break; + } } From scipy-svn at scipy.org Sat Jan 17 06:09:28 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 17 Jan 2009 05:09:28 -0600 (CST) Subject: [Scipy-svn] r5474 - trunk/scipy/fftpack/tests Message-ID: <20090117110928.AB31DC7C010@scipy.org> Author: cdavid Date: 2009-01-17 05:09:18 -0600 (Sat, 17 Jan 2009) New Revision: 5474 Modified: trunk/scipy/fftpack/tests/test_real_transforms.py Log: Add test for orthonormal mode. Modified: trunk/scipy/fftpack/tests/test_real_transforms.py =================================================================== --- trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-17 11:08:51 UTC (rev 5473) +++ trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-17 11:09:18 UTC (rev 5474) @@ -122,6 +122,16 @@ "Output dtype is %s, expected %s" % (y.dtype, self.rdt)) assert_array_almost_equal(y, yr) + def test_definition_ortho(self): + """Test orthornomal mode.""" + for i in range(len(X)): + x = np.array(X[i], dtype=self.rdt) + yr = direct_fft_dct2(x, matlab=True) + y = dct2(x, norm="ortho") + self.failUnless(y.dtype == self.rdt, + "Output dtype is %s, expected %s" % (y.dtype, self.rdt)) + assert_array_almost_equal(y, yr) + def test_axis(self): nt = 2 for i in [7, 8, 9, 16, 32, 64]: From scipy-svn at scipy.org Sat Jan 17 06:09:55 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 17 Jan 2009 05:09:55 -0600 (CST) Subject: [Scipy-svn] r5475 - in trunk/scipy/fftpack: . src Message-ID: <20090117110955.4BC10C7C010@scipy.org> Author: cdavid Date: 2009-01-17 05:09:41 -0600 (Sat, 17 Jan 2009) New Revision: 5475 Modified: trunk/scipy/fftpack/realtransforms.py trunk/scipy/fftpack/src/dct.c Log: Add float versions of dct I and II. Modified: trunk/scipy/fftpack/realtransforms.py =================================================================== --- trunk/scipy/fftpack/realtransforms.py 2009-01-17 11:09:18 UTC (rev 5474) +++ trunk/scipy/fftpack/realtransforms.py 2009-01-17 11:09:41 UTC (rev 5475) @@ -30,7 +30,7 @@ """ return _dct(x, 1, n, axis) -def dct2(x, n=None, axis=-1): +def dct2(x, n=None, axis=-1, norm=None): """ Return Discrete Cosine Transform (type II) of arbitrary type sequence x. There are several definitions, we use the following: @@ -62,9 +62,9 @@ 'A Fast Cosine Transform in One and Two Dimensions', by J. Makhoul, in IEEE Transactions on acoustics, speech and signal processing. """ - return _dct(x, 2, n, axis) + return _dct(x, 2, n, axis, normalize=norm) -def _dct(x, type, n=None, axis=-1, overwrite_x=0): +def _dct(x, type, n=None, axis=-1, overwrite_x=0, normalize=None): """ Return Discrete Cosine Transform of arbitrary type sequence x. @@ -100,11 +100,19 @@ else: raise ValueError("Type %d not understood" % type) + if normalize: + if normalize == "ortho": + nm = 1 + else: + raise ValueError("Unknown normalize mode %s" % normalize) + else: + nm = 0 + if axis == -1 or axis == len(tmp.shape) - 1: - return f(tmp, n, 0, overwrite_x) + return f(tmp, n, nm, overwrite_x) #else: # raise NotImplementedError("Axis arg not yet implemented") tmp = np.swapaxes(tmp, axis, -1) - tmp = f(tmp, n, 0, overwrite_x) + tmp = f(tmp, n, nm, overwrite_x) return np.swapaxes(tmp, axis, -1) Modified: trunk/scipy/fftpack/src/dct.c =================================================================== --- trunk/scipy/fftpack/src/dct.c 2009-01-17 11:09:18 UTC (rev 5474) +++ trunk/scipy/fftpack/src/dct.c 2009-01-17 11:09:41 UTC (rev 5475) @@ -18,6 +18,12 @@ extern void F_FUNC(dcosqb,DCOSQB)(int*,double*,double*); extern void F_FUNC(dcosqf,DCOSQF)(int*,double*,double*); +extern void F_FUNC(costi,DCOSTI)(int*,float*); +extern void F_FUNC(cost,COST)(int*,float*,float*); +extern void F_FUNC(cosqi,COSQI)(int*,float*); +extern void F_FUNC(cosqb,COSQB)(int*,float*,float*); +extern void F_FUNC(cosqf,COSQF)(int*,float*,float*); + GEN_CACHE(dct1,(int n) ,double* wsave; ,(caches_dct1[i].n==n) @@ -34,6 +40,22 @@ ,free(caches_dct2[id].wsave); ,10) +GEN_CACHE(fdct1,(int n) + ,float* wsave; + ,(caches_fdct1[i].n==n) + ,caches_fdct1[id].wsave = (float*)malloc(sizeof(float)*(3*n+15)); + F_FUNC(costi,COSTI)(&n,caches_fdct1[id].wsave); + ,free(caches_fdct1[id].wsave); + ,10) + +GEN_CACHE(fdct2,(int n) + ,float* wsave; + ,(caches_fdct2[i].n==n) + ,caches_fdct2[id].wsave = (float*)malloc(sizeof(float)*(3*n+15)); + F_FUNC(cosqi,DCOSQI)(&n,caches_fdct2[id].wsave); + ,free(caches_fdct2[id].wsave); + ,10) + void dct1(double * inout, int n, int howmany, int normalize) { int i; @@ -104,3 +126,74 @@ break; } } + +void fdct1(float * inout, int n, int howmany, int normalize) +{ + int i; + float *ptr = inout; + float *wsave = NULL; + + wsave = caches_fdct1[get_cache_id_fdct1(n)].wsave; + + for (i = 0; i < howmany; ++i, ptr += n) { + cost_(&n, (float*)(ptr), wsave); + } + + if (normalize) { + fprintf(stderr, "dct1: normalize not yet supported=%d\n", + normalize); + } else { + ptr = inout; + /* 0.5 coeff comes from fftpack defining DCT as + * 4 * sum(cos(something)), whereas most definition + * use 2 */ + for (i = n * howmany - 1; i >= 0; --i, ++ptr) { + *((float *) (ptr)) *= 0.5; + } + } +} + +void fdct2(float * inout, int n, int howmany, int normalize) +{ + int i, j; + float *ptr = inout; + float *wsave = NULL; + float n1, n2; + + wsave = caches_fdct2[get_cache_id_fdct2(n)].wsave; + + for (i = 0; i < howmany; ++i, ptr += n) { + cosqb_(&n, (float *) (ptr), wsave); + + } + + switch (normalize) { + case DCT_NORMALIZE_NO: + ptr = inout; + /* 0.5 coeff comes from fftpack defining DCT as + * 4 * sum(cos(something)), whereas most definition + * use 2 */ + for (i = n * howmany - 1; i >= 0; --i, ++ptr) { + *((float *) (ptr)) *= 0.5; + } + break; + case DCT_NORMALIZE_ORTHONORMAL: + ptr = inout; + /* 0.5 coeff comes from fftpack defining DCT as + * 4 * sum(cos(something)), whereas most definition + * use 2 */ + n1 = 0.25 * sqrt(1./n); + n2 = 0.25 * sqrt(2./n); + for (i = 0; i < howmany; ++i, ptr+=n) { + ptr[0] *= n1; + for (j = 1; j < n; ++j) { + ptr[j] *= n2; + } + } + break; + default: + fprintf(stderr, "dct2: normalize not yet supported=%d\n", + normalize); + break; + } +} From scipy-svn at scipy.org Sat Jan 17 06:10:21 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 17 Jan 2009 05:10:21 -0600 (CST) Subject: [Scipy-svn] r5476 - trunk/scipy/fftpack/src Message-ID: <20090117111021.5496FC7C010@scipy.org> Author: cdavid Date: 2009-01-17 05:10:10 -0600 (Sat, 17 Jan 2009) New Revision: 5476 Modified: trunk/scipy/fftpack/src/dct.c Log: Reindent. Modified: trunk/scipy/fftpack/src/dct.c =================================================================== --- trunk/scipy/fftpack/src/dct.c 2009-01-17 11:09:41 UTC (rev 5475) +++ trunk/scipy/fftpack/src/dct.c 2009-01-17 11:10:10 UTC (rev 5476) @@ -64,22 +64,22 @@ wsave = caches_dct1[get_cache_id_dct1(n)].wsave; - for (i = 0; i < howmany; ++i, ptr += n) { - dcost_(&n, (double*)(ptr), wsave); - } + for (i = 0; i < howmany; ++i, ptr += n) { + dcost_(&n, (double*)(ptr), wsave); + } if (normalize) { - fprintf(stderr, "dct1: normalize not yet supported=%d\n", - normalize); - } else { - ptr = inout; - /* 0.5 coeff comes from fftpack defining DCT as - * 4 * sum(cos(something)), whereas most definition - * use 2 */ - for (i = n * howmany - 1; i >= 0; --i, ++ptr) { - *((double *) (ptr)) *= 0.5; - } + fprintf(stderr, "dct1: normalize not yet supported=%d\n", + normalize); + } else { + ptr = inout; + /* 0.5 coeff comes from fftpack defining DCT as + * 4 * sum(cos(something)), whereas most definition + * use 2 */ + for (i = n * howmany - 1; i >= 0; --i, ++ptr) { + *((double *) (ptr)) *= 0.5; } + } } void dct2(double * inout, int n, int howmany, int normalize) @@ -91,39 +91,39 @@ wsave = caches_dct2[get_cache_id_dct2(n)].wsave; - for (i = 0; i < howmany; ++i, ptr += n) { - dcosqb_(&n, (double *) (ptr), wsave); + for (i = 0; i < howmany; ++i, ptr += n) { + dcosqb_(&n, (double *) (ptr), wsave); - } + } - switch (normalize) { - case DCT_NORMALIZE_NO: - ptr = inout; - /* 0.5 coeff comes from fftpack defining DCT as - * 4 * sum(cos(something)), whereas most definition - * use 2 */ - for (i = n * howmany - 1; i >= 0; --i, ++ptr) { - *((double *) (ptr)) *= 0.5; - } - break; - case DCT_NORMALIZE_ORTHONORMAL: - ptr = inout; - /* 0.5 coeff comes from fftpack defining DCT as - * 4 * sum(cos(something)), whereas most definition - * use 2 */ - n1 = 0.25 * sqrt(1./n); - n2 = 0.25 * sqrt(2./n); - for (i = 0; i < howmany; ++i, ptr+=n) { - ptr[0] *= n1; - for (j = 1; j < n; ++j) { - ptr[j] *= n2; + switch (normalize) { + case DCT_NORMALIZE_NO: + ptr = inout; + /* 0.5 coeff comes from fftpack defining DCT as + * 4 * sum(cos(something)), whereas most definition + * use 2 */ + for (i = n * howmany - 1; i >= 0; --i, ++ptr) { + *((double *) (ptr)) *= 0.5; } - } - break; - default: - fprintf(stderr, "dct2: normalize not yet supported=%d\n", - normalize); - break; + break; + case DCT_NORMALIZE_ORTHONORMAL: + ptr = inout; + /* 0.5 coeff comes from fftpack defining DCT as + * 4 * sum(cos(something)), whereas most definition + * use 2 */ + n1 = 0.25 * sqrt(1./n); + n2 = 0.25 * sqrt(2./n); + for (i = 0; i < howmany; ++i, ptr+=n) { + ptr[0] *= n1; + for (j = 1; j < n; ++j) { + ptr[j] *= n2; + } + } + break; + default: + fprintf(stderr, "dct2: normalize not yet supported=%d\n", + normalize); + break; } } @@ -135,22 +135,22 @@ wsave = caches_fdct1[get_cache_id_fdct1(n)].wsave; - for (i = 0; i < howmany; ++i, ptr += n) { - cost_(&n, (float*)(ptr), wsave); - } + for (i = 0; i < howmany; ++i, ptr += n) { + cost_(&n, (float*)(ptr), wsave); + } - if (normalize) { - fprintf(stderr, "dct1: normalize not yet supported=%d\n", - normalize); - } else { - ptr = inout; - /* 0.5 coeff comes from fftpack defining DCT as - * 4 * sum(cos(something)), whereas most definition - * use 2 */ - for (i = n * howmany - 1; i >= 0; --i, ++ptr) { - *((float *) (ptr)) *= 0.5; - } + if (normalize) { + fprintf(stderr, "dct1: normalize not yet supported=%d\n", + normalize); + } else { + ptr = inout; + /* 0.5 coeff comes from fftpack defining DCT as + * 4 * sum(cos(something)), whereas most definition + * use 2 */ + for (i = n * howmany - 1; i >= 0; --i, ++ptr) { + *((float *) (ptr)) *= 0.5; } + } } void fdct2(float * inout, int n, int howmany, int normalize) @@ -162,38 +162,38 @@ wsave = caches_fdct2[get_cache_id_fdct2(n)].wsave; - for (i = 0; i < howmany; ++i, ptr += n) { - cosqb_(&n, (float *) (ptr), wsave); + for (i = 0; i < howmany; ++i, ptr += n) { + cosqb_(&n, (float *) (ptr), wsave); - } + } - switch (normalize) { - case DCT_NORMALIZE_NO: - ptr = inout; - /* 0.5 coeff comes from fftpack defining DCT as - * 4 * sum(cos(something)), whereas most definition - * use 2 */ - for (i = n * howmany - 1; i >= 0; --i, ++ptr) { - *((float *) (ptr)) *= 0.5; - } - break; - case DCT_NORMALIZE_ORTHONORMAL: - ptr = inout; - /* 0.5 coeff comes from fftpack defining DCT as - * 4 * sum(cos(something)), whereas most definition - * use 2 */ - n1 = 0.25 * sqrt(1./n); - n2 = 0.25 * sqrt(2./n); - for (i = 0; i < howmany; ++i, ptr+=n) { - ptr[0] *= n1; - for (j = 1; j < n; ++j) { - ptr[j] *= n2; + switch (normalize) { + case DCT_NORMALIZE_NO: + ptr = inout; + /* 0.5 coeff comes from fftpack defining DCT as + * 4 * sum(cos(something)), whereas most definition + * use 2 */ + for (i = n * howmany - 1; i >= 0; --i, ++ptr) { + *((float *) (ptr)) *= 0.5; } - } - break; - default: - fprintf(stderr, "dct2: normalize not yet supported=%d\n", - normalize); - break; + break; + case DCT_NORMALIZE_ORTHONORMAL: + ptr = inout; + /* 0.5 coeff comes from fftpack defining DCT as + * 4 * sum(cos(something)), whereas most definition + * use 2 */ + n1 = 0.25 * sqrt(1./n); + n2 = 0.25 * sqrt(2./n); + for (i = 0; i < howmany; ++i, ptr+=n) { + ptr[0] *= n1; + for (j = 1; j < n; ++j) { + ptr[j] *= n2; + } + } + break; + default: + fprintf(stderr, "dct2: normalize not yet supported=%d\n", + normalize); + break; } } From scipy-svn at scipy.org Sat Jan 17 14:46:43 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 17 Jan 2009 13:46:43 -0600 (CST) Subject: [Scipy-svn] r5477 - in trunk/scipy/special: cephes tests Message-ID: <20090117194643.0668AC7C015@scipy.org> Author: ptvirtan Date: 2009-01-17 13:45:37 -0600 (Sat, 17 Jan 2009) New Revision: 5477 Modified: trunk/scipy/special/cephes/hyperg.c trunk/scipy/special/tests/test_basic.py Log: Fix #640: bad output from scipy.special.iv(k,z) for large real z. This occurred because Cephes hyperg.c:hyp1f1p estimated the error for power series expansion of Kummer confluent 1F1 as zero when the number of terms was too large. This commit makes Cephes to assume 100% error when the series does not converge, which makes it to switch to an asymptotic expansion. The Cephes hyp1f1 is not exposed by scipy.special (it uses Specfun's implementation), but it's used internally by Cephes. Improved tests for Iv are included. Modified: trunk/scipy/special/cephes/hyperg.c =================================================================== --- trunk/scipy/special/cephes/hyperg.c 2009-01-17 11:10:10 UTC (rev 5476) +++ trunk/scipy/special/cephes/hyperg.c 2009-01-17 19:45:37 UTC (rev 5477) @@ -104,7 +104,6 @@ asum = hy1f1a( a, b, x, &acanc ); - /* Pick the result with less estimated error */ if( acanc < pcanc ) @@ -157,7 +156,11 @@ if( an == 0 ) /* a singularity */ return( sum ); if( n > 200 ) - goto pdone; + { + /* did not converge: estimate 100% error */ + *err = 1.0; + return sum; + } u = x * ( an / (bn * n) ); /* check for blowup */ Modified: trunk/scipy/special/tests/test_basic.py =================================================================== --- trunk/scipy/special/tests/test_basic.py 2009-01-17 11:10:10 UTC (rev 5476) +++ trunk/scipy/special/tests/test_basic.py 2009-01-17 19:45:37 UTC (rev 5477) @@ -26,7 +26,16 @@ from numpy.testing import * from scipy.special import * import scipy.special._cephes as cephes +import numpy as np +def assert_tol_equal(a, b, rtol=1e-7, atol=0, err_msg='', verbose=True): + """Assert that `a` and `b` are equal to tolerance ``atol + rtol*abs(b)``""" + def compare(x, y): + return allclose(x, y, rtol=rtol, atol=atol) + a, b = asanyarray(a), asanyarray(b) + header = 'Not equal to tolerance rtol=%g, atol=%g' % (rtol, atol) + np.testing.utils.assert_array_compare(compare, a, b, err_msg=str(err_msg), + verbose=verbose, header=header) class TestCephes(TestCase): def test_airy(self): @@ -1326,51 +1335,6 @@ assert_array_almost_equal(hypu,hprl,12) class TestBessel(TestCase): - def test_i0(self): - values = [[0.0, 1.0], - [1e-10, 1.0], - [0.1, 0.9071009258], - [0.5, 0.6450352706], - [1.0, 0.4657596077], - [2.5, 0.2700464416], - [5.0, 0.1835408126], - [20.0, 0.0897803119], - ] - for i, (x, v) in enumerate(values): - cv = i0(x) * exp(-x) - assert_almost_equal(cv, v, 8, err_msg='test #%d' % i) - - def test_i0e(self): - oize = i0e(.1) - oizer = ive(0,.1) - assert_almost_equal(oize,oizer,8) - - def test_i1(self): - values = [[0.0, 0.0], - [1e-10, 0.4999999999500000e-10], - [0.1, 0.0452984468], - [0.5, 0.1564208032], - [1.0, 0.2079104154], - [5.0, 0.1639722669], - [20.0, 0.0875062222], - ] - for i, (x, v) in enumerate(values): - cv = i1(x) * exp(-x) - assert_almost_equal(cv, v, 8, err_msg='test #%d' % i) - - def test_i1e(self): - oi1e = i1e(.1) - oi1er = ive(1,.1) - assert_almost_equal(oi1e,oi1er,8) - - def test_iti0k0(self): - iti0 = array(iti0k0(5)) - assert_array_almost_equal(iti0,array([31.848667776169801, 1.5673873907283657]),5) - - def test_it2i0k0(self): - it2k = it2i0k0(.1) - assert_array_almost_equal(it2k,array([0.0012503906973464409, 3.3309450354686687]),6) - def test_itj0y0(self): it0 = array(itj0y0(.2)) assert_array_almost_equal(it0,array([0.19933433254006822, -0.34570883800412566]),8) @@ -1382,26 +1346,6 @@ def test_negv(self): assert_equal(iv(3,2), iv(-3,2)) - def test_iv(self): - iv1 = iv(0,.1)*exp(-.1) - assert_almost_equal(iv1,0.90710092578230106,10) - - def test_negv(self): - assert_equal(ive(3,2), ive(-3,2)) - - def test_ive(self): - ive1 = ive(0,.1) - iv1 = iv(0,.1)*exp(-.1) - assert_almost_equal(ive1,iv1,10) - - def test_ivp0(self): - assert_almost_equal(iv(1,2), ivp(0,2), 10) - - def test_ivp(self): - y=(iv(0,2)+iv(2,2))/2 - x = ivp(1,2) - assert_almost_equal(x,y,10) - def test_j0(self): oz = j0(.1) ozr = jn(0,.1) @@ -1645,7 +1589,98 @@ yvp1 = yvp(2,.2) assert_array_almost_equal(yvp1,yvpr,10) +class TestBesselI(object): + def _series(self, v, z, n=200): + k = arange(0, n).astype(float_) + r = (v+2*k)*log(.5*z) - log(gamma(k+1)) - log(gamma(v+k+1)) + r[isnan(r)] = inf + r = exp(r) + err = abs(r).max() * finfo(float_).eps * n + abs(r[-1])*10 + return r.sum(), err + + def test_i0_series(self): + for z in [1., 10., 200.5]: + value, err = self._series(0, z) + assert_tol_equal(i0(z), value, atol=err, err_msg=z) + + def test_i1_series(self): + for z in [1., 10., 200.5]: + value, err = self._series(1, z) + assert_tol_equal(i1(z), value, atol=err, err_msg=z) + + def test_iv_series(self): + for v in [-20., -10., -1., 0., 1., 12.49, 120.]: + for z in [1., 10., 200.5, -1+2j]: + value, err = self._series(v, z) + assert_tol_equal(iv(v, z), value, atol=err, err_msg=(v, z)) + + def test_i0(self): + values = [[0.0, 1.0], + [1e-10, 1.0], + [0.1, 0.9071009258], + [0.5, 0.6450352706], + [1.0, 0.4657596077], + [2.5, 0.2700464416], + [5.0, 0.1835408126], + [20.0, 0.0897803119], + ] + for i, (x, v) in enumerate(values): + cv = i0(x) * exp(-x) + assert_almost_equal(cv, v, 8, err_msg='test #%d' % i) + + def test_i0e(self): + oize = i0e(.1) + oizer = ive(0,.1) + assert_almost_equal(oize,oizer,8) + + def test_i1(self): + values = [[0.0, 0.0], + [1e-10, 0.4999999999500000e-10], + [0.1, 0.0452984468], + [0.5, 0.1564208032], + [1.0, 0.2079104154], + [5.0, 0.1639722669], + [20.0, 0.0875062222], + ] + for i, (x, v) in enumerate(values): + cv = i1(x) * exp(-x) + assert_almost_equal(cv, v, 8, err_msg='test #%d' % i) + + def test_i1e(self): + oi1e = i1e(.1) + oi1er = ive(1,.1) + assert_almost_equal(oi1e,oi1er,8) + + def test_iti0k0(self): + iti0 = array(iti0k0(5)) + assert_array_almost_equal(iti0,array([31.848667776169801, 1.5673873907283657]),5) + + def test_it2i0k0(self): + it2k = it2i0k0(.1) + assert_array_almost_equal(it2k,array([0.0012503906973464409, 3.3309450354686687]),6) + + def test_iv(self): + iv1 = iv(0,.1)*exp(-.1) + assert_almost_equal(iv1,0.90710092578230106,10) + + def test_negv(self): + assert_equal(ive(3,2), ive(-3,2)) + + def test_ive(self): + ive1 = ive(0,.1) + iv1 = iv(0,.1)*exp(-.1) + assert_almost_equal(ive1,iv1,10) + + def test_ivp0(self): + assert_almost_equal(iv(1,2), ivp(0,2), 10) + + def test_ivp(self): + y=(iv(0,2)+iv(2,2))/2 + x = ivp(1,2) + assert_almost_equal(x,y,10) + + class TestLaguerre(TestCase): def test_laguerre(self): lag0 = laguerre(0) @@ -2017,13 +2052,13 @@ for v in [-20, -10, -7.99, -3.4, -1, 0, 1, 3.4, 12.49, 16]: for z in [1, 10, 19, 21, 30]: value, err = self._series(v, z) - assert allclose(struve(v, z), value, atol=err), (v, z) + assert_tol_equal(struve(v, z), value, rtol=0, atol=err), (v, z) def test_some_values(self): - assert_almost_equal(struve(-7.99, 21), 0.0467547614113, decimal=8) - assert_almost_equal(struve(-8.01, 21), 0.0398716951023, decimal=9) - assert_almost_equal(struve(-3.0, 200), 0.0142134427432, decimal=13) - assert_almost_equal(struve(-8.0, -41), 0.0192469727846, decimal=9) + assert_tol_equal(struve(-7.99, 21), 0.0467547614113, rtol=1e-7) + assert_tol_equal(struve(-8.01, 21), 0.0398716951023, rtol=1e-8) + assert_tol_equal(struve(-3.0, 200), 0.0142134427432, rtol=1e-12) + assert_tol_equal(struve(-8.0, -41), 0.0192469727846, rtol=1e-11) assert_equal(struve(-12, -41), -struve(-12, 41)) assert_equal(struve(+12, -41), -struve(+12, 41)) assert_equal(struve(-11, -41), +struve(-11, 41)) @@ -2034,9 +2069,9 @@ def test_regression_679(self): """Regression test for #679""" - assert_almost_equal(struve(-1.0, 20 - 1e-8), struve(-1.0, 20 + 1e-8)) - assert_almost_equal(struve(-2.0, 20 - 1e-8), struve(-2.0, 20 + 1e-8)) - assert_almost_equal(struve(-4.3, 20 - 1e-8), struve(-4.3, 20 + 1e-8)) + assert_tol_equal(struve(-1.0, 20 - 1e-8), struve(-1.0, 20 + 1e-8)) + assert_tol_equal(struve(-2.0, 20 - 1e-8), struve(-2.0, 20 + 1e-8)) + assert_tol_equal(struve(-4.3, 20 - 1e-8), struve(-4.3, 20 + 1e-8)) if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Sat Jan 17 14:47:11 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 17 Jan 2009 13:47:11 -0600 (CST) Subject: [Scipy-svn] r5478 - in trunk/scipy/special: cephes tests Message-ID: <20090117194711.47114C7C015@scipy.org> Author: ptvirtan Date: 2009-01-17 13:46:56 -0600 (Sat, 17 Jan 2009) New Revision: 5478 Modified: trunk/scipy/special/cephes/hyperg.c trunk/scipy/special/cephes/iv.c trunk/scipy/special/tests/test_basic.py Log: Fixing #640: Make Cephes iv and hyperg behave better for large |z| Bump iteration limits and handle infs and nans more carefully. However, since iv is implemented in Cephes using 1F1, it overflows to inf at smaller |z| than necessary, as intermediate results are larger than floating point max. Fixing this would likely require a complete rewrite. Modified: trunk/scipy/special/cephes/hyperg.c =================================================================== --- trunk/scipy/special/cephes/hyperg.c 2009-01-17 19:45:37 UTC (rev 5477) +++ trunk/scipy/special/cephes/hyperg.c 2009-01-17 19:46:56 UTC (rev 5478) @@ -95,15 +95,22 @@ return( exp(x) * hyperg( temp, b, -x ) ); -psum = hy1f1p( a, b, x, &pcanc ); -if( pcanc < 1.0e-15 ) - goto done; +/* Try power & asymptotic series, starting from the one that is likely OK */ +if (fabs(x) < 10 + fabs(a) + fabs(b)) + { + psum = hy1f1p( a, b, x, &pcanc ); + if( pcanc < 1.0e-15 ) + goto done; + asum = hy1f1a( a, b, x, &acanc ); + } +else + { + psum = hy1f1a( a, b, x, &pcanc ); + if( pcanc < 1.0e-15 ) + goto done; + asum = hy1f1p( a, b, x, &acanc ); + } - -/* try asymptotic series */ - -asum = hy1f1a( a, b, x, &acanc ); - /* Pick the result with less estimated error */ if( acanc < pcanc ) @@ -129,7 +136,7 @@ double a, b, x; double *err; { -double n, a0, sum, t, u, temp; +double n, a0, sum, t, u, temp, maxn; double an, bn, maxt; double y, c, sumc; @@ -145,6 +152,7 @@ maxt = 0.0; *err = 1.0; +maxn = 200.0 + 2*fabs(a) + 2*fabs(b); while( t > MACHEP ) { @@ -155,11 +163,11 @@ } if( an == 0 ) /* a singularity */ return( sum ); - if( n > 200 ) + if( n > maxn ) { - /* did not converge: estimate 100% error */ - *err = 1.0; - return sum; + /* too many terms; take the last one as error estimate */ + c = fabs(c) + fabs(t)*50.0; + goto pdone; } u = x * ( an / (bn * n) ); @@ -194,6 +202,11 @@ *err = fabs(c); } +if (*err != *err) { + /* nan */ + *err = 1.0; +} + return( sum ); } @@ -261,7 +274,6 @@ acanc = fabs(err1) + fabs(err2); - if( b < 0 ) { temp = gamma(b); @@ -273,6 +285,10 @@ if( asum != 0.0 ) acanc /= fabs(asum); +if( asum*2 == asum ) + /* infinity */ + acanc = 0; + acanc *= 30.0; /* fudge factor, since error of asymptotic formula * often seems this much larger than advertised */ @@ -321,8 +337,8 @@ t = fabs(a0); /* terminating condition for asymptotic series */ - if( t > tlast ) - goto ndone; + if( t < tlast && t < MACHEP*fabs(sum) ) + goto ndone; tlast = t; sum += alast; /* the sum is one term behind */ @@ -373,7 +389,6 @@ /* estimate error due to roundoff, cancellation, and nonconvergence */ *err = MACHEP * (n + maxt) + fabs ( a0 ); - done: sum += alast; return( sum ); Modified: trunk/scipy/special/cephes/iv.c =================================================================== --- trunk/scipy/special/cephes/iv.c 2009-01-17 19:45:37 UTC (rev 5477) +++ trunk/scipy/special/cephes/iv.c 2009-01-17 19:46:56 UTC (rev 5478) @@ -69,7 +69,7 @@ double v, x; { int sign; -double t, ax; +double t, ax, res; /* If v is a negative integer, invoke symmetry */ t = floor(v); @@ -112,5 +112,8 @@ t = v * log( 0.5 * ax ) - x; t = sign * exp(t) / gamma( v + 1.0 ); ax = v + 0.5; -return( t * hyperg( ax, 2.0 * ax, 2.0 * x ) ); +res = hyperg( ax, 2.0 * ax, 2.0 * x ); +if (res*2 == res) + return sign*res / gamma( v + 1.0 ); /* inf */ +return( t * res ); } Modified: trunk/scipy/special/tests/test_basic.py =================================================================== --- trunk/scipy/special/tests/test_basic.py 2009-01-17 19:45:37 UTC (rev 5477) +++ trunk/scipy/special/tests/test_basic.py 2009-01-17 19:46:56 UTC (rev 5478) @@ -1591,9 +1591,15 @@ class TestBesselI(object): + def _lggamma(self, q): + res = zeros_like(q) + res[q>=2] = gammaln(q[q>=2]) + res[q<2] = log(gamma(q[q<2])) + return res + def _series(self, v, z, n=200): k = arange(0, n).astype(float_) - r = (v+2*k)*log(.5*z) - log(gamma(k+1)) - log(gamma(v+k+1)) + r = (v+2*k)*log(.5*z) - self._lggamma(k+1) - self._lggamma(v+k+1) r[isnan(r)] = inf r = exp(r) err = abs(r).max() * finfo(float_).eps * n + abs(r[-1])*10 @@ -1615,6 +1621,15 @@ value, err = self._series(v, z) assert_tol_equal(iv(v, z), value, atol=err, err_msg=(v, z)) + def test_cephes_vs_specfun(self): + for v in [-120, -20., -10., -1., 0., 1., 12.49, 120.]: + for z in [1., 10., 200.5, 400., 600.5, 700.6]: + c1, c2 = iv(v, z), iv(v,z+0j) + if np.isinf(c1): + assert np.abs(c2) >= 1e150 + else: + assert_tol_equal(c1, c2, err_msg=(v, z), rtol=1e-11) + def test_i0(self): values = [[0.0, 1.0], [1e-10, 1.0], From scipy-svn at scipy.org Sun Jan 18 02:10:45 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 18 Jan 2009 01:10:45 -0600 (CST) Subject: [Scipy-svn] r5479 - trunk/doc/release Message-ID: <20090118071045.89A62C7C030@scipy.org> Author: wnbell Date: 2009-01-18 01:10:41 -0600 (Sun, 18 Jan 2009) New Revision: 5479 Modified: trunk/doc/release/0.7.0-notes.rst Log: make note of the change to loadmat's squeeze_me parameter in the release notes. resolves ticket #850 Modified: trunk/doc/release/0.7.0-notes.rst =================================================================== --- trunk/doc/release/0.7.0-notes.rst 2009-01-17 19:46:56 UTC (rev 5478) +++ trunk/doc/release/0.7.0-notes.rst 2009-01-18 07:10:41 UTC (rev 5479) @@ -219,6 +219,8 @@ * new struct_as_record keyword argument to ``loadmat``, which loads struct arrays in matlab as record arrays in numpy * string arrays have ``dtype='U...'`` instead of ``dtype=object`` +* ``loadmat`` no longer squeezes singleton dimensions, i.e. + ``squeeze_me=False`` by default New Hierarchical Clustering module ---------------------------------- From scipy-svn at scipy.org Sun Jan 18 06:23:43 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 18 Jan 2009 05:23:43 -0600 (CST) Subject: [Scipy-svn] r5480 - trunk/scipy/fftpack/src Message-ID: <20090118112343.9CFCCC7C02D@scipy.org> Author: cdavid Date: 2009-01-18 05:23:38 -0600 (Sun, 18 Jan 2009) New Revision: 5480 Modified: trunk/scipy/fftpack/src/dct.c Log: Trailing spaces. Modified: trunk/scipy/fftpack/src/dct.c =================================================================== --- trunk/scipy/fftpack/src/dct.c 2009-01-18 07:10:41 UTC (rev 5479) +++ trunk/scipy/fftpack/src/dct.c 2009-01-18 11:23:38 UTC (rev 5480) @@ -74,7 +74,7 @@ } else { ptr = inout; /* 0.5 coeff comes from fftpack defining DCT as - * 4 * sum(cos(something)), whereas most definition + * 4 * sum(cos(something)), whereas most definition * use 2 */ for (i = n * howmany - 1; i >= 0; --i, ++ptr) { *((double *) (ptr)) *= 0.5; @@ -100,7 +100,7 @@ case DCT_NORMALIZE_NO: ptr = inout; /* 0.5 coeff comes from fftpack defining DCT as - * 4 * sum(cos(something)), whereas most definition + * 4 * sum(cos(something)), whereas most definition * use 2 */ for (i = n * howmany - 1; i >= 0; --i, ++ptr) { *((double *) (ptr)) *= 0.5; @@ -109,7 +109,7 @@ case DCT_NORMALIZE_ORTHONORMAL: ptr = inout; /* 0.5 coeff comes from fftpack defining DCT as - * 4 * sum(cos(something)), whereas most definition + * 4 * sum(cos(something)), whereas most definition * use 2 */ n1 = 0.25 * sqrt(1./n); n2 = 0.25 * sqrt(2./n); @@ -118,7 +118,7 @@ for (j = 1; j < n; ++j) { ptr[j] *= n2; } - } + } break; default: fprintf(stderr, "dct2: normalize not yet supported=%d\n", @@ -145,7 +145,7 @@ } else { ptr = inout; /* 0.5 coeff comes from fftpack defining DCT as - * 4 * sum(cos(something)), whereas most definition + * 4 * sum(cos(something)), whereas most definition * use 2 */ for (i = n * howmany - 1; i >= 0; --i, ++ptr) { *((float *) (ptr)) *= 0.5; @@ -171,7 +171,7 @@ case DCT_NORMALIZE_NO: ptr = inout; /* 0.5 coeff comes from fftpack defining DCT as - * 4 * sum(cos(something)), whereas most definition + * 4 * sum(cos(something)), whereas most definition * use 2 */ for (i = n * howmany - 1; i >= 0; --i, ++ptr) { *((float *) (ptr)) *= 0.5; @@ -180,7 +180,7 @@ case DCT_NORMALIZE_ORTHONORMAL: ptr = inout; /* 0.5 coeff comes from fftpack defining DCT as - * 4 * sum(cos(something)), whereas most definition + * 4 * sum(cos(something)), whereas most definition * use 2 */ n1 = 0.25 * sqrt(1./n); n2 = 0.25 * sqrt(2./n); @@ -189,7 +189,7 @@ for (j = 1; j < n; ++j) { ptr[j] *= n2; } - } + } break; default: fprintf(stderr, "dct2: normalize not yet supported=%d\n", From scipy-svn at scipy.org Sun Jan 18 06:24:07 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 18 Jan 2009 05:24:07 -0600 (CST) Subject: [Scipy-svn] r5481 - trunk/scipy/fftpack/src Message-ID: <20090118112407.3E436C7C02D@scipy.org> Author: cdavid Date: 2009-01-18 05:23:59 -0600 (Sun, 18 Jan 2009) New Revision: 5481 Modified: trunk/scipy/fftpack/src/dct.c Log: Remove tabs. Modified: trunk/scipy/fftpack/src/dct.c =================================================================== --- trunk/scipy/fftpack/src/dct.c 2009-01-18 11:23:38 UTC (rev 5480) +++ trunk/scipy/fftpack/src/dct.c 2009-01-18 11:23:59 UTC (rev 5481) @@ -8,8 +8,8 @@ #include "fftpack.h" enum normalize { - DCT_NORMALIZE_NO = 0, - DCT_NORMALIZE_ORTHONORMAL = 1 + DCT_NORMALIZE_NO = 0, + DCT_NORMALIZE_ORTHONORMAL = 1 }; extern void F_FUNC(dcosti,DCOSTI)(int*,double*); @@ -25,50 +25,50 @@ extern void F_FUNC(cosqf,COSQF)(int*,float*,float*); GEN_CACHE(dct1,(int n) - ,double* wsave; - ,(caches_dct1[i].n==n) - ,caches_dct1[id].wsave = (double*)malloc(sizeof(double)*(3*n+15)); - F_FUNC(dcosti,DCOSTI)(&n,caches_dct1[id].wsave); - ,free(caches_dct1[id].wsave); - ,10) + ,double* wsave; + ,(caches_dct1[i].n==n) + ,caches_dct1[id].wsave = (double*)malloc(sizeof(double)*(3*n+15)); + F_FUNC(dcosti,DCOSTI)(&n,caches_dct1[id].wsave); + ,free(caches_dct1[id].wsave); + ,10) GEN_CACHE(dct2,(int n) - ,double* wsave; - ,(caches_dct2[i].n==n) - ,caches_dct2[id].wsave = (double*)malloc(sizeof(double)*(3*n+15)); - F_FUNC(dcosqi,DCOSQI)(&n,caches_dct2[id].wsave); - ,free(caches_dct2[id].wsave); - ,10) + ,double* wsave; + ,(caches_dct2[i].n==n) + ,caches_dct2[id].wsave = (double*)malloc(sizeof(double)*(3*n+15)); + F_FUNC(dcosqi,DCOSQI)(&n,caches_dct2[id].wsave); + ,free(caches_dct2[id].wsave); + ,10) GEN_CACHE(fdct1,(int n) - ,float* wsave; - ,(caches_fdct1[i].n==n) - ,caches_fdct1[id].wsave = (float*)malloc(sizeof(float)*(3*n+15)); - F_FUNC(costi,COSTI)(&n,caches_fdct1[id].wsave); - ,free(caches_fdct1[id].wsave); - ,10) + ,float* wsave; + ,(caches_fdct1[i].n==n) + ,caches_fdct1[id].wsave = (float*)malloc(sizeof(float)*(3*n+15)); + F_FUNC(costi,COSTI)(&n,caches_fdct1[id].wsave); + ,free(caches_fdct1[id].wsave); + ,10) GEN_CACHE(fdct2,(int n) - ,float* wsave; - ,(caches_fdct2[i].n==n) - ,caches_fdct2[id].wsave = (float*)malloc(sizeof(float)*(3*n+15)); - F_FUNC(cosqi,DCOSQI)(&n,caches_fdct2[id].wsave); - ,free(caches_fdct2[id].wsave); - ,10) + ,float* wsave; + ,(caches_fdct2[i].n==n) + ,caches_fdct2[id].wsave = (float*)malloc(sizeof(float)*(3*n+15)); + F_FUNC(cosqi,DCOSQI)(&n,caches_fdct2[id].wsave); + ,free(caches_fdct2[id].wsave); + ,10) void dct1(double * inout, int n, int howmany, int normalize) { - int i; - double *ptr = inout; - double *wsave = NULL; + int i; + double *ptr = inout; + double *wsave = NULL; - wsave = caches_dct1[get_cache_id_dct1(n)].wsave; + wsave = caches_dct1[get_cache_id_dct1(n)].wsave; for (i = 0; i < howmany; ++i, ptr += n) { dcost_(&n, (double*)(ptr), wsave); } - if (normalize) { + if (normalize) { fprintf(stderr, "dct1: normalize not yet supported=%d\n", normalize); } else { @@ -84,12 +84,12 @@ void dct2(double * inout, int n, int howmany, int normalize) { - int i, j; - double *ptr = inout; - double *wsave = NULL; - double n1, n2; + int i, j; + double *ptr = inout; + double *wsave = NULL; + double n1, n2; - wsave = caches_dct2[get_cache_id_dct2(n)].wsave; + wsave = caches_dct2[get_cache_id_dct2(n)].wsave; for (i = 0; i < howmany; ++i, ptr += n) { dcosqb_(&n, (double *) (ptr), wsave); @@ -129,11 +129,11 @@ void fdct1(float * inout, int n, int howmany, int normalize) { - int i; - float *ptr = inout; - float *wsave = NULL; + int i; + float *ptr = inout; + float *wsave = NULL; - wsave = caches_fdct1[get_cache_id_fdct1(n)].wsave; + wsave = caches_fdct1[get_cache_id_fdct1(n)].wsave; for (i = 0; i < howmany; ++i, ptr += n) { cost_(&n, (float*)(ptr), wsave); @@ -155,12 +155,12 @@ void fdct2(float * inout, int n, int howmany, int normalize) { - int i, j; - float *ptr = inout; - float *wsave = NULL; - float n1, n2; + int i, j; + float *ptr = inout; + float *wsave = NULL; + float n1, n2; - wsave = caches_fdct2[get_cache_id_fdct2(n)].wsave; + wsave = caches_fdct2[get_cache_id_fdct2(n)].wsave; for (i = 0; i < howmany; ++i, ptr += n) { cosqb_(&n, (float *) (ptr), wsave); From scipy-svn at scipy.org Sun Jan 18 06:24:26 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 18 Jan 2009 05:24:26 -0600 (CST) Subject: [Scipy-svn] r5482 - in trunk/scipy/fftpack: . src Message-ID: <20090118112426.35597C7C02D@scipy.org> Author: cdavid Date: 2009-01-18 05:24:18 -0600 (Sun, 18 Jan 2009) New Revision: 5482 Added: trunk/scipy/fftpack/src/dct.c.src Modified: trunk/scipy/fftpack/fftpack.pyf trunk/scipy/fftpack/realtransforms.py trunk/scipy/fftpack/setup.py Log: Use template for dct sources, to support multiple types. Modified: trunk/scipy/fftpack/fftpack.pyf =================================================================== --- trunk/scipy/fftpack/fftpack.pyf 2009-01-18 11:23:59 UTC (rev 5481) +++ trunk/scipy/fftpack/fftpack.pyf 2009-01-18 11:24:18 UTC (rev 5482) @@ -163,35 +163,35 @@ intent(c) destroy_rfft_cache end subroutine destroy_rfft_cache - subroutine dct1(x,n,howmany,normalize) - ! y = dct1(x[,n,normalize,overwrite_x]) - intent(c) dct1 + subroutine ddct1(x,n,howmany,normalize) + ! y = ddct1(x[,n,normalize,overwrite_x]) + intent(c) ddct1 real*8 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 dct1 + end subroutine ddct1 - subroutine dct2(x,n,howmany,normalize) - ! y = dct2(x[,n,normalize,overwrite_x]) - intent(c) dct2 + subroutine ddct2(x,n,howmany,normalize) + ! y = ddct2(x[,n,normalize,overwrite_x]) + intent(c) ddct2 real*8 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 + end subroutine ddct2 - subroutine destroy_dct2_cache() - intent(c) destroy_dct2_cache - end subroutine destroy_dct2_cache + subroutine destroy_ddct2_cache() + intent(c) destroy_ddct2_cache + end subroutine destroy_ddct2_cache - subroutine destroy_dct1_cache() - intent(c) destroy_dct1_cache - end subroutine destroy_dct1_cache + subroutine destroy_ddct1_cache() + intent(c) destroy_ddct1_cache + end subroutine destroy_ddct1_cache end interface end python module _fftpack Modified: trunk/scipy/fftpack/realtransforms.py =================================================================== --- trunk/scipy/fftpack/realtransforms.py 2009-01-18 11:23:59 UTC (rev 5481) +++ trunk/scipy/fftpack/realtransforms.py 2009-01-18 11:24:18 UTC (rev 5482) @@ -8,8 +8,8 @@ from scipy.fftpack import _fftpack import atexit -atexit.register(_fftpack.destroy_dct1_cache) -atexit.register(_fftpack.destroy_dct2_cache) +atexit.register(_fftpack.destroy_ddct1_cache) +atexit.register(_fftpack.destroy_ddct2_cache) def dct1(x, n=None, axis=-1): """ @@ -94,9 +94,9 @@ raise NotImplemented("Padding/truncating not yet implemented") if type == 1: - f = _fftpack.dct1 + f = _fftpack.ddct1 elif type == 2: - f = _fftpack.dct2 + f = _fftpack.ddct2 else: raise ValueError("Type %d not understood" % type) Modified: trunk/scipy/fftpack/setup.py =================================================================== --- trunk/scipy/fftpack/setup.py 2009-01-18 11:23:59 UTC (rev 5481) +++ trunk/scipy/fftpack/setup.py 2009-01-18 11:24:18 UTC (rev 5482) @@ -18,11 +18,12 @@ sources=[join('src/fftpack','*.f')]) sources = ['fftpack.pyf','src/zfft.c','src/drfft.c','src/zrfft.c', - 'src/zfftnd.c', 'src/dct.c'] + 'src/zfftnd.c', 'src/dct.c.src'] config.add_extension('_fftpack', sources=sources, - libraries=['dfftpack', 'fftpack']) + libraries=['dfftpack', 'fftpack'], + include_dirs=['src']) config.add_extension('convolve', sources=['convolve.pyf','src/convolve.c'], Added: trunk/scipy/fftpack/src/dct.c.src =================================================================== --- trunk/scipy/fftpack/src/dct.c.src 2009-01-18 11:23:59 UTC (rev 5481) +++ trunk/scipy/fftpack/src/dct.c.src 2009-01-18 11:24:18 UTC (rev 5482) @@ -0,0 +1,114 @@ +/* vim:syntax=c + * vim:sw=4 + * + * Interfaces to the DCT transforms of fftpack + */ +#include + +#include "fftpack.h" + +enum normalize { + DCT_NORMALIZE_NO = 0, + DCT_NORMALIZE_ORTHONORMAL = 1 +}; + +/**begin repeat + +#type=float,double# +#pref=,d# +#PREF=,D# +*/ +extern void F_FUNC(@pref at costi, @PREF at COSTI)(int*, @type@*); +extern void F_FUNC(@pref at cost, @PREF at COST)(int*, @type@*, @type@*); +extern void F_FUNC(@pref at cosqi, @PREF at COSQI)(int*, @type@*); +extern void F_FUNC(@pref at cosqb, @PREF at COSQB)(int*, @type@*, @type@*); +extern void F_FUNC(@pref at cosqf, @PREF at COSQF)(int*, @type@*, @type@*); + +GEN_CACHE(@pref at dct1,(int n) + , at type@* wsave; + ,(caches_ at pref@dct1[i].n==n) + ,caches_ at pref@dct1[id].wsave = malloc(sizeof(@type@)*(3*n+15)); + F_FUNC(@pref at costi, @PREF at COSTI)(&n, caches_ at pref@dct1[id].wsave); + ,free(caches_ at pref@dct1[id].wsave); + ,10) + +GEN_CACHE(@pref at dct2,(int n) + , at type@* wsave; + ,(caches_ at pref@dct2[i].n==n) + ,caches_ at pref@dct2[id].wsave = malloc(sizeof(@type@)*(3*n+15)); + F_FUNC(@pref at cosqi, at PREF@COSQI)(&n,caches_ at pref@dct2[id].wsave); + ,free(caches_ at pref@dct2[id].wsave); + ,10) + +void @pref at dct1(@type@ * inout, int n, int howmany, int normalize) +{ + int i; + @type@ *ptr = inout; + @type@ *wsave = NULL; + + wsave = caches_ at pref@dct1[get_cache_id_ at pref@dct1(n)].wsave; + + for (i = 0; i < howmany; ++i, ptr += n) { + @pref at cost_(&n, ptr, wsave); + } + + if (normalize) { + fprintf(stderr, "dct1: normalize not yet supported=%d\n", + normalize); + } else { + ptr = inout; + /* 0.5 coeff comes from fftpack defining DCT as + * 4 * sum(cos(something)), whereas most definition + * use 2 */ + for (i = 0; i < n * howmany; ++i) { + ptr[i] *= 0.5; + } + } +} + +void @pref at dct2(@type@ * inout, int n, int howmany, int normalize) +{ + int i, j; + @type@ *ptr = inout; + @type@ *wsave = NULL; + @type@ n1, n2; + + wsave = caches_ at pref@dct2[get_cache_id_ at pref@dct2(n)].wsave; + + for (i = 0; i < howmany; ++i, ptr += n) { + @pref at cosqb_(&n, ptr, wsave); + + } + + switch (normalize) { + case DCT_NORMALIZE_NO: + ptr = inout; + /* 0.5 coeff comes from fftpack defining DCT as + * 4 * sum(cos(something)), whereas most definition + * use 2 */ + for (i = 0; i < n * howmany; ++i) { + ptr[i] *= 0.5; + } + break; + case DCT_NORMALIZE_ORTHONORMAL: + ptr = inout; + /* 0.5 coeff comes from fftpack defining DCT as + * 4 * sum(cos(something)), whereas most definition + * use 2 */ + n1 = 0.25 * sqrt(1./n); + n2 = 0.25 * sqrt(2./n); + for (i = 0; i < howmany; ++i, ptr+=n) { + ptr[0] *= n1; + for (j = 1; j < n; ++j) { + ptr[j] *= n2; + } + } + break; + default: + fprintf(stderr, "dct2: normalize not yet supported=%d\n", + normalize); + break; + } +} + +/**end repeat**/ From scipy-svn at scipy.org Sun Jan 18 06:24:48 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 18 Jan 2009 05:24:48 -0600 (CST) Subject: [Scipy-svn] r5483 - in trunk/scipy/fftpack: . src tests Message-ID: <20090118112448.45772C7C02D@scipy.org> Author: cdavid Date: 2009-01-18 05:24:37 -0600 (Sun, 18 Jan 2009) New Revision: 5483 Modified: trunk/scipy/fftpack/fftpack.pyf trunk/scipy/fftpack/realtransforms.py trunk/scipy/fftpack/src/dct.c.src trunk/scipy/fftpack/tests/test_real_transforms.py Log: Add dct III. Modified: trunk/scipy/fftpack/fftpack.pyf =================================================================== --- trunk/scipy/fftpack/fftpack.pyf 2009-01-18 11:24:18 UTC (rev 5482) +++ trunk/scipy/fftpack/fftpack.pyf 2009-01-18 11:24:37 UTC (rev 5483) @@ -185,6 +185,17 @@ integer optional,intent(c,in) :: normalize = 0 end subroutine ddct2 + subroutine ddct3(x,n,howmany,normalize) + ! y = ddct3(x[,n,normalize,overwrite_x]) + intent(c) ddct3 + real*8 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 ddct3 + subroutine destroy_ddct2_cache() intent(c) destroy_ddct2_cache end subroutine destroy_ddct2_cache Modified: trunk/scipy/fftpack/realtransforms.py =================================================================== --- trunk/scipy/fftpack/realtransforms.py 2009-01-18 11:24:18 UTC (rev 5482) +++ trunk/scipy/fftpack/realtransforms.py 2009-01-18 11:24:37 UTC (rev 5483) @@ -64,6 +64,43 @@ """ return _dct(x, 2, n, axis, normalize=norm) +def dct3(x, n=None, axis=-1, norm=None): + """ + Return Discrete Cosine Transform (type III) of arbitrary type sequence x. + + There are several definitions, we use the following: + + N-1 + y[k] = x[0] + 2 * sum x[n]*cos(pi*(k+0.5)*n/N), 0 <= k < N. + n=0 + + The DCT-III is the inverse of DCT-II up to a scaling factor. + + Parameters + ---------- + x : array-like + input array. + n : int, optional + Length of the transform. + axis : int, optional + axis over which to compute the transform. + + Returns + ------- + y : real ndarray + + Notes + ----- + The (unnormalized) DCT-III is the inverse of the (unnormalized) DCT-II, up + to a factor 2*N. + + Examples + -------- + >>> x = np.linspace(0, 9, 10) + >>> np.testing.assert_array_almost_equal(dct3(dct2(x)) / 20, x) + """ + return _dct(x, 3, n, axis, normalize=norm) + def _dct(x, type, n=None, axis=-1, overwrite_x=0, normalize=None): """ Return Discrete Cosine Transform of arbitrary type sequence x. @@ -97,6 +134,8 @@ f = _fftpack.ddct1 elif type == 2: f = _fftpack.ddct2 + elif type == 3: + f = _fftpack.ddct3 else: raise ValueError("Type %d not understood" % type) Modified: trunk/scipy/fftpack/src/dct.c.src =================================================================== --- trunk/scipy/fftpack/src/dct.c.src 2009-01-18 11:24:18 UTC (rev 5482) +++ trunk/scipy/fftpack/src/dct.c.src 2009-01-18 11:24:37 UTC (rev 5483) @@ -111,4 +111,26 @@ } } +void @pref at dct3(@type@ * inout, int n, int howmany, int normalize) +{ + int i; + @type@ *ptr = inout; + @type@ *wsave = NULL; + + wsave = caches_ at pref@dct2[get_cache_id_ at pref@dct2(n)].wsave; + + for (i = 0; i < howmany; ++i, ptr += n) { + @pref at cosqf_(&n, ptr, wsave); + + } + + switch (normalize) { + case DCT_NORMALIZE_NO: + break; + default: + fprintf(stderr, "dct3: normalize not yet supported=%d\n", + normalize); + break; + } +} /**end repeat**/ Modified: trunk/scipy/fftpack/tests/test_real_transforms.py =================================================================== --- trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-18 11:24:18 UTC (rev 5482) +++ trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-18 11:24:37 UTC (rev 5483) @@ -6,7 +6,7 @@ from numpy.testing import assert_array_almost_equal, TestCase from scipy.io import loadmat -from scipy.fftpack.realtransforms import dct1, dct2 +from scipy.fftpack.realtransforms import dct1, dct2, dct3 TDATA = loadmat(join(dirname(__file__), 'test.mat'), squeeze_me=True, struct_as_record=True, mat_dtype=True) @@ -153,5 +153,34 @@ def setUp(self): self.rdt = np.double +class _TestDCTIIIBase(TestCase): + def setUp(self): + self.rdt = None + + def test_definition(self): + for i in range(len(X)): + x = np.array(X[i], dtype=self.rdt) + y = dct3(x) + self.failUnless(y.dtype == self.rdt, + "Output dtype is %s, expected %s" % (y.dtype, self.rdt)) + assert_array_almost_equal(dct2(y) / (2*x.size), x) + + def test_axis(self): + nt = 2 + for i in [7, 8, 9, 16, 32, 64]: + x = np.random.randn(nt, i) + y = dct3(x) + for j in range(nt): + assert_array_almost_equal(y[j], dct3(x[j])) + + x = x.T + y = dct3(x, axis=0) + for j in range(nt): + assert_array_almost_equal(y[:,j], dct3(x[:,j])) + +class TestDCTIIIDouble(_TestDCTIIIBase): + def setUp(self): + self.rdt = np.double + if __name__ == "__main__": np.testing.run_module_suite() From scipy-svn at scipy.org Sun Jan 18 06:25:03 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 18 Jan 2009 05:25:03 -0600 (CST) Subject: [Scipy-svn] r5484 - trunk/scipy/fftpack Message-ID: <20090118112503.1446EC7C02D@scipy.org> Author: cdavid Date: 2009-01-18 05:24:57 -0600 (Sun, 18 Jan 2009) New Revision: 5484 Modified: trunk/scipy/fftpack/realtransforms.py Log: More doc for dct* functions. Modified: trunk/scipy/fftpack/realtransforms.py =================================================================== --- trunk/scipy/fftpack/realtransforms.py 2009-01-18 11:24:37 UTC (rev 5483) +++ trunk/scipy/fftpack/realtransforms.py 2009-01-18 11:24:57 UTC (rev 5484) @@ -13,7 +13,7 @@ def dct1(x, n=None, axis=-1): """ - Return Discrete Cosine Transform (type I) of arbitrary type sequence x. + Return the Discrete Cosine Transform (type I) of arbitrary type sequence x. Parameters ---------- @@ -32,15 +32,13 @@ def dct2(x, n=None, axis=-1, norm=None): """ - Return Discrete Cosine Transform (type II) of arbitrary type sequence x. - There are several definitions, we use the following: + Return the Discrete Cosine Transform (type II) of an arbitrary type + sequence x. - N-1 - y[k] = 2* sum x[n]*cos(pi*k*(2n+1)/(2*N)), 0 <= k < N. - n=0 + This is the most commonly used DCT, and corresponds to what is called 'the' + DCT; in particular, dct2(x, norm='ortho) gives the same result as Matlab + dct function - In particular, we do not normalize it by the number of points of the DCT N. - Parameters ---------- x : array-like @@ -54,6 +52,21 @@ ------- y : real ndarray + Notes + ----- + There are several definitions, we use the following (for norm=None): + + N-1 + y[k] = 2* sum x[n]*cos(pi*k*(2n+1)/(2*N)), 0 <= k < N. + n=0 + + If norm='ortho', y[k] is multiplied by a scaling factor f: + + f = sqrt(1/(4*N)) if k = 0 + f = sqrt(1/(2*N)) otherwise + + Which makes the corresponding matrix of coefficients orthonormal (OO' = Id). + References ---------- @@ -93,6 +106,8 @@ ----- The (unnormalized) DCT-III is the inverse of the (unnormalized) DCT-II, up to a factor 2*N. + + This is also called 'the' inverse DCT (IDCT). Examples -------- From scipy-svn at scipy.org Sun Jan 18 06:25:24 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 18 Jan 2009 05:25:24 -0600 (CST) Subject: [Scipy-svn] r5485 - trunk/scipy/fftpack/src Message-ID: <20090118112524.4B94EC7C02D@scipy.org> Author: cdavid Date: 2009-01-18 05:25:15 -0600 (Sun, 18 Jan 2009) New Revision: 5485 Modified: trunk/scipy/fftpack/src/dct.c.src Log: Support normalization for dct type III. Modified: trunk/scipy/fftpack/src/dct.c.src =================================================================== --- trunk/scipy/fftpack/src/dct.c.src 2009-01-18 11:24:57 UTC (rev 5484) +++ trunk/scipy/fftpack/src/dct.c.src 2009-01-18 11:25:15 UTC (rev 5485) @@ -113,24 +113,37 @@ void @pref at dct3(@type@ * inout, int n, int howmany, int normalize) { - int i; + int i, j; @type@ *ptr = inout; @type@ *wsave = NULL; + @type@ n1, n2; wsave = caches_ at pref@dct2[get_cache_id_ at pref@dct2(n)].wsave; - for (i = 0; i < howmany; ++i, ptr += n) { - @pref at cosqf_(&n, ptr, wsave); - - } - switch (normalize) { case DCT_NORMALIZE_NO: break; + case DCT_NORMALIZE_ORTHONORMAL: + n1 = sqrt(1./n); + n2 = sqrt(0.5/n); + for (i = 0; i < howmany; ++i, ptr+=n) { + ptr[0] *= n1; + for (j = 1; j < n; ++j) { + ptr[j] *= n2; + } + } + break; default: fprintf(stderr, "dct3: normalize not yet supported=%d\n", normalize); break; } + + ptr = inout; + for (i = 0; i < howmany; ++i, ptr += n) { + @pref at cosqf_(&n, ptr, wsave); + + } + } /**end repeat**/ From scipy-svn at scipy.org Sun Jan 18 06:25:40 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 18 Jan 2009 05:25:40 -0600 (CST) Subject: [Scipy-svn] r5486 - trunk/scipy/fftpack Message-ID: <20090118112540.3C084C7C02D@scipy.org> Author: cdavid Date: 2009-01-18 05:25:34 -0600 (Sun, 18 Jan 2009) New Revision: 5486 Modified: trunk/scipy/fftpack/realtransforms.py Log: Add doc for dct3. Modified: trunk/scipy/fftpack/realtransforms.py =================================================================== --- trunk/scipy/fftpack/realtransforms.py 2009-01-18 11:25:15 UTC (rev 5485) +++ trunk/scipy/fftpack/realtransforms.py 2009-01-18 11:25:34 UTC (rev 5486) @@ -36,7 +36,7 @@ sequence x. This is the most commonly used DCT, and corresponds to what is called 'the' - DCT; in particular, dct2(x, norm='ortho) gives the same result as Matlab + DCT; in particular, dct2(x, norm='ortho') gives the same result as Matlab dct function Parameters @@ -81,14 +81,9 @@ """ Return Discrete Cosine Transform (type III) of arbitrary type sequence x. - There are several definitions, we use the following: - - N-1 - y[k] = x[0] + 2 * sum x[n]*cos(pi*(k+0.5)*n/N), 0 <= k < N. - n=0 - - The DCT-III is the inverse of DCT-II up to a scaling factor. - + This is also called 'the' inverse DCT (IDCT) - dct3(x, norm='ortho') is + exactly the same as the idct function of Matlab. + Parameters ---------- x : array-like @@ -104,11 +99,22 @@ Notes ----- + There are several definitions, we use the following (norm=None): + + N-1 + y[k] = x[0] + 2 * sum x[n]*cos(pi*(k+0.5)*n/N), 0 <= k < N. + n=0 + + Or (norm='ortho'), for 0 <= k < N: + + N-1 + y[k] = x[0] / sqrt(N) + sqrt(1/N) * sum x[n]*cos(pi*(k+0.5)*n/N) + n=0 + The (unnormalized) DCT-III is the inverse of the (unnormalized) DCT-II, up - to a factor 2*N. + to a factor 2*N. The orthonormalized DCT-III is exactly the inverse of the + orthonormalized DCT-II. - This is also called 'the' inverse DCT (IDCT). - Examples -------- >>> x = np.linspace(0, 9, 10) From scipy-svn at scipy.org Sun Jan 18 06:25:56 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 18 Jan 2009 05:25:56 -0600 (CST) Subject: [Scipy-svn] r5487 - trunk/scipy/fftpack Message-ID: <20090118112556.1ACBFC7C02D@scipy.org> Author: cdavid Date: 2009-01-18 05:25:49 -0600 (Sun, 18 Jan 2009) New Revision: 5487 Modified: trunk/scipy/fftpack/realtransforms.py Log: Document normalization modes for dct II and III. Modified: trunk/scipy/fftpack/realtransforms.py =================================================================== --- trunk/scipy/fftpack/realtransforms.py 2009-01-18 11:25:34 UTC (rev 5486) +++ trunk/scipy/fftpack/realtransforms.py 2009-01-18 11:25:49 UTC (rev 5487) @@ -47,6 +47,8 @@ Length of the transform. axis : int, optional axis over which to compute the transform. + norm : {None, 'ortho'} + normalization mode (see Notes). Returns ------- @@ -92,6 +94,8 @@ Length of the transform. axis : int, optional axis over which to compute the transform. + norm : {None, 'ortho'} + normalization mode (see Notes). Returns ------- From scipy-svn at scipy.org Sun Jan 18 06:26:17 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 18 Jan 2009 05:26:17 -0600 (CST) Subject: [Scipy-svn] r5488 - trunk/scipy/fftpack/tests Message-ID: <20090118112617.CED75C7C02D@scipy.org> Author: cdavid Date: 2009-01-18 05:26:09 -0600 (Sun, 18 Jan 2009) New Revision: 5488 Modified: trunk/scipy/fftpack/tests/test_real_transforms.py Log: Add test for norm mode of DCT III. Modified: trunk/scipy/fftpack/tests/test_real_transforms.py =================================================================== --- trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-18 11:25:49 UTC (rev 5487) +++ trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-18 11:26:09 UTC (rev 5488) @@ -165,6 +165,16 @@ "Output dtype is %s, expected %s" % (y.dtype, self.rdt)) assert_array_almost_equal(dct2(y) / (2*x.size), x) + def test_definition_ortho(self): + """Test orthornomal mode.""" + for i in range(len(X)): + x = np.array(X[i], dtype=self.rdt) + y = dct2(x, norm='ortho') + xi = dct3(y, norm="ortho") + self.failUnless(xi.dtype == self.rdt, + "Output dtype is %s, expected %s" % (xi.dtype, self.rdt)) + assert_array_almost_equal(xi, x) + def test_axis(self): nt = 2 for i in [7, 8, 9, 16, 32, 64]: From scipy-svn at scipy.org Sun Jan 18 06:26:37 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 18 Jan 2009 05:26:37 -0600 (CST) Subject: [Scipy-svn] r5489 - trunk/scipy/fftpack/tests Message-ID: <20090118112637.CAC42C7C02D@scipy.org> Author: cdavid Date: 2009-01-18 05:26:28 -0600 (Sun, 18 Jan 2009) New Revision: 5489 Modified: trunk/scipy/fftpack/tests/test_real_transforms.py Log: Handle precision for equality tests in DCT tests. Modified: trunk/scipy/fftpack/tests/test_real_transforms.py =================================================================== --- trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-18 11:26:09 UTC (rev 5488) +++ trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-18 11:26:28 UTC (rev 5489) @@ -112,6 +112,7 @@ class _TestDCTIIBase(TestCase): def setUp(self): self.rdt = None + self.dec = 14 def test_definition(self): for i in range(len(X)): @@ -120,7 +121,7 @@ y = dct2(x) self.failUnless(y.dtype == self.rdt, "Output dtype is %s, expected %s" % (y.dtype, self.rdt)) - assert_array_almost_equal(y, yr) + assert_array_almost_equal(y, yr, decimal=self.dec) def test_definition_ortho(self): """Test orthornomal mode.""" @@ -130,7 +131,7 @@ y = dct2(x, norm="ortho") self.failUnless(y.dtype == self.rdt, "Output dtype is %s, expected %s" % (y.dtype, self.rdt)) - assert_array_almost_equal(y, yr) + assert_array_almost_equal(y, yr, decimal=self.dec) def test_axis(self): nt = 2 @@ -138,24 +139,27 @@ x = np.random.randn(nt, i) y = dct2(x) for j in range(nt): - assert_array_almost_equal(y[j], dct2(x[j])) + assert_array_almost_equal(y[j], dct2(x[j]), decimal=self.dec) x = x.T y = dct2(x, axis=0) for j in range(nt): - assert_array_almost_equal(y[:,j], dct2(x[:,j])) + assert_array_almost_equal(y[:,j], dct2(x[:,j]), decimal=self.dec) class TestDCTIIDouble(_TestDCTIIBase): def setUp(self): self.rdt = np.double + self.dec = 10 class TestDCTIIFloat(_TestDCTIIBase): def setUp(self): - self.rdt = np.double + self.rdt = np.float32 + self.dec = 5 class _TestDCTIIIBase(TestCase): def setUp(self): self.rdt = None + self.dec = 14 def test_definition(self): for i in range(len(X)): @@ -163,7 +167,8 @@ y = dct3(x) self.failUnless(y.dtype == self.rdt, "Output dtype is %s, expected %s" % (y.dtype, self.rdt)) - assert_array_almost_equal(dct2(y) / (2*x.size), x) + assert_array_almost_equal(dct2(y) / (2*x.size), x, + decimal=self.dec) def test_definition_ortho(self): """Test orthornomal mode.""" @@ -173,7 +178,7 @@ xi = dct3(y, norm="ortho") self.failUnless(xi.dtype == self.rdt, "Output dtype is %s, expected %s" % (xi.dtype, self.rdt)) - assert_array_almost_equal(xi, x) + assert_array_almost_equal(xi, x, decimal=self.dec) def test_axis(self): nt = 2 @@ -181,16 +186,23 @@ x = np.random.randn(nt, i) y = dct3(x) for j in range(nt): - assert_array_almost_equal(y[j], dct3(x[j])) + assert_array_almost_equal(y[j], dct3(x[j]), decimal=self.dec) x = x.T y = dct3(x, axis=0) for j in range(nt): - assert_array_almost_equal(y[:,j], dct3(x[:,j])) + assert_array_almost_equal(y[:,j], dct3(x[:,j]), + decimal=self.dec) class TestDCTIIIDouble(_TestDCTIIIBase): def setUp(self): self.rdt = np.double + self.dec = 14 +class TestDCTIIIFloat(_TestDCTIIIBase): + def setUp(self): + self.rdt = np.float32 + self.dec = 5 + if __name__ == "__main__": np.testing.run_module_suite() From scipy-svn at scipy.org Sun Jan 18 06:26:53 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 18 Jan 2009 05:26:53 -0600 (CST) Subject: [Scipy-svn] r5490 - trunk/scipy/fftpack Message-ID: <20090118112653.9E783C7C02D@scipy.org> 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": From scipy-svn at scipy.org Sun Jan 18 06:27:09 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 18 Jan 2009 05:27:09 -0600 (CST) Subject: [Scipy-svn] r5491 - trunk/scipy/fftpack/src Message-ID: <20090118112709.4F8D8C7C02D@scipy.org> Author: cdavid Date: 2009-01-18 05:27:04 -0600 (Sun, 18 Jan 2009) New Revision: 5491 Removed: trunk/scipy/fftpack/src/dct.c Log: Remove dct.c file. Deleted: trunk/scipy/fftpack/src/dct.c =================================================================== --- trunk/scipy/fftpack/src/dct.c 2009-01-18 11:26:47 UTC (rev 5490) +++ trunk/scipy/fftpack/src/dct.c 2009-01-18 11:27:04 UTC (rev 5491) @@ -1,199 +0,0 @@ -/* - Interface to various FFT libraries. - Double complex FFT and IFFT. - Author: Pearu Peterson, August 2002 - */ -#include - -#include "fftpack.h" - -enum normalize { - DCT_NORMALIZE_NO = 0, - DCT_NORMALIZE_ORTHONORMAL = 1 -}; - -extern void F_FUNC(dcosti,DCOSTI)(int*,double*); -extern void F_FUNC(dcost,DCOST)(int*,double*,double*); -extern void F_FUNC(dcosqi,DCOSQI)(int*,double*); -extern void F_FUNC(dcosqb,DCOSQB)(int*,double*,double*); -extern void F_FUNC(dcosqf,DCOSQF)(int*,double*,double*); - -extern void F_FUNC(costi,DCOSTI)(int*,float*); -extern void F_FUNC(cost,COST)(int*,float*,float*); -extern void F_FUNC(cosqi,COSQI)(int*,float*); -extern void F_FUNC(cosqb,COSQB)(int*,float*,float*); -extern void F_FUNC(cosqf,COSQF)(int*,float*,float*); - -GEN_CACHE(dct1,(int n) - ,double* wsave; - ,(caches_dct1[i].n==n) - ,caches_dct1[id].wsave = (double*)malloc(sizeof(double)*(3*n+15)); - F_FUNC(dcosti,DCOSTI)(&n,caches_dct1[id].wsave); - ,free(caches_dct1[id].wsave); - ,10) - -GEN_CACHE(dct2,(int n) - ,double* wsave; - ,(caches_dct2[i].n==n) - ,caches_dct2[id].wsave = (double*)malloc(sizeof(double)*(3*n+15)); - F_FUNC(dcosqi,DCOSQI)(&n,caches_dct2[id].wsave); - ,free(caches_dct2[id].wsave); - ,10) - -GEN_CACHE(fdct1,(int n) - ,float* wsave; - ,(caches_fdct1[i].n==n) - ,caches_fdct1[id].wsave = (float*)malloc(sizeof(float)*(3*n+15)); - F_FUNC(costi,COSTI)(&n,caches_fdct1[id].wsave); - ,free(caches_fdct1[id].wsave); - ,10) - -GEN_CACHE(fdct2,(int n) - ,float* wsave; - ,(caches_fdct2[i].n==n) - ,caches_fdct2[id].wsave = (float*)malloc(sizeof(float)*(3*n+15)); - F_FUNC(cosqi,DCOSQI)(&n,caches_fdct2[id].wsave); - ,free(caches_fdct2[id].wsave); - ,10) - -void dct1(double * inout, int n, int howmany, int normalize) -{ - int i; - double *ptr = inout; - double *wsave = NULL; - - wsave = caches_dct1[get_cache_id_dct1(n)].wsave; - - for (i = 0; i < howmany; ++i, ptr += n) { - dcost_(&n, (double*)(ptr), wsave); - } - - if (normalize) { - fprintf(stderr, "dct1: normalize not yet supported=%d\n", - normalize); - } else { - ptr = inout; - /* 0.5 coeff comes from fftpack defining DCT as - * 4 * sum(cos(something)), whereas most definition - * use 2 */ - for (i = n * howmany - 1; i >= 0; --i, ++ptr) { - *((double *) (ptr)) *= 0.5; - } - } -} - -void dct2(double * inout, int n, int howmany, int normalize) -{ - int i, j; - double *ptr = inout; - double *wsave = NULL; - double n1, n2; - - wsave = caches_dct2[get_cache_id_dct2(n)].wsave; - - for (i = 0; i < howmany; ++i, ptr += n) { - dcosqb_(&n, (double *) (ptr), wsave); - - } - - switch (normalize) { - case DCT_NORMALIZE_NO: - ptr = inout; - /* 0.5 coeff comes from fftpack defining DCT as - * 4 * sum(cos(something)), whereas most definition - * use 2 */ - for (i = n * howmany - 1; i >= 0; --i, ++ptr) { - *((double *) (ptr)) *= 0.5; - } - break; - case DCT_NORMALIZE_ORTHONORMAL: - ptr = inout; - /* 0.5 coeff comes from fftpack defining DCT as - * 4 * sum(cos(something)), whereas most definition - * use 2 */ - n1 = 0.25 * sqrt(1./n); - n2 = 0.25 * sqrt(2./n); - for (i = 0; i < howmany; ++i, ptr+=n) { - ptr[0] *= n1; - for (j = 1; j < n; ++j) { - ptr[j] *= n2; - } - } - break; - default: - fprintf(stderr, "dct2: normalize not yet supported=%d\n", - normalize); - break; - } -} - -void fdct1(float * inout, int n, int howmany, int normalize) -{ - int i; - float *ptr = inout; - float *wsave = NULL; - - wsave = caches_fdct1[get_cache_id_fdct1(n)].wsave; - - for (i = 0; i < howmany; ++i, ptr += n) { - cost_(&n, (float*)(ptr), wsave); - } - - if (normalize) { - fprintf(stderr, "dct1: normalize not yet supported=%d\n", - normalize); - } else { - ptr = inout; - /* 0.5 coeff comes from fftpack defining DCT as - * 4 * sum(cos(something)), whereas most definition - * use 2 */ - for (i = n * howmany - 1; i >= 0; --i, ++ptr) { - *((float *) (ptr)) *= 0.5; - } - } -} - -void fdct2(float * inout, int n, int howmany, int normalize) -{ - int i, j; - float *ptr = inout; - float *wsave = NULL; - float n1, n2; - - wsave = caches_fdct2[get_cache_id_fdct2(n)].wsave; - - for (i = 0; i < howmany; ++i, ptr += n) { - cosqb_(&n, (float *) (ptr), wsave); - - } - - switch (normalize) { - case DCT_NORMALIZE_NO: - ptr = inout; - /* 0.5 coeff comes from fftpack defining DCT as - * 4 * sum(cos(something)), whereas most definition - * use 2 */ - for (i = n * howmany - 1; i >= 0; --i, ++ptr) { - *((float *) (ptr)) *= 0.5; - } - break; - case DCT_NORMALIZE_ORTHONORMAL: - ptr = inout; - /* 0.5 coeff comes from fftpack defining DCT as - * 4 * sum(cos(something)), whereas most definition - * use 2 */ - n1 = 0.25 * sqrt(1./n); - n2 = 0.25 * sqrt(2./n); - for (i = 0; i < howmany; ++i, ptr+=n) { - ptr[0] *= n1; - for (j = 1; j < n; ++j) { - ptr[j] *= n2; - } - } - break; - default: - fprintf(stderr, "dct2: normalize not yet supported=%d\n", - normalize); - break; - } -} From scipy-svn at scipy.org Mon Jan 19 03:31:08 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 19 Jan 2009 02:31:08 -0600 (CST) Subject: [Scipy-svn] r5492 - in trunk/scipy/fftpack: . src Message-ID: <20090119083108.0F246C7C011@scipy.org> Author: cdavid Date: 2009-01-19 02:31:02 -0600 (Mon, 19 Jan 2009) New Revision: 5492 Modified: trunk/scipy/fftpack/realtransforms.py trunk/scipy/fftpack/src/dct.c.src Log: Implement dct 1 normalization mode similarly to other types. Modified: trunk/scipy/fftpack/realtransforms.py =================================================================== --- trunk/scipy/fftpack/realtransforms.py 2009-01-18 11:27:04 UTC (rev 5491) +++ trunk/scipy/fftpack/realtransforms.py 2009-01-19 08:31:02 UTC (rev 5492) @@ -11,7 +11,7 @@ atexit.register(_fftpack.destroy_ddct1_cache) atexit.register(_fftpack.destroy_ddct2_cache) -def dct1(x, n=None, axis=-1): +def dct1(x, n=None, axis=-1, norm=None): """ Return the Discrete Cosine Transform (type I) of arbitrary type sequence x. @@ -28,7 +28,7 @@ ------- y : real ndarray """ - return _dct(x, 1, n, axis) + return _dct(x, 1, n, axis, normalize=norm) def dct2(x, n=None, axis=-1, norm=None): """ Modified: trunk/scipy/fftpack/src/dct.c.src =================================================================== --- trunk/scipy/fftpack/src/dct.c.src 2009-01-18 11:27:04 UTC (rev 5491) +++ trunk/scipy/fftpack/src/dct.c.src 2009-01-19 08:31:02 UTC (rev 5492) @@ -42,8 +42,8 @@ void @pref at dct1(@type@ * inout, int n, int howmany, int normalize) { - int i; - @type@ *ptr = inout; + int i, j; + @type@ *ptr = inout, n1, n2; @type@ *wsave = NULL; wsave = caches_ at pref@dct1[get_cache_id_ at pref@dct1(n)].wsave; @@ -52,17 +52,26 @@ @pref at cost_(&n, ptr, wsave); } - if (normalize) { - fprintf(stderr, "dct1: normalize not yet supported=%d\n", - normalize); - } else { - ptr = inout; - /* 0.5 coeff comes from fftpack defining DCT as - * 4 * sum(cos(something)), whereas most definition - * use 2 */ - for (i = 0; i < n * howmany; ++i) { - ptr[i] *= 0.5; - } + switch (normalize) { + case DCT_NORMALIZE_NO: + break; +#if 0 + case DCT_NORMALIZE_ORTHONORMAL: + ptr = inout; + n1 = sqrt(0.5 / (n-1)); + n2 = sqrt(1. / (n-1)); + for (i = 0; i < howmany; ++i, ptr+=n) { + ptr[0] *= n1; + for (j = 1; j < n-1; ++j) { + ptr[j] *= n2; + } + } + break; +#endif + default: + fprintf(stderr, "dct1: normalize not yet supported=%d\n", + normalize); + break; } } From scipy-svn at scipy.org Mon Jan 19 03:31:25 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 19 Jan 2009 02:31:25 -0600 (CST) Subject: [Scipy-svn] r5493 - trunk/scipy/fftpack/tests Message-ID: <20090119083125.803F4C7C016@scipy.org> Author: cdavid Date: 2009-01-19 02:31:18 -0600 (Mon, 19 Jan 2009) New Revision: 5493 Added: trunk/scipy/fftpack/tests/gendata.py trunk/scipy/fftpack/tests/test.npz Removed: trunk/scipy/fftpack/tests/test.mat Modified: trunk/scipy/fftpack/tests/test_real_transforms.py Log: Use npz format instead of .mat for test data in dct tests. Added: trunk/scipy/fftpack/tests/gendata.py =================================================================== --- trunk/scipy/fftpack/tests/gendata.py 2009-01-19 08:31:02 UTC (rev 5492) +++ trunk/scipy/fftpack/tests/gendata.py 2009-01-19 08:31:18 UTC (rev 5493) @@ -0,0 +1,6 @@ +import numpy as np +from scipy.io import loadmat + +m = loadmat('test.mat', squeeze_me=True, struct_as_record=True, + mat_dtype=True) +np.savez('test.npz', **m) Deleted: trunk/scipy/fftpack/tests/test.mat =================================================================== --- trunk/scipy/fftpack/tests/test.mat 2009-01-19 08:31:02 UTC (rev 5492) +++ trunk/scipy/fftpack/tests/test.mat 2009-01-19 08:31:18 UTC (rev 5493) @@ -1,34 +0,0 @@ -MATLAB 5.0 MAT-file, Platform: GLNX86, Created on: Sat Jan 10 14:39:34 2009 IM2x??c``pb6 ??? ? -?317?fb?0`?>#3 +;'X=3skfx??c``X?l@??A??gb~0??Pa??? dW0 ?????ro??????='?????? -?q?? :@t?@???@?6I?:07W?^*??????,\[x??c``??l@??A??gb0??Pa??? d70 @(???U ????????Pq ??T\*??+B????*??$?Yx??c``??l@??A??gbA0??Pa??? dw0??'?? ???Y 4'???? ?P??/?KB??P??vP??+B?JPy:? ;8x??c``0`d``? X?| fc&? -N????]?*?o???9g????G?;?=?:`?'0?+????????????tZ8?/?g{????.?}?o ??X??x??Q???????X4?O?:f???,(????/>S%?Z>??U?gV{??????? -????.=???M??,???{?????????????^???kf????\??g/z?????e ?_?w?j???u?v?L????????5????^&??i6?g??~Zl-ym?tg??d?/??3??????KN????[g?L?????H???;????eo?P*???^??Cx?8??0@x5  ????????????I?Q?????$???,e??lO{9? ??????C=??`;???C??W???O???}L?U?????C.?w??]?3(P???z?fk???,+??L???LH?vv???5?8&???????7???fk???]?]?G??M???????+???hsi????2t|?i???y??W1??[?u?????Il?T?????crW??~??QV%????8?????s??0e??? ?`??6U?*?W???p??"????rY5???????Zg????????/l??d???????}??C?n -????????????4n4??Q???~\??S??s(???|1}????c???&????:?9????= -??fR???yw??%??[?????m???^v???? ????xz[h????P??8???\?*7????]??#?? ?u?r?????????????????!?F?Q?????u?????y#L??????:?R?????%+?U????E????+ ??d??Ew???e?????8x?-? 0? ????J?#E???f???q?B? -N>?{? -?bN?? ?~?r?1U?????u????8??S???kE??|??O^EUM???????& q?????Y? ?? ?!?n4y?L??v??????)SSk????&?F???Hn~? ?????VOAI[?????B? -?m?????l?????-I?!l???}@???>?- ?????????9??,?/?[?wuV???qdk??`?m?>?;???E?n?O!?,?w?|r???aBFw??Q?" ?? ?-?):????0??O?N?I?|:???"?q?r??w1??}????????Q?l? M?h+?_-?E^???^?t?9Tx?-? 8??'??B#??????P?????(Y -q]?????P -)??u? cd??????~????y??}???${D?_???????????n????zn/??e??(y???d???V????????#?-?A????????4?mwJli7?s?????[? ???s?W???????+?pi???? V?? qb???????F,?'u??/???Tr~s_l/?L????+???/??z?h?-?P?????b_?; ?z_*??????Z6?y!? ?&??|??k????{??????/N ??E?!?|?hCA#,D??]^?A?.??????i?V?[cX??O??FL??-?????w?Vv6K@??^?? ??????8???Lf ?G??J!k.?H>?s???v}??? -?^P??V???W??Ncaf?`{??-nOz|3!?HV?+?????A?W?z{f????{V"???V???q???e? Z?e-??t\T?g?~?a)???? -?1???)????6?????F.??1?!??ZS??F??$N??{????5?0?iW??0.$p???!T?u??v???De??O?\?1Vl??? -!??c?|_????}?|J??_?Xg???}?15=?A??}?7(mYO????(=???????L!3??FAd?? ??A?"?????9?????KRP ???,m??;??@du???? -04???J???V8:z??r???????\?f?#? P??Xl+?Ei'??>?o???K ????d?u??a?]M`?U?????Y'?0?r28*?U3????=??|?c?x???!9!??yi:???y@?o6?c??t??SL]?YJL??"H}???f05??*??BK??M?Y?f??v????(g??d? -????">e?c????!n?5???L??W??L\?SU?c?o R?_?1????uM&??=? -???!??M?.n??)?,????+Q?l???,?b??5.????BVf??R=?hn -eA9S(V?h/2?%ovo?i??n:????o??>?u?U?FR?f"1??n:O??w?_??YIy+8_?C?D?lr|?????eR2???????????A_PG???,dd=:#?i-*???|?(???)?iK g?Gk?c????-??????E-2p?)???{?S?$N?8z?FyVS+?uk1{?P?:??????????Vt4a -??(?d?/?R????|??j???????[??X??r?????N?,??H?????r?Q??]g?~??7S?K???????mMO???~)?U??~???sO??78?c????????O?w{?D???[????R&??Yu?~????e??_??_?=??}U`???w/??.?????????Z??,??k?[K????|??c?????.???x???q??}?W???[??w??5'E2P??~?+????]???????_????7?Q??????U???????*??u???*?d???? ?t~????lO??@?g? Q???+ ???????????$??T????@g{ -???F??N?????o[E??o?{??????????Lx%?r??P?WW?????x2%????? ?K????N?Jc3?????G?8???.?0~?|?b???`????w#% ???~@t???????R?E???????????????J???????????%??~??/????y|????l?"_????~?????s???R????$??z???4m6 - ??"???????j??????y???????.?n???^:?*???*?=x?-? 0? ??y??Z?8??6?U??$?T?s??[????"{?8?? I?????W?????uu????b?Td[?"?v??????<?N?e??A???[AZ?(?o??E?n??^<>????Cr?pp?SO?b?=?7??[(?? ?7[)?t??%)n??Q?w?`X???y'?????r???x?su3?N??\?????? ?~???u?-?R ???9s?18?F ?? #0???1????f?:????A??5?H??t???}Bh1??X????V??_-A?????e????k??*pb#?G!E?R??T??\???????f???T???s?;?Y?f~Z??I b??> ?5????IP?Y???Ha? -p%?G7?????c??MV?n?_????>??)??????`x ?+? ?*?s?G?"??{??^??c??C;F????z?ujw?$??? z??;?????.?-w??L??T|:IX0?"?/?+?H?/Hp:vJ?????????6*????4?2?huZd???????qm0???v5K???? tV#???u6Q?(??O9y[??v:??LO?r?Pb?A8o??K?????YL??J?9sP=1?0?}?k??Qlo??O????#_?4?*0%???j?M???@7??#/F??e????% -I?Ot^?????Ek[?&?j????8=??7??9?3?o?e?}?e?/ ?/??o?7??}????????|????qe?o ?????7?i????[?????I????|z??*?#?V?????????? h????e????/???!?vw???'8?%?O?(P??^5?2?8???^t ??s?t?d<7???lE??l???<\m-G5??a??Jp???D+ -??1?????h?Rz2???LD?nj?M????sH8bU?$MB???u=C`N????;?????~?~?Xo?.????? -?g??L???Z??9\??J?????.??g?.z?b$???I?,^??\^?`M?-?;???P??3 ?k?&??3?bZG? R??3???V??#???????BD?/?`??E??98??]?&??)uY?th?s?>??a a!*&=?ok ?,'???? P??XS??@V?I??U??????????N?AC?cs?? ????? _??[?}M_ -?;z???7????h%?0?????8/?V nm??f?~x?\??=????;'????D?w?J????uB=? -K?H4P??????!????S?V?? ?,J?ko??b????hx??Xe_a????#T????,r"????5Up?E??uC?y?-U??????;??P????k[??? ?(t(X!??[???b??q? ?9?'O?f|????? \ No newline at end of file Added: trunk/scipy/fftpack/tests/test.npz =================================================================== --- trunk/scipy/fftpack/tests/test.npz 2009-01-19 08:31:02 UTC (rev 5492) +++ trunk/scipy/fftpack/tests/test.npz 2009-01-19 08:31:18 UTC (rev 5493) @@ -0,0 +1,48 @@ +PKG|3::???PPx5.npy?NUMPYF{'descr': '??????V?Dj??(??$?????? +??0???S??R??!????`:??????(???????:?Q??s??Q$V???Mw?)???uMng???4?8c????4s???J????6?????r}a??#JFE??????????????v?????%???D??:????h??8??>n????/?????????_??V???>d??????t7?:??x?f ??????????*??s?h??????G??I?????????`?}E???? nB??u?8?$???K??\s??F?g??????K???????"?^???D??????????(@y???|??????m???y?VPUR?? y?????Q? +????)????????+?Q??G?Ua?????:?mM??z??#???1?5bD?????z??????U?%????????(??PD???????(P?W??????????T:??*X???@E+K???- ??T????"??O?@??9??"????? +??????????7??AdZ??v? ?????A2? L???.1#K??????b????}y2s??Y??L???q+????????3qU???m???????^??????>-???1%???P??"??3???? ?]?\??\??????-^k*???p??(?????R?)??????????7??OJ??AV?&???h???R????v??]???"??dJ?????.p????dO.G??f????$???? +?p?W??6#{??e?????R???p? ?n??h?????c??Bl????#}2???.?|????????????L????c???~?~?T????????????f?J=)???t`?T??a?n2U??y ???v???????????y}P????m:?H????H{????z????P??^i?.?@?v?QY?????|Z???8?5t???{??4??gV[??????????????i?????????o??Oqrt??l@?g[???Y???'?????=Q??????x*?????Q????????`????#? +??+vo??? m??Yx??o??]????&c?kt??v??0?????x>???`Hh?? ???a?n????,[W??B??????`????? >T?????3???k+????T?iA???L???~??i7?k?????!???9???yaJQ??g??????`G????_vy??_???#/n K??k)"A??????-??"??????*??|???????.Z??????IzN????f=?[??U??o??d? ??(?R,?.$???{??'!??n????7??PKG|3:?{?PPx6.npy?NUMPYF{'descr': '??q???*oq????]????????:?????????y???J?dj?n??????3???Z???????????\5?? ?"?v????oZ!?????H??K???3?N4?(??^}d??????&Ku???vOb????o??|?????????????????G?i~7????u??U???MA??8????KI??????^??????c????B??MP(????????tPxI?N?????????? ???Nh??:??)??????G_ +??(H?8????????^????_Z???? ???!????:?8???5???????2?Ao?/??????F2d?|??^?(jK??Ba?!TI??G?0#??? "?????*??d??W?n????Uo?{??;(O?y????=????????=???w?`??????u????(??N????(;??@ ???}???s?gt?\????b???? -?y???W???????1???t(?????q?????P?rQ????6%??.??a???????y????o?S? ???*???????yl*T???????>?????N??????M????????z?????~X ?D??????????1?????CW????5??????weq3?????J??< s???????a??????mvS????bS(3E????hX?6????{D???5?U?5????oD?????Id??JJ????kuN???d?V?????>???PKG|3:5????x1.npy?NUMPYF{'descr': '??ku??V??A?*???3C?{???~j?#Z?? ?w?i|??# +?W???????v????G?U:a??+Z?)?????*7???R??#??r?;p?t????n?c??S(??????l[?0?????a?F???}?????? +?>`u??PKG|3:F-???x3.npy?NUMPYF{'descr': '??????RR?=????"????????!43????????U???????*??u???*?d???? ?t~????lO??@?g? Q???+ ???????????$??T????@g{ +???F??N?????o[E??o?{??????????Lx%?r??P?WW?????x2%????? ?K????N?Jc3?????G?8???.?0~?|?b???`????w#% ???~@t???????R?E???????????????J???????????%??~??/????y|????l?"_????~?????s???R????$??z???4m6 + ??"???????j??????y???????.?n???^:?*??PKG|3:s?1?PPy4.npy?NUMPYF{'descr': '????PKG|3:j?PPy7.npy?NUMPYF{'descr': 'L?????eg??H??'????FE?????[??R???????????w?6??????=???&8Dk???>'&?w?????c.?????$?h???V?? j??x +??"??.kG6??????c??S???a:J?a??|+qJ??????,?$???????)??0;?????Q?S,!??k???Kv@???k0???K;??????+ t?????B?????????:N????-?????B?*]??]y?d???I?BN???o????Z?????Y??^G8??8V?b?`???:"?*??* _????RH????\? ????B?q9????????DF???H??U??OBf`w????S"??ZP}???????????????\5??~?SJ????vI~??(???yK?az????&????D???????d???????y??????????z??V???@????_?? sa???????,??k??????[ ????P?Y???w?E????2??t???T?p????? ?2????bV????'gI?"???pL3????(.\$k????w???|?X)[d>?@???????=?o???? ?t????????1??, s?????Z??S??@??`?Y??W +"u???????????T??d????v@??+??x?D?????0?i?`???&???dC??? ??V????i+????? ^??????)????^??$?????w??????A(kA??/c??.????dOK7???]??fl??U~?]@ ??$m?`??X/??????xHK0?@`$??*E??????????r??I????J?????9+3?0 +??qZ/????? +?ez????x?a?o??"?2?>[??g?K???{??????o?K???p>??w?????u\E???FX5?5??Z??{?????{??6???@E??????{i??VS??_??????????aTW???????6?P??? ?3 ???NX`?????C+???????????????4o?V????IO??h ??-?hF??zGw??????????3E?P=???c??T???c??N????ZIj1???z?U#%?*????? ?D.??Vs??????LK??F???Fu??*??+?????-M??????=???i?????oiI???? ??????4 ???*?j??>???_-??9??,s??????T???4???T1 u??U --D??????c? ??lNA?L???/`?Y??r q4?(???????????HI???k??????8 nM?'?????:????w5H?U???.?%????G??c??? +??qJ??J??#???????/ \????:Z?B??n???.1??????C?I~`w???[m? g?????U?????.$y/???!o??9????, ??)??????SJ?????_????\?]????`?? >??n~?j??????e?????SQ??%??\??aZ??Rx??? +@"???~??????????????Y??6?DN???L? p?????D?DT?????S????(h???b??C?????????'=cY???p5?????r"I??????d???hK????? ?-?N???\??3????T?nC??*???????????E?._???`??0?B?{???m??{3???q?ez??&?d=Y???]Rw?????_",?????l?????????????????/???C j????)N????[??N??dKW??b??OE??Z]?F???nFR??0??IQ?0? ???z???????????(??F]??lr???????xo?? ?!(?? ? b&?????]( +??,???????x'??????????`???T?????????t???? Author: cdavid Date: 2009-01-19 02:31:38 -0600 (Mon, 19 Jan 2009) New Revision: 5494 Added: trunk/scipy/fftpack/tests/fftw_dct.c trunk/scipy/fftpack/tests/fftw_ref.npz trunk/scipy/fftpack/tests/gen_fftw_ref.py Log: Add fftw-based reference data generator for test data in DCT unit tests. Added: trunk/scipy/fftpack/tests/fftw_dct.c =================================================================== --- trunk/scipy/fftpack/tests/fftw_dct.c 2009-01-19 08:31:18 UTC (rev 5493) +++ trunk/scipy/fftpack/tests/fftw_dct.c 2009-01-19 08:31:38 UTC (rev 5494) @@ -0,0 +1,80 @@ +#include +#include + +#include + +enum type { + DCT_I = 1, + DCT_II = 2, + DCT_III = 3, + DCT_IV = 4, +}; + +int gen(int type, int sz) +{ + double *a, *b; + fftw_plan p; + int i, tp; + + a = fftw_malloc(sizeof(*a) * sz); + if (a == NULL) { + fprintf(stderr, "failure\n"); + exit(EXIT_FAILURE); + } + b = fftw_malloc(sizeof(*b) * sz); + if (b == NULL) { + fprintf(stderr, "failure\n"); + exit(EXIT_FAILURE); + } + + for(i=0; i < sz; ++i) { + a[i] = i; + } + + switch(type) { + case DCT_I: + tp = FFTW_REDFT00; + break; + case DCT_II: + tp = FFTW_REDFT10; + break; + case DCT_III: + tp = FFTW_REDFT01; + break; + case DCT_IV: + tp = FFTW_REDFT11; + break; + default: + fprintf(stderr, "unknown type\n"); + exit(EXIT_FAILURE); + } + + p = fftw_plan_r2r_1d(sz, a, b, tp, FFTW_ESTIMATE); + fftw_execute(p); + fftw_destroy_plan(p); + + for(i=0; i < sz; ++i) { + printf("%f\n", b[i]); + } + fftw_free(b); + fftw_free(a); + + return 0; +} + +int main(int argc, char* argv[]) +{ + int n, tp; + + if (argc < 3) { + fprintf(stderr, "missing argument: program type n\n"); + exit(EXIT_FAILURE); + } + tp = atoi(argv[1]); + n = atoi(argv[2]); + + gen(tp, n); + fftw_cleanup(); + + return 0; +} Added: trunk/scipy/fftpack/tests/fftw_ref.npz =================================================================== --- trunk/scipy/fftpack/tests/fftw_ref.npz 2009-01-19 08:31:18 UTC (rev 5493) +++ trunk/scipy/fftpack/tests/fftw_ref.npz 2009-01-19 08:31:38 UTC (rev 5494) @@ -0,0 +1,234 @@ +PK?|3:?wOkhh dct_2_3.npy?NUMPYF{'descr': 'z?}??@???**S4?$??+???M??L#???a??? ?5?D?J??%??????? ?3??(????/???????V?)??e?? pA?,_??L??????Z??c!:??v???????8?0????@??V&???b??U????h+?m?????@P6? +??????mg?@l%t??%??g?? ?@??%#???d?????@`??V?????0|???@? ??Yu??M,?a??@M?x$?k?????/??@???u??R??!??@T??7????VG?N??@A~6r????,I?? ?@?9?}?????c??_?@??{@?????????@h%?? ???Sy=> ?@?i?q???B\9{?q?@[??K}V????????@ ??X???| +??lV?@??Q?E>???E ?u??@??u?????8??wjY?@}zl??C??p?'???@]??X3???.s?u?@U?zsb?????? ?@75?|*????6??P?@???j-??H??0???@????o?????]??@A??? ???sg&.-?@??;^????e???@}^??#i??????1??@ +???????A???rN?@????a3??W?}W???@z??????:??`/?@h$B#p??C??R??@N^dZ????N z&?@??8l????? ???@?|??Z???W$&?A1?@?f????"N'Y??@???????????M?@?]?9???^???@p$?`?????,?"?y?@Gd ?@? +?\??%?9??@!?$???I??rr??@%???????Sh?y?@???q???0~?J?@W?9?B??Y???6?@&p????0 ?G???@gE?\???h????@I?5????\>??^??@?Z ?e?????.?i?@?}??a????K??>?@?8 ?7??d???w?@?[v?? ??%??????@?,?;?????????@J]2?9???9+?&??@?c????????|%q?@-????i??W%?}?I?@??S?B??????"?@ !????????????@??0{????? ???@??c??????????@n2? ????ZK???@&?f%???6?$#h?@????a??z?r?D?@????>?????T`!?@??? ??4?9A???@w?$$:???t]????@ +??b????(?hr!??@??4c????t?????@}^??????qW?"{w?@ ?v?q???P???V?@?R??P??+??p~6?@h????0????A_??@(?????????4??@=+i?????W^?????@?? j???????~r?@??_?fg???]???5?@???/?*??????@/???????W?Yj??@?4}??????S???@O??e8y??h??I?@?}8Hh???V,~S??@'??B??? 0???@z8????????e???@N? S????&o???h?@zS? +?^??? ??1?@E?(????.????@kGq????o?]??@'???????bb?q??@???????????m]?@4?Y??S???Ia?S)?@4????![????@???l????'?_[o??@?GS=I?????;jL??@????>???q?Ws?_?@???M?V??!?K?.?@????%???t???@?5?;>???f??(???@? iT@??????X??@?????????W??^FU????c[V3?@??;M?+?????6 +?@?k????+MJAw??@?}?A???Eh??@?]?9?????P????@????????T?-ni?@?Z??Cb??t?Y?"B?@??h;??S?r/0?@?)&?????????@=?U??????a? R??@?.?ug???rp??c??@??\???????&???@??s ?{???^?s?]?@?Y?>?V????EB?8?@?I???1???wF[??@?sIE ???H?????@?I???????@.W?6 8???>???@{C?????ECv??@wR~B???9&??o??@????H???/R( ???@??p???????u2??@??+$????$D?r?@??)?l??_???R?@? U L??2?=BM1?@~?u?b+??h=|???@????? +?? ?????@??(_?????x???@????????-AF@???@???x8????Kz??@?OZ?????o?>;r?@c?dU?l????9?7S?@a? +??M???T?n4?@??V?.????~???@?6?X??e?9???@e ?????^l??@????????U?t????@???MK +???6o?t??@2??Y???i?-x??@ ??Yk???X?????@?e?Y?~??W???fV?@,???uM???a/P%?@&?(?l??DQ?O???@?.?????y?Jx??@?$:?????????@?A'??????k ?c?@/O?*[???hV?/4?@?jGq?+????????@ AJ8???N?????@?K??'????_?+???@???[????M?Bx?@?h?h?o??p?x?I?@??UG?A????????@?e?i????yUg??@? ????_?? ???@wi?aI????????? ?????8???@5&???????@?????????X????@EIH????????????@?*???????a?????@*?-?}??????A^?@|???AW?? ?$y?7?@?.l??0??J +??@???c? +??cd?k??@??A$???????y??@????????~?u????@Cs?F????????z?@R +??Ds??Bz??T?@c?~??M??SweW/?@~??7?(????55 +?@???Wz??M??;??@?$?z????L???h??@??e2???????t???@?,{???iV?9w?@?6???p?????R?@?`??CL??????.?@?W z(??= +??? +?@&6????mQf???@?O7P ?????????@??8?^???C??6??@~???????????{?@?f?vGu???b+hZX?@?? w?Q???3?9!5?@?L???.???}t? +?@a???? ??????@?X???????uoE??@_??????k??????@G?P?K???kJ???@???L?????? ??d?@T?D?[^???Z?LB?@??? ?6?q??@???q@?????q??????iq@????`q?hZbe?3q at 2;??)*q?"???p@#???S?p??CV?p at p?????p???.R??p@?S9???p????X]p@?4~?USp??????'p@?4J?p??3?9A?o at B?S???o?cFx{?yo at c?tv2fo?a???o@:$?P??n??t ???n at C???Z?n?r???r:n@????*'n?P?>c?m@?i>"?m???A_zfm@?!Y at Sm??up???l at 9|????l???Z??l@@7?l??&M??)l@=???|l?f/?N?k@s??/?k???4 Wk@ 7UDk??cw??j at 6??#?j?V*?(?j@?ba?rj?o???`j at r???Z j?A ????i@?Ft???i???_?5Ki@?fd?;8i??j????h@?E????h?M-[??zh@??tw?gh????Sfh at 1_^?}?g??Yg|_?g@?'?.|?g?sI?vBg@;???/g?a????f@???G??f???9??rf@??*`f?ut\?l f@?? \??e??v/??e@???.?e???QI?Z?1?jR?r1?q?Q at LS8??Q??v1?t?P at fh<??P?/? +??1P@?P1?? P??{ ?q?N@?J??N??v? +?;M@??????L??cw???K@??%?L_K???G6WJ@}[?T?I?L?{)@yGsd?=?????:@??y?l:???:??7@/??0?G7???b?d?4 at s?,&6#4?_?????1@?30???0??D???, at 1|DL??+??|??&@ nk ?k%?an?rG @S"?^F??dT??@X??C???t??????H???????PK?|3:?????? dct_3_17.npy?NUMPYF{'descr': 'V? N?z???I???a@E?-?p?'>B??????????d???H?;??2???4?8????j??5??'I?L?3??????1????@?0??O??.-??{??*??v/???(??????&?M?N???$?????q#??+???,"?0???? ??&?+?????^?????pz???T1??S????q???(?hr1???F? L?]3?f?+???Q?U?!??t_?,???.??"J?;??"x?*r??9????;3?p??-^, ?s ?ew?hM ?8?{?5: ??-??e8 +??A*??F ?? ?+?jc???u??????X????? i?A??kg{T??h?N?????j?3 ??????u?r2q? ??6????^???d?F ????t?(%d??I??G??@??$??J??c?G??R^k?????1w????? ?'????h?.?K????C?l???v??^ +???d???jt???5??.???3??O\???.X? x???g}?1Y\?????T??????????!r???\???????n??????81$'7???????????y?]?z???$a?N"???e??J?????"??|?????1?.??7??:r?????)?:?????T??X??v?!H??Q??B?????w?~????gG???b????,?+??e?z?F????*?=%?????0&???????V?????:Yj?????)??????????????/m8, |???A?}R[?????+?F?????%?2??A t? (?????????k +dv?????y????l#? ????Dg????`R||????v0b?????PK?|3:??? ?? dct_3_12.npy?NUMPYF{'descr': '@?=Ab??:???"??V0@?????-?2???AG#@?$??{!?????A/@[x^*6???3h?????aod???PK?|3:?Ks?PP dct_3_32.npy?NUMPYF{'descr': '?GK?v??0(?(br?7o??n?????si?????K:e??????/b??? ?+2: K ?UD?p?:vP??X??q??O?????S??????c?@?? +???-U?W??,??l??# nk?????o????9???+??????+?????{)? ?????U? +??XR?>G +??^???? ?????} ?tE)!Xu??}? + ???T? gW??*?C3????BK??Gp#e??~?.rO?7n1????????b????????^????x????M??u?? ?1??L??(?1??y?Z??????{/?????????N ~?QMI??(????D?????e?s~ +??qN`:m????3K???????>???t&???????>???L????7R?H? ?????9#??????? ??W????????????k? ?????j??%???q????????i3NC?????;?????m?k???~T??>? + Y???f????9???a?7?????w?Gox????@J???4`?_?????b?e?????? ??#?????v??;]???p??[????WY????p[[x^*????Z'.???]??kye???\??7??{?\???W +?\?H???W[?????G>?x??????!6X8??J???????l?????????a?2??6?,????Y??????^f?(?7??fffff????}??????????sF???IEc????M??~?T??R?U??????]?V$???3???????????????8a?h????U?@???gc%?YI???.n?????R?r/0??~?{?????z?????? ??x??????A^????Xl??????S??9??????I??>????????????}????????????? ???t>u??? ]?@???/??C??@h=|??? ???[??2?3/???GXT??$??????B ???q?????5???X?????????????Q?d]?????M???4?27?????M???P??%???}N??_)??z??(Hlw????rk?mI??4?Op???????:8????9z??f????Z?????l#????D???????.9???????~P)??<?$????? ???H??iP?????N@a??y=?????KqU????V?????B???8a??4???H????S?D??9|??S??????q????SW>???z?p?????-???=??)$??;???R?>?G??????4`????0C?? ????f????L?A????? ??,?"??PK?|3:Z???pp dct_1_4.npy?NUMPYF{'descr': '??????-II??@j??{-???k :!?l?@ +p?a???(?)1?@%?}??&??t ]???@??????????????@?/?^????Q?\?M??@?,??P|??=~o?O?@????E????9?7?@??????? ??E???@r? ?o???f`X~??@??HhK????P??1??@?Nx .w???????N?@CT??F??????@??I ???a?9??@v?;O??????I???@???^x?????D??@W??:?????2?f?@a???^??????:?@yW=`?2??g{???@??6?3????m????@????9???Dj??t??@?? ???k? ????@?!S>????R&5?!l?@????d?????E?@??~>??d??@??7????b.??@J?5?o????;?E??@?????????d?? +??@-@?????]??ky??@???????o???i?@????Ic?????NDG?@>Y1\A??? m?%?@?[???????8???@r????????????@?]gC>???:Z??.??@????u????W????@??\?=???Q?n??@h?4 ????????g?@@?,ub???mU2J?@?!?k?D?????-?@/??'??v?r?b?@ Q> ???W=??@????/???MLb???@4J??????c?=i??@???????3???@???????JT??@U?W????A?p???@? ??b?????;?9??@=?????Z5?w?@?????t????W?k?@?[?~?h????HiV_?@R?X?;]??>yX??S?@??&??Q???r???H?@??-?F??#I??=?@???s?;??^f?(?2?@?? ?0??? ?s (?@???s&&??H?????@?\????If?w?@"T???????4} ?@dv???????????@?=?????Vc)??@??s??????W???@p???!????Z'.???@~7???????{d???@??-???wR~???@?Kua??????d??@aE????#?tu??@?f???????fh???@??rgf???Di???@CBu???J?? ??@e???????-_????@??\4$????q7???@??V|????O??????@ ??????1Bx????@H?I???????y???@????????j??G~?@?Y}??X???w?@/????v??z??Cuq?@????Tp???~?:Pk?@?V??7j??oG8-Xe?@????Gd???F??_?@?o{??^?? ???Y?@?Or??X??@4??zT?@ m9??S??n??3O?@??kCN??rl=CJ?@ T??/I??'?@rp???&???????#?@`X??"??????+ ?@h^?????A???@/l?V>??Gw;??@???t???h??J?@?P?????O9&??@??m[?????s ?@?vMH ???c${D +?@r??Z? ???D?e=?@)r???????W^?@???? ????;??@??i?[??J?i??@?B?????v?U???@d??s?????p?@?[;??aS?Q??@C??3T??E??S??@??????????q>?@???????Q????@???????$???@D?r?????2??b?@A?)VM??rP? ?@?#????PK?|3:"+???? dct_1_17.npy?NUMPYF{'descr': ':???v?????$|?o????\? &??????:?t?? 4Hc???bb?????}???u????n??????b~n?\????*?w?????9??????????7????nJy-1???????????W?}W?{????8??\x??;O<'?u?R???pbs??,??sq?N ????o????s(?l???&?+9j??T?G? +h????,??f????@??ld???N?`}?b??Q?B?y?a??S>U#\`???9??q?^???!r?z?\??G?C??Z?D???@.Y??|#?g?W?????ZV?KxB??U?? ??;?S?|{??/?R?n????Q?p?>;?Q??{????>P???}????N???5"?M??h?RD?/L??6U???J?u???I?2??%??H?????Mb?G??S????F?'???E?:vP???D???q?@(D?C?_?+gC?fk}???B??K??gB???;aA??L3????@??5*p? 4@?????M?Q?????RyI>????x!N=???E???^???L? ?b??U= ??m?s? +????D?? +??????z +?FaE< +?MK??F? ????cw? ???#??? ??S???J ??PN?? ?p?N\?????iQ?????#?g???@fg1??R?U??????k?????X???????x]_???S?,??68???q9^???? $(~???O?\?i??o?:???? ??.R( ?????????u?????????Z????@-/???L???????????w??o???? #?????r0?`?mU?9?*?dq?????f????T????F???6?u?!{??????V??W#?2??s??A??!?A???l??????S?*???E?????i??Q?d?HN&nD??a??#???????p'?_??h??HK????Bs???L4H?S?????mj????L????I~?/????5?????>???????;????A-??????w???>??s??T?P?m?????kS?a??+e9????N??P8??L???n?o???\?????????g?w???B?v??G????????O0????G????????????N?????R?.?????,???c???a?.?e??????@?r????.R( _???,|}?K???l@?8??@1?d?%????N??????A?<??vq ????y?????????j?????????????,?Y??? R????If?????x???r????@??a????%!Q????v0b?@????1v?K0????-$ ??9???(??? ?X??d??????MHk :???G>?x??????????????1???????e?????M~?N????.??????-$`ty??+??Dk?????i?:]??b?7?WO??u["?A??!??4??qTn??&??PR`L????n,( ????K?'???y???M????.?????K??????r??9????'??rJ???T?{F"?????k????0??9?????ng_y???????????? ??N]y???,z?n??#?tu?b???|???W???O8??L??6?!?A???K??$7???P?,???q?&"??M??f???eRC? ???6?De????Y?h????~????????]?)????QS?'???#??????4?c?=???xG?j????????????S?4?????"???????>V????P?I?5????P????????"???????e1?y??????fq???d??7i???j??%a??????+Y???5?;NQ???}??.?I??nLOX?A????2T?T:?????\?2??F?7?+??ds?Y1\????+?p?{???{?w??.T???r??????sn??2*Aj?????J#f???Az?b?? )"?*^??=??MZ???J +?V??E??f?R??$??:O???????K?????P?BH??*?=%?D???C?H?A???h8en>??G???R;??i?x?J8??n???W5??W??y2???)???/?????-v?,???N? S[*??????(?'????|?X%??#k ??"???!?K? ???&p?n??????J??Z??8?????l<??(*?T??Y??+???V?a???BwI??????}??????? ????]?? ??A}??. ??f??t? ??bX9???7p?????d?z???]??????nJy???? ?????9?!????Wy???@.q????d??{??v??????U??????!Y??????'??fJ?o ?????PK?|3:?%??? dct_2_16.npy?NUMPYF{'descr': '$??y??0???F?|DL?$n0??3?Y?? ???_Z??????L? ?c}????5[yI???|?.P????,^,???rk?m?\????????????g?R??w?>X??????^D?1?????J?.??PK?|3:r?A??? dct_2_17.npy?NUMPYF{'descr': '?`` dct_4_2.npy?NUMPYF{'descr': 'Y?B??p????l at AJ?i#i?Y6sHj?`@?8b->8_?/??C?W@?W??"?V??PN???R@?5??DR?t)?*?O@,???d-N?Rew??J@???,?J??a1?Z?G@????8G???? kE@?X?+?E????%?C@`??zC??f?lttB@/Q?5?CB?L????}A at y???eYA?i???@@??o ??@?I???*E@@??g#3@?N?a????@X????????? q??@np?????PK?|3:?o??PP dct_1_512.npy?NUMPYF{'descr': 'z?}??_?JD?A?[?????`X?????_?U???g?hS?[??YezQ?bod?O??YvQ??L???hUK:LJ??6x_? H????Cl?4F??z?c???D?? ?W?BC??,,???A??x)u?8t@??? +?H??>???m??????6?S???EH???2?????!??????h???????74e???????Wt?????0??\?????dV?p{?????R$_???q??sC???;k?](??d:tz? ??_?R#?????????????%???????L/1????b.????????z??e?< d???%W??M??ip[[8??(???=#??z??Q???!\?z?????aN?????????????????????5\??????tA}?????# nk???!\?zz??????i??????Y?????>9J?????!r?:??????$,???2>?^???????????5^?I ????=?????0????????? ?y?????$#ga?????3Lm??????*??O????? 1?T???mV}?????5? u????Q???????R ?h??????Z?{???an?r??vR_?vj??????Mb??2??|Z?? ?XS????5??K???b?? E??^0???>????:?f8??hB???2?????R{-??????'????tx#???L??~???Bs?F???h?^`????o????KZ? ???E??? ???!?? ??Y?U???P)??????????lscz???d??????U???????'?????PK?|3:?????? dct_2_15.npy?NUMPYF{'descr': 'w2a?????g??@y??M??????h4t?@??!?w]?????????@H? +???>$|?C??@S?k%4m????????@??j????????A???@I*S?M?????5?7?@?mU?$?????.??@?)??????6Z?8n?@x??x?\??P?D??@?tu?????(d?m0??@??r??????T??X?@!W?Y?H??Z??F?@?,{????c????@)?ah????y$^?Z]?@fN???N????!??@?O0????I?%n??@A ????R ?px?@-#??>k???????0?@?:?v?#?????????@???u???3?`?+??@?0???`?5?Ye?@\;Q?Y????Q]%?@??a????d?? #??@0???????u????@{h+?????????o?@+??%e?? ???O6?@?+?P,??r?_q??@U???t?????v??@??kH???m?%????@????{???:?m?A_?@#??2V????-?,?@\???#???O??F??@?[t???????qG??@?? ???*oG8?9?@^??y?(?????=??@???????h?????@?????t??8?? +?-?@?f? ???L?k>??@n??????GY?????@y????u????Wq3?@nm?y?$?????????@-?(????V??D???@?\?g????m??I?@*?Z?;??O??D??@gaO;??????????@=??????S"??n?@?????a???6??(?@(?XQ??9 +!??@?P?f????>\r???@I?+????.???>_?@]m??rS???]??@u ??=???i3N???@-??\N?????(????@?j???????ve?@4??yZ??d?ww)?@%??????\??@n/????Ku???@?3?c~???????}?@?3ys??]~pfF?@K???+f??@k`? ????u?W??@????????p?n?:??@R?.?????v??$???@?HK?????7?^?G??@???????*??Fnh?@??*??a??RC??D?@ ????>?? ???!?@|F"4????fO??@/??????.??:??@*9'?????? [?/??@B_z????Y?????@???k?????R??x?@-????r??>?x??W?@?`???Q???)?Jm7?@?d???1???w??c?@m?Yg???"?????@#f?y????+???[??@?$??????I [??@>!;o?????TO????@a??'????L?:Y|?@?,AF?v??T?:?U^?@C?_??X??M??S?@?@? ?I;??r??C#?@m????????2?@?f?l???O\?Wp??@*??%@??? ??Y???@|??????z?c????@??,?????sI???@?>?Q????{?by?@?C?|ht????P^?@?S??+Y?????;C?@?k??6>????[(?@?a???#???X? ?@2*! ????P????@?EB[????O?????@??????????l%??@Kt?Y????5??a???@?Z +H+???gG?????@??G?????"i7?t?@?C???W??U???C?@k???L????.??+?@??,`2'??7?n???@??8U???w????@?I????????2S???@E.8?O???f???U??@?Xni%???3?,%[??@??y5????5C???@??r?~??????5??@Ac&??????E?r?@???R?n???*??\?@(???X???=???F?@(*??B??5??-1?@? ?2-??j?????C?'w?@??q??s?????uc?@?,D?_?? ?1??O?@?'I?lL??|?5Z?? ??@-]?F????%???>N??G? \D?@/? +?A??eV?p?7?@i???5???n???+?@???K)?? +??a?@d? 1????? +]?@??k1??U?2s?@???bL?????????@=??????Y?|???@??*????e6?$S??@????:???[| +????@{???????lXSi??@?S9?Y???8??d??@ ??????kg{???@?z0)????A?,_???@????????v?????@??Kq?????S????@???????Y?????@??# ???f3??F??@m?OTV~????V?u?@ y?P?s??/3l?k?@??-i??3O?)?`?@eU???^??b.?AV?@?z?bT???????K?@??-WJ??????A?@???????Mjh?7?@????5???s?f?-?@?wg?+???q??#?@9???!??d????@??_? ????&?@???b???:?z?@p^???????,????@?b~n(??????b??@??@,?????Y????@?yC???|{?????@k??????M?p]??@K?b?????Y??/??@E?>?????_\????@??X3r????????@?[ q???$?w~!??@%?/??????V?D??@??h:???????2|??@A??????vj.???@FC??4???????%??@?F??????M?????@???( ????T???@??j??}??4?/.?v?@?QI?0u???Ky`n?@?t!V?l???c?f?@35 ??d???}?k?]?@v??u\????|??U?@????[T??\???M?@?(??TL??!???E?@O\?W`D???+???=?@??\?}6?@?P?l?4??'jinU.?@+???,???b?d?&?@??B%??????@????????%z?@f?"??r?t???@??8?????j????@????=????;?@????????jM?????@?d????k?m????@??? o????n?U???@?yq?K???? o????@>?h9?????{??@?0 +?7???(?r????@!??F???:#J{???@?%?d????hV????@s/0+????]T ??@??V|??????B?X??@?4??"???&Q/????@?N[#?????;!??@??E????>?$@???@?z?"p????R?(??@?m???????U?&???@?G??????7???n??@B??*J????_u?(??@?}???? y7???@>? ????F ?????@??S????sJ at L?{?@p`r??z??8???u?@????t???a?[?o?@?|\?n???H???i?@Ve??h?????c?@Bv???b??m?Y^?@?n ]??|??WX?@_}{.S???~????@?U?&?????????@?66;"???;?? :??@t'?]???6??#???@??S??????(?7???@B?%U????a??L3??@.???]????.PR???@??x!?????Z?7??@y??[I???Z??????@???c??????Ud4??@??)h??? w.????@`? +???j??U???@Z?$?????1[?:??@?3iSu???????@??=x=???9d????@?$?????)?????@?Z ????o?????@n?R]????+?????@?v/????????????@*:??????J/????@(F??????H?)s???@? ?????+0du???@?K:???]p??@???Vp???E.8?_??@?=??????M!u???@?????????+H??@fI??Z??????f??@??g????G?`???@???1???J]2?Q??@?w?G??????el???@?D8???????j??@?)X??????[Z ??@?!?m????M????@???????????g~?@??#?}??????({?@?x???z??>"??w?@?L1aw??????t?@???:t???(??q?@?oq??P???n?@N??n???t?k?@??o + k??}%??h?@???h???????e?@A??#e??????b?@?R??@b???????_?@GY??h_????]?@si???\???o?DYZ?@?????Y??og_y?W?@M??(#W??7??T?@??SwT??N?G?OR?@;7m?Q??;?p??O?@sePm at O??H???*M?@??HK?L??A?m?J?@?%?4J??U???0H?@??U??G???:M?E?@Z-??TE???X?_bC?@?Z???B?????) A?@?w???@??U????>?@?[w?T>???W?|K$??;p???"?@0?[w?"?????13!?@???? ??bHN&??@ |(?B????I`??@[B>?????a?b?@?? ?????W???@(?????<0?`?@qvk???*;????@s?c?????U????@Gt??F??t??g)?@i?? +????%??@??b????????@r?&R??~o??M?@fN?????G???@???????S????@?b~n???,??? ?@ ?^? ??b??? ?@??x\? ????? ?@??dy ???HZ? +?@???sx +??S?'?? ?@?l?? ????????@u?b?????5?!??@v????????`??@gd?????4J?.?@Sy;? ??^&?g?@?y??D???J????@????????????@3?????????N?@??wc1??????@???"????b???@?=B???2?g???@???aw???7?G?@??P????[^????@??=A?????5[)?@??????}w???@?T3ki??????????@?????;???R??????????$?????BW"P}???c}?[???s???M?????;k?](???e3??????? +??/????????PK?|3:K7|PP dct_3_64.npy?NUMPYF{'descr': '>!;o3I@??.???H??L?D??F at 4/??wRF?sHj?dvD@???D?i?V?PB at 7n1?7?A?L??I@@%u????&m????<@?,???#d????w?'??@[@h=<6????u???@?1?????????`??@v???U?????\5?~@d?g^?~??????{@:???vZ{?)B?v?qy@??r?? y?T? ??kw@???Xgw?1|DL??u@?Q??_u?p?71?!t@??????s???????r at i?????r??BFW?q@*?~??\q????U?{p@??L?*Lp???M(Do@]?.?n? +.V??8m at P?s'X?l????I??k@?>?Ok??A`?Pj@?)9'??i???9}?h@??Pyh??nK??ng@??It5g?????K=f at 7??5f??*l8 e@;Qi?d??7?? +d@????D?c? +????c@???#??b??????,b at r? ?Ob??@?M?>??0|DLe;@6sHj??:?ByGs 8@?>$D?7????O?4@????hM4??E????1@?M?a?1?j2?m??,@??/J??+????`??&@k?m?\x%??;???L @h#?M)O?>???@@8?W????? 1^????S?????PK?|3:?(??PP dct_1_64.npy?NUMPYF{'descr': 'j??)t^c?i@?O?Doi?3?f???h@???B?h??G?z?h@??(???g??Hm?xg at N?&?O\g?d???H?f@??q???f?uV ??Pf@?[?8f?st?*?e@?b??B?e? W@?Pe@?k?,?;e?U????d@?{b?*?d??V sd at LOX??`d????Ad@?????c?.v??2?c@ ???c??e?%b[c at +???YLc?&?"?d +c@??k&_?b?I??r??b at A?????b?"?Alxb@46?4a?`?+3????_@|?8c??_??=?>t?_@????:?_? O??'?_@??p??_?K"? ??_ at +Kt?Y?_?PK?|3:?0?PP dct_2_256.npy?NUMPYF{'descr': '? ????4J???%??*???#???E??6?:h???????????????????????8?*5??Y???tw???8?#+????^? ?? +MK?]?? +?s 3????F??u??<n??W?'???4w??o??H???D??Z~?*O ????Wy??u:???????I?? ???????????KY?8??????????????cZ?????????????x@?????O????????????????????g)Y?????Xl????un???????z???????c?????a???????????| ^??a??M???K????/????z???? ?????????f?v???^=?1X???a???X??VG?t????l??p???????G6??q9^?h???j?3??{????-ax?>Ab???u???mm!ds?8??sq???????o?0o??l??)"C6j??????h??Tka?f???o'gd??? ??b?T9?)9?a?)?QGGT`??????z^?N?W???\??]????Z???.Q?Y?4J??%?W?<2V??EV?R???U?A?m?S?Q1????R?j/????Q???*?C?P?????&P?1AG??N?`x%?sSM?0???D?K?DQ?O??J? ??%W?I?????{H??e2?uG?q????F???+???E??k????D?`?????C?n?|?b0C???? ?yB??&???A??]??a)A????z?@?P?c*???~T?~O?>????e?=???????????{??(?O??Z?????[???c?????8 Q??M??u????4}?c? ?????Df.p)?8k??*?? ?/??G???????Z~?*Op???f??:???????????????????Z +H??(v?U#?K9_??????-$p?DL?$z????$???G?I?q?e??2? ???L??(???I????]?7?~?Az???lC?8???U??[?~?{???HnM?-?????????+I??K????^D ?b??????????????pY??P??b?? ??? k???O?????"?~h?S???"1?y??n??? ??G??????O"????K?????X?V??"???? ???:TS? ??????2 ??.9?? ?@????x ??z0) ??l??)? ??( ??m ????? ?? ?bG? +??%?

rk?????5??k?^?}t?*?%X???????b ????qnn????? 1?6>?????fh<???:d?w????, F??6?x ???.Q???L?u?????M??h?fL?g3????r???? M????b????N>=?e???4???e6?????????? v??6Vb??t????c[F???6???y?????an?r?????????A???h????H?=?N??????E??????????/???)?ahu2??:?S??????? +(???MK??F??O??'????B?"LQ????????c?????????_b,?/???9{g?U????uoEbB????`R?????]????? 8K?r???d??J/?????/???????.????J????i??[#?qp)???L?^????u"?T3???D6?.6m???Q??/??????k????6?^??????9z|??j?0 +B????}8H???6+1????D?????????/?^??????'??H?RE???????Y???x??? ?????aQQ??kD0.??[??????l???????!??3????p?GRR????J"? ??`?eM,???? >???????c> ???p????`??n??S2?????????r?????@???????5???{??.???O??!;oc?#???@????I? >??? ?>???????x????Y??N????&?%????;P??????}U.???F~????Z??m??????#]??v?1<6??VH?I????|???????/??????.l?V???3??????f??Os??z?WH??????????M?E???E?>?'????iQ????4}v?u??(??vL??J??Gp#??Y2??????*;??.?????k????;?%8????O?Z?7Z??#????2?????M~ ??g{?????????t{??%w?Df.???h?????#?M)????????J????\m????????????f???i????+,????JY?8????R??%?????0|D??#gaO;??????_???]???l????Z ?%??QL?3???#?qp???? ?XS?? +???w ???c?]K????!?{??????? ???H??'?????Z??8????/???s??????0??H?? + ???c ????? AJ?i??B????'???*??p???????T???%???d???^EF$?????/??????nf????1?Zd????CR %??:?w??????G?C?????r??h??? ?0?*????c???????????????q???[z4????qR????? ?e????? U1?~??m??oB???????????C?????Ec??l???_???:T????&l????L??~?????nf????f???i??g ??/????B???????w??-?????}"O???9??? ??+?C3O???L???$|?o?????-y?#r?????p0[?@???%g??????`?K?@JD?????W$&?yC?@v????????wakF??@?%?L?????jG-6?@?'G?????????@5 ???????K'??@G??F????o^l?@??Gp+????>??w??@?b?D????2W?f??@??uR?t??o??} ??@;?f??t???????@T? ?y????????@S?Q?7}????5?E?@?%????????E???@]?gA????+??????@??"Mdp???,????@???M?N??g???br?@k'JBbC??_EF?w?@o??L?? ??????@?#c??f????.????@mq???????3?????@^???????? ?0?@?<?????(y5?@???E`????r?*??@$ ????x*??????????????@ ??#?q??^????@???????#1????@{???Y????25 ?.?@U?q???~8H?b??@>!;oC????1 {?[?@?B?Y I??E?>??@?f(???I?5???@?^~?i????_??{7?@?S???&??z8????@?4????k,aml??@?6??s???A?La-?@x?g???/?????@a3?????? +?????@l#?)z????7??9?@Cq???+???+?? ??@??r?W??????3k??@qW?"??????]?Y?@~R??L????? ?@%z?b????-?!??@/?e?????L??????@????~??}?I?@???=???9 at 0? ?@?u??p?????0(???@??Rb???vn???@*AJ????X3R??@?_?E ????}9S2?@_?"????|~!???@ ??o????ER?3R?@???\W>???????@`"?u?????/?{?@???h???"?~H?@??p????c?T4???@U????????????K?@Z??B?9???`??C??@???????.s???@?+?z?y?? DO??-?@?5?U??????1&??@??)W??????k?rx?@C??Vh??????{ ?@??????scz?2??@W??x????=Y??u?@????Sf?????Us"?@OX????Mg'???@"5?b:????+g????@???gr???O%2?@?3??$????&???@A?9w???? E?????@8??_L???I??UN?@/?Xn?@???t????@?O?????^????@????????'????u?@S ??(i??????%0?@*t^c?#???K??@io?$??????????@????????5??re?@?%r?yY???Cn??#?@?,{2????b????@'L?????B??* +??@??F?????Z??c?e?@/l?V>Z??o??'?@? ?:??? ?=?.??@~;???????DX??@2????????.??[t?@%@M-?i??????3:?@?????/???3???@_?sa????9^??I??@??8???N??}??@?mnLo?????BqY?@??]??O??i8en#?@??bbS??J?%r???@n?????????????@???? +????!8V??@??ME?z???0DN?P?@???qG???a????@??~????z?}@??m^?}??Ry??}@??????}???1?7}@yy:WT&}?]?gAh?|@;4,F??|???? +??|@?yUgp|???.'|@:????|??{b?j?{@???Ig?{?????v{@S?A??f{??:???{@?k@??.? )k? ?^)?j@Yk(??j??+?SRj@??t??2f?Y?.??e@'c`?e????!fe@]?jJ2Re???????d@????d???EB??d at 7T???sd? +?Y2d@??? #d??J#f??c@?????c????$=c@?W??`??5=((G`@?]??3`?O?}??_@??L???_?75?|?^@?D???^???ht^@+n?b~?]?Y???.;]@3?z?]?????g\@???{?A\? ?????[@,f??o[?+?? ?Z@)yu??Z?lzPP??Y@?k]j??Y??+??y Y at S8???X?|?(B?OX@?A?*X?3???W@@h?4 ??=?E?>?;@?o&? q:???hU?7@??1!?J7??a??4@ l??3%4?q??H/?1@[y????0??/??L?,@?C?b??+??w)u??&@?:U?gl%??&??G @???}?F??Y?>??@??|?X?????????Tt$?????PK?|3:?F=PP dct_3_256.npy?NUMPYF{'descr': '@???9??>#Ay?@??\?P?? ?N??D?@ 7U&?????(@t??@???SV{??d(Z?@?`R|????Z??@?0DN???3??b??@???$????'0??m??@?!?A????=?N5??@gaO;|????,???@?A&y???:?=?@?L??Z???t\???1?@??[?? ???F ^?n?@????L????a??@> l?A??????}? +?@Q??C??????J?h?@?w??pK????e11??@Z??m$???t????? + ??r??|??n\r@????SGr??y???q@?[??q??!T??yq@/R( ?eq?X9 q at z?????p??????p@???L#?p???!??;p at L8?O)p???P?o at r? +??o?*?=%g?n@??{+?n?o???T)n@a?r?n??P???mm at dT8Lm?V+~)?l@?1?=B?l?m??v +B?#?W@?????=? ??"?;@?c?? ?:?>?^???7 at z????W7?{J??=?4 at w??/-4??|?y?1@?{?_?1?X:?%?,@???-?+?IC???&@?\???n%???&?H @?2o?uH?A ]?@?S?????k???????Q????PK?|3:Vo?PP dct_4_256.npy?NUMPYF{'descr': 'x???`???w@X?vM?w?[??g??w@&4I,)?w???Btu at D???Xiu?R??Z?8u at A?}R.u?c?dU??t@?%r?Y?t?u??+?t@???`[?t?ap???t at LKC?t??Sw%_t@?\p?Ut? ??ES-t at UO?}$t?????5?s at c????s???Q??s@?S:X?s?(eRC??s@??%??s??X??vs@$|?o?ns?!V??Ls@???4Es??<*?/$s@?\??s? +?(z ?r@~?u?2?r??l??g?r at O=????r??t????r@??8???r??/?'??r at y:W???r??G???mr@????gr?Q??Mr@?r?}GGr?ILP?w-r at Q????'r???Y?r@ c A? r?Q?????q@"???S?q?????,?q@??w}&?q?i?^`??q@~T???q?B???q at -????q?/?N[#?q@??????q?}?5^?mq@?{,}hiq?7n1?Vq at t???Rq?`?eM??q@?;?_?;q????p?)q@@j'&q??{b?*q@[&??|q??"2q@?vMH??p?LR?b?p at EIH???p???h:??p@???p?b???4?p at qu??p?R???v?p at 7qr???p?????}?p at W'g(??p?VG?tF?p@?????p?2k???p@????B?p?c?J!~p@?? ?{p??# qp@ +,?)?np??????dp@??I??bp?[ +H?Yp@?y??Wp?z8??4Np@?[??MLp??>?Cp at F??0Bp??\?h:p at Y?.??8p??}???1p at r??Q?/p?A CG)p@???t?'p???@?!p at M???d p??????p@?n-?p?? ? xp@ ???ep??o?h?p@???? p? ?D?? p@?? 0?p??Z fp@?????p?=???p@??f*p??U????o@??&??o?WA t??o@??fc%?o????o@?zM??o??`????o at D? 5?o??I?2?o@???i?o?PK?|3:Jj{??? dct_4_8.npy?NUMPYF{'descr': '??i?w???@/?H 3??z2???w at B??r?v?wL??sr@J??q???=??6n at O]?,?Em?? ???i@+??O?h???!??Lf@^f?(?e?kGq???c@??? vcc?d????a at S?{/a?^I?\?9`@??*???_?oH??]@<???v]?1zn?+?[@m??pe[?6?:?Y@?KqU??Y?/??$mX@???z?-X????t? W@?G,?V??|V@??????U?#?k$ U at 7??:r?T?O??e?4T@ )"?*T? &?(?yS@)r?#[S????{??R@8????R??&k?CJR@????3R?#?3???Q@?8?Z??Q?#K?eQ@[?? ?TQ??< $ Q at M?x$^?P?+?? ?P@??t??P?;m??}P@?mQf?sP?rl=C8IP@$ +-??@P????d?P@??'c|P?????P@??????O??3????O@????C?O??? '?O@x??e?O?PK?|3:?wOkhh ??dct_2_3.npyPK?|3:4?j?PP ???dct_2_64.npyPK?|3:?B??? ?? dct_3_15.npyPK?|3:2OQ?P P ???dct_3_1024.npyPK?|3:?????? ??y$dct_3_17.npyPK?|3:" ??? ??{%dct_3_16.npyPK?|3:??r +PP ??u&dct_1_256.npyPK?|3:??? ?? ???.dct_3_12.npyPK?|3:?Ks?PP ???/dct_3_32.npyPK?|3:?1,PP ??D1dct_2_512.npyPK?|3:^?w??? ???Adct_1_8.npyPK?|3:???}PP ??xBdct_2_128.npyPK?|3:Z???pp ???Fdct_1_4.npyPK?|3:R???hh ???Gdct_1_3.npyPK?|3:??dK`` ??Hdct_1_2.npyPK?|3:???Y?? ???Hdct_2_8.npyPK?|3:?v??hh ??_Idct_4_3.npyPK?|3:?M]hh ???Idct_3_3.npyPK?|3:?`??`` ???Jdct_3_2.npyPK?|3:????pp ?? +Kdct_3_4.npyPK?|3:B??6pp ???Kdct_4_4.npyPK?|3:hT???? ???`` ????dct_4_2.npyPK?|3:J/?PP ??)?dct_4_32.npyPK?|3:?o??PP ????dct_1_512.npyPK?|3:?????? ???dct_2_15.npyPK?|3:??J%P P ???dct_4_1024.npyPK?|3:??G??? ????dct_4_15.npyPK?|3:?X??? ??~?dct_4_16.npyPK?|3:? \?? ??x?dct_4_17.npyPK?|3:j??[?? ??z?dct_4_12.npyPK?|3::tXPP ??T?dct_1_128.npyPK?|3:K7|PP ????dct_3_64.npyPK?|3:?1??PP ??I?dct_3_128.npyPK?|3:?(??PP ????dct_1_64.npyPK?|3:?cs?PP ??>?dct_4_128.npyPK?|3:?0?PP ????dct_2_256.npyPK?|3:? Author: cdavid Date: 2009-01-19 02:31:56 -0600 (Mon, 19 Jan 2009) New Revision: 5495 Modified: trunk/scipy/fftpack/tests/fftw_dct.c Log: Handle both single and double precision for FFTW test generation. Modified: trunk/scipy/fftpack/tests/fftw_dct.c =================================================================== --- trunk/scipy/fftpack/tests/fftw_dct.c 2009-01-19 08:31:38 UTC (rev 5494) +++ trunk/scipy/fftpack/tests/fftw_dct.c 2009-01-19 08:31:56 UTC (rev 5495) @@ -3,6 +3,29 @@ #include +#ifdef DCT_TEST_USE_SINGLE +typedef float float_prec; +#define PF "%.7f" +#define FFTW_PLAN fftwf_plan +#define FFTW_MALLOC fftwf_malloc +#define FFTW_FREE fftwf_free +#define FFTW_PLAN_CREATE fftwf_plan_r2r_1d +#define FFTW_EXECUTE fftwf_execute +#define FFTW_DESTROY_PLAN fftwf_destroy_plan +#define FFTW_CLEANUP fftwf_cleanup +#else +typedef double float_prec; +#define PF "%.18f" +#define FFTW_PLAN fftw_plan +#define FFTW_MALLOC fftw_malloc +#define FFTW_FREE fftw_free +#define FFTW_PLAN_CREATE fftw_plan_r2r_1d +#define FFTW_EXECUTE fftw_execute +#define FFTW_DESTROY_PLAN fftw_destroy_plan +#define FFTW_CLEANUP fftw_cleanup +#endif + + enum type { DCT_I = 1, DCT_II = 2, @@ -12,16 +35,16 @@ int gen(int type, int sz) { - double *a, *b; - fftw_plan p; + float_prec *a, *b; + FFTW_PLAN p; int i, tp; - a = fftw_malloc(sizeof(*a) * sz); + a = FFTW_MALLOC(sizeof(*a) * sz); if (a == NULL) { fprintf(stderr, "failure\n"); exit(EXIT_FAILURE); } - b = fftw_malloc(sizeof(*b) * sz); + b = FFTW_MALLOC(sizeof(*b) * sz); if (b == NULL) { fprintf(stderr, "failure\n"); exit(EXIT_FAILURE); @@ -49,15 +72,15 @@ exit(EXIT_FAILURE); } - p = fftw_plan_r2r_1d(sz, a, b, tp, FFTW_ESTIMATE); - fftw_execute(p); - fftw_destroy_plan(p); + p = FFTW_PLAN_CREATE(sz, a, b, tp, FFTW_ESTIMATE); + FFTW_EXECUTE(p); + FFTW_DESTROY_PLAN(p); for(i=0; i < sz; ++i) { - printf("%f\n", b[i]); + printf(PF"\n", b[i]); } - fftw_free(b); - fftw_free(a); + FFTW_FREE(b); + FFTW_FREE(a); return 0; } @@ -74,7 +97,7 @@ n = atoi(argv[2]); gen(tp, n); - fftw_cleanup(); + FFTW_CLEANUP(); return 0; } From scipy-svn at scipy.org Mon Jan 19 03:32:21 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 19 Jan 2009 02:32:21 -0600 (CST) Subject: [Scipy-svn] r5496 - trunk/scipy/fftpack/tests Message-ID: <20090119083221.8A7FAC7C011@scipy.org> Author: cdavid Date: 2009-01-19 02:32:11 -0600 (Mon, 19 Jan 2009) New Revision: 5496 Added: trunk/scipy/fftpack/tests/Makefile trunk/scipy/fftpack/tests/fftw_double_ref.npz trunk/scipy/fftpack/tests/fftw_single_ref.npz Removed: trunk/scipy/fftpack/tests/fftw_ref.npz Modified: trunk/scipy/fftpack/tests/gen_fftw_ref.py trunk/scipy/fftpack/tests/test_real_transforms.py Log: Handle both double and single precision in unit tests for DCT. Added: trunk/scipy/fftpack/tests/Makefile =================================================================== --- trunk/scipy/fftpack/tests/Makefile 2009-01-19 08:31:56 UTC (rev 5495) +++ trunk/scipy/fftpack/tests/Makefile 2009-01-19 08:32:11 UTC (rev 5496) @@ -0,0 +1,13 @@ +CC = gcc +LD = gcc + +fftw_single: fftw_dct.c + $(CC) -W -Wall -DDCT_TEST_USE_SINGLE $< -o $@ -lfftw3f + +fftw_double: fftw_dct.c + $(CC) -W -Wall $< -o $@ -lfftw3 + +clean: + rm -f fftw_single + rm -f fftw_double + rm -f *.o Added: trunk/scipy/fftpack/tests/fftw_double_ref.npz =================================================================== --- trunk/scipy/fftpack/tests/fftw_double_ref.npz 2009-01-19 08:31:56 UTC (rev 5495) +++ trunk/scipy/fftpack/tests/fftw_double_ref.npz 2009-01-19 08:32:11 UTC (rev 5496) @@ -0,0 +1,257 @@ +PKA?3:? ?hh dct_2_3.npy?NUMPYF{'descr': 'D??Vlgz`???[B>?u??4?F?????? X???Kts#\?????w6%??PKA?3:{???? dct_3_15.npy?NUMPYF{'descr': '???X???n?$??@?HG??????"w;Pt?@????????(?LGU?@??%X ????&K?h?@?????? j"md??@Pd?t???[~^?@?D?????'?#??O?@.?r?????;??@?K?@?%?I???{??M=??@=a?????B~???@Y??????? ,lnJ?@??c?D?????Pz??@?2?'`R????o??"?@??]?l????OB?]??@]??????%Y{??@f???????F5?????@])i?3??????"???@.?K????p?>???@S?? +???????mg?@"?r??%??b?? ?@Q?%#????????@?B?V????}5|???@????Yu?????a??@?rv$?k??h?/??@?? ??u??M???!??@???7????eC?N??@?@3r?????? ?@???}???uf??_?@?{@????????@j?? ?????y=> ?@Hx?q???$?8{?q?@??K}V??}=?????@?B?X?????lV?@ ?S?E>??em +?u??@??q?????u??wjY?@Lp??C???^%???@??X3?????s?u?@? zsb??%???? ?@?[??????u???@?r??r????? ?b??@08?3????vU?{?p?@?G??8g????m??=?@? "?a4??Z8d ?@?D +?\???#8??@9+?$???X1?rr??@??????????h?y?@?q??F??J?@'`D?B??)???6?@?Ck??????G???@?bG?\???#?q????@_?5????;??^??@ D ?e??? .?i?@????a??R?Y??>?@tW?7??}??w?@??v?? ??z????T`!?@4d? ??+A???@p}2$:????Q????@e??b??????mr!??@?s'c??????????@????????_q?"{w?@?o?v?q?? ????V?@^k??P??~?p~6?@'????0??y?A_??@_v??????v?4??@?x??????w?????@?? j?????H?~r?@_?o?fg??Gk???5?@?J?/?*?? ????@?7?????????j??@H0S}?????!`???@K??e8y??|???I?@G?Hh????jS??@???B?????/???@?????????????@@E?R????? |??h?@?p +?^??S???1?@x(??To6????@&eT???????]??@?????????u?q??@&????????m]?@??N??S??GX?S)?@?<???Xc????@?b?l????K?g[o??@GWM=I???[l*jL??@??>???-?Ps?_?@???M?V???u`?.?@@ ??%??H????@?J?;>??????(???@?t?T@???5??X??@??????????a??V??dkCB?8?@v????1????W[??@?'xIE ????????@?=????????E????@?t;??????N????@+???S???)?(Y??@m ???}???4?H3a?@ %`a?Z??e?h?V>?@??'6 8????1???@("C?????1Cv??@?a~B???+??o??@????H????(5 ???@l??p?????O?u2??@@??+$?????D?r?@?`??l??m c?R?@?U L??\NBM1?@????b+??*b???@X??? +???s????@O53_????uvx???@?I??????N?e@???@j#y8?????/z??@??-Z???????>;r?@?BdU?l???]5?7S?@5????M???7?n4?@???V?.???,y???@??9?X????T???@??l ???T??^l??@??????????r???????~?:??@?o?????? ?& Xp?@?a?i??rW at -?H?@??sA??????!!?@???????N?????@>???????Q????@??Z??????w?????@u?????????{????@"%f?}???L??A^?@a~??AW???-Ny?7?@????0??*?+??@???c? +??r;?k??@?+>$????N???y??@??P?????'v?????@|??F?????#?z?@????Ds??????T?@?h???M??YN?eW/?@?7?(??#?45 +?@Q?Wz?????;??@s??z????????h??@4??2???????t???@%?????_?9w?@%???p?? W_?R?@Zy?CL??f???.?@??Xz(??;`??? +?@@?????Wf???@?CUP ???r?)????@W3`?^????4??6??@??Q?????????{?@?t>vGu??Bd8hZX?@;[w?Q????9!5?@?|???.??q?}? +?@?_y?? ???????@?JY?????)?oE??@??????????????@??D r@\??ir?ZgXJ ?q@??q6?q?*?????q@?????q?hWY??iq@????`q? `e?3q at R ?)*q???s?p@??H?S?p???V?p at m?????p??1`R??p@!9???p?7??X]p@~??USp??&???'p at b?^J?p?4?S:A?o@??S???o?i?8{?yo@\w2fo?B???o@??lP??n???N???n@?y?Z?n?41r?r:n@?FP?*'n????c?m at R?="?m??O?_zfm@???Y at Sm??q{???l@??}???l? ,???l@?v6?l?3K???)l@?J??|l?F???N?k@???/?k???} Wk@?E$UDk?????j at +?C#?j?_'7?(?j@?P~?rj?St??`j at -?XG??f????rf@????*`f?{Ip?l f at E?[??e??_?/??e@|?.?e??" I?@"kd?=????"??:@? ??l:?*????7@? 2?G7?\_?d?4 at r?!6#4??{5C??1@?U????0??????,@`$?\??+????&@?t?k%?c?rG @\el^F?????@?D??@??????n"????PKA?3:?{???? dct_3_17.npy?NUMPYF{'descr': 'B????O?++=?????????-? N???l?H?;?????|??$??4?8??6d??5??;??=????L?3?< +?*?=?0????1??>??L2???>?0?* x?TL =?tH??.-?{?????`&??*?k#/?x=?b???(?ty?v??"?????&???0?/=T?????$???7#=w????q#??2P?????2?,"??d???-=?????? ?I?\>?%=?}f ???PC??rI ={T??=I???"?]%Z?????J+?q =???i ?-M???8??????u?? 1?!=7@? ???\?l?) =~????^???E???????[ ??????ey4???Wf%d??????=?/7?G???YW?] =?g??$???T??P?=rB?4c?\??#??=?? ^k????-????K??!4 at l????t????=s3?^ +??r 1i[????? +kt??~A ???? ??8/???'???s +=<? +P\??-M???8?????x???[y?0??=??mY\???:?K^??tZ????????` -?\-??!r??C?5?P7=?p\,????'?????1?6????(?*???"=?_A'7??Q? b??=O?????iL?g ? =H=?.?z??E8?? ???O"??7???rl??b?D??????I?(?S??G??#??? ?=?=>????? +???=??2???N??Ab?????b??Zt?m?$=?b???+?? `E??B=&?.?F???bC?t???.??????N?K?j?=?`Tt?????es??=?????f??????? =R +???:????:`?n?U?{l????X???1???[c??????.??????????@?Y?b??:??????V0@??aM??-??<_?AG#@???{!??A??A/@K u6???Np?????/???c???PKA?3:??gPP dct_3_32.npy?NUMPYF{'descr': 'A_&@?? V??????N???\??????PKA?3:`Q[?PP dct_2_512.npy?NUMPYF{'descr': '???$?/b? ?m?L?U? +?#?>G +??????? ?qPy?} ??g??Wu?Y??? ???zgW?_?b3??4??BK???DJe???f rO???????-?^??b?-??????[c8?????????%??t??J9???L?q????????????8?{/?Q6q????YH{ ~?????(?>n ????t??~ +??f???9m????4????$?T??>???c]&???%?>??U?1?????r .?? ??e?'L#???M?=?? ???B?????Nd"???+"?~????"?4%???_?b????7?/NC????T???? +?g/0????k?????QM?????mJ??y???k?j?\??2? ~????%????????u?????P?=???"??z???????}??quo????}CH? ??=#9zJ????????'.?#????????t$??6?*?????_2??6??za?2????#}?L??w?r????GYO???????(????4?*N??\????"??????B????mdnd??-?.?4???????D?????5?I???_???????t?N????????r????7B?K??~k??J??@???????h? l??????5#?????<">?=??!F??:???^??dI???Lc?&\???)) ?? ??\??????LT ?????x???"??PKA?3:Z???pp dct_1_4.npy?NUMPYF{'descr': '?z?zW?O?????7W??@|?<$???8:`f???@y???J|??_?n??@???????W???[?@.???P????;?? ?@?zF?K??}.5????@r?a6i????7?????@z??R????l?7?y?@????:p??;]??7E?@?l???;???a????@|??????}??????@D?c???????U??@?(~?????-?_\??@??j?rw??B?I?Q?@?+?2qI???????$?@?zA$????M??^??@???????r??????@z?A?J???{??G?@?????8?????=I??@b??"???????Y???@?X??N???T?i ?X?@?? ??J??????? ?@??%??????Lk??@??L?!???CV???y?@z?p??l??????2?@{???<&?? c?????@?K??2?????????@????????i???g?@!??m?[???P??&?@???? ????S??@?qT??????;0II??@3b?{-?????p!?l?@?`?a???7?)1?@??A??&??U?d???@????????q????@B??^??????G?M??@T#??P|?????o?O?@??m?E????.?7?@l??????k?E???@???o????jX~??@?ThK????^??1??@??Y .w???@???N?@?p??F???y???@?2 ??????9??@??pO????lF?I???@=|?^x???'??D??@???:???$?3?f?@ip??^??????:?@t?D`?2???e9???@?3??Pl{????@?-??9???????t??@?nl? ??????????@??x>????????!l?@??g?d?????E?@?VX~>??w?/d??@.h????p?a.??@+<4?o???]?[?E??@??h??????b? +??@??b????????ky??@I??????@D#??i?@???????.??@????u?????Q????@8?@?=??????m??@b? ????qX ??g?@c?,ub????tU2J?@{??k?D???4{?-?@:?y?'???? ????=??@????/???o?b???@K?l??????-?=i??@??????? ????@!???????(?IT??@?i?W??????p???@A*??b???Xi?9??@O??????p??w?@?????t??U~??k?@.4?~?h??EC?iV_?@y?S?;]???Mc??S?@??U??Q??{ ???H?@ +?F??Hc???=?@?1?s?;????(?2?@?O??0?????s (?@? fs&&??>?????@????????#w?@,??????Vc)??@{??s?????W???@G???!????-???@???????rW?d???@???-???WS~???@=ua??????d??@??n????"Obu??@gf??????}H4h???@?gYgf???w{?h???@??Au????Q +??@?????????a????@?h?4$???G8???@ :@|?????m?????@?.??????*>????@?FL??????3?y???@??????? ]o?G~?@?? Y}??W=;??w?@?g???v??1??Cuq?@????Tp?????:Pk?@X?d?7j??;/-Xe?@????Gd???(m??_?@M?N??^???????Y?@? b??X??????zT?@?y2??S??????3O?@?%UkCN????qCJ?@???/I??B?k(E?@9?SGD???4?b@?@????????t#zf?;?@?o;?:??`?9?X7?@1?j?6?????3?@ ?wEQ2????{??.?@?%?=.???>BT+?@6??S*??t???>'?@?(??&???????#?@L?Z??"??? ??+ ?@???????x???z*;??@dC'?t??.X?J?@2????????F&??@??m[???CX?s ?@E?qH ???"{D +?@3??Z? ??M?re=?@?G??????qX^?@?q? ???a?;??@I,k?[??/?F??@?-?????_u?@????????????@*??????????@G???????v?b?@$??UM????? ?@??I???PKA?3:I?1^?? dct_1_17.npy?NUMPYF{'descr': ':??t#b??=????????J??/??=???o???????DX?O=?? &?????}????=i??:?t???5?7?x=?#?3Hc????)Q1?j=??j?????????f=?I???u?????J{?Y?0 n????-??f?7 vn?\???3 K&v?a?w???.Y?K?=u?=z?????? v67{?/??7???O??V9d???)y-1???>G:_f???S?????]?#??????W?{?JA>?????%???\x?(?Hf?r=t??<'?u?FU?"??a=8t??pbs?C_}Y?wq=?R??sq?9???A?g=??~???o? ?`??g=6z?s(?l?@?h??S=???+9j??K?_??U=m?G? +h??b?vo8?Z&???f?6??OD?????ld??(???zL?nR?_}?b???!??i????y?a????AQ?:i=? 9??U?T???BQ=$;F?;?S??0K=V?F=r6?/?R???}?r.N=?????Q?!jy??9=??P???I??S???????N??BoZ??V?a?n?M?u?#?]?_??F?/L?????C=:?+???J?c??|P=?{`??I?E???l?\=??W&??H??Oi??e??n?Qb?G?W?KT1`=??)???F?? ?Y#?=8D@???B???k?RcO=B??gB???!yb=???;aA?x,?C??0?Z????@??I??R!3??(S? 4@?="4??YT?9&F?Q???? +!?;???yI>??>????P????#N=??????E???b??^K??9???K?? =???x0 9?QTq>]=E&??YP8?????WA=??S5??7?r}? :B@=d?/?6??t??{?E= ???I6???????8=?4???5?z????*!=b??H?5?????cC??f:???4??'??F?& p???3????T??1^?q3??2??]?/???9Y?2???PBM=rF?$?t2?Op0e?????!???1??? C??7???@?e?1??????BU????3M1??-? 8=?@?H?0? +??T=d??l%M0??h????L=^? g?/?Iu?N=?????/???d???C=2???d`.?:?!=2?M=~'???-?`??VF?=??W??-?(??}?????} `,?I??v??&????D??+?.j/zfI?K?I?&+?_??? ????b??*?cLN??E???? ?*??f????:??U???v)???S?7?v??2??(??o???>=?????l(??????LJ=O??pZ?'?`|??S? =?y?s'?-?G:??T=?-????&?o?H?I?=???Zw?&???S??6=!?LA?&?;???@?@=??C?%??f?KE?9=??%?C%?6p???h?<?????$?,??A???HgF8z$?(E?e??0?|u??$?????:.?9???#???9??=Ag?S?`#?????Z????K\#?@!?\H1????;?"??Z?l+l=;?u^"?X??R??R=?S/?? "????@??=wu???!??O3?KN=Y?#mjp!?k???C=?C?<%!?????O={?L?? ??9?s?<=?]??? ?? ????E=1 *?6O ??z??>?.=O*? ????|=?x??????( _??9???C???Z]=>????????||bCP??P??S?????[?:???"???k??iL3??I??[.???9???d????????p? +?~>6=??>?M??3?6fD=al??5??????$?=????\w????P??P=?2?K???????9=????????S?,T9=???'???-4 *??Q??V5[???@??????????1=??t???=ZQ?i@=?E}_?i?zo?[=? ??7H?????c?K=?~M?i????f9=`i?????C????9=????????#?8 +A=?{u?v?????C=|??E?w?X?? ,=?6????}tn(?lsl?????`@?b?'?zv?????? +?&?1=????G??y????F=Ot???X??{??[?[=????+????&k????Jms??'???7~???%;??_=..?p?T?p55??T=?`?Y?^?????V=^???e??=&??J???????<=:?z??? ???QT)?K=?q?Yu ?f????-=2|?E!* ???5??=M?+? ??Y????=?a7?o? ?.?h??w'?]?,?O ?I?Q?/??6?? ?z?iu?60? ??]? ?Q????y.???2pL? ???(??$^=???f/????? 0???G??7?(??.????????P???-?+???????h??C?#=??\R????gm7??i?~?D??????6O?F?M????'d^???r0 +?7???, i1?????x:n=/:??????4?1??6=?^l ????? ??4=,Z(??????U?s?A=??~??????9l!??1=?X\X????? s?F=gxfx.??W $??3=? +????t?S???"=??&C%?????*???=?"?M?????x^?=b??R?????????]????u?5d??VX?:???? x?&=????19?M????? +??^?^=????_???ad?$:?"=???%????! ?gK?1=??5?X????!?v?}?=|5??L??2He???'=? ?' ??P?2$kr/=?+L(??????@(7=?g^M????????XC=?????????&&%=?$?F???{?=Ut:=/??}????b????x(=}?8$J??????y7=?,?!???d{@1=??D????.?|?P=IJ!?9???&+FY4???Mz*y???8???+?????????????O????]y???????=? ?Cn??A /W?f=|?{??b?????z? +9=o5??W???????A=?????L???#??,?/=F?Bq?A??^? yC?D=?8u-%7??????56=?8J??,??}???I*=%??"??=????= + ????S?Qx??-=???]? ???dt?*K??J5'=??????? u???=?7&=???=???T<=????????P? ??)=_:1?????:?|?I?0=?Q?\????<-?K??8=|v ?????|???F=?T???????D??`?0=I +?+6???g?+??9=????????&2????????????V???~C?y??I?m{??A???gq???h ?W=~?K18i?????mh????&?$a??g??wC????=1?+Y?????? ?f=???ENQ????N???&?.??@?I??.?????0=d?c??A????1G?? ?+$??T:????p??7=????2???R?? Q/=N?j??+???????BH=???F$??"??p?,3=T{~ ???'????$=?c????p?Y?=&{{ ??@??D+?0=??WvF??Q???????]N????1???? =????????JN????T???N???F`????Q?B???????fJ =?$?zz??? ?@ 5u =?l#5????>?k????????w?(?P?:=???????R:?)=?=r????7???V['=??~????X??w=????*???~?(C?C=h???E????J?=??V=?bX?v???r_{??"=[??????h??4=?D????,?C?D6=?g?x?{??B??W;?'=u??6w??9' ?G(E=K#?r??U??IX?6=???sn???w??a'=?j?@j????2??%=`?x?#f????????5=@?'b??????SA???]e?A??1=? 2 R;??)???HE=Q|?;J8??????4=?GZLW5???????=={??.y2?????^*,??????/??????_???S.?,??(????L????/[*???Y?lA?J???'??du"??}=4`??X%??O6??t?w=??G??"?????S?M?????? ??N???-???Go?????$n0??|?h?? ???Y???9; M? ?M??????F??yI?????tP???Y6?v,???d]?z?\????N???Fu@R???????????io??1???in??.??PKA?3:? ?W?? dct_2_17.npy?NUMPYF{'descr': '8_??)HC?W@F??"?V??"???R@?w??DR?z?'?O@??I?d-N?Q??y??J at c??.?J?????Z?G at Q?^??8G????!kE at n?')?E?u +??%?C at Z????zC? :kttB@??3?CB?????}A@???eYA??????@@??B??@?????*E@@i?%h#3@???d????@6?????z?q??@?;??????PKA?3:*B?0PP dct_1_512.npy?NUMPYF{'descr': '??)?Km]x? ?5????y5??,???;??i=?D?e+?D?u?OXu=?\~t?<*???i?0?u=G?B?F&)? a-y?S?m?et=M;?%? ?"P? l]=j??mB ??Q? A5f=?}y??? ??I? ??g=D?Z ?v at G??m/=?????? ?N +?Jz?P=?f??8 ?????x?c=?P??? +??ZH?A=? ? ? +???_Y??P=????!? ??D[+?W=?????" ??Pj???`=?g#??????1V?=????A??8(@Q?`??#?????q??? +??q?w?n?U6?'-?L=;A.? ????????XK??Hf=?2>f???????8(B=?8?????]?%???<=??a???????R#?L=????z??v&???d=?,?d????????`=???w?M????u???[=M?: [8???E ?d=v%?z=#??K?j???R=*?????????`=mzz??????y??i=C?p????|??,!d="??"??????oF=?B?f????c?0 ??j=??0??????????X=?+????????&O=?m??j???F??????????? ??W=|x?f8???k???'c=Y?(??2???R?3ZM??F?-???k??W=j??'??C????U=?%?#???co??W=??q?~???k?v?H= ?)?F??l??5-)c=z???_????p??[=?=C???C?N???R=&uQ???? ? +!?f=?3??? ????g?N?_=?? ??nu?T?>=???k?????F?>? =:,??????C?X_=??s????lYA?l3=???bz????vn4w6=? V?d?????aE?a5^????V????hU??1S?'??<1?_??????PKA?3:???? dct_2_15.npy?NUMPYF{'descr': '???@8???o????H????@?1c?????D/i*?@?????^?????@?N???j???????@V/????j0xO??@???)?????b?Yo?@?????P??yYw?s??@???K????D??,?@:d???@M?????@?R?g?z???(???@7?d????3?t??y?@?B at w2a??????g??@L#?M????W.?h4t?@0C?w]?????????@l?? +???~u?C??@L,o%4m??+C????@vBk?????a??A???@??W?M????O5?7?@upU?$????.??@e????????? ?8n?@~??x?\?????C??@?Zq????????m0??@??t??????M??X?@???Y?H??c???F?@X ,{????V=?????@'?eh????vS[?Z]?@ "???N??RI(??@??/?????%n??@???????px?@??>k??????0?@?dw?#??7??????@e +??u?????[?+??@'r,????#9?Ye?@??R?Y????U]%?@?Ea??????? #??@??????=:p????@?+?????????o?@????%e??{??O6?@???P,????_q??@?V??t????{v??@_?kH???YR????@????{???JNs?A_?@L??2V??7+?-?,?@y????#???&??F??@2rw?????;??qG??@??? ????K8?9?@?r?y?(?????=??@? +(?????49?????@????t??$?? +?-?@?-u ???Qgv>??@???????1??????@>????u????Vq3?@???y?$??#?????@lZ-?????H?D???@ ?g?????1??I?@?1[?;???JwD??@)?>;???? ;????@????????l???n?@y????a??????(?@cecQ???? +!??@???f??????u???@p??+????}???>_?@?c??rS??K?V??@???=???V7N???@???\N????Y????@??u?????o?ve?@{?yZ??:??ww)?@ ?????\??@ ?9????q???@3|c~???? ???}?@??!3ys?????pfF?@?gXU??@?.:E??????????@?Bf ???g?Q???@??%!Ix??f~???R?@]u?GVJ????o?O%?@?? +e+???tk????@?h?????C??&???@'x???????????@|3?*???/4??w?@s@?W?o????F??M?@??}?eF???1??$?@??\???D??????@r=??S?????4????@$???????????@ s80????MV?l??@O???????@ ?$?a?@`#??Z?????J\??+???????K??@W?I?????Vb,bL??@?\6???????Pc???@?XL?V?????;?7t?@??8?p??~???]?@d?Ya?X???? RF?@'y{66B???????/?@ ????+???J???@D?M?????P!??@L fL???=????@?z??????}c;???@??`sC???TFa???@???????9;?\?@???1QU??j;Z??3?@??d?,???v?'? +?@{A6Cc??)?T?l??@???(??????????@?~?oh???t???9??@?c?!???g ?eSl?@=??CPe???PQ?E?@?fU;?>??]?Ef??@??? ??~???W??@$?q???????y?:??@?[???????!?@T:4????xqO??@57???????:??@(???????i?/??@(?????6[????@9??k?????# ??x?@??? ??[(?@?l??#??Z?n? ?@???! ??UP/????@ ?-[???????????@?2???????l%??@??Y?????.?a???@???G+??????????@*=????c?7?t?@?q??W?? |.??C?@?z??L????????+?@ ? `2'???P`???@/?8U????????@??????????S???@??O????I??U??@?ui%?????/%[??@9??y5????y?C???@?Zn?~????C?5??@??C&???>??E?r?@??R?n???????\?@?????X??????F?@??2??B????-1?@???2-????Y???@?j ????'d?@?e%???????V??@S{???????;?_|??@-?z??????JT ???@???????qmr?_??@????????o??_??@????s???ywI? ??@???>j???aP*?'w?@??_??s??????uc?@)d&D?_??7?G??O?@Pb??lL????MZ?2+b?@Zw*? _?????Q?@r?%??M??U??? @?@?????N???)\D?@j2? +?A??"c q?7?@????5??o????+?@? ??K)????a?@??? 1????? +]?@@m2k1????2s?@??bL??]E|????@????????0??|???@???*???????$S??@????:?????????@?????????b>Si??@8Q>?Y???T?d??@???????T\?{???@??8)??????<_???@??????????c????@?>q????W86????@?^??????????@$'= ???/k~?F??@D9qTV~??2?W?u?@?F?P?s??c??k?@S??-i??&w?)?`?@8]??^???H?AV?@n??bT???????K?@?}&WJ??8???A?@l??????8?a?7?@?y???5??B??f?-?@Elg?+??[????#?@???!???????@$?G? ??6?&?@Nv3?b????z?@6?@???l?4????nU.?@]?'??,???%?d?&?@?" B%??^??@[??????g#%z?@N +g"???%v???@??G??????????@????=???x??;?@???????????????@k????bja????@?Q? o????~U???@??R?K?????v????@??h9???fj??{??@z?&?7???.?W????@???F?????S{???@???d????O????@DA+?????s6 ??@Q?H|????F?I?X??@|???"?????"????@A>h#?????k?;!??@???D????P?2@???@: ?"p????hB?(??@u??????????&???@??????????n??@??*J?????l?(??@Fq????kr?6???@[@?????R?????@X??S?????C%L?{?@?A???z??X???u?@?????t??%?|[?o?@??m?n??<=???i?@????h??????c?@?=???b????Y^?@?  ]??m>??WX?@??"?MW??S??F?R?@?jE?Q??C?q]M?@?O???K????-?nG?@?{1?lF????c?A?@??&?@??(C?(p;"????/? :??@?j?]????~?#???@?Z[????????7???@??U????P??L3??@?:??]???@?>R???@??!??????7??@J ?[I????&?????@?|c?????)Td4??@?? )h???p????@(3? +???(??U???@??.??????ud?:??@0?Su???p?????@?,x=???q,?????@vU????`?????@IY ????ud?????@E?<]??????????@??@?????!w?????@1????????$????@???????[s???@????? +Qiu???@?2:???????@?LVp????H7?_??@7?????????u???@D???????#H??@?:??Z??????f??@??g???? ??`???@??1???R(?Q??@K?G????s?Vl???@?i?C8???????j??@?7x??????0I ??@???m???R?8????@eT?????7^??g~?@9??#?}????v?({?@?????z??i??w?@?93aw??w???t?@a??:t?? +??q?@???oq??)s??n?@&???n????t?k?@t?X + k?????DYZ?@????Y??Dv?y?W?@?B)#W??#/??T?@???SwT????P?OR?@??Jm?Q???{Z??O?@R?@m at O??.|??*M?@??7K?L?????m?J?@_C??4J???}??0H?@-Vs??G?????L?E?@*u??TE???f?_bC?@?r??B???* A?@[???@??:???>?@>??7?H?|K$??e>???"?@ Nw?"???C?13!?@?L-?? ??$1&??@??.?B????N`??@?;,????-?I?b?@DE ???8???@-?&?????]Q?`?@??}?????????@???????m?????@ n??F????g)?@e?? +?????6??@??D?????????@?fCR??>???M?@ ????? +???@O9???????r???@???n???????? ?@9??^? ??a???? ?@?Lm\? ??A??? ?@???dy ??U?Z? +?@??sx +????? ?@>??? ??????@?e???????!??@?????????_??@???????b`F?.?@?H? ????F?g?@?i??D????????@?????????????@V???????)??N?@vc1??k?????@??"???j???@?LA?????????@??aw?????G?@p?1????2?????@? EA????JP[)?@??{?????w???@??ki????x????@[???????{?H8??@??i????x?T???@ X ?????? 4??@0??l ????j0????@$??????????~??@Z??ir????p??A??@??9????????@??BW????X1??@? ?f???PKA?3:??m4?? dct_4_15.npy?NUMPYF{'descr': '??lA???)+??%????3l?A??E?U??"???o?C?r?Q?: ?uC???[+=? ??????+5WR`?^????c??/????1?X???????c9 ++F?????}????P?F0?0?f?????T????"?????'??+BS?AKDv??gn???6=?78? ???K???A?U????? +??R9H?(?"??????????:cG??!???????? <-?)?CO???? ?6fE?%dK8i8?\?>0??n(?? ?|r???}ee_???$????r?g? ????2Y/???]K3??K??6??????????Y?:&????t??6????H?? z??-??z?:??? =??l4??>"l?v?%=?\?r????!?f???4?r?S??????5 Y?/@?? ??????(??"=?h??I???V???+=R??? ???????????y??????? ??/???;??>_?Ks5?,?x$???8"???!=??q"? ??/?T at W???]?-????????o?,???H=,3??9??KIU=?????????/u.?E?P? l????>?yY=R??b?????(A~??|]g;??Yh?F[4?8??????????????N=?w?????h+?o3I@=V????H???&C??F@?,(?wRF??D?dvD@????D????Y?PB at T ??3?@?3?#d??J+??'??@;??=<6????????@e^??????_,?`??@?T??U???#z4]5?~@i??^?~?)K???{@?W??vZ{??cw?qy at K+??? y?3w???kw at i?Xgw?w??L??u@?????_u? .1?!t@yW???s??x????r@??????r???BFW?q at q? ??\q??9 V?{p@? ?*Lp????(Do at .m?.?n???h??8m at n??&X?l????I??k@?Wa?Ok?o??Pj@???'??i??;59}?h@?Y?Qyh?xEt??ng at vk?Ht5g??wd?K=f@?5f????8 e at IzLi?d?hz? +d@?R?D?c?%????c@v?#??b??k???,b@???Ob?v? +??La@?z??t%a??0?Nkx`@??DY?R`??b?R?\_@?,???_?z06N??]@F????]???1)l\@=?'?+\?/?? [@?e 6??Z????/H?Y at h{?C[~Y?N??uX@????;X??V4r?@??.J?>??.?CLe;@??dm??:?z??As 8@??N'D?7?$ov?O?4 at T???hM4?H%????1 at J?TY?1????]??,@???O??+?u?uc??&@km?\x%?e??L @?l?5)O??Z,?@@{?????n?!e^???h????PKA?3:? #PP dct_1_64.npy?NUMPYF{'descr': '?? ]???JSj)??-?L?3 +????PKA?3:?,??PP dct_4_128.npy?NUMPYF{'descr': '8??@?b?T?@??!???i??@$@?????FJ +?j?@FaS????'???@?=? ???? +?2j?@%HH?#??????R??@?????????G at Lo?@??? N??9B?f?@uBs????"???@E/^???~?S?X?|@x at f??c|?a|t?A?z@'???2z?^????x@!er?Vx?9v?fw@??`??v?;W??u at O??i*Wu???w-Tt@???U?t???R0:s@????? +s?m!H??r@?Q???r?????K`q@v??:q??????p at zj?;e^c?i at O??Doi?h????h@?Td?B?h?(B0z?h@R????g?%?l?xg@?B1?O\g????H?f@{h????f???+??Pf@???8f??"?*?e@?99?B?e?\????Pe@?W:,?;e??e??d@?d?*?d?s?psd at A,W??`d???"?Ad at 1B???c????2?c@?????c?87&b[c at e8??YLc?????d +c@ *?%_?b???r??b at Mo????b?Ob?Alxb at 9?6&`=[a@?^S5?Ra?v[? .a@????;&a?G???La@?m?"?`??/?-??`@??s_?`?? e??`@?lW??`?[dv???`@??/[W?`?F=@K?}`@(?x??x`?#??c`@gG??_`?g\?Z[L`@?lwrH`??kZA?7`@x?WJa4`?w?<?%`@ |H?"`?????`@9??2`????v? `@f?\a?`?_I????_@o?b??_????@t?_@???:?_?/???'?_@????_???? ??_@????Y?_?PKA?3:?uEPP dct_2_256.npy?NUMPYF{'descr': '!*E????0"B??? A?i??%*??Hx;?h'?R?88????J?5?K??Z[;3?6ev??J1???wB?B/?+j?fc,? ?????)???J?^?'??u???%?`?H$??^tU??"????6!????4? ?y?!g????8?-"?????N??+?Z?q?]?!????p?????w?Q]????8?????n+?Z`?}?2??k?L??8x?????5Y~Vb ?Fy?\w? ?X??t?? +?ZbtX ? 0?,???l????M?? +??;h???B$Q??)?????M??"m?~??L[q%????e?4??v?)-S?IY[?Z???z)? ??c?{Hu??????h???????????E!"?y????l?????!??????4]?u ??0?,-7?????n1k???Z???????gBD????Ld?(?9??,??????Pz??]???hI???I???????z`W?!????qc!????????6,M? ??? [? ??u??I??l????*???-??E??s c9h????]:????6??B????B ??????GO?*5??|???tw??^ 3+??????E ??{Jf?]????@63???= ?D????-M ???Nb{???A????????9 ?????m ????13?$??????????????;????? .?????~???@???????????J?????c????%?(Y??]?*?o???? +???????4;???7???c???????????~-???????^???L_vQ???Op???/??+6???????0??????g??o???I???3X????"??X??BA?f???????p????c???????/"y?PKA?3:U???P P dct_2_1024.npy?NUMPYF{'descr': '??????G6????h??Y?4??{? ???-ax??????u??/?l!ds?i???sq???????o??@???l?k1I"C6j?W????h???`?f??8(gd??Q +??b???V*9?a?^p?GGT`?IL???z^?R????\? .????Z????O?Y?r???%?W??aO??EV?L ???U? ?l?S???????R???/???Q?1?B?C?P?s???&P?0#bC??N??Nn?sSM??#??D?K?@a?L??J???6%W?I?/\???{H????uG?R??F??t???E???f???D???????C?"???b0C??j??yB???A???A?0#?a)A???z?@???'*???.2g|O?>??:??e?=?????????!??}oy?_!????J$!????q?? ?iqq ??{?@?% ????????G???(?8???Z?????s[???c????=?VI?????u???G?}??)??????g 7p)??# ?*????q??G????????UF?1Op?*?E?f????????S??????9V????? ?Q????U#???????TATN$p??K5z????(??????M?q?]??H? ?a?(7??)_?I??2?2?7?Ev ?????E?9????K??[???????q?-????????S?x??K?;??kD ???\???????????t?g?P???z? ?"?k?????????j??~h????"1? ?7????&?%?????%P"????u???u~?V?W?P~?? ????0S? ??q~??2 ?!?"A?? ??????x ??; ) ???)? ?????m ??B??? ??d G? +??X ?

???q.??????????k???/??*? ?`????j?J9 ????8n?d!6? 1?L\?????X!g?????I0?w?O?3? +F??i'?x ????t???s??????h????=g3?T|???????P'????????k?V(?e???Eb4???Q 6?=??????b???u???r??t??m _[F?Q??0?????????^???r?????????(?*??h????T?=?m????zT]????s???/??????Su2??fu???????g(???vH?F???????????TQ???n81??c??? ?????]g=I0???r??U???'P?|bB??w?d?Q????35 ????ku??r?????J/???^.????????????_?i??[X??o)??@?Yx?????v?|3??????5m????HN?/??=???k????De??????i?y|????? +B??????H??}m11????cA????q?Jl?^???b??'??m??PE????1S?Y???<_?E ??????PQ??? ??.??w[^?????v}@????n?]?3?????h RR??O???? ??&q?a,????1????XqX ???%??`??:]??2???13????`W??????h???????|??{?? ?.?O???sU?#????d@????0?>???s?x?????( ?x??????N??????%???hK?????`6?-????!?????Jk?m????e??#]???0?;6??q?????????c????g?????? '?&W???|gV?Ey?????T???=(00???/?X) ??? +??????0?%4;???d???,D??FVu????d???????P??u???V??R2????|?i????=???????dk????h?C*???u?????w????????\?Sj???cx+??0?))???:?Yd????{(r?????r5??mIi?A???)P?V????.-h???x????G????0? ??5??????gz????????g?a??Q?J?)????1?????s?o{n???N?? ????E??? +M???|:j???rFf????!?7???3?%uw?????WC???? 3,????8\???????|??????AB?u??j*v`gC??2???n??4m;?????t?K????8???}???dD?FM???*U?%???|Zq_????*?????? ??O?????#'E!`??`?2k?1??j%?????.?=??????8???????p)g{???.??N??Q^?&"?????R?????{A?!?????*????? ?Os?????WH????j?????2D???tA '????:~ Q?????BP?u??????vL??<? q#??st?????? ?;I/???[???????F??3????}v5?8Z??;?7*?2??o\?~ ????2d????_??t{???1??f.???as ??????????????2SJ???????????6q?????????i?????????????7????7?0$????}A?zD?? ??9????;? `?????p?l?? ????%???I??1??????y?????? ??R???? ?v ??????K????;~?????b ??? +?2????O?)y7???????s???????0?????Y ?????;?????6????i??2?L??'???q??n????1>dS???X2(6?d??eA< $????#f?????-?????)?Yd???^?> +%??:w??????k??D???????h??7?q>?*??NY9r?????q!????I????q??B?J|4?????????e?a???????ez?~???,F?oB??7A?????n?'?????A??n???S?P`:T????0??????P~??????????0h^??i??`????/??>T?A???K?)??w?????r??????M???C?} ??????M???U????:C???????#[????$?????WE?6?z??f?.9 ???s??????aa7p-???k??c???~?jKP?????a"???7???zt?????a!???iX???r?9y??@???????;,?rs?@????????:?p5?@:I}?L???&XoG-6?@RI?????????@?/?????????K'??@i???F??UJv^l?@?Jp+???g ??w??@? ?D??????f??@?>vR?t??"x?} ??@Gec??t???o???@"?y????("???@?E?7}??xq?5?E?@???????^;?E???@?\cA????Q)?????@15Mdp??;)'????@??M?N??????br?@??NBbC???z7?w?@Cq?L?????????@tKo??f???t(????@???????[??????@?=??????? +?0?@?????2?5y5?@n??E`???2c?*??@??????[?????>??@?(???X?4???@?g?i????4??{7?@z????&????????@^?????N?iml??@4?J??s???CMa-?@?9T???N??????@ #?????$??????@?6?)z????8??9?@[????+????? ??@9?]?W???i?3k??@[?"???U?]?Y?@?^i??L??'m?? ?@v?,?b?????!??@??^?????u?????@?????~???)(?I?@r}???=?????0? ?@??p?????Y(???@//?Qb????{??@8V?@J??^7H3R??@JO}E ???H??9S2?@??????T!???@;V?o????%?f?3R?@0h?\W>???? ???@?}??u????C 0?{?@)???h??UR?~H?@?e????04???@?"??????r????K?@?R+C?9?????C??@??????'??r???@??cz?y????k??-?@p?tU??????1&??@J?'W????~kd?rx?@????Vh??~h??{ ?@?????6?V?2??@>(?x?????0n??u?@^???Sf??bv?Us"?@ B???????'???@9?b:????Un?@???????@+~??????3?G????@????????????u?@?"??(i??'l-?%0?@???c?#??;??K??@??g?$???1?????@{??????????re?@??Q?yY???s}??#?@?mh{2???~?????@?????????* +??@\?"?????&??c?e?@'??V>Z??UP??'?@`?:???f$?.??@??????7??DX??@? ?????????[t?@ ?V-?i?????3:?@-?p??/?? f???@L`a???????I??@d??8????+?}??@???Lo???Q?!qY?@?_???O??7,n#?@.?HbS????r???@????????Z??????@? ?? +???!V-8V??@(LXE?z??luN?P?@(5??qG????????@?r=????6Ge??@S:?????>R6?s@?f??a?"?@.M@?w?j??~?{l?;?~@??2???~?????MP~@??h0?>~??? +?z?}@-??m^?}???(y??}@?K^???}?????7}@+$?WT&}??Ah?|@? +^F??|?47? +??|@-?Ugp|?Qh?'|@8????|?????j?{@??Ig?{??????v{@?????f{?[????{@?>c?&{? n?w??z@5e?`?z??s??tz@?]?zez?????? z@?g:yoz?FV??H?y@?R:?y??2B?zy at e??m?ky?}8?')y at u?'*?y?? ??x at d??p?x???CN??x@????dyx?????r8x@)W?*x? 3?^??w@?? ???w??????w at 2?IB??w?TZ?/Nw at M????@w?91???w@^s??v?1??9??v@?zAgE?v??3e?jv@??c?!]v??3G{ v@???x?v??W??#?u@?AM???u?a?_??u@?????u?j_Du@??_?6u?(X???t@??G???t???@?t@?,??M?t??6|Z9mt@?Ya`t?T?u??&t@?%??t?(?????s@?$}?,?s?????l?s at I??%??s?????Vs@ &Js???d3-s@?]??s????&N?r at kK???r??9????r@?????~r????Hr@*????;r?|??r@W???q???????q@^????q?s?U?q@"?4vq?????@q at TN?05q?XT?Mq@?f?r??p??????p@??:n?p?1Hnr9?p@????tp?n???@p@?7?O5p?????p at g\S???o?U,? 6?o@????oo????? o at q?cs?n?Aoh1??n@??M?pwn?xl??n@4j|?m???ne?m at l??k@A?? )k?m??_)?j at M?(??j???~?SRj@@%?s? ??I???????H at h????FH????= ?F@?-??g?F??????eE@??H)VE?MU??+?C@??W???C??~I?@??S??=?q?;?;@4??? q:??r U?7 at 1?Z!?J7?m-????4@???3%4???G/?1 at 3?p??0?????L?,@?~o??+???|??&@?V,?gl%???,??G @???w?F?M?h1??@ +??X?????T????T?????PKA?3:w??PP dct_3_256.npy?NUMPYF{'descr': '|????RZ??@??1N??????b??@?*?$????????m??@??.?A???Q??N5??@c?M;|?????7???@?iLy?????? =?@|???Z?????Q??1?@,???? ??>\?]?n?@?????L??$?Ua??@? y?A???=_~? +?@?C??????V?h?@5_??pK??a??11??@??Sm$???q???????A?}@p??k}?????)?|@3?????|?IOn?{@4??;??{?????g#{@?\?l"{?Zm??dz at K?Z?Bz?_??*?y@?!/???y?'?????x at Luw??x??j'?KSx at t1(5x??}?E??w@?R???w??A??Ow@?7?G?v?y?tL7zv@[?{"%_v?????F?u@??f??u??:k?0Yu@??$!??u???3??t@???+,?t??-(?Jt@?????2t?h)&1e?s@5?\?s???4?&Ls@?????5s?o)???r at 9?w ??r?O???n\r at w???SGr?}s????q@?z???q?H???yq at i#X ?eq????9 q@?????p?t????p@?;?L#?p??????;p@???O)p??? +P?o@??? +??o?`?3%g?n@??4|+?n?x?"?T)n@?q?n?????mm@?fR9Lm????})?l@???>B?l?J??A?M at U?=iKkM?????L@?????K??O3?ImJ at U??%!J???D?H@$ +1KH???>??*G@?|??e?F?P??Om?E@$?`?RAE?F?q??C@?H???C??i???TB at I^?y +B??F9??@@P???p@??{rW3E>@Q????=??S?(?;@??m? ?:?zLX???7@?????W7?????=?4@D?/-4?????y?1 at Lb?1?h90?%?,@???+?+??I???&@??L??n%?8??-?H @?R?uH?@? ]?@?b?????1X?????.???PKA?3:??oPP dct_4_256.npy?NUMPYF{'descr': 'x?A"m???w@ ^wM?w??jh??w at 8?\,)?w?????-Vw@ +< +~Hw?6?x w@?? ??v??"???v at x?#???v???'{pxv@??/??kv? n??3v@(?z=?'v?e~`???u@?6????u??"/??u@#i?^??u??1?Btu@;???Xiu??n?Z?8u@`I#R.u? ?JU??t@?????Ls@!l4Es?????/$s@?jN?s????z ?r@["]?2?r?????g?r at I????r??k???r at -????r????'??r@??????r??????mr@??X??gr?!%??Mr@???}GGr?=Y?w-r@?????'r???Y?r@?_A? r?d?u???q@k??S?q??$*?,?q@[?}&?q??ak`??q at L?????q?jg???q@%g??q?B q[#?q@? '???q??!K^?mq@???}hiq?\??1?Vq@?'??Rq????M??q@??_?;q?%{?p?)q@??|'&q?y???*q at b?A?|q????2q@?X?G??p??? +c?p at V?4???p??J?9??p@????p?q!r?4?p@?????p?(?q?v?p@??1???p??@?}?p@=](??p?Q?tF?p@'?????p?o?u???p@????B?p??? ~p@?? ?{p????" qp@L)?np?l????dp@?????bp??ek?Yp@? +h?Wp?8??4Np@1??MLp?"?a?Cp@?]h?0Bp?????h:p@??=??8p??????1p@??QQ?/p????BG)p at t?u?'p????@?!p@?7??d p??Op??p@???,?p??? xp@????o at re???o?fq?s??o@#i?c%?o????o@??L??o??????o@?c 5?o?NmM?2?o@???j?o?PKA?3:(Kc?? dct_4_8.npy?NUMPYF{'descr': '????w???@}?H 3? ?????w@?}??r?v??[??sr@??J??q?x?:??6n@??-?Em??????i@?=m?O?h?????Lf@???(?e?????c@ a? vcc?????a@?O?{/a??8]?9`@??????_??A???]@cF??v]?k5??+?[@?g?pe[??#M:?Y@?.?T??Y?pn$mX@?F?z?-X?"RDu? W@??,?V??x?|V at qp?>??U?Y??l$ U@?%?:r?T??Q{g?4T@?:?*T????&?yS@???#[S??? {??R@?w????R?70u?CJR@????3R?: ????Q at r??[??Q?L??L?eQ@(!?TQ?? ?$ Q@?[%^?P?;~ ?P@?Jv??P????}P@?d?sP??C8IP at e???@P?@~?d?P@,??a|P??K`??P@)?r???O??????O@????C?O??i? '?O@?Q??e?O?PKA?3:? ?hh ??dct_2_3.npyPKA?3:???PP ???dct_2_64.npyPKA?3:{???? ?? dct_3_15.npyPKA?3:{=?P P ???dct_3_1024.npyPKA?3:?{???? ??y$dct_3_17.npyPKA?3:0e???? ??{%dct_3_16.npyPKA?3:?G"{PP ??u&dct_1_256.npyPKA?3:;3??? ???.dct_3_12.npyPKA?3:??gPP ???/dct_3_32.npyPKA?3:`Q[?PP ??D1dct_2_512.npyPKA?3:??3?? ???Adct_1_8.npyPKA?3:?$?OPP ??xBdct_2_128.npyPKA?3:Z???pp ???Fdct_1_4.npyPKA?3:R???hh ???Gdct_1_3.npyPKA?3:??dK`` ??Hdct_1_2.npyPKA?3:????? ???Hdct_2_8.npyPKA?3:?6pShh ??_Idct_4_3.npyPKA?3:????hh ???Idct_3_3.npyPKA?3:q??<`` ???Jdct_3_2.npyPKA?3:j???pp ?? +Kdct_3_4.npyPKA?3:???pp ???Kdct_4_4.npyPKA?3:?? ?? ???dct_4_128.npyPKA?3:?uEPP ????dct_2_256.npyPKA?3:U???P P ??4?dct_2_1024.npyPKA?3:=?^?? ????sizes.npyPKA?3:?=?]PP ??_?dct_3_512.npyPKA?3:w??PP ??? dct_3_256.npyPKA?3:??oPP ??Udct_4_256.npyPKA?3:(Kc?? ???dct_4_8.npyPKA?3:????PP ???dct_4_64.npyPK99? ! \ No newline at end of file Deleted: trunk/scipy/fftpack/tests/fftw_ref.npz =================================================================== --- trunk/scipy/fftpack/tests/fftw_ref.npz 2009-01-19 08:31:56 UTC (rev 5495) +++ trunk/scipy/fftpack/tests/fftw_ref.npz 2009-01-19 08:32:11 UTC (rev 5496) @@ -1,234 +0,0 @@ -PK?|3:?wOkhh dct_2_3.npy?NUMPYF{'descr': 'z?}??@???**S4?$??+???M??L#???a??? ?5?D?J??%??????? ?3??(????/???????V?)??e?? pA?,_??L??????Z??c!:??v???????8?0????@??V&???b??U????h+?m?????@P6? -??????mg?@l%t??%??g?? ?@??%#???d?????@`??V?????0|???@? ??Yu??M,?a??@M?x$?k?????/??@???u??R??!??@T??7????VG?N??@A~6r????,I?? ?@?9?}?????c??_?@??{@?????????@h%?? ???Sy=> ?@?i?q???B\9{?q?@[??K}V????????@ ??X???| -??lV?@??Q?E>???E ?u??@??u?????8??wjY?@}zl??C??p?'???@]??X3???.s?u?@U?zsb?????? ?@75?|*????6??P?@???j-??H??0???@????o?????]??@A??? ???sg&.-?@??;^????e???@}^??#i??????1??@ -???????A???rN?@????a3??W?}W???@z??????:??`/?@h$B#p??C??R??@N^dZ????N z&?@??8l????? ???@?|??Z???W$&?A1?@?f????"N'Y??@???????????M?@?]?9???^???@p$?`?????,?"?y?@Gd ?@? -?\??%?9??@!?$???I??rr??@%???????Sh?y?@???q???0~?J?@W?9?B??Y???6?@&p????0 ?G???@gE?\???h????@I?5????\>??^??@?Z ?e?????.?i?@?}??a????K??>?@?8 ?7??d???w?@?[v?? ??%??????@?,?;?????????@J]2?9???9+?&??@?c????????|%q?@-????i??W%?}?I?@??S?B??????"?@ !????????????@??0{????? ???@??c??????????@n2? ????ZK???@&?f%???6?$#h?@????a??z?r?D?@????>?????T`!?@??? ??4?9A???@w?$$:???t]????@ -??b????(?hr!??@??4c????t?????@}^??????qW?"{w?@ ?v?q???P???V?@?R??P??+??p~6?@h????0????A_??@(?????????4??@=+i?????W^?????@?? j???????~r?@??_?fg???]???5?@???/?*??????@/???????W?Yj??@?4}??????S???@O??e8y??h??I?@?}8Hh???V,~S??@'??B??? 0???@z8????????e???@N? S????&o???h?@zS? -?^??? ??1?@E?(????.????@kGq????o?]??@'???????bb?q??@???????????m]?@4?Y??S???Ia?S)?@4????![????@???l????'?_[o??@?GS=I?????;jL??@????>???q?Ws?_?@???M?V??!?K?.?@????%???t???@?5?;>???f??(???@? iT@??????X??@?????????W??^FU????c[V3?@??;M?+?????6 -?@?k????+MJAw??@?}?A???Eh??@?]?9?????P????@????????T?-ni?@?Z??Cb??t?Y?"B?@??h;??S?r/0?@?)&?????????@=?U??????a? R??@?.?ug???rp??c??@??\???????&???@??s ?{???^?s?]?@?Y?>?V????EB?8?@?I???1???wF[??@?sIE ???H?????@?I???????@.W?6 8???>???@{C?????ECv??@wR~B???9&??o??@????H???/R( ???@??p???????u2??@??+$????$D?r?@??)?l??_???R?@? U L??2?=BM1?@~?u?b+??h=|???@????? -?? ?????@??(_?????x???@????????-AF@???@???x8????Kz??@?OZ?????o?>;r?@c?dU?l????9?7S?@a? -??M???T?n4?@??V?.????~???@?6?X??e?9???@e ?????^l??@????????U?t????@???MK -???6o?t??@2??Y???i?-x??@ ??Yk???X?????@?e?Y?~??W???fV?@,???uM???a/P%?@&?(?l??DQ?O???@?.?????y?Jx??@?$:?????????@?A'??????k ?c?@/O?*[???hV?/4?@?jGq?+????????@ AJ8???N?????@?K??'????_?+???@???[????M?Bx?@?h?h?o??p?x?I?@??UG?A????????@?e?i????yUg??@? ????_?? ???@wi?aI????????? ?????8???@5&???????@?????????X????@EIH????????????@?*???????a?????@*?-?}??????A^?@|???AW?? ?$y?7?@?.l??0??J +??@???c? -??cd?k??@??A$???????y??@????????~?u????@Cs?F????????z?@R -??Ds??Bz??T?@c?~??M??SweW/?@~??7?(????55 -?@???Wz??M??;??@?$?z????L???h??@??e2???????t???@?,{???iV?9w?@?6???p?????R?@?`??CL??????.?@?W z(??= -??? -?@&6????mQf???@?O7P ?????????@??8?^???C??6??@~???????????{?@?f?vGu???b+hZX?@?? w?Q???3?9!5?@?L???.???}t? -?@a???? ??????@?X???????uoE??@_??????k??????@G?P?K???kJ???@???L?????? ??d?@T?D?[^???Z?LB?@??? ?6?q??@???q@?????q??????iq@????`q?hZbe?3q at 2;??)*q?"???p@#???S?p??CV?p at p?????p???.R??p@?S9???p????X]p@?4~?USp??????'p@?4J?p??3?9A?o at B?S???o?cFx{?yo at c?tv2fo?a???o@:$?P??n??t ???n at C???Z?n?r???r:n@????*'n?P?>c?m@?i>"?m???A_zfm@?!Y at Sm??up???l at 9|????l???Z??l@@7?l??&M??)l@=???|l?f/?N?k@s??/?k???4 Wk@ 7UDk??cw??j at 6??#?j?V*?(?j@?ba?rj?o???`j at r???Z j?A ????i@?Ft???i???_?5Ki@?fd?;8i??j????h@?E????h?M-[??zh@??tw?gh????Sfh at 1_^?}?g??Yg|_?g@?'?.|?g?sI?vBg@;???/g?a????f@???G??f???9??rf@??*`f?ut\?l f@?? \??e??v/??e@???.?e???QI?Z?1?jR?r1?q?Q at LS8??Q??v1?t?P at fh<??P?/? -??1P@?P1?? P??{ ?q?N@?J??N??v? -?;M@??????L??cw???K@??%?L_K???G6WJ@}[?T?I?L?{)@yGsd?=?????:@??y?l:???:??7@/??0?G7???b?d?4 at s?,&6#4?_?????1@?30???0??D???, at 1|DL??+??|??&@ nk ?k%?an?rG @S"?^F??dT??@X??C???t??????H???????PK?|3:?????? dct_3_17.npy?NUMPYF{'descr': 'V? N?z???I???a@E?-?p?'>B??????????d???H?;??2???4?8????j??5??'I?L?3??????1????@?0??O??.-??{??*??v/???(??????&?M?N???$?????q#??+???,"?0???? ??&?+?????^?????pz???T1??S????q???(?hr1???F? L?]3?f?+???Q?U?!??t_?,???.??"J?;??"x?*r??9????;3?p??-^, ?s ?ew?hM ?8?{?5: ??-??e8 -??A*??F ?? ?+?jc???u??????X????? i?A??kg{T??h?N?????j?3 ??????u?r2q? ??6????^???d?F ????t?(%d??I??G??@??$??J??c?G??R^k?????1w????? ?'????h?.?K????C?l???v??^ -???d???jt???5??.???3??O\???.X? x???g}?1Y\?????T??????????!r???\???????n??????81$'7???????????y?]?z???$a?N"???e??J?????"??|?????1?.??7??:r?????)?:?????T??X??v?!H??Q??B?????w?~????gG???b????,?+??e?z?F????*?=%?????0&???????V?????:Yj?????)??????????????/m8, |???A?}R[?????+?F?????%?2??A t? (?????????k -dv?????y????l#? ????Dg????`R||????v0b?????PK?|3:??? ?? dct_3_12.npy?NUMPYF{'descr': '@?=Ab??:???"??V0@?????-?2???AG#@?$??{!?????A/@[x^*6???3h?????aod???PK?|3:?Ks?PP dct_3_32.npy?NUMPYF{'descr': '?GK?v??0(?(br?7o??n?????si?????K:e??????/b??? ?+2: K ?UD?p?:vP??X??q??O?????S??????c?@?? -???-U?W??,??l??# nk?????o????9???+??????+?????{)? ?????U? -??XR?>G -??^???? ?????} ?tE)!Xu??}? - ???T? gW??*?C3????BK??Gp#e??~?.rO?7n1????????b????????^????x????M??u?? ?1??L??(?1??y?Z??????{/?????????N ~?QMI??(????D?????e?s~ -??qN`:m????3K???????>???t&???????>???L????7R?H? ?????9#??????? ??W????????????k? ?????j??%???q????????i3NC?????;?????m?k???~T??>? - Y???f????9???a?7?????w?Gox????@J???4`?_?????b?e?????? ??#?????v??;]???p??[????WY????p[[x^*????Z'.???]??kye???\??7??{?\???W -?\?H???W[?????G>?x??????!6X8??J???????l?????????a?2??6?,????Y??????^f?(?7??fffff????}??????????sF???IEc????M??~?T??R?U??????]?V$???3???????????????8a?h????U?@???gc%?YI???.n?????R?r/0??~?{?????z?????? ??x??????A^????Xl??????S??9??????I??>????????????}????????????? ???t>u??? ]?@???/??C??@h=|??? ???[??2?3/???GXT??$??????B ???q?????5???X?????????????Q?d]?????M???4?27?????M???P??%???}N??_)??z??(Hlw????rk?mI??4?Op???????:8????9z??f????Z?????l#????D???????.9???????~P)??<?$????? ???H??iP?????N@a??y=?????KqU????V?????B???8a??4???H????S?D??9|??S??????q????SW>???z?p?????-???=??)$??;???R?>?G??????4`????0C?? ????f????L?A????? ??,?"??PK?|3:Z???pp dct_1_4.npy?NUMPYF{'descr': '??????-II??@j??{-???k :!?l?@ -p?a???(?)1?@%?}??&??t ]???@??????????????@?/?^????Q?\?M??@?,??P|??=~o?O?@????E????9?7?@??????? ??E???@r? ?o???f`X~??@??HhK????P??1??@?Nx .w???????N?@CT??F??????@??I ???a?9??@v?;O??????I???@???^x?????D??@W??:?????2?f?@a???^??????:?@yW=`?2??g{???@??6?3????m????@????9???Dj??t??@?? ???k? ????@?!S>????R&5?!l?@????d?????E?@??~>??d??@??7????b.??@J?5?o????;?E??@?????????d?? -??@-@?????]??ky??@???????o???i?@????Ic?????NDG?@>Y1\A??? m?%?@?[???????8???@r????????????@?]gC>???:Z??.??@????u????W????@??\?=???Q?n??@h?4 ????????g?@@?,ub???mU2J?@?!?k?D?????-?@/??'??v?r?b?@ Q> ???W=??@????/???MLb???@4J??????c?=i??@???????3???@???????JT??@U?W????A?p???@? ??b?????;?9??@=?????Z5?w?@?????t????W?k?@?[?~?h????HiV_?@R?X?;]??>yX??S?@??&??Q???r???H?@??-?F??#I??=?@???s?;??^f?(?2?@?? ?0??? ?s (?@???s&&??H?????@?\????If?w?@"T???????4} ?@dv???????????@?=?????Vc)??@??s??????W???@p???!????Z'.???@~7???????{d???@??-???wR~???@?Kua??????d??@aE????#?tu??@?f???????fh???@??rgf???Di???@CBu???J?? ??@e???????-_????@??\4$????q7???@??V|????O??????@ ??????1Bx????@H?I???????y???@????????j??G~?@?Y}??X???w?@/????v??z??Cuq?@????Tp???~?:Pk?@?V??7j??oG8-Xe?@????Gd???F??_?@?o{??^?? ???Y?@?Or??X??@4??zT?@ m9??S??n??3O?@??kCN??rl=CJ?@ T??/I??'?@rp???&???????#?@`X??"??????+ ?@h^?????A???@/l?V>??Gw;??@???t???h??J?@?P?????O9&??@??m[?????s ?@?vMH ???c${D -?@r??Z? ???D?e=?@)r???????W^?@???? ????;??@??i?[??J?i??@?B?????v?U???@d??s?????p?@?[;??aS?Q??@C??3T??E??S??@??????????q>?@???????Q????@???????$???@D?r?????2??b?@A?)VM??rP? ?@?#????PK?|3:"+???? dct_1_17.npy?NUMPYF{'descr': ':???v?????$|?o????\? &??????:?t?? 4Hc???bb?????}???u????n??????b~n?\????*?w?????9??????????7????nJy-1???????????W?}W?{????8??\x??;O<'?u?R???pbs??,??sq?N ????o????s(?l???&?+9j??T?G? -h????,??f????@??ld???N?`}?b??Q?B?y?a??S>U#\`???9??q?^???!r?z?\??G?C??Z?D???@.Y??|#?g?W?????ZV?KxB??U?? ??;?S?|{??/?R?n????Q?p?>;?Q??{????>P???}????N???5"?M??h?RD?/L??6U???J?u???I?2??%??H?????Mb?G??S????F?'???E?:vP???D???q?@(D?C?_?+gC?fk}???B??K??gB???;aA??L3????@??5*p? 4@?????M?Q?????RyI>????x!N=???E???^???L? ?b??U= ??m?s? -????D?? -??????z -?FaE< -?MK??F? ????cw? ???#??? ??S???J ??PN?? ?p?N\?????iQ?????#?g???@fg1??R?U??????k?????X???????x]_???S?,??68???q9^???? $(~???O?\?i??o?:???? ??.R( ?????????u?????????Z????@-/???L???????????w??o???? #?????r0?`?mU?9?*?dq?????f????T????F???6?u?!{??????V??W#?2??s??A??!?A???l??????S?*???E?????i??Q?d?HN&nD??a??#???????p'?_??h??HK????Bs???L4H?S?????mj????L????I~?/????5?????>???????;????A-??????w???>??s??T?P?m?????kS?a??+e9????N??P8??L???n?o???\?????????g?w???B?v??G????????O0????G????????????N?????R?.?????,???c???a?.?e??????@?r????.R( _???,|}?K???l@?8??@1?d?%????N??????A?<??vq ????y?????????j?????????????,?Y??? R????If?????x???r????@??a????%!Q????v0b?@????1v?K0????-$ ??9???(??? ?X??d??????MHk :???G>?x??????????????1???????e?????M~?N????.??????-$`ty??+??Dk?????i?:]??b?7?WO??u["?A??!??4??qTn??&??PR`L????n,( ????K?'???y???M????.?????K??????r??9????'??rJ???T?{F"?????k????0??9?????ng_y???????????? ??N]y???,z?n??#?tu?b???|???W???O8??L??6?!?A???K??$7???P?,???q?&"??M??f???eRC? ???6?De????Y?h????~????????]?)????QS?'???#??????4?c?=???xG?j????????????S?4?????"???????>V????P?I?5????P????????"???????e1?y??????fq???d??7i???j??%a??????+Y???5?;NQ???}??.?I??nLOX?A????2T?T:?????\?2??F?7?+??ds?Y1\????+?p?{???{?w??.T???r??????sn??2*Aj?????J#f???Az?b?? )"?*^??=??MZ???J +?V??E??f?R??$??:O???????K?????P?BH??*?=%?D???C?H?A???h8en>??G???R;??i?x?J8??n???W5??W??y2???)???/?????-v?,???N? S[*??????(?'????|?X%??#k ??"???!?K? ???&p?n??????J??Z??8?????l<??(*?T??Y??+???V?a???BwI??????}??????? ????]?? ??A}??. ??f??t? ??bX9???7p?????d?z???]??????nJy???? ?????9?!????Wy???@.q????d??{??v??????U??????!Y??????'??fJ?o ?????PK?|3:?%??? dct_2_16.npy?NUMPYF{'descr': '$??y??0???F?|DL?$n0??3?Y?? ???_Z??????L? ?c}????5[yI???|?.P????,^,???rk?m?\????????????g?R??w?>X??????^D?1?????J?.??PK?|3:r?A??? dct_2_17.npy?NUMPYF{'descr': '?`` dct_4_2.npy?NUMPYF{'descr': 'Y?B??p????l at AJ?i#i?Y6sHj?`@?8b->8_?/??C?W@?W??"?V??PN???R@?5??DR?t)?*?O@,???d-N?Rew??J@???,?J??a1?Z?G@????8G???? kE@?X?+?E????%?C@`??zC??f?lttB@/Q?5?CB?L????}A at y???eYA?i???@@??o ??@?I???*E@@??g#3@?N?a????@X????????? q??@np?????PK?|3:?o??PP dct_1_512.npy?NUMPYF{'descr': 'z?}??_?JD?A?[?????`X?????_?U???g?hS?[??YezQ?bod?O??YvQ??L???hUK:LJ??6x_? H????Cl?4F??z?c???D?? ?W?BC??,,???A??x)u?8t@??? -?H??>???m??????6?S???EH???2?????!??????h???????74e???????Wt?????0??\?????dV?p{?????R$_???q??sC???;k?](??d:tz? ??_?R#?????????????%???????L/1????b.????????z??e?< d???%W??M??ip[[8??(???=#??z??Q???!\?z?????aN?????????????????????5\??????tA}?????# nk???!\?zz??????i??????Y?????>9J?????!r?:??????$,???2>?^???????????5^?I ????=?????0????????? ?y?????$#ga?????3Lm??????*??O????? 1?T???mV}?????5? u????Q???????R ?h??????Z?{???an?r??vR_?vj??????Mb??2??|Z?? ?XS????5??K???b?? E??^0???>????:?f8??hB???2?????R{-??????'????tx#???L??~???Bs?F???h?^`????o????KZ? ???E??? ???!?? ??Y?U???P)??????????lscz???d??????U???????'?????PK?|3:?????? dct_2_15.npy?NUMPYF{'descr': 'w2a?????g??@y??M??????h4t?@??!?w]?????????@H? -???>$|?C??@S?k%4m????????@??j????????A???@I*S?M?????5?7?@?mU?$?????.??@?)??????6Z?8n?@x??x?\??P?D??@?tu?????(d?m0??@??r??????T??X?@!W?Y?H??Z??F?@?,{????c????@)?ah????y$^?Z]?@fN???N????!??@?O0????I?%n??@A ????R ?px?@-#??>k???????0?@?:?v?#?????????@???u???3?`?+??@?0???`?5?Ye?@\;Q?Y????Q]%?@??a????d?? #??@0???????u????@{h+?????????o?@+??%e?? ???O6?@?+?P,??r?_q??@U???t?????v??@??kH???m?%????@????{???:?m?A_?@#??2V????-?,?@\???#???O??F??@?[t???????qG??@?? ???*oG8?9?@^??y?(?????=??@???????h?????@?????t??8?? -?-?@?f? ???L?k>??@n??????GY?????@y????u????Wq3?@nm?y?$?????????@-?(????V??D???@?\?g????m??I?@*?Z?;??O??D??@gaO;??????????@=??????S"??n?@?????a???6??(?@(?XQ??9 -!??@?P?f????>\r???@I?+????.???>_?@]m??rS???]??@u ??=???i3N???@-??\N?????(????@?j???????ve?@4??yZ??d?ww)?@%??????\??@n/????Ku???@?3?c~???????}?@?3ys??]~pfF?@K???+f??@k`? ????u?W??@????????p?n?:??@R?.?????v??$???@?HK?????7?^?G??@???????*??Fnh?@??*??a??RC??D?@ ????>?? ???!?@|F"4????fO??@/??????.??:??@*9'?????? [?/??@B_z????Y?????@???k?????R??x?@-????r??>?x??W?@?`???Q???)?Jm7?@?d???1???w??c?@m?Yg???"?????@#f?y????+???[??@?$??????I [??@>!;o?????TO????@a??'????L?:Y|?@?,AF?v??T?:?U^?@C?_??X??M??S?@?@? ?I;??r??C#?@m????????2?@?f?l???O\?Wp??@*??%@??? ??Y???@|??????z?c????@??,?????sI???@?>?Q????{?by?@?C?|ht????P^?@?S??+Y?????;C?@?k??6>????[(?@?a???#???X? ?@2*! ????P????@?EB[????O?????@??????????l%??@Kt?Y????5??a???@?Z -H+???gG?????@??G?????"i7?t?@?C???W??U???C?@k???L????.??+?@??,`2'??7?n???@??8U???w????@?I????????2S???@E.8?O???f???U??@?Xni%???3?,%[??@??y5????5C???@??r?~??????5??@Ac&??????E?r?@???R?n???*??\?@(???X???=???F?@(*??B??5??-1?@? ?2-??j?????C?'w?@??q??s?????uc?@?,D?_?? ?1??O?@?'I?lL??|?5Z?? ??@-]?F????%???>N??G? \D?@/? -?A??eV?p?7?@i???5???n???+?@???K)?? -??a?@d? 1????? -]?@??k1??U?2s?@???bL?????????@=??????Y?|???@??*????e6?$S??@????:???[| -????@{???????lXSi??@?S9?Y???8??d??@ ??????kg{???@?z0)????A?,_???@????????v?????@??Kq?????S????@???????Y?????@??# ???f3??F??@m?OTV~????V?u?@ y?P?s??/3l?k?@??-i??3O?)?`?@eU???^??b.?AV?@?z?bT???????K?@??-WJ??????A?@???????Mjh?7?@????5???s?f?-?@?wg?+???q??#?@9???!??d????@??_? ????&?@???b???:?z?@p^???????,????@?b~n(??????b??@??@,?????Y????@?yC???|{?????@k??????M?p]??@K?b?????Y??/??@E?>?????_\????@??X3r????????@?[ q???$?w~!??@%?/??????V?D??@??h:???????2|??@A??????vj.???@FC??4???????%??@?F??????M?????@???( ????T???@??j??}??4?/.?v?@?QI?0u???Ky`n?@?t!V?l???c?f?@35 ??d???}?k?]?@v??u\????|??U?@????[T??\???M?@?(??TL??!???E?@O\?W`D???+???=?@??\?}6?@?P?l?4??'jinU.?@+???,???b?d?&?@??B%??????@????????%z?@f?"??r?t???@??8?????j????@????=????;?@????????jM?????@?d????k?m????@??? o????n?U???@?yq?K???? o????@>?h9?????{??@?0 -?7???(?r????@!??F???:#J{???@?%?d????hV????@s/0+????]T ??@??V|??????B?X??@?4??"???&Q/????@?N[#?????;!??@??E????>?$@???@?z?"p????R?(??@?m???????U?&???@?G??????7???n??@B??*J????_u?(??@?}???? y7???@>? ????F ?????@??S????sJ at L?{?@p`r??z??8???u?@????t???a?[?o?@?|\?n???H???i?@Ve??h?????c?@Bv???b??m?Y^?@?n ]??|??WX?@_}{.S???~????@?U?&?????????@?66;"???;?? :??@t'?]???6??#???@??S??????(?7???@B?%U????a??L3??@.???]????.PR???@??x!?????Z?7??@y??[I???Z??????@???c??????Ud4??@??)h??? w.????@`? -???j??U???@Z?$?????1[?:??@?3iSu???????@??=x=???9d????@?$?????)?????@?Z ????o?????@n?R]????+?????@?v/????????????@*:??????J/????@(F??????H?)s???@? ?????+0du???@?K:???]p??@???Vp???E.8?_??@?=??????M!u???@?????????+H??@fI??Z??????f??@??g????G?`???@???1???J]2?Q??@?w?G??????el???@?D8???????j??@?)X??????[Z ??@?!?m????M????@???????????g~?@??#?}??????({?@?x???z??>"??w?@?L1aw??????t?@???:t???(??q?@?oq??P???n?@N??n???t?k?@??o - k??}%??h?@???h???????e?@A??#e??????b?@?R??@b???????_?@GY??h_????]?@si???\???o?DYZ?@?????Y??og_y?W?@M??(#W??7??T?@??SwT??N?G?OR?@;7m?Q??;?p??O?@sePm at O??H???*M?@??HK?L??A?m?J?@?%?4J??U???0H?@??U??G???:M?E?@Z-??TE???X?_bC?@?Z???B?????) A?@?w???@??U????>?@?[w?T>???W?|K$??;p???"?@0?[w?"?????13!?@???? ??bHN&??@ |(?B????I`??@[B>?????a?b?@?? ?????W???@(?????<0?`?@qvk???*;????@s?c?????U????@Gt??F??t??g)?@i?? -????%??@??b????????@r?&R??~o??M?@fN?????G???@???????S????@?b~n???,??? ?@ ?^? ??b??? ?@??x\? ????? ?@??dy ???HZ? -?@???sx -??S?'?? ?@?l?? ????????@u?b?????5?!??@v????????`??@gd?????4J?.?@Sy;? ??^&?g?@?y??D???J????@????????????@3?????????N?@??wc1??????@???"????b???@?=B???2?g???@???aw???7?G?@??P????[^????@??=A?????5[)?@??????}w???@?T3ki??????????@?????;???R??????????$?????BW"P}???c}?[???s???M?????;k?](???e3??????? -??/????????PK?|3:K7|PP dct_3_64.npy?NUMPYF{'descr': '>!;o3I@??.???H??L?D??F at 4/??wRF?sHj?dvD@???D?i?V?PB at 7n1?7?A?L??I@@%u????&m????<@?,???#d????w?'??@[@h=<6????u???@?1?????????`??@v???U?????\5?~@d?g^?~??????{@:???vZ{?)B?v?qy@??r?? y?T? ??kw@???Xgw?1|DL??u@?Q??_u?p?71?!t@??????s???????r at i?????r??BFW?q@*?~??\q????U?{p@??L?*Lp???M(Do@]?.?n? -.V??8m at P?s'X?l????I??k@?>?Ok??A`?Pj@?)9'??i???9}?h@??Pyh??nK??ng@??It5g?????K=f at 7??5f??*l8 e@;Qi?d??7?? -d@????D?c? -????c@???#??b??????,b at r? ?Ob??@?M?>??0|DLe;@6sHj??:?ByGs 8@?>$D?7????O?4@????hM4??E????1@?M?a?1?j2?m??,@??/J??+????`??&@k?m?\x%??;???L @h#?M)O?>???@@8?W????? 1^????S?????PK?|3:?(??PP dct_1_64.npy?NUMPYF{'descr': 'j??)t^c?i@?O?Doi?3?f???h@???B?h??G?z?h@??(???g??Hm?xg at N?&?O\g?d???H?f@??q???f?uV ??Pf@?[?8f?st?*?e@?b??B?e? W@?Pe@?k?,?;e?U????d@?{b?*?d??V sd at LOX??`d????Ad@?????c?.v??2?c@ ???c??e?%b[c at +???YLc?&?"?d -c@??k&_?b?I??r??b at A?????b?"?Alxb@46?4a?`?+3????_@|?8c??_??=?>t?_@????:?_? O??'?_@??p??_?K"? ??_ at +Kt?Y?_?PK?|3:?0?PP dct_2_256.npy?NUMPYF{'descr': '? ????4J???%??*???#???E??6?:h???????????????????????8?*5??Y???tw???8?#+????^? ?? -MK?]?? -?s 3????F??u??<n??W?'???4w??o??H???D??Z~?*O ????Wy??u:???????I?? ???????????KY?8??????????????cZ?????????????x@?????O????????????????????g)Y?????Xl????un???????z???????c?????a???????????| ^??a??M???K????/????z???? ?????????f?v???^=?1X???a???X??VG?t????l??p???????G6??q9^?h???j?3??{????-ax?>Ab???u???mm!ds?8??sq???????o?0o??l??)"C6j??????h??Tka?f???o'gd??? ??b?T9?)9?a?)?QGGT`??????z^?N?W???\??]????Z???.Q?Y?4J??%?W?<2V??EV?R???U?A?m?S?Q1????R?j/????Q???*?C?P?????&P?1AG??N?`x%?sSM?0???D?K?DQ?O??J? ??%W?I?????{H??e2?uG?q????F???+???E??k????D?`?????C?n?|?b0C???? ?yB??&???A??]??a)A????z?@?P?c*???~T?~O?>????e?=???????????{??(?O??Z?????[???c?????8 Q??M??u????4}?c? ?????Df.p)?8k??*?? ?/??G???????Z~?*Op???f??:???????????????????Z -H??(v?U#?K9_??????-$p?DL?$z????$???G?I?q?e??2? ???L??(???I????]?7?~?Az???lC?8???U??[?~?{???HnM?-?????????+I??K????^D ?b??????????????pY??P??b?? ??? k???O?????"?~h?S???"1?y??n??? ??G??????O"????K?????X?V??"???? ???:TS? ??????2 ??.9?? ?@????x ??z0) ??l??)? ??( ??m ????? ?? ?bG? -??%?

rk?????5??k?^?}t?*?%X???????b ????qnn????? 1?6>?????fh<???:d?w????, F??6?x ???.Q???L?u?????M??h?fL?g3????r???? M????b????N>=?e???4???e6?????????? v??6Vb??t????c[F???6???y?????an?r?????????A???h????H?=?N??????E??????????/???)?ahu2??:?S??????? -(???MK??F??O??'????B?"LQ????????c?????????_b,?/???9{g?U????uoEbB????`R?????]????? 8K?r???d??J/?????/???????.????J????i??[#?qp)???L?^????u"?T3???D6?.6m???Q??/??????k????6?^??????9z|??j?0 -B????}8H???6+1????D?????????/?^??????'??H?RE???????Y???x??? ?????aQQ??kD0.??[??????l???????!??3????p?GRR????J"? ??`?eM,???? >???????c> ???p????`??n??S2?????????r?????@???????5???{??.???O??!;oc?#???@????I? >??? ?>???????x????Y??N????&?%????;P??????}U.???F~????Z??m??????#]??v?1<6??VH?I????|???????/??????.l?V???3??????f??Os??z?WH??????????M?E???E?>?'????iQ????4}v?u??(??vL??J??Gp#??Y2??????*;??.?????k????;?%8????O?Z?7Z??#????2?????M~ ??g{?????????t{??%w?Df.???h?????#?M)????????J????\m????????????f???i????+,????JY?8????R??%?????0|D??#gaO;??????_???]???l????Z ?%??QL?3???#?qp???? ?XS?? -???w ???c?]K????!?{??????? ???H??'?????Z??8????/???s??????0??H?? - ???c ????? AJ?i??B????'???*??p???????T???%???d???^EF$?????/??????nf????1?Zd????CR %??:?w??????G?C?????r??h??? ?0?*????c???????????????q???[z4????qR????? ?e????? U1?~??m??oB???????????C?????Ec??l???_???:T????&l????L??~?????nf????f???i??g ??/????B???????w??-?????}"O???9??? ??+?C3O???L???$|?o?????-y?#r?????p0[?@???%g??????`?K?@JD?????W$&?yC?@v????????wakF??@?%?L?????jG-6?@?'G?????????@5 ???????K'??@G??F????o^l?@??Gp+????>??w??@?b?D????2W?f??@??uR?t??o??} ??@;?f??t???????@T? ?y????????@S?Q?7}????5?E?@?%????????E???@]?gA????+??????@??"Mdp???,????@???M?N??g???br?@k'JBbC??_EF?w?@o??L?? ??????@?#c??f????.????@mq???????3?????@^???????? ?0?@?<?????(y5?@???E`????r?*??@$ ????x*??????????????@ ??#?q??^????@???????#1????@{???Y????25 ?.?@U?q???~8H?b??@>!;oC????1 {?[?@?B?Y I??E?>??@?f(???I?5???@?^~?i????_??{7?@?S???&??z8????@?4????k,aml??@?6??s???A?La-?@x?g???/?????@a3?????? -?????@l#?)z????7??9?@Cq???+???+?? ??@??r?W??????3k??@qW?"??????]?Y?@~R??L????? ?@%z?b????-?!??@/?e?????L??????@????~??}?I?@???=???9 at 0? ?@?u??p?????0(???@??Rb???vn???@*AJ????X3R??@?_?E ????}9S2?@_?"????|~!???@ ??o????ER?3R?@???\W>???????@`"?u?????/?{?@???h???"?~H?@??p????c?T4???@U????????????K?@Z??B?9???`??C??@???????.s???@?+?z?y?? DO??-?@?5?U??????1&??@??)W??????k?rx?@C??Vh??????{ ?@??????scz?2??@W??x????=Y??u?@????Sf?????Us"?@OX????Mg'???@"5?b:????+g????@???gr???O%2?@?3??$????&???@A?9w???? E?????@8??_L???I??UN?@/?Xn?@???t????@?O?????^????@????????'????u?@S ??(i??????%0?@*t^c?#???K??@io?$??????????@????????5??re?@?%r?yY???Cn??#?@?,{2????b????@'L?????B??* -??@??F?????Z??c?e?@/l?V>Z??o??'?@? ?:??? ?=?.??@~;???????DX??@2????????.??[t?@%@M-?i??????3:?@?????/???3???@_?sa????9^??I??@??8???N??}??@?mnLo?????BqY?@??]??O??i8en#?@??bbS??J?%r???@n?????????????@???? -????!8V??@??ME?z???0DN?P?@???qG???a????@??~????z?}@??m^?}??Ry??}@??????}???1?7}@yy:WT&}?]?gAh?|@;4,F??|???? -??|@?yUgp|???.'|@:????|??{b?j?{@???Ig?{?????v{@S?A??f{??:???{@?k@??.? )k? ?^)?j@Yk(??j??+?SRj@??t??2f?Y?.??e@'c`?e????!fe@]?jJ2Re???????d@????d???EB??d at 7T???sd? -?Y2d@??? #d??J#f??c@?????c????$=c@?W??`??5=((G`@?]??3`?O?}??_@??L???_?75?|?^@?D???^???ht^@+n?b~?]?Y???.;]@3?z?]?????g\@???{?A\? ?????[@,f??o[?+?? ?Z@)yu??Z?lzPP??Y@?k]j??Y??+??y Y at S8???X?|?(B?OX@?A?*X?3???W@@h?4 ??=?E?>?;@?o&? q:???hU?7@??1!?J7??a??4@ l??3%4?q??H/?1@[y????0??/??L?,@?C?b??+??w)u??&@?:U?gl%??&??G @???}?F??Y?>??@??|?X?????????Tt$?????PK?|3:?F=PP dct_3_256.npy?NUMPYF{'descr': '@???9??>#Ay?@??\?P?? ?N??D?@ 7U&?????(@t??@???SV{??d(Z?@?`R|????Z??@?0DN???3??b??@???$????'0??m??@?!?A????=?N5??@gaO;|????,???@?A&y???:?=?@?L??Z???t\???1?@??[?? ???F ^?n?@????L????a??@> l?A??????}? -?@Q??C??????J?h?@?w??pK????e11??@Z??m$???t????? - ??r??|??n\r@????SGr??y???q@?[??q??!T??yq@/R( ?eq?X9 q at z?????p??????p@???L#?p???!??;p at L8?O)p???P?o at r? -??o?*?=%g?n@??{+?n?o???T)n@a?r?n??P???mm at dT8Lm?V+~)?l@?1?=B?l?m??v -B?#?W@?????=? ??"?;@?c?? ?:?>?^???7 at z????W7?{J??=?4 at w??/-4??|?y?1@?{?_?1?X:?%?,@???-?+?IC???&@?\???n%???&?H @?2o?uH?A ]?@?S?????k???????Q????PK?|3:Vo?PP dct_4_256.npy?NUMPYF{'descr': 'x???`???w@X?vM?w?[??g??w@&4I,)?w???Btu at D???Xiu?R??Z?8u at A?}R.u?c?dU??t@?%r?Y?t?u??+?t@???`[?t?ap???t at LKC?t??Sw%_t@?\p?Ut? ??ES-t at UO?}$t?????5?s at c????s???Q??s@?S:X?s?(eRC??s@??%??s??X??vs@$|?o?ns?!V??Ls@???4Es??<*?/$s@?\??s? -?(z ?r@~?u?2?r??l??g?r at O=????r??t????r@??8???r??/?'??r at y:W???r??G???mr@????gr?Q??Mr@?r?}GGr?ILP?w-r at Q????'r???Y?r@ c A? r?Q?????q@"???S?q?????,?q@??w}&?q?i?^`??q@~T???q?B???q at -????q?/?N[#?q@??????q?}?5^?mq@?{,}hiq?7n1?Vq at t???Rq?`?eM??q@?;?_?;q????p?)q@@j'&q??{b?*q@[&??|q??"2q@?vMH??p?LR?b?p at EIH???p???h:??p@???p?b???4?p at qu??p?R???v?p at 7qr???p?????}?p at W'g(??p?VG?tF?p@?????p?2k???p@????B?p?c?J!~p@?? ?{p??# qp@ -,?)?np??????dp@??I??bp?[ -H?Yp@?y??Wp?z8??4Np@?[??MLp??>?Cp at F??0Bp??\?h:p at Y?.??8p??}???1p at r??Q?/p?A CG)p@???t?'p???@?!p at M???d p??????p@?n-?p?? ? xp@ ???ep??o?h?p@???? p? ?D?? p@?? 0?p??Z fp@?????p?=???p@??f*p??U????o@??&??o?WA t??o@??fc%?o????o@?zM??o??`????o at D? 5?o??I?2?o@???i?o?PK?|3:Jj{??? dct_4_8.npy?NUMPYF{'descr': '??i?w???@/?H 3??z2???w at B??r?v?wL??sr@J??q???=??6n at O]?,?Em?? ???i@+??O?h???!??Lf@^f?(?e?kGq???c@??? vcc?d????a at S?{/a?^I?\?9`@??*???_?oH??]@<???v]?1zn?+?[@m??pe[?6?:?Y@?KqU??Y?/??$mX@???z?-X????t? W@?G,?V??|V@??????U?#?k$ U at 7??:r?T?O??e?4T@ )"?*T? &?(?yS@)r?#[S????{??R@8????R??&k?CJR@????3R?#?3???Q@?8?Z??Q?#K?eQ@[?? ?TQ??< $ Q at M?x$^?P?+?? ?P@??t??P?;m??}P@?mQf?sP?rl=C8IP@$ --??@P????d?P@??'c|P?????P@??????O??3????O@????C?O??? '?O@x??e?O?PK?|3:?wOkhh ??dct_2_3.npyPK?|3:4?j?PP ???dct_2_64.npyPK?|3:?B??? ?? dct_3_15.npyPK?|3:2OQ?P P ???dct_3_1024.npyPK?|3:?????? ??y$dct_3_17.npyPK?|3:" ??? ??{%dct_3_16.npyPK?|3:??r -PP ??u&dct_1_256.npyPK?|3:??? ?? ???.dct_3_12.npyPK?|3:?Ks?PP ???/dct_3_32.npyPK?|3:?1,PP ??D1dct_2_512.npyPK?|3:^?w??? ???Adct_1_8.npyPK?|3:???}PP ??xBdct_2_128.npyPK?|3:Z???pp ???Fdct_1_4.npyPK?|3:R???hh ???Gdct_1_3.npyPK?|3:??dK`` ??Hdct_1_2.npyPK?|3:???Y?? ???Hdct_2_8.npyPK?|3:?v??hh ??_Idct_4_3.npyPK?|3:?M]hh ???Idct_3_3.npyPK?|3:?`??`` ???Jdct_3_2.npyPK?|3:????pp ?? -Kdct_3_4.npyPK?|3:B??6pp ???Kdct_4_4.npyPK?|3:hT???? ???`` ????dct_4_2.npyPK?|3:J/?PP ??)?dct_4_32.npyPK?|3:?o??PP ????dct_1_512.npyPK?|3:?????? ???dct_2_15.npyPK?|3:??J%P P ???dct_4_1024.npyPK?|3:??G??? ????dct_4_15.npyPK?|3:?X??? ??~?dct_4_16.npyPK?|3:? \?? ??x?dct_4_17.npyPK?|3:j??[?? ??z?dct_4_12.npyPK?|3::tXPP ??T?dct_1_128.npyPK?|3:K7|PP ????dct_3_64.npyPK?|3:?1??PP ??I?dct_3_128.npyPK?|3:?(??PP ????dct_1_64.npyPK?|3:?cs?PP ??>?dct_4_128.npyPK?|3:?0?PP ????dct_2_256.npyPK?|3:???e???V"??,??m?k?Y4? ????~???^??PKb?3:??%?? dct_3_15.npy?NUMPYF{'descr': 'PKb?3:?E??PPdct_3_1024.npy?NUMPYF{'descr': 'E?>?(=E~??D? +???"?Dp???? ?D???????DH?????D??????D??????DR???p??D?|?????D$q?????D?g????Dj`??p??D[?????D?W????DuV??g??D+W?????D?Y?????DD^?????D;d?????D?l??~??Dw????D????F??D~???j??D????)??D???????D?????D@?????Do????0?D8??\I?D???9d?D?:?????D`W??p??D?u?????D|D0?{?Dt\>?<]=D?$=??&(?C ????8?C ???wK?C???h_?C???t?C?????C#2?????C?J?????C_d??5??CD??B??C??????C=????/?C?????O?C;???q?C+?????C??C????x?C?&?????C?a?????CQ????-?C????k?C??????CvY????C????",?C????n?C?????C?_??e??C?????8?C?????~?C?-?????C?t??? ?C?????S?C*??v??C?L??"??CT???l0?CN????{?Cx,?????C?x????C????cb?C???u??C?a??E??C????O?C??????C8Q?????C?????B?C????*??C4G??p??C??????B???Z??B???????B\??*?BX?????B?????s?B?M????B???????B*???p?B?H??E?B??????Bk????q?B?L??c ?B????A??B?????{?BU??s+?Bd????B???????B?e??{vB?0t? ?iBj?g??E]B??Z???PB2aN?:DB$?A??x7BP05???*Bv?(??LB(?X?B?n? #B6????A ??????A?c??*??A,??????A?????A ?????fA ?]??}4A^+?2A:????@p??@?????PKb?3:?;1??? dct_3_17.npy?NUMPYF{'descr': 'PKb?3:????? dct_3_16.npy?NUMPYF{'descr': '^?8??'?$?8????t?q???B?7??????5?7???{?5??????V??x?????6D?????7B????2??K??`??!?=??\??iR???????4tf???6Q????;??????V5?????H7??vz?7?su??d????k??j$7?kb???;5??Y??75??Q??d??o4J???V??C???q6k???:??7?*m4??Q1??:.??)+??&(??.%?vE"??c?^?????U??JG????????T ?F? ?"?????4?k??????????$)??9\??}?????????N??1???????+??O???????Lg?? Z???5??k??????$???$??s??9????x????????? ??f?????????;U??2?}??Uv??Fo??)h?} a??7Z??pR??L?7??1?2?*???#?T??I?V??? ??(?? +????;???Y???7G??3K??M????????"?????ro???U?=?_?#?' +??????????|??n? `J?PKb?3:t>}.pp dct_1_8.npy?NUMPYF{'descr': 'PKb?3:>=??XX dct_3_2.npy?NUMPYF{'descr': 'u`` dct_2_4.npy?NUMPYF{'descr': 'E??=??Q8E?)7?02E? 1?cS,E?P+???&EI?%???!En? ?? +E?4???EK???LEt???JE???0? E?? ???E?F??Et???BE??]?D-G??/?Dxv??d??D???????D????Kw?D???????D"??????DJ???r?D????(?D\f??? +?DgP????D?c??CJ?D???????D?????Di~?????D? ???v?DS????P?DV????F?DH???@W?D???????D?????DeG????D +???0??Dk????D????W??D????=D]?=?T?)? ?(D?Y(???'Doy'???&D??&?\?%DJ?%??%DK?$??C$D$??u#D}P#???"D??"???!D?!? !D?? ??_ D+= ???D?????D???L2D???~D?^???D???K!D3??vD\X???D???+Dy ?_?DOl???D??YNDE2???DS??D???DOo?S?D/??DiD?O???D^???RD?9???Dj??rED?-???D????AD?*?a?D???>GD?0?X?Dp???UD@???D???rlD?W??D?????D?w?|D? +?3? D?? ??I D7 ??? D? ?C} Dk ?? D? ?F? D?? ??X D^G ??? +D?? +??? +D5? +?{D +DQ4 +??? D/? ?P? D?? ?h@ D31 ?=?DV????D???KD?=???D???Q?D???nfDY?;D???D?????D??KD?>?7DM????D5???D?{??HD?=? D ???D ????D????^D?T??'D??;?E??qZ;S=???9?5????9?p.?????1?'??Mx7+B!?d?H?l9???8???KD?:#??{.6? ????75???8u??mD??o???#:??FL????q?~b??C???L`??76 !^??{??F?[???v?P?Y??Y?~?W??!6H?U??!8??S?8X?Q???1???O?????? +N??x?? -L????54VJ?cc?7V?H?????e?F??G???D??M?7??C???K8A?A?e??????=???=>?/i ????%e0?????.??+d6??-?????.,?*????*????3.y)???V5//(? ??$?&?????%??d?66E$? ?`????q????j?6?A??? 8?n?zlK8i??o?!?????Z????????Y2??6?????7WG??^t??????#???8????+?5?s??????(???u]???????q?\????+?6?]??????? ???7????????6t?????w????????6?O???Y6?'??E??7???e68???????????????????r??)????Y?6t??0b8_???P??N???7???@??????6??T??? /???xL9?*????-9?+?????9X*????u9+.??\N7t4??? ?v=??!?=7^L???y???Z????C8?m????V??????f?????????(???????,????j?6Y???????g ???!51????5k???Mx7??????5?????1?6????T??7??5Q8c3???y??h??;@??????I??_????15????L]?7?J??????????%??7?????15?? +??{?8O???t??E?????U?o???????'??V?c??s?? 1(9*???7??1??N?#8?d???|?B???@??7 ???Mx??d??Ne??????u]????2??s??()07@?????5Z=?????5?????+d???????????????????6A5??b??7?????8g??W8?Gs??9???????o????N???+d?"????a8?2???M????????6???@???p??????8X???a? ????y?t??? 8??????6?)???19?????]u?Z???u]6??????I?D +????#8?????Q?s????y?????-&?;)????j????? 4i7?>???{.6`??????5?^???76?????x?`_???? 63???Y6 ???iR?76??_q8????????c?? ???&???n???????+??r.??~?8Z???E?u?9e???Y?6???(,q??????B?8?@??%?????????:???????:?&???? ?????6%?8go??h~??3??? +7p???? ??&f????8K?????j"???????????? ?????9???3z???7C???j?6? ?????????????5V???j???j?????4 +4?????5???}?7C?????7???? 4??zy??>???+G??????M??????H???\?7????f?s??????H?7Ag??`@8??7'??????3??????;?}???=&w?g??????3??????[????B7?C??S??7 '???T?????V}?(???J??????? ?@?????O??7???? ???s????q???|??????g??X?8?R????n9?>??6sm:?.??]?e:????P?8J??9??7???N?#??????j??????QL??E???I?7??????B?s???h~??????????Q????u??+|??@/8?o??KD7?b????6xO?????6?_??????Z???? ??2???156K1??/??7%-???j?7f%??&?3?? ???;a??????L??????87E??V}8f ????j?v??{i??K?????y????90??@/8s???#&;??PKb?3:?R?4?? dct_2_16.npy?NUMPYF{'descr': '??n?O?????K??f??? al??2?@??V????6??????wI?PKb?3:I0K??? dct_2_17.npy?NUMPYF{'descr': '??9??Z????W???:?:NW??w;?B?????^????e9?Np?c?;?bH??????)????9?????z??V?? +"?????????????F:?r??G-?'F????9?????4M9?(}???>??Gf???aR??X:?@????8??1???v?I$???9? ?&?+:? ??7?w;??????Q8?S??>5????!D2??B??Oc/?E??8??,? ???h?)???<9?4'?z.?y?$???&?O#"?I.9?????v?oS????7??}???????8W???2x?*x?D?(??c?q?8?c????m?*?,8? ????9U? +?j?????R?8[ ??9?9?S?_q9????-9?Z??/?"??g???q??????m?9Z???tk9????X???y???N+??t??? +??8["??y??7_???8????? +??*?? ?@?d????"?8Q,??Gk1?>????(#8>w???p}9?$??/?"7G????Z8????w ?L???l??8-u??v??:8???!?=?+a??{???d??fo?K}??]??8?????T?7????j????????79?1??"i?8???????!??????9 '????7[~??f$ ? ???()?8?c??QL?8S?????A??o??hUp8???#?9???!?~9F)????{?)???g??????????z/???o?8??????8#?????t?nx?????9?X???)?9?????9????b??9^??????d???B|???????????????8???? ?@9?????o?8 ???!.o?????sO??]?????L??????????????"????????9???n?=?????&j???v??????D?oe>F?%=???7F)?6?{1Fe0??+F$?*?56&F|B%?!F?4 ?DKF?s???F????F????vF=??? F9? +??F?c??F>??JSF????o?E[W??n??E?x?????E?????z?E?????S?EYj??te?E'??????E????&?E?X?????E? ??C??E??????E????U??EV??%?E?i????E??????Exr??R??EN&??p??E?????q?E?????t?E???????E? ??T??EG??1?E???? t?E???????E'w???u?Er??i?E???????E?Y?? ??E???6W?E????`9?E?????*?E?????*?E????9?E,????T?EC???e}?E2)??z??E~`?????E????@?EL??????E?K????E????f?Ew??2?E\-?@?|E?0|???yE?Fy???vE?mv?*&tE3?s? +lqE?p???nE?Gn?@'lE??k???iE?&i?;gE?f???dEK?d?2MbE??a???_E??_???]E?G]??t[E{[?1EYE??X?!WE??V? UE??T???RE??R?l?PE??P??NEg?N?? ME??L?(KE??J??KIEC?H??xGE?$G?9?EE?[E??CE??C?73BE??A? ?@E24@???>Eg?>?^7=Eg??????D^?????D??? ??DF??????DQ?????D?????B?DR??;o?DI?????D?w??e??D????D"????5?De???l?D?H?????D???????D?????Dd???v\?D?9??4??D?z?????D????C$?Dz???j?D+I?????D???????D?????H?D?'????D?u??O??D`???<6?D??????D?i??B??D*???3?Do?????DFl?????D?????>?D? ?????Dv}?????D????MX?DK;??3??D??????D4?????Dic????D?????K?D10?????D??????D??????D?m????D?????b?D|H?????D????B?D~(??V??D????j'?D? ?????D{???J?De???A??D?o??_?D?????y?Dxa??H??D/?????D???:??D s???3?D?%??)??DC?????DU????O?DB????D???????D?????q?D at d???(?D??????D??????D ???6R?DkE??? ?D+???4??D????(??D?t???????D?????D +??????D???? ??D0??????D????a?D?Z??=?Di6????DJ????D???????DI??????DS?????D?????i?D?c??H?D?A???&?D? ????D???????D??????D???????D????2??D???!f?D?`??\G?D?A??)?D?#??? +?D???a??D?????D???????D??????D?????z?D|u???^?D?Y??YC?De>??N(?Dj#??? ?D??????D???D??D???????D???f??D????t??D?????t?D?p???\?D[X???D?D?@??W-?D)??2?D ??^??DB??????D???????D??????D??????D??????D?????}?D?y??Ri?D?e??MU?D?Q???A?D?=??$.?D?*???D???[?D??????D???????D????%??D???????D???????D???????D???????D????|~?D?{???n?D?k??T_?D?\????3?Di0???$?D\"???D???? ?D0??s??D??????DN?????D???????D??????D????v??Df???8??D7???K??DX??????D????e??D????m??D???????D??lw?D?u??fn?D?l???e?D!d??J]?D?[??4U?D?S??lM?D L???E?D?D???>?D?=???7?D?6??t1?DP0??@+?D%*??W%?DN$????D???w?D?????D?????D ??~ ?D? ??r?D?????D??J?D???\?DK????D?????D???c?D?????D??}?D?????D????D?????D????D +??PKb?3:c?9t?? dct_4_15.npy?NUMPYF{'descr': '??(C??#?fCj????C?k??qB?B?????B????q?B??????B?}?????BJ ??z??B,;??p?uB??q?%?^B0?Z???IB[?E???5B??2?$?#B~? ???B????HBB??????A/6???A4??????A?@*??????????PKb?3:???PP dct_3_128.npy?NUMPYF{'descr': '_?????C???????CWa??& +xCoYu? ?iC?Rg?8?\C}Z???PC??N???EC??C?t;C??9?^?1C?@0??)CMs'?Q? C'2???C8n?xgC?? +g +C?+ ?Y?C??????Bn??????Bw????`?B X??L`?B$m??>??B???????Bq?????B.*??y?B5???'[?BA?????B???????BIo????B?'??e??B{??QM{B?yx?7?kB? i?8?\BhZ?4NBTmK????B?=??i1BH?.?xt#BE? ???B?<??*B??????A ???b*?A?d????A[J??s?A/k??qf?A????.?gA?~^???4A??+?rgA?y??n?@???????????PKb?3:?F`)PP dct_1_64.npy?NUMPYF{'descr': 'p??*H? Q)????O??????????w??????XW??*z?"c??O???=?K?.?? ????-? ?????? ??????????????????????????\[??????e???tw??k?A?_??T??J?xaA???8? +V0?%?(??M!??o?O??K? ???e??????X???o??????]??AT???????\??b??????IZ??????Tg??????Em???B???L??????????? y???p??Oh??a`???X??@Q?J??BC?)???Q??L??????????t??^C?????]???x$??{????????????????????;?(?9???7??m5?Od3?C^1?Pb/?x%-?S6+?su)???'?f?%?5?#??="?^z ????????>?+??A???V?W???.????n:????? ??? ? 5 +?)??yc????M????C??????????&??U???????? ??,!???????s?? ??????????/X??1-???????????w???V???S??-N???F???1??IS???`???q??z??????????????????=??Ps??????6???@???A???????&???x??????RQ??????^*?????????[???????@v??`????|??4,??a???TN??j???t??o??]????g??????????e?? ?????l????q???.??K????????Z???D??5,??P???]???^???P????b???~~??A|?bz???w?"?u???s???q??o?9?m?k?k??Qi?Wg?Ne??Pc?zPa?[_?l]??~[???Y???W?V??T??aR???P??BO?UaM??J?? I???G???E?PlD??B???@????9??5?=?2?pQ/?f?+??|(?sk%???!??f?>?? ???:?F? ?s- +?Y??'k???????????????????%???]|???C??Lf??V???c???????????Q>??}????o?? N??gv??????)???????Px???i?#M\???G?(?7??b6??I+??"?6z?!??3?????????? ???g???V??Th?+???J??\h??PKb?3:=?^?? sizes.npy?NUMPYF{'descr': 'gE?\e?S=]E&?[?B TE1uR??KEJ???CEy`B??wD?>?`&????C? ?????C???????C????V??C???????C?????C??????C?2??4??C?V??"?C2????8?Cd???^s?CB???F??C?6?????C+???/O?C??????C?+??2?C[???Gj?C??????C?^??H?C???????C?K??#??C,??????C?P??N?C;???C??C\m???s?CD??R?C???????CB???U?C????C?????C0F??*f?C2??? ?C???????Cdv????C}:???i?C ???5?C?????CS???s??Cw?????C?P??]??Cf.??|r?C:??^W?C????*@?CP????,?Ck?????CI?????C??????C????c?C????G?Cw?????CQ???C?Ci???%?Cue??1|CG|{?[MxC?w??ntC??s?Z?pC?o? ?lC?l???hCoEh??-eCx~d??jaCf?`?L?]C??\???YC?HY??AVC?U???RC??Q???NC?>N?oCKCn?J???GCQ?F?DC_C?,n at C??????$C??#??? C*) ??WC????C?I?r}C5???C?w???C"?pN Cs? ? ?C?R???C???H9C??????BY?????B????x?B?C?????BD?=??7D??5??0D??.?Z?)D'l(??u#Dwd"??D??vVDId??@D~[??qD? ?G? D* ??DK?? yD????#?C???s??C?b?? ??C?X??Q??C????jS?C(-??:?C ???#?C ??Ri?C e??O??C????j??CE????C????r??C???????C&???0:?C?h?????C????}?Ch????S?C????&K?C????Ba?Cb???|??C????z??C?:???L?C~??????C?.???h?C??????C???X??C`J???p}C?O|?0KwCh1v??JqC37p?;mkC`j?H?eC?d?N`C?_??ZC??Y??7UC?@T?8?OC$O?^?JC ?I??EC2?D??@Ct???X?;C??:??7Cv96??`2C7?1?+?-C ?,?"3)Cwa(???$Cs?#?eP CW??I?C#1???Ct???{C_??TCf???: C?} +??/C?t??1CQy? ??B???O??B?O????B????h?B ??,??B?????p?B0??6?Bl???x??Bcu??5??B?>???d?B???8M?B????D?BH???LK?Bl??N`?B??????B?D??v??B?u?????BB????3?B???t +{B??x??mBzZk? +?`B?(^??jSB? Q?_XFB&?C??V9B?6?bc,BN +*??}B?'??BQ?|?Bl???)?Ap???2??A????U?A???<?A?i?????A?%???gAK?]?5?4A?v+??EAPC?????@?????????PKb?3:??lPP dct_4_256.npy?NUMPYF{'descr': ' D?m???Dg???D????D$??$D???? D[ ??] D????=D????ED??}sD+???-??C?????l?C???????C9?????C~??x?C????a:?C?z??,?C?t??{J?C!??????C??????C?a??m??C????aQ?C????+?Cv???$&?CR????>?C????s?CE?????CqJ??n.?CE???h??C?@??L?Cg?????CT??????C?^??}??C;=??+??Cb/?????C 4????C?J?????C?r??#??C????dA?C???????CJ??'??C?????j?C?#?????Cf????u?C?3????C-??? +??C?v??e?C?)??{!?C?????C????C??C???????C'd??x~?C?L???n?C?>???h?C::???k?C?>???w?CkL??T??C?b??b??C5??????C???????C????1?C* ???m?CFK?????C????`??Co????O?C?1??U??C????? ?CW???rp?ClU?????C????Q?C?8?????C????K?Cq5??1??C????n^?CJ????C7???U??Cv???%?C?????C?????q?Cjb????C???G??C??????C???9J?C?>??? ?C#????C???????C0????v?C?n??VN?C?G??1+?C]%?? ?C!????C???l?C-????Cz??U?C?????C???PKb?3:??9Ppp dct_4_8.npy?NUMPYF{'descr': '??!i?Bn????B]Q????B7???$Y?B???A??BS???S??B!??? ??B????R?B????}?B????3/?B???? Y?B???????B????2??B????I?B???;??B????i?B???g?~B?~?7~B/ ~?PKb?3:Fm?j\\ ??dct_2_3.npyPKb?3:?W??PP ???dct_2_64.npyPKb?3:??%?? ???dct_3_15.npyPKb?3:?E??PP???dct_3_1024.npyPKb?3:?;1??? ??1dct_3_17.npyPKb?3:????? ???dct_3_16.npyPKb?3:???PP ???dct_1_256.npyPKb?3:@?L?? ??$dct_3_12.npyPKb?3:?mp??? ???dct_3_32.npyPKb?3:?~??PP ???dct_2_512.npyPKb?3:t>}.pp ??C#dct_1_8.npyPKb?3:????PP ???#dct_2_128.npyPKb?3:(?V?`` ??W&dct_1_4.npyPKb?3:?s??\\ ???&dct_1_3.npyPKb?3:?Ob;XX ??e'dct_1_2.npyPKb?3:R!??pp ???'dct_2_8.npyPKb?3:9??\\ ??(dct_4_3.npyPKb?3:?F??\\ ??)dct_3_3.npyPKb?3:>=??XX ???)dct_3_2.npyPKb?3:?R?`` ?? +*dct_3_4.npyPKb?3:%q??`` ???*dct_4_4.npyPKb?3:\???? ??+dct_1_12.npyPKb?3:p??-pp ???+dct_3_8.npyPKb?3:\??oXX ??_,dct_2_2.npyPKb?3:{W?j?? ???,dct_1_32.npyPKb?3:q>u`` ???-dct_2_4.npyPKb?3:?~???? ??c.dct_2_12.npyPKb?3:_y??PP ?? /dct_4_512.npyPKb?3:F??i?? ???7dct_1_17.npyPKb?3:?E?,?? ??F8dct_1_16.npyPKb?3:??X ?? ??9dct_1_15.npyPKb?3:,?-TPP???9dct_1_1024.npyPKb?3:?R?4?? ??2Jdct_2_16.npyPKb?3:?O???? ???Jdct_2_32.npyPKb?3:I0K??? ???Kdct_2_17.npyPKb?3:4??XX ???Ldct_4_2.npyPKb?3:'????? ??%Mdct_4_32.npyPKb?3:?{g?PP ??Ndct_1_512.npyPKb?3:??\??? ???Vdct_2_15.npyPKb?3:??ePP??PWdct_4_1024.npyPKb?3:c?9t?? ???gdct_4_15.npyPKb?3:??*??? ???hdct_4_16.npyPKb?3:5?i??? ?? 0 - - This is the exact same formula as Matlab. - """ - x = np.asarray(x) - if not np.isrealobj(x): - raise ValueError("Complex input not supported") - n = x.size - y = np.zeros(n * 4, x.dtype) - y[1:2*n:2] = x - y[2*n+1::2] = x[-1::-1] - y = np.real(numfft(y))[:n] - if matlab: - y[0] *= np.sqrt(.25 / n) - y[1:] *= np.sqrt(.5 / n) - return y - -def direct_dct2(x): - """Direct implementation (O(n^2)) of dct II. - - dct(u) = 2 * sum_{i=0}^{N-1}{f(i)cos((i + 0.5)\pi u/N} - - Note that it is not 'normalized' - """ - n = x.size - #a = np.empty((n, n), dtype = x.dtype) - #for i in xrange(n): - # for j in xrange(n): - # a[i, j] = x[j] * np.cos(np.pi * (0.5 + j) * i / n) - grd = np.outer(np.linspace(0, n - 1, n), np.linspace(0.5, 0.5 + n - 1, n)) - a = np.cos(np.pi / n * grd) * x - - return 2 * a.sum(axis = 1) - -def fdct2(x): - """Compute a 'Fast' Discrete Cosine Transform, type II, using a N point fft - instead of a direct 4n point DFT - - \forall u \in 0...N-1, - dct(u) = sum_{i=0}^{N-1}{f(i)cos((i + 0.5)\pi u/N} - - See 'A Fast Cosine Transform in One and Two Dimensions', by J. Makhoul, in - IEEE Transactions on acoustics, speech and signal processing. - - Note that it is not 'normalized' - """ - x = np.asarray(x) - n = x.size - v = np.empty(x.size, x.dtype) - if (n/2) * 2 == n: - iseven = True +def fftw_ref(type, size, dt): + x = np.linspace(0, size-1, size).astype(dt) + if dt == np.double: + data = FFTWDATA_DOUBLE + elif dt == np.float32: + data = FFTWDATA_SINGLE else: - iseven = False - cut = (n-1)/2 + 1 - v[:cut] = x[::2] - if iseven: - v[cut:] = x[-1:0:-2] - else: - v[cut:] = x[-2::-2] - t = 2 * numfft(v) * np.exp(-1j * np.pi * 0.5 / n * np.linspace(0, n-1, n)) - v[:n/2+1] = np.real(t)[:n/2+1] - if iseven: - v[n/2+1:] = -np.imag(t)[n/2-1:0:-1] - else: - v[n/2+1:] = -np.imag(t)[n/2:0:-1] - return v + raise ValueError() + y = (data['dct_%d_%d' % (type, size)]).astype(dt) + return x, y -def test_refs(): - for i in range(len(X)): - assert_array_almost_equal(direct_fft_dct2(X[i], matlab=True), Y[i]) - assert_array_almost_equal(direct_fft_dct2(X[i], matlab=False), direct_dct2(X[i])) - - for i in range(len(X)): - x = X[i] - y = direct_fft_dct2(x, matlab=True) - y[0] *= np.sqrt(x.size*4) - y[1:] *= np.sqrt(x.size*2) - assert_array_almost_equal(y, direct_dct2(x)) - -def test_fdct2(): - for i in range(len(X)): - assert_array_almost_equal(direct_dct2(X[i]), fdct2(X[i])) - class _TestDCTIIBase(TestCase): def setUp(self): self.rdt = None self.dec = 14 def test_definition(self): - for i in range(len(X)): - x = np.array(X[i], dtype=self.rdt) - yr = direct_dct2(x) + for i in FFTWDATA_SIZES: + x, yr = fftw_ref(2, i, self.rdt) y = dct2(x) self.failUnless(y.dtype == self.rdt, "Output dtype is %s, expected %s" % (y.dtype, self.rdt)) - assert_array_almost_equal(y, yr, decimal=self.dec) + # XXX: we divide by np.max(y) because the tests fail otherwise. We + # should really use something like assert_array_approx_equal. The + # difference is due to fftw using a better algorithm w.r.t error + # propagation compared to the ones from fftpack. + assert_array_almost_equal(y / np.max(y), yr / np.max(y), decimal=self.dec, + err_msg="Size %d failed" % i) def test_definition_ortho(self): """Test orthornomal mode.""" for i in range(len(X)): x = np.array(X[i], dtype=self.rdt) - yr = direct_fft_dct2(x, matlab=True) + yr = Y[i] y = dct2(x, norm="ortho") self.failUnless(y.dtype == self.rdt, "Output dtype is %s, expected %s" % (y.dtype, self.rdt)) From scipy-svn at scipy.org Mon Jan 19 03:32:36 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 19 Jan 2009 02:32:36 -0600 (CST) Subject: [Scipy-svn] r5497 - trunk/scipy/fftpack Message-ID: <20090119083236.CACB8C7C011@scipy.org> Author: cdavid Date: 2009-01-19 02:32:32 -0600 (Mon, 19 Jan 2009) New Revision: 5497 Modified: trunk/scipy/fftpack/fftpack.pyf Log: Add f2py wrapper for single prec dct type I. Modified: trunk/scipy/fftpack/fftpack.pyf =================================================================== --- trunk/scipy/fftpack/fftpack.pyf 2009-01-19 08:32:11 UTC (rev 5496) +++ trunk/scipy/fftpack/fftpack.pyf 2009-01-19 08:32:32 UTC (rev 5497) @@ -196,6 +196,17 @@ integer optional,intent(c,in) :: normalize = 0 end subroutine ddct3 + subroutine dct1(x,n,howmany,normalize) + ! y = dct1(x[,n,normalize,overwrite_x]) + intent(c) dct1 + 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 dct1 + subroutine dct2(x,n,howmany,normalize) ! y = dct2(x[,n,normalize,overwrite_x]) intent(c) dct2 From scipy-svn at scipy.org Mon Jan 19 03:32:55 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 19 Jan 2009 02:32:55 -0600 (CST) Subject: [Scipy-svn] r5498 - trunk/scipy/fftpack/tests Message-ID: <20090119083255.07F6EC7C011@scipy.org> Author: cdavid Date: 2009-01-19 02:32:50 -0600 (Mon, 19 Jan 2009) New Revision: 5498 Modified: trunk/scipy/fftpack/tests/test_real_transforms.py Log: Refactor DCT tests so that the core code is independent of the DCT type. Modified: trunk/scipy/fftpack/tests/test_real_transforms.py =================================================================== --- trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-19 08:32:32 UTC (rev 5497) +++ trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-19 08:32:50 UTC (rev 5498) @@ -21,6 +21,8 @@ FFTWDATA_SINGLE = np.load(join(dirname(__file__), 'fftw_single_ref.npz')) FFTWDATA_SIZES = FFTWDATA_DOUBLE['sizes'] +TYPE2DCT = {1: dct1, 2: dct2, 3: dct3} + def fftw_ref(type, size, dt): x = np.linspace(0, size-1, size).astype(dt) if dt == np.double: @@ -32,15 +34,17 @@ y = (data['dct_%d_%d' % (type, size)]).astype(dt) return x, y -class _TestDCTIIBase(TestCase): +class _TestDCTBase(TestCase): def setUp(self): self.rdt = None self.dec = 14 + self.type = None + self.func = None def test_definition(self): for i in FFTWDATA_SIZES: - x, yr = fftw_ref(2, i, self.rdt) - y = dct2(x) + x, yr = fftw_ref(self.type, i, self.rdt) + y = self.func(x) self.failUnless(y.dtype == self.rdt, "Output dtype is %s, expected %s" % (y.dtype, self.rdt)) # XXX: we divide by np.max(y) because the tests fail otherwise. We @@ -50,53 +54,31 @@ assert_array_almost_equal(y / np.max(y), yr / np.max(y), decimal=self.dec, err_msg="Size %d failed" % i) - def test_definition_ortho(self): - """Test orthornomal mode.""" - for i in range(len(X)): - x = np.array(X[i], dtype=self.rdt) - yr = Y[i] - y = dct2(x, norm="ortho") - self.failUnless(y.dtype == self.rdt, - "Output dtype is %s, expected %s" % (y.dtype, self.rdt)) - assert_array_almost_equal(y, yr, decimal=self.dec) - def test_axis(self): nt = 2 for i in [7, 8, 9, 16, 32, 64]: x = np.random.randn(nt, i) - y = dct2(x) + y = self.func(x) for j in range(nt): - assert_array_almost_equal(y[j], dct2(x[j]), decimal=self.dec) + assert_array_almost_equal(y[j], self.func(x[j]), decimal=self.dec) x = x.T - y = dct2(x, axis=0) + y = self.func(x, axis=0) for j in range(nt): - assert_array_almost_equal(y[:,j], dct2(x[:,j]), decimal=self.dec) + assert_array_almost_equal(y[:,j], self.func(x[:,j]), decimal=self.dec) -class TestDCTIIDouble(_TestDCTIIBase): - def setUp(self): - self.rdt = np.double - self.dec = 10 - -class TestDCTIIFloat(_TestDCTIIBase): - def setUp(self): - self.rdt = np.float32 - self.dec = 5 - -class _TestDCTIIIBase(TestCase): - def setUp(self): - self.rdt = None - self.dec = 14 - - def test_definition(self): +class _TestDCTIIBase(_TestDCTBase): + def test_definition_matlab(self): + """Test correspondance with matlab (orthornomal mode).""" for i in range(len(X)): x = np.array(X[i], dtype=self.rdt) - y = dct3(x) + yr = Y[i] + y = dct2(x, norm="ortho") self.failUnless(y.dtype == self.rdt, "Output dtype is %s, expected %s" % (y.dtype, self.rdt)) - assert_array_almost_equal(dct2(y) / (2*x.size), x, - decimal=self.dec) + assert_array_almost_equal(y, yr, decimal=self.dec) +class _TestDCTIIIBase(_TestDCTBase): def test_definition_ortho(self): """Test orthornomal mode.""" for i in range(len(X)): @@ -107,29 +89,47 @@ "Output dtype is %s, expected %s" % (xi.dtype, self.rdt)) assert_array_almost_equal(xi, x, decimal=self.dec) - def test_axis(self): - nt = 2 - for i in [7, 8, 9, 16, 32, 64]: - x = np.random.randn(nt, i) - y = dct3(x) - for j in range(nt): - assert_array_almost_equal(y[j], dct3(x[j]), decimal=self.dec) +class TestDCTIDouble(_TestDCTBase): + def setUp(self): + self.rdt = np.double + self.dec = 10 + self.type = 1 + self.func = TYPE2DCT[self.type] - x = x.T - y = dct3(x, axis=0) - for j in range(nt): - assert_array_almost_equal(y[:,j], dct3(x[:,j]), - decimal=self.dec) +class TestDCTIFloat(_TestDCTBase): + def setUp(self): + self.rdt = np.float32 + self.dec = 5 + self.type = 1 + self.func = TYPE2DCT[self.type] +class TestDCTIIDouble(_TestDCTIIBase): + def setUp(self): + self.rdt = np.double + self.dec = 10 + self.type = 2 + self.func = TYPE2DCT[self.type] + +class TestDCTIIFloat(_TestDCTIIBase): + def setUp(self): + self.rdt = np.float32 + self.dec = 5 + self.type = 2 + self.func = TYPE2DCT[self.type] + class TestDCTIIIDouble(_TestDCTIIIBase): def setUp(self): self.rdt = np.double self.dec = 14 + self.type = 3 + self.func = TYPE2DCT[self.type] class TestDCTIIIFloat(_TestDCTIIIBase): def setUp(self): self.rdt = np.float32 self.dec = 5 + self.type = 3 + self.func = TYPE2DCT[self.type] if __name__ == "__main__": np.testing.run_module_suite() From scipy-svn at scipy.org Mon Jan 19 03:33:10 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 19 Jan 2009 02:33:10 -0600 (CST) Subject: [Scipy-svn] r5499 - trunk/scipy/fftpack Message-ID: <20090119083310.A0183C7C011@scipy.org> Author: cdavid Date: 2009-01-19 02:33:05 -0600 (Mon, 19 Jan 2009) New Revision: 5499 Modified: trunk/scipy/fftpack/realtransforms.py Log: Change DCT API: use dct/idct with type argument instead of dct*. Modified: trunk/scipy/fftpack/realtransforms.py =================================================================== --- trunk/scipy/fftpack/realtransforms.py 2009-01-19 08:32:50 UTC (rev 5498) +++ trunk/scipy/fftpack/realtransforms.py 2009-01-19 08:33:05 UTC (rev 5499) @@ -2,7 +2,7 @@ Real spectrum tranforms (DCT, DST, MDCT) """ -__all__ = ['dct1', 'dct2'] +__all__ = ['dct'] import numpy as np from scipy.fftpack import _fftpack @@ -11,42 +11,20 @@ atexit.register(_fftpack.destroy_ddct1_cache) atexit.register(_fftpack.destroy_ddct2_cache) -def dct1(x, n=None, axis=-1, norm=None): +def dct(x, type=2, n=None, axis=-1, norm=None): """ - Return the Discrete Cosine Transform (type I) of arbitrary type sequence x. + Return the Discrete Cosine Transform of arbitrary type sequence x. Parameters ---------- x : array-like input array. + type : {1, 2, 3} + type of the DCT (see Notes). n : int, optional Length of the transform. axis : int, optional axis over which to compute the transform. - - Returns - ------- - y : real ndarray - """ - return _dct(x, 1, n, axis, normalize=norm) - -def dct2(x, n=None, axis=-1, norm=None): - """ - Return the Discrete Cosine Transform (type II) of an arbitrary type - sequence x. - - This is the most commonly used DCT, and corresponds to what is called 'the' - DCT; in particular, dct2(x, norm='ortho') gives the same result as Matlab - dct function - - Parameters - ---------- - x : array-like - input array. - n : int, optional - Length of the transform. - axis : int, optional - axis over which to compute the transform. norm : {None, 'ortho'} normalization mode (see Notes). @@ -56,8 +34,29 @@ Notes ----- - There are several definitions, we use the following (for norm=None): + For a single dimension array x, dct(x, norm='ortho') is equal to matlab + dct(x). + There are theoretically 8 types of the DCT, only the first 3 types are + implemented in scipy. 'The' DCT generally refers to DCT type 2, and 'the' + Inverse DCT generally refers to DCT type 3. + + type I + ~~~~~~ + There are several definitions of the DCT-I; we use the following (for + norm=None): + + for 0 <= k < N, + + N-1 + y[k] = x[0] + (-1)**k x[N-1] + 2 * sum x[n]*cos(pi*k*n/(N-1)) + n=0 + + type II + ~~~~~~~ + There are several definitions of the DCT-II; we use the following (for + norm=None): + N-1 y[k] = 2* sum x[n]*cos(pi*k*(2n+1)/(2*N)), 0 <= k < N. n=0 @@ -69,6 +68,24 @@ Which makes the corresponding matrix of coefficients orthonormal (OO' = Id). + type III + ~~~~~~~~ + There are several definitions, we use the following (norm=None): + + N-1 + y[k] = x[0] + 2 * sum x[n]*cos(pi*(k+0.5)*n/N), 0 <= k < N. + n=0 + + Or (norm='ortho'), for 0 <= k < N: + + N-1 + y[k] = x[0] / sqrt(N) + sqrt(1/N) * sum x[n]*cos(pi*(k+0.5)*n/N) + n=0 + + The (unnormalized) DCT-III is the inverse of the (unnormalized) DCT-II, up + to a factor 2*N. The orthonormalized DCT-III is exactly the inverse of the + orthonormalized DCT-II. + References ---------- @@ -77,19 +94,21 @@ 'A Fast Cosine Transform in One and Two Dimensions', by J. Makhoul, in IEEE Transactions on acoustics, speech and signal processing. """ - return _dct(x, 2, n, axis, normalize=norm) + if type == 1 and norm is not None: + raise NotImplementedError( + "Orthonormalization not yet supported for DCT-I") + return _dct(x, type, n, axis, normalize=norm) -def dct3(x, n=None, axis=-1, norm=None): +def idct(x, type=2, n=None, axis=-1, norm=None): """ - Return Discrete Cosine Transform (type III) of arbitrary type sequence x. + Return the Inverse Discrete Cosine Transform of arbitrary type sequence x. - This is also called 'the' inverse DCT (IDCT) - dct3(x, norm='ortho') is - exactly the same as the idct function of Matlab. - Parameters ---------- x : array-like input array. + type : {1, 2, 3} + type of the IDCT (see Notes). n : int, optional Length of the transform. axis : int, optional @@ -103,28 +122,24 @@ Notes ----- - There are several definitions, we use the following (norm=None): + For a single dimension array x, idct(x, norm='ortho') is equal to matlab + idct(x) - N-1 - y[k] = x[0] + 2 * sum x[n]*cos(pi*(k+0.5)*n/N), 0 <= k < N. - n=0 + 'The' IDCT is the IDCT of type 2, which is the same as DCT of type 3. - Or (norm='ortho'), for 0 <= k < N: + IDCT of type 1 is the DCT of type 1, IDCT of type 2 is the DCT of type 3, + and IDCT of type 3 is the DCT of type 2. - N-1 - y[k] = x[0] / sqrt(N) + sqrt(1/N) * sum x[n]*cos(pi*(k+0.5)*n/N) - n=0 - - The (unnormalized) DCT-III is the inverse of the (unnormalized) DCT-II, up - to a factor 2*N. The orthonormalized DCT-III is exactly the inverse of the - orthonormalized DCT-II. - - Examples + See Also -------- - >>> x = np.linspace(0, 9, 10) - >>> np.testing.assert_array_almost_equal(dct3(dct2(x)) / 20, x) + dct """ - return _dct(x, 3, n, axis, normalize=norm) + if type == 1 and norm is not None: + raise NotImplementedError( + "Orthonormalization not yet supported for IDCT-I") + # Inverse/forward type table + _TP = {1:1, 2:3, 3:2} + return _dct(x, _TP[type], n, axis, normalize=norm) def _dct(x, type, n=None, axis=-1, overwrite_x=0, normalize=None): """ From scipy-svn at scipy.org Mon Jan 19 03:33:26 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 19 Jan 2009 02:33:26 -0600 (CST) Subject: [Scipy-svn] r5500 - trunk/scipy/fftpack/tests Message-ID: <20090119083326.DE3D2C7C011@scipy.org> Author: cdavid Date: 2009-01-19 02:33:22 -0600 (Mon, 19 Jan 2009) New Revision: 5500 Modified: trunk/scipy/fftpack/tests/test_real_transforms.py Log: Adapt DCT tests to new API. Modified: trunk/scipy/fftpack/tests/test_real_transforms.py =================================================================== --- trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-19 08:33:05 UTC (rev 5499) +++ trunk/scipy/fftpack/tests/test_real_transforms.py 2009-01-19 08:33:22 UTC (rev 5500) @@ -5,7 +5,7 @@ from numpy.fft import fft as numfft from numpy.testing import assert_array_almost_equal, TestCase -from scipy.fftpack.realtransforms import dct1, dct2, dct3 +from scipy.fftpack.realtransforms import dct, idct # Matlab reference data MDATA = np.load(join(dirname(__file__), 'test.npz')) @@ -21,8 +21,6 @@ FFTWDATA_SINGLE = np.load(join(dirname(__file__), 'fftw_single_ref.npz')) FFTWDATA_SIZES = FFTWDATA_DOUBLE['sizes'] -TYPE2DCT = {1: dct1, 2: dct2, 3: dct3} - def fftw_ref(type, size, dt): x = np.linspace(0, size-1, size).astype(dt) if dt == np.double: @@ -39,12 +37,11 @@ self.rdt = None self.dec = 14 self.type = None - self.func = None def test_definition(self): for i in FFTWDATA_SIZES: x, yr = fftw_ref(self.type, i, self.rdt) - y = self.func(x) + y = dct(x, type=self.type) self.failUnless(y.dtype == self.rdt, "Output dtype is %s, expected %s" % (y.dtype, self.rdt)) # XXX: we divide by np.max(y) because the tests fail otherwise. We @@ -58,14 +55,16 @@ nt = 2 for i in [7, 8, 9, 16, 32, 64]: x = np.random.randn(nt, i) - y = self.func(x) + y = dct(x, type=self.type) for j in range(nt): - assert_array_almost_equal(y[j], self.func(x[j]), decimal=self.dec) + assert_array_almost_equal(y[j], dct(x[j], type=self.type), + decimal=self.dec) x = x.T - y = self.func(x, axis=0) + y = dct(x, axis=0, type=self.type) for j in range(nt): - assert_array_almost_equal(y[:,j], self.func(x[:,j]), decimal=self.dec) + assert_array_almost_equal(y[:,j], dct(x[:,j], type=self.type), + decimal=self.dec) class _TestDCTIIBase(_TestDCTBase): def test_definition_matlab(self): @@ -73,7 +72,7 @@ for i in range(len(X)): x = np.array(X[i], dtype=self.rdt) yr = Y[i] - y = dct2(x, norm="ortho") + y = dct(x, norm="ortho", type=2) self.failUnless(y.dtype == self.rdt, "Output dtype is %s, expected %s" % (y.dtype, self.rdt)) assert_array_almost_equal(y, yr, decimal=self.dec) @@ -83,8 +82,8 @@ """Test orthornomal mode.""" for i in range(len(X)): x = np.array(X[i], dtype=self.rdt) - y = dct2(x, norm='ortho') - xi = dct3(y, norm="ortho") + y = dct(x, norm='ortho', type=2) + xi = dct(y, norm="ortho", type=3) self.failUnless(xi.dtype == self.rdt, "Output dtype is %s, expected %s" % (xi.dtype, self.rdt)) assert_array_almost_equal(xi, x, decimal=self.dec) @@ -94,42 +93,96 @@ self.rdt = np.double self.dec = 10 self.type = 1 - self.func = TYPE2DCT[self.type] class TestDCTIFloat(_TestDCTBase): def setUp(self): self.rdt = np.float32 self.dec = 5 self.type = 1 - self.func = TYPE2DCT[self.type] class TestDCTIIDouble(_TestDCTIIBase): def setUp(self): self.rdt = np.double self.dec = 10 self.type = 2 - self.func = TYPE2DCT[self.type] class TestDCTIIFloat(_TestDCTIIBase): def setUp(self): self.rdt = np.float32 self.dec = 5 self.type = 2 - self.func = TYPE2DCT[self.type] class TestDCTIIIDouble(_TestDCTIIIBase): def setUp(self): self.rdt = np.double self.dec = 14 self.type = 3 - self.func = TYPE2DCT[self.type] class TestDCTIIIFloat(_TestDCTIIIBase): def setUp(self): self.rdt = np.float32 self.dec = 5 self.type = 3 - self.func = TYPE2DCT[self.type] +class _TestIDCTBase(TestCase): + def setUp(self): + self.rdt = None + self.dec = 14 + self.type = None + + def test_definition(self): + for i in FFTWDATA_SIZES: + xr, yr = fftw_ref(self.type, i, self.rdt) + y = dct(xr, type=self.type) + x = idct(yr, type=self.type) + if self.type == 1: + x /= 2 * (i-1) + else: + x /= 2 * i + self.failUnless(x.dtype == self.rdt, + "Output dtype is %s, expected %s" % (x.dtype, self.rdt)) + # XXX: we divide by np.max(y) because the tests fail otherwise. We + # should really use something like assert_array_approx_equal. The + # difference is due to fftw using a better algorithm w.r.t error + # propagation compared to the ones from fftpack. + assert_array_almost_equal(x / np.max(x), xr / np.max(x), decimal=self.dec, + err_msg="Size %d failed" % i) + +class TestIDCTIDouble(_TestIDCTBase): + def setUp(self): + self.rdt = np.double + self.dec = 10 + self.type = 1 + +class TestIDCTIFloat(_TestIDCTBase): + def setUp(self): + self.rdt = np.float32 + self.dec = 4 + self.type = 1 + +class TestIDCTIIDouble(_TestIDCTBase): + def setUp(self): + self.rdt = np.double + self.dec = 10 + self.type = 2 + +class TestIDCTIIFloat(_TestIDCTBase): + def setUp(self): + self.rdt = np.float32 + self.dec = 5 + self.type = 2 + +class TestIDCTIIIDouble(_TestIDCTBase): + def setUp(self): + self.rdt = np.double + self.dec = 14 + self.type = 3 + +class TestIDCTIIIFloat(_TestIDCTBase): + def setUp(self): + self.rdt = np.float32 + self.dec = 5 + self.type = 3 + if __name__ == "__main__": np.testing.run_module_suite() From scipy-svn at scipy.org Mon Jan 19 03:37:24 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 19 Jan 2009 02:37:24 -0600 (CST) Subject: [Scipy-svn] r5501 - trunk/scipy/fftpack Message-ID: <20090119083724.093FDC7C011@scipy.org> Author: cdavid Date: 2009-01-19 02:37:20 -0600 (Mon, 19 Jan 2009) New Revision: 5501 Modified: trunk/scipy/fftpack/realtransforms.py Log: Raise an exception for DCT-I and size < 2. Modified: trunk/scipy/fftpack/realtransforms.py =================================================================== --- trunk/scipy/fftpack/realtransforms.py 2009-01-19 08:33:22 UTC (rev 5500) +++ trunk/scipy/fftpack/realtransforms.py 2009-01-19 08:37:20 UTC (rev 5501) @@ -199,6 +199,9 @@ else: nm = 0 + if type == 1 and n < 2: + raise ValueError("DCT-I is not defined for size < 2") + if axis == -1 or axis == len(tmp.shape) - 1: return f(tmp, n, nm, overwrite_x) #else: From scipy-svn at scipy.org Mon Jan 19 03:46:03 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 19 Jan 2009 02:46:03 -0600 (CST) Subject: [Scipy-svn] r5502 - trunk/scipy/fftpack Message-ID: <20090119084603.DF685C7C011@scipy.org> Author: cdavid Date: 2009-01-19 02:45:59 -0600 (Mon, 19 Jan 2009) New Revision: 5502 Modified: trunk/scipy/fftpack/realtransforms.py Log: Make idct available for the public namespace of realtransforms. Modified: trunk/scipy/fftpack/realtransforms.py =================================================================== --- trunk/scipy/fftpack/realtransforms.py 2009-01-19 08:37:20 UTC (rev 5501) +++ trunk/scipy/fftpack/realtransforms.py 2009-01-19 08:45:59 UTC (rev 5502) @@ -2,7 +2,7 @@ Real spectrum tranforms (DCT, DST, MDCT) """ -__all__ = ['dct'] +__all__ = ['dct', 'idct'] import numpy as np from scipy.fftpack import _fftpack From scipy-svn at scipy.org Mon Jan 19 03:46:17 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 19 Jan 2009 02:46:17 -0600 (CST) Subject: [Scipy-svn] r5503 - trunk/scipy/fftpack Message-ID: <20090119084617.E9EA2C7C011@scipy.org> Author: cdavid Date: 2009-01-19 02:46:13 -0600 (Mon, 19 Jan 2009) New Revision: 5503 Modified: trunk/scipy/fftpack/realtransforms.py Log: Forgot to register cache cleaner for single prec DCT. Modified: trunk/scipy/fftpack/realtransforms.py =================================================================== --- trunk/scipy/fftpack/realtransforms.py 2009-01-19 08:45:59 UTC (rev 5502) +++ trunk/scipy/fftpack/realtransforms.py 2009-01-19 08:46:13 UTC (rev 5503) @@ -10,6 +10,8 @@ import atexit atexit.register(_fftpack.destroy_ddct1_cache) atexit.register(_fftpack.destroy_ddct2_cache) +atexit.register(_fftpack.destroy_dct1_cache) +atexit.register(_fftpack.destroy_dct2_cache) def dct(x, type=2, n=None, axis=-1, norm=None): """ From scipy-svn at scipy.org Mon Jan 19 05:25:02 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 19 Jan 2009 04:25:02 -0600 (CST) Subject: [Scipy-svn] r5504 - in branches/0.7.x/scipy: lib/blas lib/lapack linalg Message-ID: <20090119102502.2A30EC7C011@scipy.org> Author: cdavid Date: 2009-01-19 04:24:57 -0600 (Mon, 19 Jan 2009) New Revision: 5504 Modified: branches/0.7.x/scipy/lib/blas/atlas_version.c branches/0.7.x/scipy/lib/lapack/atlas_version.c branches/0.7.x/scipy/linalg/atlas_version.c Log: Do not print atlas build info at import; add a version function if printing is necessary. Modified: branches/0.7.x/scipy/lib/blas/atlas_version.c =================================================================== --- branches/0.7.x/scipy/lib/blas/atlas_version.c 2009-01-19 08:46:13 UTC (rev 5503) +++ branches/0.7.x/scipy/lib/blas/atlas_version.c 2009-01-19 10:24:57 UTC (rev 5504) @@ -1,24 +1,43 @@ #ifdef __CPLUSPLUS__ extern "C" { #endif + #include "Python.h" -static PyMethodDef module_methods[] = { {NULL,NULL} }; -PyMODINIT_FUNC initatlas_version(void) { - PyObject *m = NULL; + +void ATL_buildinfo(void); + +static char doc_version[] = "Print ATLAS build info."; + +static PyObject *version(PyObject* self, PyObject* args) +{ #if defined(NO_ATLAS_INFO) - printf("NO ATLAS INFO AVAILABLE\n"); + printf("NO ATLAS INFO AVAILABLE\n"); #else - void ATL_buildinfo(void); - ATL_buildinfo(); + ATL_buildinfo(); #endif - m = Py_InitModule("atlas_version", module_methods); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyMethodDef module_methods[] = { + {"version", version, METH_VARARGS, doc_version}, + {NULL, NULL, 0, NULL} +}; + +PyMODINIT_FUNC initatlas_version(void) +{ + PyObject *m = NULL; + m = Py_InitModule("atlas_version", module_methods); #if defined(ATLAS_INFO) - { - PyObject *d = PyModule_GetDict(m); - PyDict_SetItemString(d,"ATLAS_VERSION",PyString_FromString(ATLAS_INFO)); - } + { + PyObject *d = PyModule_GetDict(m); + PyDict_SetItemString(d, "ATLAS_VERSION", + PyString_FromString(ATLAS_INFO)); + } #endif } + #ifdef __CPLUSCPLUS__ } #endif Modified: branches/0.7.x/scipy/lib/lapack/atlas_version.c =================================================================== --- branches/0.7.x/scipy/lib/lapack/atlas_version.c 2009-01-19 08:46:13 UTC (rev 5503) +++ branches/0.7.x/scipy/lib/lapack/atlas_version.c 2009-01-19 10:24:57 UTC (rev 5504) @@ -1,24 +1,43 @@ #ifdef __CPLUSPLUS__ extern "C" { #endif + #include "Python.h" -static PyMethodDef module_methods[] = { {NULL,NULL} }; -PyMODINIT_FUNC initatlas_version(void) { - PyObject *m = NULL; + +void ATL_buildinfo(void); + +static char doc_version[] = "Print ATLAS build info."; + +static PyObject *version(PyObject* self, PyObject* args) +{ #if defined(NO_ATLAS_INFO) - printf("NO ATLAS INFO AVAILABLE\n"); + printf("NO ATLAS INFO AVAILABLE\n"); #else - void ATL_buildinfo(void); - ATL_buildinfo(); + ATL_buildinfo(); #endif - m = Py_InitModule("atlas_version", module_methods); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyMethodDef module_methods[] = { + {"version", version, METH_VARARGS, doc_version}, + {NULL, NULL, 0, NULL} +}; + +PyMODINIT_FUNC initatlas_version(void) +{ + PyObject *m = NULL; + m = Py_InitModule("atlas_version", module_methods); #if defined(ATLAS_INFO) - { - PyObject *d = PyModule_GetDict(m); - PyDict_SetItemString(d,"ATLAS_VERSION",PyString_FromString(ATLAS_INFO)); - } + { + PyObject *d = PyModule_GetDict(m); + PyDict_SetItemString(d, "ATLAS_VERSION", + PyString_FromString(ATLAS_INFO)); + } #endif } + #ifdef __CPLUSCPLUS__ } #endif Modified: branches/0.7.x/scipy/linalg/atlas_version.c =================================================================== --- branches/0.7.x/scipy/linalg/atlas_version.c 2009-01-19 08:46:13 UTC (rev 5503) +++ branches/0.7.x/scipy/linalg/atlas_version.c 2009-01-19 10:24:57 UTC (rev 5504) @@ -1,24 +1,43 @@ #ifdef __CPLUSPLUS__ extern "C" { #endif + #include "Python.h" -static PyMethodDef module_methods[] = { {NULL,NULL} }; -PyMODINIT_FUNC initatlas_version(void) { - PyObject *m = NULL; + +void ATL_buildinfo(void); + +static char doc_version[] = "Print ATLAS build info."; + +static PyObject *version(PyObject* self, PyObject* args) +{ #if defined(NO_ATLAS_INFO) - printf("NO ATLAS INFO AVAILABLE\n"); + printf("NO ATLAS INFO AVAILABLE\n"); #else - void ATL_buildinfo(void); - ATL_buildinfo(); + ATL_buildinfo(); #endif - m = Py_InitModule("atlas_version", module_methods); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyMethodDef module_methods[] = { + {"version", version, METH_VARARGS, doc_version}, + {NULL, NULL, 0, NULL} +}; + +PyMODINIT_FUNC initatlas_version(void) +{ + PyObject *m = NULL; + m = Py_InitModule("atlas_version", module_methods); #if defined(ATLAS_INFO) - { - PyObject *d = PyModule_GetDict(m); - PyDict_SetItemString(d,"ATLAS_VERSION",PyString_FromString(ATLAS_INFO)); - } + { + PyObject *d = PyModule_GetDict(m); + PyDict_SetItemString(d, "ATLAS_VERSION", + PyString_FromString(ATLAS_INFO)); + } #endif } + #ifdef __CPLUSCPLUS__ } #endif From scipy-svn at scipy.org Mon Jan 19 05:26:59 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 19 Jan 2009 04:26:59 -0600 (CST) Subject: [Scipy-svn] r5505 - in branches/0.7.x/scipy: lib/blas lib/lapack linalg Message-ID: <20090119102659.B8F7BC7C011@scipy.org> Author: cdavid Date: 2009-01-19 04:26:55 -0600 (Mon, 19 Jan 2009) New Revision: 5505 Modified: branches/0.7.x/scipy/lib/blas/atlas_version.c branches/0.7.x/scipy/lib/lapack/atlas_version.c branches/0.7.x/scipy/linalg/atlas_version.c Log: Revert change 5504 - I applied it to the wrong branch. Modified: branches/0.7.x/scipy/lib/blas/atlas_version.c =================================================================== --- branches/0.7.x/scipy/lib/blas/atlas_version.c 2009-01-19 10:24:57 UTC (rev 5504) +++ branches/0.7.x/scipy/lib/blas/atlas_version.c 2009-01-19 10:26:55 UTC (rev 5505) @@ -1,43 +1,24 @@ #ifdef __CPLUSPLUS__ extern "C" { #endif - #include "Python.h" - -void ATL_buildinfo(void); - -static char doc_version[] = "Print ATLAS build info."; - -static PyObject *version(PyObject* self, PyObject* args) -{ +static PyMethodDef module_methods[] = { {NULL,NULL} }; +PyMODINIT_FUNC initatlas_version(void) { + PyObject *m = NULL; #if defined(NO_ATLAS_INFO) - printf("NO ATLAS INFO AVAILABLE\n"); + printf("NO ATLAS INFO AVAILABLE\n"); #else - ATL_buildinfo(); + void ATL_buildinfo(void); + ATL_buildinfo(); #endif - - Py_INCREF(Py_None); - return Py_None; -} - -static PyMethodDef module_methods[] = { - {"version", version, METH_VARARGS, doc_version}, - {NULL, NULL, 0, NULL} -}; - -PyMODINIT_FUNC initatlas_version(void) -{ - PyObject *m = NULL; - m = Py_InitModule("atlas_version", module_methods); + m = Py_InitModule("atlas_version", module_methods); #if defined(ATLAS_INFO) - { - PyObject *d = PyModule_GetDict(m); - PyDict_SetItemString(d, "ATLAS_VERSION", - PyString_FromString(ATLAS_INFO)); - } + { + PyObject *d = PyModule_GetDict(m); + PyDict_SetItemString(d,"ATLAS_VERSION",PyString_FromString(ATLAS_INFO)); + } #endif } - #ifdef __CPLUSCPLUS__ } #endif Modified: branches/0.7.x/scipy/lib/lapack/atlas_version.c =================================================================== --- branches/0.7.x/scipy/lib/lapack/atlas_version.c 2009-01-19 10:24:57 UTC (rev 5504) +++ branches/0.7.x/scipy/lib/lapack/atlas_version.c 2009-01-19 10:26:55 UTC (rev 5505) @@ -1,43 +1,24 @@ #ifdef __CPLUSPLUS__ extern "C" { #endif - #include "Python.h" - -void ATL_buildinfo(void); - -static char doc_version[] = "Print ATLAS build info."; - -static PyObject *version(PyObject* self, PyObject* args) -{ +static PyMethodDef module_methods[] = { {NULL,NULL} }; +PyMODINIT_FUNC initatlas_version(void) { + PyObject *m = NULL; #if defined(NO_ATLAS_INFO) - printf("NO ATLAS INFO AVAILABLE\n"); + printf("NO ATLAS INFO AVAILABLE\n"); #else - ATL_buildinfo(); + void ATL_buildinfo(void); + ATL_buildinfo(); #endif - - Py_INCREF(Py_None); - return Py_None; -} - -static PyMethodDef module_methods[] = { - {"version", version, METH_VARARGS, doc_version}, - {NULL, NULL, 0, NULL} -}; - -PyMODINIT_FUNC initatlas_version(void) -{ - PyObject *m = NULL; - m = Py_InitModule("atlas_version", module_methods); + m = Py_InitModule("atlas_version", module_methods); #if defined(ATLAS_INFO) - { - PyObject *d = PyModule_GetDict(m); - PyDict_SetItemString(d, "ATLAS_VERSION", - PyString_FromString(ATLAS_INFO)); - } + { + PyObject *d = PyModule_GetDict(m); + PyDict_SetItemString(d,"ATLAS_VERSION",PyString_FromString(ATLAS_INFO)); + } #endif } - #ifdef __CPLUSCPLUS__ } #endif Modified: branches/0.7.x/scipy/linalg/atlas_version.c =================================================================== --- branches/0.7.x/scipy/linalg/atlas_version.c 2009-01-19 10:24:57 UTC (rev 5504) +++ branches/0.7.x/scipy/linalg/atlas_version.c 2009-01-19 10:26:55 UTC (rev 5505) @@ -1,43 +1,24 @@ #ifdef __CPLUSPLUS__ extern "C" { #endif - #include "Python.h" - -void ATL_buildinfo(void); - -static char doc_version[] = "Print ATLAS build info."; - -static PyObject *version(PyObject* self, PyObject* args) -{ +static PyMethodDef module_methods[] = { {NULL,NULL} }; +PyMODINIT_FUNC initatlas_version(void) { + PyObject *m = NULL; #if defined(NO_ATLAS_INFO) - printf("NO ATLAS INFO AVAILABLE\n"); + printf("NO ATLAS INFO AVAILABLE\n"); #else - ATL_buildinfo(); + void ATL_buildinfo(void); + ATL_buildinfo(); #endif - - Py_INCREF(Py_None); - return Py_None; -} - -static PyMethodDef module_methods[] = { - {"version", version, METH_VARARGS, doc_version}, - {NULL, NULL, 0, NULL} -}; - -PyMODINIT_FUNC initatlas_version(void) -{ - PyObject *m = NULL; - m = Py_InitModule("atlas_version", module_methods); + m = Py_InitModule("atlas_version", module_methods); #if defined(ATLAS_INFO) - { - PyObject *d = PyModule_GetDict(m); - PyDict_SetItemString(d, "ATLAS_VERSION", - PyString_FromString(ATLAS_INFO)); - } + { + PyObject *d = PyModule_GetDict(m); + PyDict_SetItemString(d,"ATLAS_VERSION",PyString_FromString(ATLAS_INFO)); + } #endif } - #ifdef __CPLUSCPLUS__ } #endif From scipy-svn at scipy.org Mon Jan 19 05:29:17 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 19 Jan 2009 04:29:17 -0600 (CST) Subject: [Scipy-svn] r5506 - in trunk/scipy/lib: blas lapack Message-ID: <20090119102917.48BBAC7C011@scipy.org> Author: cdavid Date: 2009-01-19 04:29:13 -0600 (Mon, 19 Jan 2009) New Revision: 5506 Modified: trunk/scipy/lib/blas/atlas_version.c trunk/scipy/lib/lapack/atlas_version.c Log: Do not show atlas build info when importing atlas_version: forgot to apply the changes to scipy.lib as well. Modified: trunk/scipy/lib/blas/atlas_version.c =================================================================== --- trunk/scipy/lib/blas/atlas_version.c 2009-01-19 10:26:55 UTC (rev 5505) +++ trunk/scipy/lib/blas/atlas_version.c 2009-01-19 10:29:13 UTC (rev 5506) @@ -1,24 +1,33 @@ -#ifdef __CPLUSPLUS__ -extern "C" { -#endif #include "Python.h" -static PyMethodDef module_methods[] = { {NULL,NULL} }; -PyMODINIT_FUNC initatlas_version(void) { - PyObject *m = NULL; + +static PyObject* version(PyObject* self, PyObject* dummy) +{ #if defined(NO_ATLAS_INFO) - printf("NO ATLAS INFO AVAILABLE\n"); + printf("NO ATLAS INFO AVAILABLE\n"); #else - void ATL_buildinfo(void); - ATL_buildinfo(); + void ATL_buildinfo(void); + ATL_buildinfo(); #endif - m = Py_InitModule("atlas_version", module_methods); + + Py_INCREF(Py_None); + return Py_None; +} + +static char version_doc[] = "Print the build info from atlas."; + +static PyMethodDef module_methods[] = { + {"version", version, METH_VARARGS, version_doc}, + {NULL, NULL, 0, NULL} +}; + +PyMODINIT_FUNC initatlas_version(void) +{ + PyObject *m = NULL; + m = Py_InitModule("atlas_version", module_methods); #if defined(ATLAS_INFO) - { - PyObject *d = PyModule_GetDict(m); - PyDict_SetItemString(d,"ATLAS_VERSION",PyString_FromString(ATLAS_INFO)); - } + { + PyObject *d = PyModule_GetDict(m); + PyDict_SetItemString(d,"ATLAS_VERSION",PyString_FromString(ATLAS_INFO)); + } #endif } -#ifdef __CPLUSCPLUS__ -} -#endif Modified: trunk/scipy/lib/lapack/atlas_version.c =================================================================== --- trunk/scipy/lib/lapack/atlas_version.c 2009-01-19 10:26:55 UTC (rev 5505) +++ trunk/scipy/lib/lapack/atlas_version.c 2009-01-19 10:29:13 UTC (rev 5506) @@ -1,24 +1,33 @@ -#ifdef __CPLUSPLUS__ -extern "C" { -#endif #include "Python.h" -static PyMethodDef module_methods[] = { {NULL,NULL} }; -PyMODINIT_FUNC initatlas_version(void) { - PyObject *m = NULL; + +static PyObject* version(PyObject* self, PyObject* dummy) +{ #if defined(NO_ATLAS_INFO) - printf("NO ATLAS INFO AVAILABLE\n"); + printf("NO ATLAS INFO AVAILABLE\n"); #else - void ATL_buildinfo(void); - ATL_buildinfo(); + void ATL_buildinfo(void); + ATL_buildinfo(); #endif - m = Py_InitModule("atlas_version", module_methods); + + Py_INCREF(Py_None); + return Py_None; +} + +static char version_doc[] = "Print the build info from atlas."; + +static PyMethodDef module_methods[] = { + {"version", version, METH_VARARGS, version_doc}, + {NULL, NULL, 0, NULL} +}; + +PyMODINIT_FUNC initatlas_version(void) +{ + PyObject *m = NULL; + m = Py_InitModule("atlas_version", module_methods); #if defined(ATLAS_INFO) - { - PyObject *d = PyModule_GetDict(m); - PyDict_SetItemString(d,"ATLAS_VERSION",PyString_FromString(ATLAS_INFO)); - } + { + PyObject *d = PyModule_GetDict(m); + PyDict_SetItemString(d,"ATLAS_VERSION",PyString_FromString(ATLAS_INFO)); + } #endif } -#ifdef __CPLUSCPLUS__ -} -#endif From scipy-svn at scipy.org Mon Jan 19 13:48:39 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 19 Jan 2009 12:48:39 -0600 (CST) Subject: [Scipy-svn] r5507 - in trunk/scipy/special: specfun tests Message-ID: <20090119184839.08F1BC7C011@scipy.org> Author: ptvirtan Date: 2009-01-19 12:48:21 -0600 (Mon, 19 Jan 2009) New Revision: 5507 Modified: trunk/scipy/special/specfun/specfun.f trunk/scipy/special/tests/test_basic.py Log: Fix #852: improve accuracy of jn_zeros by refactoring Specfun JYNDD, JYNB Code to calculate the value of Bessel functions of integer order was duplicated in specfun.f routines JYNDD and JYNB. The former routine didn't do asymptotic expansion, and its results were bad for large values of x, resulting to errors in `scipy.special.jn_zeros`. This commit refactors the common code of these two functions to JYNBH, and makes JYZO Newton tolerances stricter. The changes to JYNDD also remove the limitation n <= 101. Improved tests for jn_zeros are included. Modified: trunk/scipy/special/specfun/specfun.f =================================================================== --- trunk/scipy/special/specfun/specfun.f 2009-01-19 10:29:13 UTC (rev 5506) +++ trunk/scipy/special/specfun/specfun.f 2009-01-19 18:48:21 UTC (rev 5507) @@ -1863,55 +1863,24 @@ C BYN --- Yn(x) C DYN --- Yn'(x) C FYN --- Yn"(x) +C Routines called: +C JYNBH to compute Jn and Yn C =========================================================== C IMPLICIT DOUBLE PRECISION (A-H,O-Z) - DIMENSION BJ(102),BY(102) - DO 10 NT=1,900 - MT=INT(0.5*LOG10(6.28*NT)-NT*LOG10(1.36*DABS(X)/NT)) - IF (MT.GT.20) GO TO 15 -10 CONTINUE -15 M=NT - BS=0.0D0 - F0=0.0D0 - F1=1.0D-35 - SU=0.0D0 - F=0.0D0 - DO 20 K=M,0,-1 - F=2.0D0*(K+1.0D0)*F1/X-F0 - IF (K.LE.N+1) BJ(K+1)=F - IF (K.EQ.2*INT(K/2)) THEN - BS=BS+2.0D0*F - IF (K.NE.0) SU=SU+(-1)**(K/2)*F/K - ENDIF - F0=F1 -20 F1=F - DO 25 K=0,N+1 -25 BJ(K+1)=BJ(K+1)/(BS-F) - BJN=BJ(N+1) - EC=0.5772156649015329D0 - E0=0.3183098861837907D0 - S1=2.0D0*E0*(DLOG(X/2.0D0)+EC)*BJ(1) - F0=S1-8.0D0*E0*SU/(BS-F) - F1=(BJ(2)*F0-2.0D0*E0/X)/BJ(1) - BY(1)=F0 - BY(2)=F1 - DO 30 K=2,N+1 - F=2.0D0*(K-1.0D0)*F1/X-F0 - BY(K+1)=F - F0=F1 -30 F1=F - BYN=BY(N+1) - DJN=-BJ(N+2)+N*BJ(N+1)/X - DYN=-BY(N+2)+N*BY(N+1)/X + DIMENSION BJ(2),BY(2) + CALL JYNBH(N+1,N,X,NM,BJ,BY) +C Compute derivatives by differentiation formulas + BJN=BJ(1) + BYN=BY(1) + DJN=-BJ(2)+N*BJ(1)/X + DYN=-BY(2)+N*BY(1)/X FJN=(N*N/(X*X)-1.0D0)*BJN-DJN/X FYN=(N*N/(X*X)-1.0D0)*BYN-DYN/X RETURN END - - C ********************************** SUBROUTINE GAM0 (X,GA) @@ -4253,27 +4222,61 @@ C DY(n) --- Yn'(x) C NM --- Highest order computed C Routines called: +C JYNBH to calculate the Jn and Yn +C ===================================================== +C + IMPLICIT DOUBLE PRECISION (A-H,O-Z) + DIMENSION BJ(0:N),DJ(0:N),BY(0:N),DY(0:N) + CALL JYNBH(N,0,X,NM,BJ,BY) +C Compute derivatives by differentiation formulas + IF (X.LT.1.0D-100) THEN + DO 10 K=0,N + DJ(K) = 0.0D0 + 10 DY(K) = 1.0D+300 + DJ(1)=0.5D0 + ELSE + DJ(0)=-BJ(1) + DO 40 K=1,NM + 40 DJ(K)=BJ(K-1)-K/X*BJ(K) + DY(0)=-BY(1) + DO 50 K=1,NM + 50 DY(K)=BY(K-1)-K*BY(K)/X + END IF + RETURN + END + + +C ********************************** + + SUBROUTINE JYNBH(N,NMIN,X,NM,BJ,BY) +C +C ===================================================== +C Purpose: Compute Bessel functions Jn(x), Yn(x) +C Input : x --- Argument of Jn(x) and Yn(x) ( x ? 0 ) +C n --- Highest order of Jn(x) and Yn(x) computed ( n ? 0 ) +C nmin -- Lowest order computed ( nmin ? 0 ) +C Output: BJ(n-NMIN) --- Jn(x) ; if indexing starts at 0 +C BY(n-NMIN) --- Yn(x) ; if indexing starts at 0 +C NM --- Highest order computed +C Routines called: C MSTA1 and MSTA2 to calculate the starting C point for backward recurrence C ===================================================== C IMPLICIT DOUBLE PRECISION (A-H,O-Z) - DIMENSION BJ(0:N),DJ(0:N),BY(0:N),DY(0:N), - & A(4),B(4),A1(4),B1(4) + DIMENSION BJ(0:N-NMIN),BY(0:N-NMIN),A(4),B(4),A1(4),B1(4) PI=3.141592653589793D0 R2P=.63661977236758D0 NM=N IF (X.LT.1.0D-100) THEN - DO 10 K=0,N - BJ(K)=0.0D0 - DJ(K)=0.0D0 - BY(K)=-1.0D+300 -10 DY(K)=1.0D+300 - BJ(0)=1.0D0 - DJ(1)=0.5D0 + DO 10 K=NMIN,N + BJ(K-NMIN)=0.0D0 +10 BY(K-NMIN)=-1.0D+300 + IF (NMIN.EQ.0) BJ(0)=1.0D0 RETURN ENDIF IF (X.LE.300.0.OR.N.GT.INT(0.9*X)) THEN +C Backward recurrence for Jn IF (N.EQ.0) NM=1 M=MSTA1(X,200) IF (M.LT.NM) THEN @@ -4289,7 +4292,7 @@ F=0.0D0 DO 15 K=M,0,-1 F=2.0D0*(K+1.0D0)/X*F1-F2 - IF (K.LE.NM) BJ(K)=F + IF (K.LE.NM .AND. K.GE.NMIN) BJ(K-NMIN)=F IF (K.EQ.2*INT(K/2).AND.K.NE.0) THEN BS=BS+2.0D0*F SU=SU+(-1)**(K/2)*F/K @@ -4299,14 +4302,19 @@ F2=F1 15 F1=F S0=BS+F - DO 20 K=0,NM -20 BJ(K)=BJ(K)/S0 + DO 20 K=NMIN,NM +20 BJ(K-NMIN)=BJ(K-NMIN)/S0 +C Estimates for Yn at start of recurrence + BJ0 = F1 / S0 + BJ1 = F2 / S0 EC=DLOG(X/2.0D0)+0.5772156649015329D0 - BY0=R2P*(EC*BJ(0)-4.0D0*SU/S0) - BY(0)=BY0 - BY1=R2P*((EC-1.0D0)*BJ(1)-BJ(0)/X-4.0D0*SV/S0) - BY(1)=BY1 + BY0=R2P*(EC*BJ0-4.0D0*SU/S0) + BY1=R2P*((EC-1.0D0)*BJ1-BJ0/X-4.0D0*SV/S0) + IF (0.GE.NMIN) BY(0-NMIN)=BY0 + IF (1.GE.NMIN) BY(1-NMIN)=BY1 + KY=2 ELSE +C Hankel expansion DATA A/-.7031250000000000D-01,.1121520996093750D+00, & -.5725014209747314D+00,.6074042001273483D+01/ DATA B/ .7324218750000000D-01,-.2271080017089844D+00, @@ -4324,8 +4332,8 @@ CU=DSQRT(R2P/X) BJ0=CU*(P0*DCOS(T1)-Q0*DSIN(T1)) BY0=CU*(P0*DSIN(T1)+Q0*DCOS(T1)) - BJ(0)=BJ0 - BY(0)=BY0 + IF (0.GE.NMIN) BJ(0-NMIN)=BJ0 + IF (0.GE.NMIN) BY(0-NMIN)=BY0 T2=X-0.75D0*PI P1=1.0D0 Q1=0.375D0/X @@ -4334,25 +4342,21 @@ 30 Q1=Q1+B1(K)*X**(-2*K-1) BJ1=CU*(P1*DCOS(T2)-Q1*DSIN(T2)) BY1=CU*(P1*DSIN(T2)+Q1*DCOS(T2)) - BJ(1)=BJ1 - BY(1)=BY1 + IF (1.GE.NMIN) BJ(1-NMIN)=BJ1 + IF (1.GE.NMIN) BY(1-NMIN)=BY1 DO 35 K=2,NM BJK=2.0D0*(K-1.0D0)/X*BJ1-BJ0 - BJ(K)=BJK + IF (K.GE.NMIN) BJ(K-NMIN)=BJK BJ0=BJ1 35 BJ1=BJK + KY=2 ENDIF - DJ(0)=-BJ(1) - DO 40 K=1,NM -40 DJ(K)=BJ(K-1)-K/X*BJ(K) - DO 45 K=2,NM +C Forward recurrence for Yn + DO 45 K=KY,NM BYK=2.0D0*(K-1.0D0)*BY1/X-BY0 - BY(K)=BYK + IF (K.GE.NMIN) BY(K-NMIN)=BYK BY0=BY1 45 BY1=BYK - DY(0)=-BY(1) - DO 50 K=1,NM -50 DY(K)=BY(K-1)-K*BY(K)/X RETURN END @@ -10416,20 +10420,27 @@ C IMPLICIT DOUBLE PRECISION (A-H,O-Z) DIMENSION RJ0(NT),RJ1(NT),RY0(NT),RY1(NT) + PI=3.141592653589793D0 +C -- Newton method for j_{N,L} +C 1) initial guess for j_{N,1} IF (N.LE.20) THEN X=2.82141+1.15859*N ELSE +C Abr & Stg (9.5.14) X=N+1.85576*N**0.33333+1.03315/N**0.33333 ENDIF L=0 +C 2) iterate 10 X0=X CALL JYNDD(N,X,BJN,DJN,FJN,BYN,DYN,FYN) X=X-BJN/DJN - IF (DABS(X-X0).GT.1.0D-9) GO TO 10 + IF (DABS(X-X0).GT.1.0D-11) GO TO 10 +C 3) initial guess for j_{N,L+1} L=L+1 RJ0(L)=X - X=X+3.1416+(0.0972+0.0679*N-0.000354*N**2)/L + X=X+PI+(0.0972+0.0679*N-0.000354*N**2)/L IF (L.LT.NT) GO TO 10 +C -- Newton method for j_{N,L}' IF (N.LE.20) THEN X=0.961587+1.07703*N ELSE @@ -10440,38 +10451,40 @@ 15 X0=X CALL JYNDD(N,X,BJN,DJN,FJN,BYN,DYN,FYN) X=X-DJN/FJN - IF (DABS(X-X0).GT.1.0D-9) GO TO 15 + IF (DABS(X-X0).GT.1.0D-11) GO TO 15 L=L+1 RJ1(L)=X - X=X+3.1416+(0.4955+0.0915*N-0.000435*N**2)/L + X=X+PI+(0.4955+0.0915*N-0.000435*N**2)/L IF (L.LT.NT) GO TO 15 IF (N.LE.20) THEN X=1.19477+1.08933*N ELSE X=N+0.93158*N**0.33333+0.26035/N**0.33333 ENDIF +C -- Newton method for y_{N,L} L=0 20 X0=X CALL JYNDD(N,X,BJN,DJN,FJN,BYN,DYN,FYN) X=X-BYN/DYN - IF (DABS(X-X0).GT.1.0D-9) GO TO 20 + IF (DABS(X-X0).GT.1.0D-11) GO TO 20 L=L+1 RY0(L)=X - X=X+3.1416+(0.312+0.0852*N-0.000403*N**2)/L + X=X+PI+(0.312+0.0852*N-0.000403*N**2)/L IF (L.LT.NT) GO TO 20 IF (N.LE.20) THEN X=2.67257+1.16099*N ELSE X=N+1.8211*N**0.33333+0.94001/N**0.33333 ENDIF +C -- Newton method for y_{N,L}' L=0 25 X0=X CALL JYNDD(N,X,BJN,DJN,FJN,BYN,DYN,FYN) X=X-DYN/FYN - IF (DABS(X-X0).GT.1.0D-9) GO TO 25 + IF (DABS(X-X0).GT.1.0D-11) GO TO 25 L=L+1 RY1(L)=X - X=X+3.1416+(0.197+0.0643*N-0.000286*N**2)/L + X=X+PI+(0.197+0.0643*N-0.000286*N**2)/L IF (L.LT.NT) GO TO 25 RETURN END Modified: trunk/scipy/special/tests/test_basic.py =================================================================== --- trunk/scipy/special/tests/test_basic.py 2009-01-19 10:29:13 UTC (rev 5506) +++ trunk/scipy/special/tests/test_basic.py 2009-01-19 18:48:21 UTC (rev 5507) @@ -1399,6 +1399,16 @@ 13.32369, 16.47063]),4) + def test_jn_zeros_large(self): + jn0 = jn_zeros(0, 300) + assert_tol_equal(jn0[260-1], 816.02884495068867280, rtol=1e-13) + assert_tol_equal(jn0[280-1], 878.86068707124422606, rtol=1e-13) + assert_tol_equal(jn0[300-1], 941.69253065317954064, rtol=1e-13) + jn10 = jn_zeros(10, 300) + assert_tol_equal(jn10[260-1], 831.67668514305631151, rtol=1e-13) + assert_tol_equal(jn10[280-1], 894.51275095371316931, rtol=1e-13) + assert_tol_equal(jn10[300-1], 957.34826370866539775, rtol=1e-13) + def test_jnjnp_zeros(self): pass #jnjp = jnjnp(3) From scipy-svn at scipy.org Mon Jan 19 13:49:36 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 19 Jan 2009 12:49:36 -0600 (CST) Subject: [Scipy-svn] r5508 - in trunk/scipy/special: . specfun tests Message-ID: <20090119184936.46ACBC7C011@scipy.org> Author: ptvirtan Date: 2009-01-19 12:48:55 -0600 (Mon, 19 Jan 2009) New Revision: 5508 Modified: trunk/scipy/special/basic.py trunk/scipy/special/specfun.pyf trunk/scipy/special/specfun/specfun.f trunk/scipy/special/tests/test_basic.py Log: Fixing #852: make specfun.f:JYZO work also for N >= 101. In addition to removing the checks for N, this requires rewriting the Newton iterations in JYZO to be more robust, because for large N the initial guess used between successive zeros becomes inaccurate. Additional tests for jn/yn zeros are included. Modified: trunk/scipy/special/basic.py =================================================================== --- trunk/scipy/special/basic.py 2009-01-19 18:48:21 UTC (rev 5507) +++ trunk/scipy/special/basic.py 2009-01-19 18:48:55 UTC (rev 5508) @@ -81,7 +81,7 @@ raise ValueError, "Arguments must be integers." if (nt <=0): raise ValueError, "nt > 0" - return specfun.jyzo(n,nt) + return specfun.jyzo(abs(n),nt) def jn_zeros(n,nt): """Compute nt zeros of the Bessel function Jn(x). Modified: trunk/scipy/special/specfun/specfun.f =================================================================== --- trunk/scipy/special/specfun/specfun.f 2009-01-19 18:48:21 UTC (rev 5507) +++ trunk/scipy/special/specfun/specfun.f 2009-01-19 18:48:55 UTC (rev 5508) @@ -10408,7 +10408,7 @@ C ====================================================== C Purpose: Compute the zeros of Bessel functions Jn(x), C Yn(x), and their derivatives -C Input : n --- Order of Bessel functions ( n ? 101 ) +C Input : n --- Order of Bessel functions (n >= 0) C NT --- Number of zeros (roots) C Output: RJ0(L) --- L-th zero of Jn(x), L=1,2,...,NT C RJ1(L) --- L-th zero of Jn'(x), L=1,2,...,NT @@ -10431,14 +10431,23 @@ ENDIF L=0 C 2) iterate + XGUESS=X 10 X0=X CALL JYNDD(N,X,BJN,DJN,FJN,BYN,DYN,FYN) X=X-BJN/DJN + IF (X-X0.LT.-1) X=X0-1 + IF (X-X0.GT.1) X=X0+1 IF (DABS(X-X0).GT.1.0D-11) GO TO 10 C 3) initial guess for j_{N,L+1} + IF (L.GE.1 .AND. X.LE.RJ0(L)+0.5) THEN + X=XGUESS+PI + XGUESS=X + GO TO 10 + END IF L=L+1 RJ0(L)=X - X=X+PI+(0.0972+0.0679*N-0.000354*N**2)/L +C XXX: should have a better initial guess for large N ~> 100 here + X=X+PI+MAX((0.0972+0.0679*N-0.000354*N**2)/L, 0d0) IF (L.LT.NT) GO TO 10 C -- Newton method for j_{N,L}' IF (N.LE.20) THEN @@ -10448,43 +10457,68 @@ ENDIF IF (N.EQ.0) X=3.8317 L=0 + XGUESS=X 15 X0=X CALL JYNDD(N,X,BJN,DJN,FJN,BYN,DYN,FYN) X=X-DJN/FJN + IF (X-X0.LT.-1) X=X0-1 + IF (X-X0.GT.1) X=X0+1 IF (DABS(X-X0).GT.1.0D-11) GO TO 15 + IF (L.GE.1 .AND. X.LE.RJ1(L)+0.5) THEN + X=XGUESS+PI + XGUESS=X + GO TO 15 + END IF L=L+1 RJ1(L)=X - X=X+PI+(0.4955+0.0915*N-0.000435*N**2)/L +C XXX: should have a better initial guess for large N ~> 100 here + X=X+PI+MAX((0.4955+0.0915*N-0.000435*N**2)/L,0d0) IF (L.LT.NT) GO TO 15 +C -- Newton method for y_{N,L} IF (N.LE.20) THEN X=1.19477+1.08933*N ELSE X=N+0.93158*N**0.33333+0.26035/N**0.33333 ENDIF -C -- Newton method for y_{N,L} L=0 + XGUESS=X 20 X0=X CALL JYNDD(N,X,BJN,DJN,FJN,BYN,DYN,FYN) X=X-BYN/DYN + IF (X-X0.LT.-1) X=X0-1 + IF (X-X0.GT.1) X=X0+1 IF (DABS(X-X0).GT.1.0D-11) GO TO 20 + IF (L.GE.1 .AND. X.LE.RY0(L)+0.5) THEN + X=XGUESS+PI + XGUESS=X + GO TO 20 + END IF L=L+1 RY0(L)=X - X=X+PI+(0.312+0.0852*N-0.000403*N**2)/L +C XXX: should have a better initial guess for large N ~> 100 here + X=X+PI+MAX((0.312+0.0852*N-0.000403*N**2)/L,0d0) IF (L.LT.NT) GO TO 20 +C -- Newton method for y_{N,L}' IF (N.LE.20) THEN X=2.67257+1.16099*N ELSE X=N+1.8211*N**0.33333+0.94001/N**0.33333 ENDIF -C -- Newton method for y_{N,L}' L=0 + XGUESS=X 25 X0=X CALL JYNDD(N,X,BJN,DJN,FJN,BYN,DYN,FYN) X=X-DYN/FYN IF (DABS(X-X0).GT.1.0D-11) GO TO 25 + IF (L.GE.1 .AND. X.LE.RY1(L)+0.5) THEN + X=XGUESS+PI + XGUESS=X + GO TO 25 + END IF L=L+1 RY1(L)=X - X=X+PI+(0.197+0.0643*N-0.000286*N**2)/L +C XXX: should have a better initial guess for large N ~> 100 here + X=X+PI+MAX((0.197+0.0643*N-0.000286*N**2)/L,0d0) IF (L.LT.NT) GO TO 25 RETURN END Modified: trunk/scipy/special/specfun.pyf =================================================================== --- trunk/scipy/special/specfun.pyf 2009-01-19 18:48:21 UTC (rev 5507) +++ trunk/scipy/special/specfun.pyf 2009-01-19 18:48:55 UTC (rev 5508) @@ -410,7 +410,7 @@ ! rswfo ! ch12n subroutine jyzo(n,nt,rj0,rj1,ry0,ry1) ! in :specfun:specfun.f - integer intent(in), check(abs(n)<=101) :: n + integer intent(in), check(n>=0) :: n integer intent(in), check(nt>0) :: nt double precision intent(out),dimension(nt),depend(nt) :: rj0 double precision intent(out),dimension(nt),depend(nt) :: rj1 Modified: trunk/scipy/special/tests/test_basic.py =================================================================== --- trunk/scipy/special/tests/test_basic.py 2009-01-19 18:48:21 UTC (rev 5507) +++ trunk/scipy/special/tests/test_basic.py 2009-01-19 18:48:55 UTC (rev 5508) @@ -1399,16 +1399,38 @@ 13.32369, 16.47063]),4) - def test_jn_zeros_large(self): + jn102 = jn_zeros(102,5) + assert_tol_equal(jn102, array([110.89174935992040343, + 117.83464175788308398, + 123.70194191713507279, + 129.02417238949092824, + 134.00114761868422559]), rtol=1e-13) + + jn301 = jn_zeros(301,5) + assert_tol_equal(jn301, array([313.59097866698830153, + 323.21549776096288280, + 331.22338738656748796, + 338.39676338872084500, + 345.03284233056064157]), rtol=1e-13) + + def test_jn_zeros_slow(self): jn0 = jn_zeros(0, 300) assert_tol_equal(jn0[260-1], 816.02884495068867280, rtol=1e-13) assert_tol_equal(jn0[280-1], 878.86068707124422606, rtol=1e-13) assert_tol_equal(jn0[300-1], 941.69253065317954064, rtol=1e-13) + jn10 = jn_zeros(10, 300) assert_tol_equal(jn10[260-1], 831.67668514305631151, rtol=1e-13) assert_tol_equal(jn10[280-1], 894.51275095371316931, rtol=1e-13) assert_tol_equal(jn10[300-1], 957.34826370866539775, rtol=1e-13) + jn3010 = jn_zeros(3010,5) + assert_tol_equal(jn3010, array([3036.86590780927, + 3057.06598526482, + 3073.66360690272, + 3088.37736494778, + 3101.86438139042]), rtol=1e-8) + def test_jnjnp_zeros(self): pass #jnjp = jnjnp(3) @@ -1423,6 +1445,8 @@ 8.53632, 11.70600, 14.86359]),4) + jnp = jnp_zeros(443,5) + assert_tol_equal(jvp(443, jnp), 0, atol=1e-15) def test_jnyn_zeros(self): jnz = jnyn_zeros(1,5) @@ -1445,7 +1469,7 @@ 6.94150, 10.12340, 13.28576, - 16.44006])),4) + 16.44006])),5) def test_jvp(self): jvprim = jvp(2,2) @@ -1568,10 +1592,16 @@ def test_yn_zeros(self): an = yn_zeros(4,2) assert_array_almost_equal(an,array([ 5.64515, 9.36162]),5) + an = yn_zeros(443,5) + assert_tol_equal(an, [450.13573091578090314, 463.05692376675001542, + 472.80651546418663566, 481.27353184725625838, + 488.98055964441374646], rtol=1e-19) def test_ynp_zeros(self): ao = ynp_zeros(0,2) assert_array_almost_equal(ao,array([ 2.19714133, 5.42968104]),6) + ao = ynp_zeros(443,5) + assert_tol_equal(yvp(443, ao), 0, atol=1e-15) def test_yn(self): yn2n = yn(1,.2) From scipy-svn at scipy.org Thu Jan 22 10:53:32 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 22 Jan 2009 09:53:32 -0600 (CST) Subject: [Scipy-svn] r5509 - branches/0.7.x/tools/win32/build_scripts Message-ID: <20090122155332.DB068C7C029@scipy.org> Author: cdavid Date: 2009-01-22 09:53:25 -0600 (Thu, 22 Jan 2009) New Revision: 5509 Added: branches/0.7.x/tools/win32/build_scripts/lib.py Modified: branches/0.7.x/tools/win32/build_scripts/pavement.py Log: Update paver script to handle rc releases. Added: branches/0.7.x/tools/win32/build_scripts/lib.py =================================================================== --- branches/0.7.x/tools/win32/build_scripts/lib.py 2009-01-19 18:48:55 UTC (rev 5508) +++ branches/0.7.x/tools/win32/build_scripts/lib.py 2009-01-22 15:53:25 UTC (rev 5509) @@ -0,0 +1,70 @@ +from os.path import join, exists +import re +import subprocess + +VREGEX = re.compile("version\s*=\s*'(\d+)\.(\d+)\.(\d+)([a-zA-Z0-9]*)'") +ISRELREGEX = re.compile("release\s*=\s*True") +ISDEVREGEX = re.compile("release\s*=\s*False") +RCEX = re.compile("rc(\d)") + +def get_svn_version(chdir): + out = subprocess.Popen(['svn', 'info'], + stdout = subprocess.PIPE, + cwd = chdir).communicate()[0] + r = re.compile('Revision: ([0-9]+)') + svnver = None + for line in out.split('\n'): + m = r.match(line) + if m: + svnver = m.group(1) + + if not svnver: + raise ValueError("Error while parsing svn version ?") + + return svnver + +def get_scipy_version(src_root): + version_file = join(src_root, "scipy", "version.py") + if not exists(version_file): + raise IOError("file %s not found" % version_file) + + fid = open(version_file, "r") + version, rc, isdev = parse_verstring(fid.readlines()) + + verstr = ".".join([str(i) for i in version]) + if isdev: + verstr += ".dev" + verstr += get_svn_version(src_root) + return verstr + +def parse_verstring(lines): + isdev = None + version = None + for line in lines: + m = VREGEX.match(line) + if m: + gr = m.groups() + version = [int(i) for i in gr[:3]] + m = RCEX.match(gr[3]) + if m: + rc = int(m.group(1)) + else: + rc = 0 + break + + if not version: + raise ValueError("Error parsing %s" % "".join(lines)) + + for line in lines: + if ISRELREGEX.match(line): + if isdev is None: + isdev = False + else: + raise RuntimeError("isdev already set ?") + if ISDEVREGEX.match(line): + if isdev is None: + isdev = True + else: + raise RuntimeError("isdev already set ?") + + return version, rc, isdev Modified: branches/0.7.x/tools/win32/build_scripts/pavement.py =================================================================== --- branches/0.7.x/tools/win32/build_scripts/pavement.py 2009-01-19 18:48:55 UTC (rev 5508) +++ branches/0.7.x/tools/win32/build_scripts/pavement.py 2009-01-22 15:53:25 UTC (rev 5509) @@ -5,6 +5,8 @@ import re from zipfile import ZipFile +from lib import get_svn_version, get_scipy_version + BUILD_MSI = False SRC_ROOT = normpath(pjoin(os.getcwd(), os.pardir, os.pardir, os.pardir)) BUILD_ROOT = os.getcwd() @@ -157,54 +159,6 @@ def bootstrap_dir(pyver): return pjoin(BUILD_ROOT, "bootstrap-%s" % pyver) -def get_scipy_version(src_root): - version_file = pjoin(src_root, "scipy", "version.py") - if not pexists(version_file): - raise IOError("file %s not found" % version_file) - - fid = open(version_file, "r") - vregex = re.compile("version\s*=\s*'(\d+)\.(\d+)\.(\d+)'") - isrelregex = re.compile("release\s*=\s*True") - isdevregex = re.compile("release\s*=\s*False") - isdev = None - version = None - for line in fid.readlines(): - m = vregex.match(line) - if m: - version = [int(i) for i in m.groups()] - if isrelregex.match(line): - if isdev is None: - isdev = False - else: - raise RuntimeError("isdev already set ?") - if isdevregex.match(line): - if isdev is None: - isdev = True - else: - raise RuntimeError("isdev already set ?") - - verstr = ".".join([str(i) for i in version]) - if isdev: - verstr += ".dev" - verstr += get_svn_version(src_root) - return verstr - -def get_svn_version(chdir): - out = subprocess.Popen(['svn', 'info'], - stdout = subprocess.PIPE, - cwd = chdir).communicate()[0] - r = re.compile('Revision: ([0-9]+)') - svnver = None - for line in out.split('\n'): - m = r.match(line) - if m: - svnver = m.group(1) - - if not svnver: - raise ValueError("Error while parsing svn version ?") - - return svnver - def get_python_exec(ver): """Return the executable of python for the given version.""" # XXX Check that the file actually exists From scipy-svn at scipy.org Thu Jan 22 11:05:43 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 22 Jan 2009 10:05:43 -0600 (CST) Subject: [Scipy-svn] r5510 - branches/0.7.x/tools/win32/build_scripts Message-ID: <20090122160543.C6C6FC7C035@scipy.org> Author: cdavid Date: 2009-01-22 10:05:37 -0600 (Thu, 22 Jan 2009) New Revision: 5510 Modified: branches/0.7.x/tools/win32/build_scripts/lib.py Log: Forgot to add rc info to verstring. Modified: branches/0.7.x/tools/win32/build_scripts/lib.py =================================================================== --- branches/0.7.x/tools/win32/build_scripts/lib.py 2009-01-22 15:53:25 UTC (rev 5509) +++ branches/0.7.x/tools/win32/build_scripts/lib.py 2009-01-22 16:05:37 UTC (rev 5510) @@ -32,6 +32,9 @@ version, rc, isdev = parse_verstring(fid.readlines()) verstr = ".".join([str(i) for i in version]) + if rc > 0: + verstr += "rc%d" % rc + if isdev: verstr += ".dev" verstr += get_svn_version(src_root) From scipy-svn at scipy.org Fri Jan 23 02:26:49 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 23 Jan 2009 01:26:49 -0600 (CST) Subject: [Scipy-svn] r5511 - tags Message-ID: <20090123072649.5E044C7C023@scipy.org> Author: cdavid Date: 2009-01-23 01:26:42 -0600 (Fri, 23 Jan 2009) New Revision: 5511 Added: tags/0.7.0rc2/ Log: Create a rc2 (rc1 had a bug in the build scripts) Copied: tags/0.7.0rc2 (from rev 5510, branches/0.7.x) From scipy-svn at scipy.org Fri Jan 23 02:28:20 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 23 Jan 2009 01:28:20 -0600 (CST) Subject: [Scipy-svn] r5512 - tags/0.7.0rc2/scipy Message-ID: <20090123072820.4985BC7C023@scipy.org> Author: cdavid Date: 2009-01-23 01:28:14 -0600 (Fri, 23 Jan 2009) New Revision: 5512 Modified: tags/0.7.0rc2/scipy/version.py Log: Update version for rc2. Modified: tags/0.7.0rc2/scipy/version.py =================================================================== --- tags/0.7.0rc2/scipy/version.py 2009-01-23 07:26:42 UTC (rev 5511) +++ tags/0.7.0rc2/scipy/version.py 2009-01-23 07:28:14 UTC (rev 5512) @@ -1,5 +1,5 @@ -version = '0.7.0' -release=False +version = '0.7.0rc2' +release=True if not release: import os From scipy-svn at scipy.org Fri Jan 23 04:25:03 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 23 Jan 2009 03:25:03 -0600 (CST) Subject: [Scipy-svn] r5513 - trunk/tools/win32/build_scripts Message-ID: <20090123092503.6EB53C7C023@scipy.org> Author: cdavid Date: 2009-01-23 03:24:54 -0600 (Fri, 23 Jan 2009) New Revision: 5513 Added: trunk/tools/win32/build_scripts/lib.py Modified: trunk/tools/win32/build_scripts/pavement.py Log: 'forward-port' the changes in build scripts to handle rc versions for win32 binaries. Copied: trunk/tools/win32/build_scripts/lib.py (from rev 5510, branches/0.7.x/tools/win32/build_scripts/lib.py) Modified: trunk/tools/win32/build_scripts/pavement.py =================================================================== --- trunk/tools/win32/build_scripts/pavement.py 2009-01-23 07:28:14 UTC (rev 5512) +++ trunk/tools/win32/build_scripts/pavement.py 2009-01-23 09:24:54 UTC (rev 5513) @@ -5,6 +5,8 @@ import re from zipfile import ZipFile +from lib import get_svn_version, get_scipy_version + BUILD_MSI = False SRC_ROOT = normpath(pjoin(os.getcwd(), os.pardir, os.pardir, os.pardir)) BUILD_ROOT = os.getcwd() @@ -157,54 +159,6 @@ def bootstrap_dir(pyver): return pjoin(BUILD_ROOT, "bootstrap-%s" % pyver) -def get_scipy_version(src_root): - version_file = pjoin(src_root, "scipy", "version.py") - if not pexists(version_file): - raise IOError("file %s not found" % version_file) - - fid = open(version_file, "r") - vregex = re.compile("version\s*=\s*'(\d+)\.(\d+)\.(\d+)'") - isrelregex = re.compile("release\s*=\s*True") - isdevregex = re.compile("release\s*=\s*False") - isdev = None - version = None - for line in fid.readlines(): - m = vregex.match(line) - if m: - version = [int(i) for i in m.groups()] - if isrelregex.match(line): - if isdev is None: - isdev = False - else: - raise RuntimeError("isdev already set ?") - if isdevregex.match(line): - if isdev is None: - isdev = True - else: - raise RuntimeError("isdev already set ?") - - verstr = ".".join([str(i) for i in version]) - if isdev: - verstr += ".dev" - verstr += get_svn_version(src_root) - return verstr - -def get_svn_version(chdir): - out = subprocess.Popen(['svn', 'info'], - stdout = subprocess.PIPE, - cwd = chdir).communicate()[0] - r = re.compile('Revision: ([0-9]+)') - svnver = None - for line in out.split('\n'): - m = r.match(line) - if m: - svnver = m.group(1) - - if not svnver: - raise ValueError("Error while parsing svn version ?") - - return svnver - def get_python_exec(ver): """Return the executable of python for the given version.""" # XXX Check that the file actually exists From scipy-svn at scipy.org Fri Jan 23 18:14:07 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 23 Jan 2009 17:14:07 -0600 (CST) Subject: [Scipy-svn] r5514 - in trunk/scipy/special: . cephes Message-ID: <20090123231407.993EEC7C02C@scipy.org> Author: ptvirtan Date: 2009-01-23 17:13:54 -0600 (Fri, 23 Jan 2009) New Revision: 5514 Modified: trunk/scipy/special/_cephesmodule.c trunk/scipy/special/cephes/mtherr.c Log: Show Cephes errors as Python warnings instead of fprintfing. This changes cephes/mtherr.c to signal warnings via PyErr_WarnEx rather than fprintf. (Though error printing is disabled by default, as previously.) Modified: trunk/scipy/special/_cephesmodule.c =================================================================== --- trunk/scipy/special/_cephesmodule.c 2009-01-23 09:24:54 UTC (rev 5513) +++ trunk/scipy/special/_cephesmodule.c 2009-01-23 23:13:54 UTC (rev 5514) @@ -6,6 +6,7 @@ * Copyright 1999 Travis E. Oliphant * Revisions 2002 (added functions from cdflib) */ +#include #include "Python.h" #include "numpy/arrayobject.h" @@ -1050,6 +1051,23 @@ } +static PyObject *scipy_special_SpecialFunctionWarning = NULL; + +void scipy_special_raise_warning(char *fmt, ...) +{ + NPY_ALLOW_C_API_DEF + char msg[1024]; + va_list ap; + + va_start(ap, fmt); + PyOS_vsnprintf(msg, 1024, fmt, ap); + va_end(ap); + + NPY_ALLOW_C_API + PyErr_WarnEx(scipy_special_SpecialFunctionWarning, msg, 2); + NPY_DISABLE_C_API +} + static char errprint_doc[] = \ "errprint({flag}) sets the error printing flag for special functions\n" \ " (from the cephesmodule). The output is the previous state.\n" \ @@ -1102,6 +1120,14 @@ /* Load the cephes operators into the array module's namespace */ Cephes_InitOperators(d); + /* Register and add the warning type object */ + scipy_special_SpecialFunctionWarning = PyErr_NewException( + "scipy.special._cephes.SpecialFunctionWarning", + PyExc_RuntimeWarning, + NULL); + PyModule_AddObject(m, "SpecialFunctionWarning", + scipy_special_SpecialFunctionWarning); + /* Check for errors */ if (PyErr_Occurred()) Py_FatalError("can't initialize module _cephes"); Modified: trunk/scipy/special/cephes/mtherr.c =================================================================== --- trunk/scipy/special/cephes/mtherr.c 2009-01-23 09:24:54 UTC (rev 5513) +++ trunk/scipy/special/cephes/mtherr.c 2009-01-23 23:13:54 UTC (rev 5514) @@ -57,6 +57,7 @@ #include #include "mconf.h" +void scipy_special_raise_warning(char *fmt, ...); int scipy_special_print_error_messages = 0; int merror = 0; @@ -66,42 +67,39 @@ * in mconf.h. */ static char *ermsg[8] = { -"unknown", /* error code 0 */ -"domain", /* error code 1 */ -"singularity", /* et seq. */ -"overflow", -"underflow", -"total loss of precision", -"partial loss of precision", -"too many iterations" + "unknown", /* error code 0 */ + "domain", /* error code 1 */ + "singularity", /* et seq. */ + "overflow", + "underflow", + "total loss of precision", + "partial loss of precision", + "too many iterations" }; -int mtherr( name, code ) -char *name; -int code; +int mtherr(char *name, int code) { + /* Display string passed by calling program, + * which is supposed to be the name of the + * function in which the error occurred: + */ -/* Display string passed by calling program, - * which is supposed to be the name of the - * function in which the error occurred: - */ + /* Set global error message word */ + merror = code; -/* Set global error message word */ -merror = code; - -/* Display error message defined - * by the code argument. - */ -if( (code <= 0) || (code >= 8) ) + /* Display error message defined + * by the code argument. + */ + if ((code <= 0) || (code >= 8)) code = 0; -if (scipy_special_print_error_messages) { - printf( "\n%s ", name ); - printf( "%s error\n", ermsg[code] ); -} -/* Return to calling - * program - */ -return( 0 ); + if (scipy_special_print_error_messages) { + scipy_special_raise_warning("%s: %s error", name, ermsg[code]); + } + + /* Return to calling + * program + */ + return (0); } From scipy-svn at scipy.org Fri Jan 23 18:14:40 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 23 Jan 2009 17:14:40 -0600 (CST) Subject: [Scipy-svn] r5515 - in trunk/scipy/special: cephes tests Message-ID: <20090123231440.CCB35C7C02E@scipy.org> Author: ptvirtan Date: 2009-01-23 17:14:26 -0600 (Fri, 23 Jan 2009) New Revision: 5515 Modified: trunk/scipy/special/cephes/jv.c trunk/scipy/special/tests/test_basic.py Log: Fix #623: better Cephes jv.c:recur continued fraction termination conditions There were two problems in the old termination conditions for the continued fraction for Jn/Jn-1: 1) It could terminate spuriously on the first iteration, because the initial value for `ans` corresponded to a possible value of the fraction but not one obtained from the iteration. 2) `jv` could call `recur` with values of `n` and `x` such that the continued fraction iteration would not converge and the maximum iteration limit was reached. The code is now more careful with 1) and enforces a minimum number of iterations, and 2) is worked around by bumping the maximum iteration limit so that the CF should converge for all calls that come from `jv`. The iteration limits can be estimated as the number of iterations needed is known for this continued fraction. Additional tests included. Modified: trunk/scipy/special/cephes/jv.c =================================================================== --- trunk/scipy/special/cephes/jv.c 2009-01-23 23:13:54 UTC (rev 5514) +++ trunk/scipy/special/cephes/jv.c 2009-01-23 23:14:26 UTC (rev 5515) @@ -98,15 +98,6 @@ double k, q, t, y, an; int i, sign, nint; - /* The recursion used when n = 3 and x = 4 in recur gives - the wrong answer. - - Simple fix for now: - */ - if ((n==3) && (x == 4)) { - return 0.43017147387562193; - } - nint = 0; /* Flag for integer n */ sign = 1; /* Flag for sign inversion */ an = fabs(n); @@ -265,8 +256,29 @@ double k, ans, qk, xk, yk, r, t, kf; static double big = BIG; int nflag, ctr; + int miniter, maxiter; -/* continued fraction for Jn(x)/Jn-1(x) */ +/* Continued fraction for Jn(x)/Jn-1(x) + * AMS 9.1.73 + * + * x -x^2 -x^2 + * ------ --------- --------- ... + * 2 n + 2(n+1) + 2(n+2) + + * + * Compute it with the simplest possible algorithm. + * + * This continued fraction starts to converge when (|n| + m) > |x|. + * Hence, at least |x|-|n| iterations are necessary before convergence is + * achieved. There is a hard limit set below, m <= 30000, which is chosen + * so that no branch in `jv` requires more iterations to converge. + * The exact maximum number is (500/3.6)^2 - 500 ~ 19000 + */ + + maxiter = 22000; + miniter = fabs(x) - fabs(*n); + if (miniter < 1) + miniter = 1; + if (*n < 0.0) nflag = 1; else @@ -284,7 +296,7 @@ qkm1 = *n + *n; xk = -x * x; yk = qkm1; - ans = 1.0; + ans = 0.0; /* ans=0.0 ensures that t=1.0 in the first iteration */ ctr = 0; do { yk += 2.0; @@ -294,23 +306,28 @@ pkm1 = pk; qkm2 = qkm1; qkm1 = qk; - if (qk != 0) + + /* check convergence */ + if (qk != 0 && ctr > miniter) r = pk / qk; else r = 0.0; + if (r != 0) { t = fabs((ans - r) / r); ans = r; - } else + } else { t = 1.0; + } - if (++ctr > 1000) { + if (++ctr > maxiter) { mtherr("jv", UNDERFLOW); goto done; } if (t < MACHEP) goto done; + /* renormalize coefficients */ if (fabs(pk) > big) { pkm2 /= big; pkm1 /= big; @@ -321,6 +338,8 @@ while (t > MACHEP); done: + if (ans == 0) + ans = 1.0; #if CEPHES_DEBUG printf("%.6e\n", ans); Modified: trunk/scipy/special/tests/test_basic.py =================================================================== --- trunk/scipy/special/tests/test_basic.py 2009-01-23 23:13:54 UTC (rev 5514) +++ trunk/scipy/special/tests/test_basic.py 2009-01-23 23:14:26 UTC (rev 5515) @@ -1629,17 +1629,29 @@ yvp1 = yvp(2,.2) assert_array_almost_equal(yvp1,yvpr,10) +class TestBesselJ(object): + + def test_cephes_vs_specfun(self): + for v in [-120, -20., -10., -1., 0., 1., 12.49, 120., 301]: + for z in [1., 10., 200.5, 400., 600.5, 700.6, 1300, 10000]: + c1, c2, c3 = jv(v, z), jv(v,z+0j), jn(int(v), z) + if np.isinf(c1): + assert np.abs(c2) >= 1e150 + else: + assert_tol_equal(c1, c2, err_msg=(v, z), rtol=1e-11) + if v == int(v): + assert_tol_equal(c2, c3, err_msg=(v, z), rtol=1e-11) + + def test_ticket_623(self): + assert_tol_equal(jv(3, 4), 0.43017147387562193) + assert_tol_equal(jv(301, 1300), 0.0183487151115275) + assert_tol_equal(jv(301, 1296.0682), -0.0224174325312048) + class TestBesselI(object): - def _lggamma(self, q): - res = zeros_like(q) - res[q>=2] = gammaln(q[q>=2]) - res[q<2] = log(gamma(q[q<2])) - return res - def _series(self, v, z, n=200): k = arange(0, n).astype(float_) - r = (v+2*k)*log(.5*z) - self._lggamma(k+1) - self._lggamma(v+k+1) + r = (v+2*k)*log(.5*z) - gammaln(k+1) - gammaln(v+k+1) r[isnan(r)] = inf r = exp(r) err = abs(r).max() * finfo(float_).eps * n + abs(r[-1])*10 From scipy-svn at scipy.org Fri Jan 23 19:32:03 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 23 Jan 2009 18:32:03 -0600 (CST) Subject: [Scipy-svn] r5516 - in trunk/scipy/special: . tests Message-ID: <20090124003203.960D4C7C028@scipy.org> Author: ptvirtan Date: 2009-01-23 18:31:39 -0600 (Fri, 23 Jan 2009) New Revision: 5516 Modified: trunk/scipy/special/amos_wrappers.c trunk/scipy/special/tests/test_basic.py Log: Fix #853: use correct symmetries for J_v / Y_v for negative non-int. orders Modified: trunk/scipy/special/amos_wrappers.c =================================================================== --- trunk/scipy/special/amos_wrappers.c 2009-01-23 23:14:26 UTC (rev 5515) +++ trunk/scipy/special/amos_wrappers.c 2009-01-24 00:31:39 UTC (rev 5516) @@ -73,6 +73,35 @@ return w; } +static Py_complex +rotate_jy(Py_complex j, Py_complex y, double v) +{ + Py_complex w; + double c = cos(v * M_PI); + double s = sin(v * M_PI); + w.real = j.real * c - y.real * s; + w.imag = j.imag * c - y.imag * s; + return w; +} + +static int +reflect_jy(Py_complex *jy, double v) +{ + /* NB: Y_v may be huge near negative integers -- so handle exact + * integers carefully + */ + int i; + if (v != floor(v)) + return 0; + + i = v - 16384.0 * floor(v / 16384.0); + if (i & 1) { + jy->real = -jy->real; + jy->imag = -jy->imag; + } + return 1; +} + int cairy_wrap(Py_complex z, Py_complex *ai, Py_complex *aip, Py_complex *bi, Py_complex *bip) { int id = 0; int ierr = 0; @@ -144,18 +173,22 @@ int kode = 1; int nz, ierr; int sign = 1; - Py_complex cy; + Py_complex cy_j, cy_y, cwork; if (v < 0) { v = -v; sign = -1; } - F_FUNC(zbesj,ZBESJ)(CADDR(z), &v, &kode, &n, CADDR(cy), &nz, &ierr); + F_FUNC(zbesj,ZBESJ)(CADDR(z), &v, &kode, &n, CADDR(cy_j), &nz, &ierr); DO_MTHERR("jv:"); if (sign == -1) { - cy = rotate(cy, v); + if (!reflect_jy(&cy_j, v)) { + F_FUNC(zbesy,ZBESY)(CADDR(z), &v, &kode, &n, CADDR(cy_y), &nz, CADDR(cwork), &ierr); + DO_MTHERR("jv(yv):"); + cy_j = rotate_jy(cy_j, cy_y, v); + } } - return cy; + return cy_j; } Py_complex cbesj_wrap_e( double v, Py_complex z) { @@ -163,18 +196,22 @@ int kode = 2; int nz, ierr; int sign = 1; - Py_complex cy; + Py_complex cy_j, cy_y, cwork; if (v < 0) { v = -v; sign = -1; } - F_FUNC(zbesj,ZBESJ)(CADDR(z), &v, &kode, &n, CADDR(cy), &nz, &ierr); + F_FUNC(zbesj,ZBESJ)(CADDR(z), &v, &kode, &n, CADDR(cy_j), &nz, &ierr); DO_MTHERR("jve:"); if (sign == -1) { - cy = rotate(cy, v); + if (!reflect_jy(&cy_j, v)) { + F_FUNC(zbesy,ZBESY)(CADDR(z), &v, &kode, &n, CADDR(cy_y), &nz, CADDR(cwork), &ierr); + DO_MTHERR("jve(yve):"); + cy_j = rotate_jy(cy_j, cy_y, v); + } } - return cy; + return cy_j; } @@ -183,19 +220,23 @@ int kode = 1; int nz, ierr; int sign = 1; - Py_complex cy, cwork; + Py_complex cy_y, cy_j, cwork; if (v < 0) { v = -v; sign = -1; } - F_FUNC(zbesy,ZBESY)(CADDR(z), &v, &kode, &n, CADDR(cy), &nz, CADDR(cwork), &ierr); + F_FUNC(zbesy,ZBESY)(CADDR(z), &v, &kode, &n, CADDR(cy_y), &nz, CADDR(cwork), &ierr); DO_MTHERR("yv:"); if (sign == -1) { - cy = rotate(cy, v); + if (!reflect_jy(&cy_y, v)) { + F_FUNC(zbesj,ZBESJ)(CADDR(z), &v, &kode, &n, CADDR(cy_j), &nz, &ierr); + DO_MTHERR("yv(jv):"); + cy_y = rotate_jy(cy_y, cy_j, -v); + } } - return cy; + return cy_y; } Py_complex cbesy_wrap_e( double v, Py_complex z) { @@ -203,18 +244,22 @@ int kode = 2; int nz, ierr; int sign = 1; - Py_complex cy, cwork; + Py_complex cy_y, cy_j, cwork; if (v < 0) { v = -v; sign = -1; } - F_FUNC(zbesy,ZBESY)(CADDR(z), &v, &kode, &n, CADDR(cy), &nz, CADDR(cwork), &ierr); + F_FUNC(zbesy,ZBESY)(CADDR(z), &v, &kode, &n, CADDR(cy_y), &nz, CADDR(cwork), &ierr); DO_MTHERR("yve:"); if (sign == -1) { - cy = rotate(cy, v); + if (!reflect_jy(&cy_y, v)) { + F_FUNC(zbesj,ZBESJ)(CADDR(z), &v, &kode, &n, CADDR(cy_j), &nz, &ierr); + DO_MTHERR("yv(jv):"); + cy_y = rotate_jy(cy_y, cy_j, -v); + } } - return cy; + return cy_y; } Modified: trunk/scipy/special/tests/test_basic.py =================================================================== --- trunk/scipy/special/tests/test_basic.py 2009-01-23 23:14:26 UTC (rev 5515) +++ trunk/scipy/special/tests/test_basic.py 2009-01-24 00:31:39 UTC (rev 5516) @@ -1631,12 +1631,14 @@ class TestBesselJ(object): - def test_cephes_vs_specfun(self): - for v in [-120, -20., -10., -1., 0., 1., 12.49, 120., 301]: + def test_cephes_vs_amos(self): + for v in [-120, -100.3, -20., -10., -1., 0., 1., 12.49, 120., 301]: for z in [1., 10., 200.5, 400., 600.5, 700.6, 1300, 10000]: c1, c2, c3 = jv(v, z), jv(v,z+0j), jn(int(v), z) if np.isinf(c1): assert np.abs(c2) >= 1e150 + elif np.isnan(c1): + assert np.abs(c2.imag) > 1e-10 else: assert_tol_equal(c1, c2, err_msg=(v, z), rtol=1e-11) if v == int(v): @@ -1647,6 +1649,31 @@ assert_tol_equal(jv(301, 1300), 0.0183487151115275) assert_tol_equal(jv(301, 1296.0682), -0.0224174325312048) + def test_ticket_853(self): + # cephes + assert_tol_equal(jv(-1, 1 ), -0.4400505857449335) + assert_tol_equal(jv(-2, 1 ), 0.1149034849319005) + assert_tol_equal(yv(-1, 1 ), 0.7812128213002887) + assert_tol_equal(yv(-2, 1 ), -1.650682606816255) + assert_tol_equal(jv(-0.5, 1 ), 0.43109886801837607952) + assert_tol_equal(yv(-0.5, 1 ), 0.6713967071418031) + # amos + assert_tol_equal(jv(-1, 1+0j), -0.4400505857449335) + assert_tol_equal(jv(-2, 1+0j), 0.1149034849319005) + assert_tol_equal(yv(-1, 1+0j), 0.7812128213002887) + assert_tol_equal(yv(-2, 1+0j), -1.650682606816255) + assert_tol_equal(jv(-0.5, 1+0j), 0.43109886801837607952) + assert_tol_equal(jv(-0.5, 1+1j), 0.2628946385649065-0.827050182040562j) + assert_tol_equal(yv(-0.5, 1+0j), 0.6713967071418031) + assert_tol_equal(yv(-0.5, 1+1j), 0.967901282890131+0.0602046062142816j) + + assert_tol_equal(jve(-0.5,1+0j), jv(-0.5, 1+0j)) + assert_tol_equal(yve(-0.5,1+0j), yv(-0.5, 1+0j)) + + assert_tol_equal(hankel1(-0.5, 1+1j), jv(-0.5, 1+1j) + 1j*yv(-0.5,1+1j)) + assert_tol_equal(hankel2(-0.5, 1+1j), jv(-0.5, 1+1j) - 1j*yv(-0.5,1+1j)) + + class TestBesselI(object): def _series(self, v, z, n=200): From scipy-svn at scipy.org Sat Jan 24 03:06:36 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 24 Jan 2009 02:06:36 -0600 (CST) Subject: [Scipy-svn] r5517 - trunk/scipy/fftpack Message-ID: <20090124080636.45988C7C028@scipy.org> Author: cdavid Date: 2009-01-24 02:06:32 -0600 (Sat, 24 Jan 2009) New Revision: 5517 Modified: trunk/scipy/fftpack/SConscript Log: BUG: fix fftpack scons build. Modified: trunk/scipy/fftpack/SConscript =================================================================== --- trunk/scipy/fftpack/SConscript 2009-01-24 00:31:39 UTC (rev 5516) +++ trunk/scipy/fftpack/SConscript 2009-01-24 08:06:32 UTC (rev 5517) @@ -1,4 +1,4 @@ -# Last Change: Sat Jan 10 05:00 PM 2009 J +# Last Change: Sat Jan 24 04:00 PM 2009 J # vim:syntax=python from os.path import join as pjoin @@ -26,8 +26,8 @@ env.PrependUnique(LIBPATH = ['.']) # Build _fftpack -src = ['src/zfft.c','src/drfft.c','src/zrfft.c', 'src/zfftnd.c', 'src/dct.c', - 'fftpack.pyf'] +src = ['src/zfft.c','src/drfft.c','src/zrfft.c', 'src/zfftnd.c', 'fftpack.pyf'] +src += env.FromCTemplate('src/dct.c.src') env.NumpyPythonExtension('_fftpack', src) # Build convolve From scipy-svn at scipy.org Sat Jan 24 05:32:36 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 24 Jan 2009 04:32:36 -0600 (CST) Subject: [Scipy-svn] r5518 - trunk/scipy/fftpack Message-ID: <20090124103236.76FF7C7C028@scipy.org> Author: cdavid Date: 2009-01-24 04:32:22 -0600 (Sat, 24 Jan 2009) New Revision: 5518 Modified: trunk/scipy/fftpack/realtransforms.py Log: Fix DCT docstring: sum index boundaris and normalization note for DCT-I. Modified: trunk/scipy/fftpack/realtransforms.py =================================================================== --- trunk/scipy/fftpack/realtransforms.py 2009-01-24 08:06:32 UTC (rev 5517) +++ trunk/scipy/fftpack/realtransforms.py 2009-01-24 10:32:22 UTC (rev 5518) @@ -50,10 +50,13 @@ for 0 <= k < N, - N-1 + N-2 y[k] = x[0] + (-1)**k x[N-1] + 2 * sum x[n]*cos(pi*k*n/(N-1)) - n=0 + n=1 + Only None is supported as normalization mode for DCT-I. Note also that the + DCT-I is only supported for input size > 1 + type II ~~~~~~~ There are several definitions of the DCT-II; we use the following (for @@ -76,13 +79,13 @@ N-1 y[k] = x[0] + 2 * sum x[n]*cos(pi*(k+0.5)*n/N), 0 <= k < N. - n=0 + n=1 Or (norm='ortho'), for 0 <= k < N: N-1 y[k] = x[0] / sqrt(N) + sqrt(1/N) * sum x[n]*cos(pi*(k+0.5)*n/N) - n=0 + n=1 The (unnormalized) DCT-III is the inverse of the (unnormalized) DCT-II, up to a factor 2*N. The orthonormalized DCT-III is exactly the inverse of the From scipy-svn at scipy.org Sat Jan 24 05:41:18 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 24 Jan 2009 04:41:18 -0600 (CST) Subject: [Scipy-svn] r5519 - trunk/scipy/fftpack Message-ID: <20090124104118.247B4C7C028@scipy.org> Author: cdavid Date: 2009-01-24 04:41:14 -0600 (Sat, 24 Jan 2009) New Revision: 5519 Modified: trunk/scipy/fftpack/__init__.py Log: Add dct and idct in scipy.fftpack namespace. Modified: trunk/scipy/fftpack/__init__.py =================================================================== --- trunk/scipy/fftpack/__init__.py 2009-01-24 10:32:22 UTC (rev 5518) +++ trunk/scipy/fftpack/__init__.py 2009-01-24 10:41:14 UTC (rev 5519) @@ -16,6 +16,8 @@ register_func(k, eval(k)) del k, register_func +from realtransforms import * +__all__.extend(['dct', 'idct']) from numpy.testing import Tester test = Tester().test From scipy-svn at scipy.org Sat Jan 24 05:43:50 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 24 Jan 2009 04:43:50 -0600 (CST) Subject: [Scipy-svn] r5520 - trunk/doc/release Message-ID: <20090124104350.6D6F7C7C028@scipy.org> Author: cdavid Date: 2009-01-24 04:43:46 -0600 (Sat, 24 Jan 2009) New Revision: 5520 Modified: trunk/doc/release/0.8.0-notes.rst Log: Add dct/idct and single precision improvements in 0.8.0 release notes. Modified: trunk/doc/release/0.8.0-notes.rst =================================================================== --- trunk/doc/release/0.8.0-notes.rst 2009-01-24 10:41:14 UTC (rev 5519) +++ trunk/doc/release/0.8.0-notes.rst 2009-01-24 10:43:46 UTC (rev 5520) @@ -43,3 +43,13 @@ -------------------------------- SciPy documentation is greatly improved. + +New features of the fftpack package +----------------------------------- + +New realtransforms have been added, namely dct and idct for Discrete Cosine +Transform; type I, II and III are available, for both single and double +precision. + +fft functions can now handle single precision inputs as well: fft(x) will +return a single precision array if x is single precision. From scipy-svn at scipy.org Sun Jan 25 13:28:13 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 25 Jan 2009 12:28:13 -0600 (CST) Subject: [Scipy-svn] r5521 - in trunk/scipy/special: . tests Message-ID: <20090125182813.29849C7C035@scipy.org> Author: ptvirtan Date: 2009-01-25 12:28:00 -0600 (Sun, 25 Jan 2009) New Revision: 5521 Modified: trunk/scipy/special/amos_wrappers.c trunk/scipy/special/tests/test_basic.py Log: Fixing #853: also I_v: use correct symmetry for negative orders (complex x) Modified: trunk/scipy/special/amos_wrappers.c =================================================================== --- trunk/scipy/special/amos_wrappers.c 2009-01-24 10:43:46 UTC (rev 5520) +++ trunk/scipy/special/amos_wrappers.c 2009-01-25 18:28:00 UTC (rev 5521) @@ -102,6 +102,24 @@ return 1; } +static int +reflect_i(Py_complex *ik, double v) +{ + if (v != floor(v)) + return 0; + return 1; /* I is symmetric for integer v */ +} + +static Py_complex +rotate_i(Py_complex i, Py_complex k, double v) +{ + Py_complex w; + double s = sin(v * M_PI)*(2.0/M_PI); + w.real = i.real + s*k.real; + w.imag = i.imag + s*k.imag; + return w; +} + int cairy_wrap(Py_complex z, Py_complex *ai, Py_complex *aip, Py_complex *bi, Py_complex *bip) { int id = 0; int ierr = 0; @@ -142,28 +160,57 @@ Py_complex cbesi_wrap( double v, Py_complex z) { int n = 1; int kode = 1; + int sign = 1; int nz, ierr; - Py_complex cy; + Py_complex cy, cy_k; if (v < 0) { v = -v; + sign = -1; } F_FUNC(zbesi,ZBESI)(CADDR(z), &v, &kode, &n, CADDR(cy), &nz, &ierr); DO_MTHERR("iv:"); + + if (sign == -1) { + if (!reflect_i(&cy, v)) { + F_FUNC(zbesk,ZBESK)(CADDR(z), &v, &kode, &n, CADDR(cy_k), &nz, &ierr); + DO_MTHERR("iv(kv):"); + cy = rotate_i(cy, cy_k, v); + } + } + return cy; } Py_complex cbesi_wrap_e( double v, Py_complex z) { int n = 1; int kode = 2; + int sign = 1; int nz, ierr; - Py_complex cy; + Py_complex cy, cy_k; if (v < 0) { v = -v; + sign = -1; } F_FUNC(zbesi,ZBESI)(CADDR(z), &v, &kode, &n, CADDR(cy), &nz, &ierr); DO_MTHERR("ive:"); + + if (sign == -1) { + if (!reflect_i(&cy, v)) { + F_FUNC(zbesk,ZBESK)(CADDR(z), &v, &kode, &n, CADDR(cy_k), &nz, &ierr); + DO_MTHERR("ive(kv):"); + /* adjust scaling to match zbesi */ + cy_k = rotate(cy_k, -z.imag/M_PI); + if (z.real > 0) { + cy_k.real *= exp(-2*z.real); + cy_k.imag *= exp(-2*z.real); + } + /* v -> -v */ + cy = rotate_i(cy, cy_k, v); + } + } + return cy; } @@ -181,6 +228,7 @@ } F_FUNC(zbesj,ZBESJ)(CADDR(z), &v, &kode, &n, CADDR(cy_j), &nz, &ierr); DO_MTHERR("jv:"); + if (sign == -1) { if (!reflect_jy(&cy_j, v)) { F_FUNC(zbesy,ZBESY)(CADDR(z), &v, &kode, &n, CADDR(cy_y), &nz, CADDR(cwork), &ierr); @@ -270,6 +318,7 @@ Py_complex cy; if (v < 0) { + /* K_v == K_{-v} even for non-integer v */ v = -v; } F_FUNC(zbesk,ZBESK)(CADDR(z), &v, &kode, &n, CADDR(cy), &nz, &ierr); @@ -284,6 +333,7 @@ Py_complex cy; if (v < 0) { + /* K_v == K_{-v} even for non-integer v */ v = -v; } F_FUNC(zbesk,ZBESK)(CADDR(z), &v, &kode, &n, CADDR(cy), &nz, &ierr); Modified: trunk/scipy/special/tests/test_basic.py =================================================================== --- trunk/scipy/special/tests/test_basic.py 2009-01-24 10:43:46 UTC (rev 5520) +++ trunk/scipy/special/tests/test_basic.py 2009-01-25 18:28:00 UTC (rev 5521) @@ -1650,25 +1650,45 @@ assert_tol_equal(jv(301, 1296.0682), -0.0224174325312048) def test_ticket_853(self): + """Negative-order Bessels""" # cephes assert_tol_equal(jv(-1, 1 ), -0.4400505857449335) assert_tol_equal(jv(-2, 1 ), 0.1149034849319005) assert_tol_equal(yv(-1, 1 ), 0.7812128213002887) assert_tol_equal(yv(-2, 1 ), -1.650682606816255) + assert_tol_equal(iv(-1, 1 ), 0.5651591039924851) + assert_tol_equal(iv(-2, 1 ), 0.1357476697670383) + assert_tol_equal(kv(-1, 1 ), 0.6019072301972347) + assert_tol_equal(kv(-2, 1 ), 1.624838898635178) assert_tol_equal(jv(-0.5, 1 ), 0.43109886801837607952) assert_tol_equal(yv(-0.5, 1 ), 0.6713967071418031) + assert_tol_equal(iv(-0.5, 1 ), 1.231200214592967) + assert_tol_equal(kv(-0.5, 1 ), 0.4610685044478945) # amos assert_tol_equal(jv(-1, 1+0j), -0.4400505857449335) assert_tol_equal(jv(-2, 1+0j), 0.1149034849319005) assert_tol_equal(yv(-1, 1+0j), 0.7812128213002887) assert_tol_equal(yv(-2, 1+0j), -1.650682606816255) + + assert_tol_equal(iv(-1, 1+0j), 0.5651591039924851) + assert_tol_equal(iv(-2, 1+0j), 0.1357476697670383) + assert_tol_equal(kv(-1, 1+0j), 0.6019072301972347) + assert_tol_equal(kv(-2, 1+0j), 1.624838898635178) + assert_tol_equal(jv(-0.5, 1+0j), 0.43109886801837607952) assert_tol_equal(jv(-0.5, 1+1j), 0.2628946385649065-0.827050182040562j) assert_tol_equal(yv(-0.5, 1+0j), 0.6713967071418031) assert_tol_equal(yv(-0.5, 1+1j), 0.967901282890131+0.0602046062142816j) + + assert_tol_equal(iv(-0.5, 1+0j), 1.231200214592967) + assert_tol_equal(iv(-0.5, 1+1j), 0.77070737376928+0.39891821043561j) + assert_tol_equal(kv(-0.5, 1+0j), 0.4610685044478945) + assert_tol_equal(kv(-0.5, 1+1j), 0.06868578341999-0.38157825981268j) - assert_tol_equal(jve(-0.5,1+0j), jv(-0.5, 1+0j)) - assert_tol_equal(yve(-0.5,1+0j), yv(-0.5, 1+0j)) + assert_tol_equal(jve(-0.5,1+0.3j), jv(-0.5, 1+0.3j)*exp(-0.3)) + assert_tol_equal(yve(-0.5,1+0.3j), yv(-0.5, 1+0.3j)*exp(-0.3)) + assert_tol_equal(ive(-0.5,0.3+1j), iv(-0.5, 0.3+1j)*exp(-0.3)) + assert_tol_equal(kve(-0.5,0.3+1j), kv(-0.5, 0.3+1j)*exp(0.3+1j)) assert_tol_equal(hankel1(-0.5, 1+1j), jv(-0.5, 1+1j) + 1j*yv(-0.5,1+1j)) assert_tol_equal(hankel2(-0.5, 1+1j), jv(-0.5, 1+1j) - 1j*yv(-0.5,1+1j)) From scipy-svn at scipy.org Sun Jan 25 13:50:56 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 25 Jan 2009 12:50:56 -0600 (CST) Subject: [Scipy-svn] r5522 - trunk/doc/release Message-ID: <20090125185056.7C69FC7C03E@scipy.org> Author: wnbell Date: 2009-01-25 12:50:54 -0600 (Sun, 25 Jan 2009) New Revision: 5522 Modified: trunk/doc/release/0.7.0-notes.rst Log: added note about change to spdiags() Modified: trunk/doc/release/0.7.0-notes.rst =================================================================== --- trunk/doc/release/0.7.0-notes.rst 2009-01-25 18:28:00 UTC (rev 5521) +++ trunk/doc/release/0.7.0-notes.rst 2009-01-25 18:50:54 UTC (rev 5522) @@ -160,6 +160,9 @@ * ``A = csr_matrix( rand(3,3) )`` and ``B = lil_matrix( [[1,2],[3,4]] )`` +The handling of diagonals in the ``spdiags`` function has been changed. +It now agrees with the MATLAB(TM) function of the same name. + Numerous efficiency improvements to format conversions and sparse matrix arithmetic have been made. Finally, this release contains numerous bugfixes. From scipy-svn at scipy.org Sun Jan 25 14:02:49 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 25 Jan 2009 13:02:49 -0600 (CST) Subject: [Scipy-svn] r5523 - in trunk/scipy/special: . cephes tests Message-ID: <20090125190249.EFF23C7C015@scipy.org> Author: ptvirtan Date: 2009-01-25 13:02:17 -0600 (Sun, 25 Jan 2009) New Revision: 5523 Modified: trunk/scipy/special/_cephesmodule.c trunk/scipy/special/amos_wrappers.c trunk/scipy/special/amos_wrappers.h trunk/scipy/special/cephes/iv.c trunk/scipy/special/cephes/jv.c trunk/scipy/special/tests/test_basic.py Log: Fixing #854: make iv, jv, etc. return NaN when out-of-domain or failure - Fix Cephes iv, jv return values; on DOMAIN return NaN, not zero - Fix amos_wrappers return value handling: return NaNs when Amos signals that it didn't do any computation - Fix _cephesmodule signatures: all real-valued functions should return NaN when the result would be complex, instead of just returning the real part. Modified: trunk/scipy/special/_cephesmodule.c =================================================================== --- trunk/scipy/special/_cephesmodule.c 2009-01-25 18:50:54 UTC (rev 5522) +++ trunk/scipy/special/_cephesmodule.c 2009-01-25 19:02:17 UTC (rev 5523) @@ -30,14 +30,12 @@ static PyUFuncGenericFunction cephes1_2_functions[] = { NULL, NULL, NULL, NULL,}; static PyUFuncGenericFunction cephes1_2c_functions[] = { NULL, NULL,}; static PyUFuncGenericFunction cephes1c_4_functions[] = { NULL, NULL, NULL, NULL }; -static PyUFuncGenericFunction cephes1cp_4_functions[] = { NULL, NULL, NULL, NULL}; static PyUFuncGenericFunction cephes1cpb_4_functions[] = { NULL, NULL,}; static PyUFuncGenericFunction cephes2_functions[] = { NULL, NULL, }; static PyUFuncGenericFunction cephes2_2_functions[] = { NULL, NULL, }; static PyUFuncGenericFunction cephes2_4_functions[] = { NULL, NULL, }; static PyUFuncGenericFunction cephes2a_functions[] = { NULL, NULL, }; static PyUFuncGenericFunction cephes2c_functions[] = { NULL, NULL, NULL, NULL }; -static PyUFuncGenericFunction cephes2cp_functions[] = { NULL, NULL, NULL, NULL, }; static PyUFuncGenericFunction cephes2cpp_functions[] = { NULL, NULL, }; static PyUFuncGenericFunction cephes3_functions[] = { NULL, NULL, NULL, NULL}; static PyUFuncGenericFunction cephes3a_functions[] = { NULL, NULL, }; @@ -50,7 +48,7 @@ static PyUFuncGenericFunction cephes1c_functions[] = { NULL, NULL, }; static void * airy_data[] = { (void *)airy, (void *)airy, (void *)cairy_wrap, (void *)cairy_wrap,}; -static void * airye_data[] = { (void *)cairy_wrap_e, (void *)cairy_wrap_e, (void *)cairy_wrap_e, (void *)cairy_wrap_e, }; +static void * airye_data[] = { (void *)cairy_wrap_e_real, (void *)cairy_wrap_e_real, (void *)cairy_wrap_e, (void *)cairy_wrap_e, }; static void * itairy_data[] = { (void *)itairy_wrap, (void *)itairy_wrap, }; static void * kelvin_data[] = { (void *)kelvin_wrap, (void *)kelvin_wrap,}; @@ -148,22 +146,22 @@ (void *)gammaincinv, }; static void * iv_data[] = { (void *)iv, (void *)iv, (void *)cbesi_wrap, (void *)cbesi_wrap,}; -static void * ive_data[] = { (void *)cbesi_wrap_e, (void *)cbesi_wrap_e, (void *)cbesi_wrap_e, (void *)cbesi_wrap_e, }; +static void * ive_data[] = { (void *)cbesi_wrap_e_real, (void *)cbesi_wrap_e_real, (void *)cbesi_wrap_e, (void *)cbesi_wrap_e, }; static void * j0_data[] = { (void *)j0, (void *)j0, }; static void * y0_data[] = { (void *)y0, (void *)y0, }; static void * j1_data[] = { (void *)j1, (void *)j1, }; static void * y1_data[] = { (void *)y1, (void *)y1, }; static void * jv_data[] = { (void *)jv, (void *)jv, (void *)cbesj_wrap, (void *)cbesj_wrap,}; -static void * jve_data[] = { (void *)cbesj_wrap_e, (void *)cbesj_wrap_e, (void *)cbesj_wrap_e, (void *)cbesj_wrap_e, }; +static void * jve_data[] = { (void *)cbesj_wrap_e_real, (void *)cbesj_wrap_e_real, (void *)cbesj_wrap_e, (void *)cbesj_wrap_e, }; static void * yv_data[] = { (void *)yv, (void *)yv, (void *)cbesy_wrap, (void *)cbesy_wrap,}; -static void * yve_data[] = { (void *)cbesy_wrap_e, (void *)cbesy_wrap_e, (void *)cbesy_wrap_e, (void *)cbesy_wrap_e, }; +static void * yve_data[] = { (void *)cbesy_wrap_e_real, (void *)cbesy_wrap_e_real, (void *)cbesy_wrap_e, (void *)cbesy_wrap_e, }; static void * k0_data[] = { (void *)k0, (void *)k0, }; static void * k0e_data[] = { (void *)k0e, (void *)k0e, }; static void * k1_data[] = { (void *)k1, (void *)k1, }; static void * k1e_data[] = { (void *)k1e, (void *)k1e, }; -static void * kv_data[] = { (void *)cbesk_wrap, (void *)cbesk_wrap, (void *)cbesk_wrap, (void *)cbesk_wrap,}; -static void * kve_data[] = { (void *)cbesk_wrap_e, (void *)cbesk_wrap_e, (void *)cbesk_wrap_e, (void *)cbesk_wrap_e,}; +static void * kv_data[] = { (void *)cbesk_wrap_real, (void *)cbesk_wrap_real, (void *)cbesk_wrap, (void *)cbesk_wrap,}; +static void * kve_data[] = { (void *)cbesk_wrap_e_real, (void *)cbesk_wrap_e_real, (void *)cbesk_wrap_e, (void *)cbesk_wrap_e,}; static void * hankel1_data[] = { (void *)cbesh_wrap1, (void *)cbesh_wrap1,}; static void * hankel1e_data[] = { (void *)cbesh_wrap1_e, (void *)cbesh_wrap1_e,}; static void * hankel2_data[] = { (void *)cbesh_wrap2, (void *)cbesh_wrap2,}; @@ -356,10 +354,6 @@ cephes1c_4_functions[1] = PyUFunc_d_dddd; cephes1c_4_functions[2] = PyUFunc_F_FFFF_As_D_DDDD; cephes1c_4_functions[3] = PyUFunc_D_DDDD; - cephes1cp_4_functions[0] = PyUFunc_f_ffff_As_D_DDDD; - cephes1cp_4_functions[1] = PyUFunc_d_dddd_As_D_DDDD; - cephes1cp_4_functions[2] = PyUFunc_F_FFFF_As_D_DDDD; - cephes1cp_4_functions[3] = PyUFunc_D_DDDD; cephes1cpb_4_functions[0] = PyUFunc_f_FFFF_As_d_DDDD; cephes1cpb_4_functions[1] = PyUFunc_d_DDDD; cephes2_functions[0] = PyUFunc_ff_f_As_dd_d; @@ -372,10 +366,6 @@ cephes2c_functions[1] = PyUFunc_dd_d; cephes2c_functions[2] = PyUFunc_fF_F_As_dD_D; cephes2c_functions[3] = PyUFunc_dD_D; - cephes2cp_functions[0] = PyUFunc_ff_f_As_dD_D; - cephes2cp_functions[1] = PyUFunc_dd_d_As_dD_D; - cephes2cp_functions[2] = PyUFunc_fF_F_As_dD_D; - cephes2cp_functions[3] = PyUFunc_dD_D; cephes2cpp_functions[0] = PyUFunc_fF_F_As_dD_D; cephes2cpp_functions[1] = PyUFunc_dD_D; cephes2_4_functions[0] = PyUFunc_ff_ffff_As_dd_dddd; @@ -555,7 +545,7 @@ f = PyUFunc_FromFuncAndData(cephes2c_functions, iv_data, cephes_3c_types, 4, 2, 1, PyUFunc_None, "iv", iv_doc, 0); PyDict_SetItemString(dictionary, "iv", f); Py_DECREF(f); - f = PyUFunc_FromFuncAndData(cephes2cp_functions, ive_data, cephes_3c_types, 4, 2, 1, PyUFunc_None, "ive", ive_doc, 0); + f = PyUFunc_FromFuncAndData(cephes2c_functions, ive_data, cephes_3c_types, 4, 2, 1, PyUFunc_None, "ive", ive_doc, 0); PyDict_SetItemString(dictionary, "ive", f); Py_DECREF(f); @@ -614,7 +604,7 @@ Py_DECREF(f); - f = PyUFunc_FromFuncAndData(cephes1cp_4_functions, airye_data, cephes_5c_types, 4, 1, 4, PyUFunc_None, "airye", airye_doc, 0); + f = PyUFunc_FromFuncAndData(cephes1c_4_functions, airye_data, cephes_5c_types, 4, 1, 4, PyUFunc_None, "airye", airye_doc, 0); PyDict_SetItemString(dictionary, "airye", f); Py_DECREF(f); @@ -662,13 +652,13 @@ accurate. So we alias jv to jn */ PyDict_SetItemString(dictionary, "jn", f); Py_DECREF(f); - f = PyUFunc_FromFuncAndData(cephes2cp_functions, jve_data, cephes_3c_types, 4, 2, 1, PyUFunc_None, "jve", jve_doc, 0); + f = PyUFunc_FromFuncAndData(cephes2c_functions, jve_data, cephes_3c_types, 4, 2, 1, PyUFunc_None, "jve", jve_doc, 0); PyDict_SetItemString(dictionary, "jve", f); Py_DECREF(f); f = PyUFunc_FromFuncAndData(cephes2c_functions, yv_data, cephes_3c_types, 4, 2, 1, PyUFunc_None, "yv", yv_doc, 0); PyDict_SetItemString(dictionary, "yv", f); Py_DECREF(f); - f = PyUFunc_FromFuncAndData(cephes2cp_functions, yve_data, cephes_3c_types, 4, 2, 1, PyUFunc_None, "yve", yve_doc, 0); + f = PyUFunc_FromFuncAndData(cephes2c_functions, yve_data, cephes_3c_types, 4, 2, 1, PyUFunc_None, "yve", yve_doc, 0); PyDict_SetItemString(dictionary, "yve", f); Py_DECREF(f); @@ -685,10 +675,10 @@ f = PyUFunc_FromFuncAndData(cephes1_functions, k1e_data, cephes_2_types, 2, 1, 1, PyUFunc_None, "k1e", k1e_doc, 0); PyDict_SetItemString(dictionary, "k1e", f); Py_DECREF(f); - f = PyUFunc_FromFuncAndData(cephes2cp_functions, kv_data, cephes_3c_types, 4, 2, 1, PyUFunc_None, "kv", kv_doc, 0); + f = PyUFunc_FromFuncAndData(cephes2c_functions, kv_data, cephes_3c_types, 4, 2, 1, PyUFunc_None, "kv", kv_doc, 0); PyDict_SetItemString(dictionary, "kv", f); Py_DECREF(f); - f = PyUFunc_FromFuncAndData(cephes2cp_functions, kve_data, cephes_3c_types, 4, 2, 1, PyUFunc_None, "kve", kve_doc, 0); + f = PyUFunc_FromFuncAndData(cephes2c_functions, kve_data, cephes_3c_types, 4, 2, 1, PyUFunc_None, "kve", kve_doc, 0); PyDict_SetItemString(dictionary, "kve", f); Py_DECREF(f); @@ -1064,7 +1054,7 @@ va_end(ap); NPY_ALLOW_C_API - PyErr_WarnEx(scipy_special_SpecialFunctionWarning, msg, 2); + PyErr_WarnEx(scipy_special_SpecialFunctionWarning, msg, 1); NPY_DISABLE_C_API } Modified: trunk/scipy/special/amos_wrappers.c =================================================================== --- trunk/scipy/special/amos_wrappers.c 2009-01-25 18:50:54 UTC (rev 5522) +++ trunk/scipy/special/amos_wrappers.c 2009-01-25 19:02:17 UTC (rev 5523) @@ -62,6 +62,13 @@ return -1; } +void set_nan_if_no_computation_done(Py_complex *v, int ierr) { + if (v != NULL && (ierr == 1 || ierr == 2 || ierr == 4 || ierr == 5)) { + v->real = NAN; + v->imag = NAN; + } +} + static Py_complex rotate(Py_complex z, double v) { @@ -127,15 +134,15 @@ int nz; F_FUNC(zairy,ZAIRY)(CADDR(z), &id, &kode, F2C_CST(ai), &nz, &ierr); - DO_MTHERR("airy:"); + DO_MTHERR("airy:", ai); F_FUNC(zbiry,ZBIRY)(CADDR(z), &id, &kode, F2C_CST(bi), &nz, &ierr); - DO_MTHERR("airy:"); + DO_MTHERR("airy:", bi); id = 1; F_FUNC(zairy,ZAIRY)(CADDR(z), &id, &kode, F2C_CST(aip), &nz, &ierr); - DO_MTHERR("airy:"); + DO_MTHERR("airy:", aip); F_FUNC(zbiry,ZBIRY)(CADDR(z), &id, &kode, F2C_CST(bip), &nz, &ierr); - DO_MTHERR("airy:"); + DO_MTHERR("airy:", bip); return 0; } @@ -145,18 +152,52 @@ int nz, ierr; F_FUNC(zairy,ZAIRY)(CADDR(z), &id, &kode, F2C_CST(ai), &nz, &ierr); - DO_MTHERR("airye:"); + DO_MTHERR("airye:", ai); F_FUNC(zbiry,ZBIRY)(CADDR(z), &id, &kode, F2C_CST(bi), &nz, &ierr); - DO_MTHERR("airye:"); + DO_MTHERR("airye:", bi); id = 1; F_FUNC(zairy,ZAIRY)(CADDR(z), &id, &kode, F2C_CST(aip), &nz, &ierr); - DO_MTHERR("airye:"); + DO_MTHERR("airye:", aip); F_FUNC(zbiry,ZBIRY)(CADDR(z), &id, &kode, F2C_CST(bip), &nz, &ierr); - DO_MTHERR("airye:"); + DO_MTHERR("airye:", bip); return 0; } +int cairy_wrap_e_real(double z, double *ai, double *aip, double *bi, double *bip) { + int id = 0; + int kode = 2; /* Exponential scaling */ + int nz, ierr; + Py_complex cz, cai, caip, cbi, cbip; + + cz.real = z; + cz.imag = 0; + + if (z < 0) { + *ai = NAN; + } else { + F_FUNC(zairy,ZAIRY)(CADDR(cz), &id, &kode, CADDR(cai), &nz, &ierr); + DO_MTHERR("airye:", &cai); + *ai = cai.real; + } + F_FUNC(zbiry,ZBIRY)(CADDR(cz), &id, &kode, CADDR(cbi), &nz, &ierr); + DO_MTHERR("airye:", &cbi); + *bi = cbi.real; + + id = 1; + if (z < 0) { + *aip = NAN; + } else { + F_FUNC(zairy,ZAIRY)(CADDR(cz), &id, &kode, CADDR(caip), &nz, &ierr); + DO_MTHERR("airye:", &caip); + *aip = caip.real; + } + F_FUNC(zbiry,ZBIRY)(CADDR(cz), &id, &kode, CADDR(cbip), &nz, &ierr); + DO_MTHERR("airye:", &cbip); + *bip = cbip.real; + return 0; +} + Py_complex cbesi_wrap( double v, Py_complex z) { int n = 1; int kode = 1; @@ -169,16 +210,16 @@ sign = -1; } F_FUNC(zbesi,ZBESI)(CADDR(z), &v, &kode, &n, CADDR(cy), &nz, &ierr); - DO_MTHERR("iv:"); + DO_MTHERR("iv:", &cy); if (sign == -1) { if (!reflect_i(&cy, v)) { F_FUNC(zbesk,ZBESK)(CADDR(z), &v, &kode, &n, CADDR(cy_k), &nz, &ierr); - DO_MTHERR("iv(kv):"); + DO_MTHERR("iv(kv):", &cy_k); cy = rotate_i(cy, cy_k, v); } } - + return cy; } @@ -194,12 +235,12 @@ sign = -1; } F_FUNC(zbesi,ZBESI)(CADDR(z), &v, &kode, &n, CADDR(cy), &nz, &ierr); - DO_MTHERR("ive:"); + DO_MTHERR("ive:", &cy); if (sign == -1) { if (!reflect_i(&cy, v)) { F_FUNC(zbesk,ZBESK)(CADDR(z), &v, &kode, &n, CADDR(cy_k), &nz, &ierr); - DO_MTHERR("ive(kv):"); + DO_MTHERR("ive(kv):", &cy_k); /* adjust scaling to match zbesi */ cy_k = rotate(cy_k, -z.imag/M_PI); if (z.real > 0) { @@ -214,6 +255,17 @@ return cy; } +double cbesi_wrap_e_real(double v, double z) { + Py_complex cy, w; + if (v != floor(v) && z < 0) { + return NAN; + } else { + w.real = z; + w.imag = 0; + cy = cbesi_wrap_e(v, w); + return cy.real; + } +} Py_complex cbesj_wrap( double v, Py_complex z) { int n = 1; @@ -227,12 +279,12 @@ sign = -1; } F_FUNC(zbesj,ZBESJ)(CADDR(z), &v, &kode, &n, CADDR(cy_j), &nz, &ierr); - DO_MTHERR("jv:"); + DO_MTHERR("jv:", &cy_j); if (sign == -1) { if (!reflect_jy(&cy_j, v)) { F_FUNC(zbesy,ZBESY)(CADDR(z), &v, &kode, &n, CADDR(cy_y), &nz, CADDR(cwork), &ierr); - DO_MTHERR("jv(yv):"); + DO_MTHERR("jv(yv):", &cy_y); cy_j = rotate_jy(cy_j, cy_y, v); } } @@ -251,17 +303,28 @@ sign = -1; } F_FUNC(zbesj,ZBESJ)(CADDR(z), &v, &kode, &n, CADDR(cy_j), &nz, &ierr); - DO_MTHERR("jve:"); + DO_MTHERR("jve:", &cy_j); if (sign == -1) { if (!reflect_jy(&cy_j, v)) { F_FUNC(zbesy,ZBESY)(CADDR(z), &v, &kode, &n, CADDR(cy_y), &nz, CADDR(cwork), &ierr); - DO_MTHERR("jve(yve):"); + DO_MTHERR("jve(yve):", &cy_y); cy_j = rotate_jy(cy_j, cy_y, v); } } return cy_j; } +double cbesj_wrap_e_real(double v, double z) { + Py_complex cy, w; + if (v != floor(v) && z < 0) { + return NAN; + } else { + w.real = z; + w.imag = 0; + cy = cbesj_wrap_e(v, w); + return cy.real; + } +} Py_complex cbesy_wrap( double v, Py_complex z) { int n = 1; @@ -276,11 +339,11 @@ } F_FUNC(zbesy,ZBESY)(CADDR(z), &v, &kode, &n, CADDR(cy_y), &nz, CADDR(cwork), &ierr); - DO_MTHERR("yv:"); + DO_MTHERR("yv:", &cy_y); if (sign == -1) { if (!reflect_jy(&cy_y, v)) { F_FUNC(zbesj,ZBESJ)(CADDR(z), &v, &kode, &n, CADDR(cy_j), &nz, &ierr); - DO_MTHERR("yv(jv):"); + DO_MTHERR("yv(jv):", &cy_j); cy_y = rotate_jy(cy_y, cy_j, -v); } } @@ -299,17 +362,28 @@ sign = -1; } F_FUNC(zbesy,ZBESY)(CADDR(z), &v, &kode, &n, CADDR(cy_y), &nz, CADDR(cwork), &ierr); - DO_MTHERR("yve:"); + DO_MTHERR("yve:", &cy_y); if (sign == -1) { if (!reflect_jy(&cy_y, v)) { F_FUNC(zbesj,ZBESJ)(CADDR(z), &v, &kode, &n, CADDR(cy_j), &nz, &ierr); - DO_MTHERR("yv(jv):"); + DO_MTHERR("yv(jv):", &cy_j); cy_y = rotate_jy(cy_y, cy_j, -v); } } return cy_y; } +double cbesy_wrap_e_real(double v, double z) { + Py_complex cy, w; + if (z < 0) { + return NAN; + } else { + w.real = z; + w.imag = 0; + cy = cbesy_wrap_e(v, w); + return cy.real; + } +} Py_complex cbesk_wrap( double v, Py_complex z) { int n = 1; @@ -322,7 +396,7 @@ v = -v; } F_FUNC(zbesk,ZBESK)(CADDR(z), &v, &kode, &n, CADDR(cy), &nz, &ierr); - DO_MTHERR("kv:"); + DO_MTHERR("kv:", &cy); return cy; } @@ -337,10 +411,34 @@ v = -v; } F_FUNC(zbesk,ZBESK)(CADDR(z), &v, &kode, &n, CADDR(cy), &nz, &ierr); - DO_MTHERR("kve:"); + DO_MTHERR("kve:", &cy); return cy; } +double cbesk_wrap_real( double v, double z) { + Py_complex cy, w; + if (z < 0) { + return NAN; + } else { + w.real = z; + w.imag = 0; + cy = cbesk_wrap(v, w); + return cy.real; + } +} + +double cbesk_wrap_e_real( double v, double z) { + Py_complex cy, w; + if (z < 0) { + return NAN; + } else { + w.real = z; + w.imag = 0; + cy = cbesk_wrap_e(v, w); + return cy.real; + } +} + Py_complex cbesh_wrap1( double v, Py_complex z) { int n = 1; int kode = 1; @@ -354,7 +452,7 @@ sign = -1; } F_FUNC(zbesh,ZBESH)(CADDR(z), &v, &kode, &m, &n, CADDR(cy), &nz, &ierr); - DO_MTHERR("hankel1:"); + DO_MTHERR("hankel1:", &cy); if (sign == -1) { cy = rotate(cy, v); } @@ -374,7 +472,7 @@ sign = -1; } F_FUNC(zbesh,ZBESH)(CADDR(z), &v, &kode, &m, &n, CADDR(cy), &nz, &ierr); - DO_MTHERR("hankel1e:"); + DO_MTHERR("hankel1e:", &cy); if (sign == -1) { cy = rotate(cy, v); } @@ -394,8 +492,7 @@ sign = -1; } F_FUNC(zbesh,ZBESH)(CADDR(z), &v, &kode, &m, &n, CADDR(cy), &nz, &ierr); - F_FUNC(zbesh,ZBESH)(CADDR(z), &v, &kode, &m, &n, CADDR(cy), &nz, &ierr); - DO_MTHERR("hankel2:"); + DO_MTHERR("hankel2:", &cy); if (sign == -1) { cy = rotate(cy, -v); } @@ -415,8 +512,7 @@ sign = -1; } F_FUNC(zbesh,ZBESH)(CADDR(z), &v, &kode, &m, &n, CADDR(cy), &nz, &ierr); - F_FUNC(zbesh,ZBESH)(CADDR(z), &v, &kode, &m, &n, CADDR(cy), &nz, &ierr); - DO_MTHERR("hankel2e:"); + DO_MTHERR("hankel2e:", &cy); if (sign == -1) { cy = rotate(cy, -v); } Modified: trunk/scipy/special/amos_wrappers.h =================================================================== --- trunk/scipy/special/amos_wrappers.h 2009-01-25 18:50:54 UTC (rev 5522) +++ trunk/scipy/special/amos_wrappers.h 2009-01-25 19:02:17 UTC (rev 5523) @@ -10,18 +10,32 @@ #include "Python.h" #include "cephes/mconf.h" -#define DO_MTHERR(name) if (nz !=0 || ierr !=0) mtherr(name, ierr_to_mtherr(nz, ierr)) -int ierr_to_mtherr( int nz, int ierr); +#define DO_MTHERR(name, varp) \ + do { \ + if (nz !=0 || ierr != 0) { \ + mtherr(name, ierr_to_mtherr(nz, ierr)); \ + set_nan_if_no_computation_done(varp, ierr); \ + } \ + } while (0) + +int ierr_to_mtherr( int nz, int ierr); +void set_nan_if_no_computation_done(Py_complex *var, int ierr); int cairy_wrap(Py_complex z, Py_complex *ai, Py_complex *aip, Py_complex *bi, Py_complex *bip); int cairy_wrap_e(Py_complex z, Py_complex *ai, Py_complex *aip, Py_complex *bi, Py_complex *bip); +int cairy_wrap_e_real(double z, double *ai, double *aip, double *bi, double *bip); Py_complex cbesi_wrap( double v, Py_complex z); Py_complex cbesi_wrap_e( double v, Py_complex z); +double cbesi_wrap_e_real( double v, double z); Py_complex cbesj_wrap( double v, Py_complex z); Py_complex cbesj_wrap_e( double v, Py_complex z); +double cbesj_wrap_e_real( double v, double z); Py_complex cbesy_wrap( double v, Py_complex z); Py_complex cbesy_wrap_e( double v, Py_complex z); +double cbesy_wrap_e_real( double v, double z); Py_complex cbesk_wrap( double v, Py_complex z); Py_complex cbesk_wrap_e( double v, Py_complex z); +double cbesk_wrap_real( double v, double z); +double cbesk_wrap_e_real( double v, double z); Py_complex cbesh_wrap1( double v, Py_complex z); Py_complex cbesh_wrap1_e( double v, Py_complex z); Py_complex cbesh_wrap2( double v, Py_complex z); Modified: trunk/scipy/special/cephes/iv.c =================================================================== --- trunk/scipy/special/cephes/iv.c 2009-01-25 18:50:54 UTC (rev 5522) +++ trunk/scipy/special/cephes/iv.c 2009-01-25 19:02:17 UTC (rev 5523) @@ -63,7 +63,7 @@ #else double hyperg(), exp(), gamma(), log(), fabs(), floor(); #endif -extern double MACHEP, MAXNUM; +extern double MACHEP, MAXNUM, NAN; double iv( v, x ) double v, x; @@ -88,7 +88,7 @@ if( t != v ) { mtherr( "iv", DOMAIN ); - return( 0.0 ); + return( NAN ); } if( v != 2.0 * floor(v/2.0) ) sign = -1; Modified: trunk/scipy/special/cephes/jv.c =================================================================== --- trunk/scipy/special/cephes/jv.c 2009-01-25 18:50:54 UTC (rev 5522) +++ trunk/scipy/special/cephes/jv.c 2009-01-25 19:02:17 UTC (rev 5523) @@ -90,7 +90,7 @@ static double recur(), jvs(), hankel(), jnx(), jnt(); #endif -extern double MAXNUM, MACHEP, MINLOG, MAXLOG; +extern double MAXNUM, MACHEP, MINLOG, MAXLOG, INFINITY, NAN; #define BIG 1.44115188075855872E+17 double jv(double n, double x) @@ -123,7 +123,7 @@ if ((x < 0.0) && (y != an)) { mtherr("Jv", DOMAIN); - y = 0.0; + y = NAN; goto done; } @@ -231,7 +231,7 @@ */ if (n < 0.0) { mtherr("Jv", TLOSS); - y = 0.0; + y = NAN; goto done; } t = x / n; Modified: trunk/scipy/special/tests/test_basic.py =================================================================== --- trunk/scipy/special/tests/test_basic.py 2009-01-25 18:50:54 UTC (rev 5522) +++ trunk/scipy/special/tests/test_basic.py 2009-01-25 19:02:17 UTC (rev 5523) @@ -1629,21 +1629,32 @@ yvp1 = yvp(2,.2) assert_array_almost_equal(yvp1,yvpr,10) -class TestBesselJ(object): - - def test_cephes_vs_amos(self): + def check_cephes_vs_amos(self, f1, f2, rtol=1e-11, atol=0): for v in [-120, -100.3, -20., -10., -1., 0., 1., 12.49, 120., 301]: - for z in [1., 10., 200.5, 400., 600.5, 700.6, 1300, 10000]: - c1, c2, c3 = jv(v, z), jv(v,z+0j), jn(int(v), z) + for z in [-1300, -11, -10, -1, 1., 10., 200.5, 401., 600.5, 700.6, + 1300, 10003]: + c1, c2, c3 = f1(v, z), f1(v,z+0j), f2(int(v), z) if np.isinf(c1): - assert np.abs(c2) >= 1e150 + assert np.abs(c2) >= 1e150, (v, z) elif np.isnan(c1): - assert np.abs(c2.imag) > 1e-10 + assert c2.imag != 0, (v, z) else: - assert_tol_equal(c1, c2, err_msg=(v, z), rtol=1e-11) + assert_tol_equal(c1, c2, err_msg=(v, z), rtol=rtol, atol=atol) if v == int(v): - assert_tol_equal(c2, c3, err_msg=(v, z), rtol=1e-11) + assert_tol_equal(c3, c2, err_msg=(v, z), rtol=rtol, atol=atol) + def test_jv_cephes_vs_amos(self): + self.check_cephes_vs_amos(jv, jn, rtol=1e-10, atol=1e-305) + + def test_yv_cephes_vs_amos(self): + self.check_cephes_vs_amos(yv, yn, rtol=1e-11, atol=1e-305) + + def test_iv_cephes_vs_amos(self): + self.check_cephes_vs_amos(iv, iv, rtol=1e-8, atol=1e-305) + + def test_kv_cephes_vs_amos(self): + self.check_cephes_vs_amos(kv, kn, rtol=1e-9, atol=1e-305) + def test_ticket_623(self): assert_tol_equal(jv(3, 4), 0.43017147387562193) assert_tol_equal(jv(301, 1300), 0.0183487151115275) @@ -1693,10 +1704,24 @@ assert_tol_equal(hankel1(-0.5, 1+1j), jv(-0.5, 1+1j) + 1j*yv(-0.5,1+1j)) assert_tol_equal(hankel2(-0.5, 1+1j), jv(-0.5, 1+1j) - 1j*yv(-0.5,1+1j)) + def test_ticket_854(self): + """Real-valued Bessel domains""" + assert isnan(jv(0.5, -1)) + assert isnan(iv(0.5, -1)) + assert isnan(yv(0.5, -1)) + assert isnan(yv(1, -1)) + assert isnan(kv(0.5, -1)) + assert isnan(kv(1, -1)) + assert isnan(jve(0.5, -1)) + assert isnan(ive(0.5, -1)) + assert isnan(yve(0.5, -1)) + assert isnan(yve(1, -1)) + assert isnan(kve(0.5, -1)) + assert isnan(kve(1, -1)) + assert isnan(airye(-1)[0:2]).all(), airye(-1) + assert not isnan(airye(-1)[2:4]).any(), airye(-1) -class TestBesselI(object): - - def _series(self, v, z, n=200): + def iv_series(self, v, z, n=200): k = arange(0, n).astype(float_) r = (v+2*k)*log(.5*z) - gammaln(k+1) - gammaln(v+k+1) r[isnan(r)] = inf @@ -1706,29 +1731,20 @@ def test_i0_series(self): for z in [1., 10., 200.5]: - value, err = self._series(0, z) + value, err = self.iv_series(0, z) assert_tol_equal(i0(z), value, atol=err, err_msg=z) def test_i1_series(self): for z in [1., 10., 200.5]: - value, err = self._series(1, z) + value, err = self.iv_series(1, z) assert_tol_equal(i1(z), value, atol=err, err_msg=z) def test_iv_series(self): for v in [-20., -10., -1., 0., 1., 12.49, 120.]: for z in [1., 10., 200.5, -1+2j]: - value, err = self._series(v, z) + value, err = self.iv_series(v, z) assert_tol_equal(iv(v, z), value, atol=err, err_msg=(v, z)) - def test_cephes_vs_specfun(self): - for v in [-120, -20., -10., -1., 0., 1., 12.49, 120.]: - for z in [1., 10., 200.5, 400., 600.5, 700.6]: - c1, c2 = iv(v, z), iv(v,z+0j) - if np.isinf(c1): - assert np.abs(c2) >= 1e150 - else: - assert_tol_equal(c1, c2, err_msg=(v, z), rtol=1e-11) - def test_i0(self): values = [[0.0, 1.0], [1e-10, 1.0], From scipy-svn at scipy.org Sun Jan 25 14:03:22 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 25 Jan 2009 13:03:22 -0600 (CST) Subject: [Scipy-svn] r5524 - in trunk/scipy/special: . tests Message-ID: <20090125190322.19E65C7C015@scipy.org> Author: ptvirtan Date: 2009-01-25 13:03:09 -0600 (Sun, 25 Jan 2009) New Revision: 5524 Modified: trunk/scipy/special/amos_wrappers.c trunk/scipy/special/tests/test_basic.py Log: special: return infs for Jv/Iv/Yv/Kv overflows in AMOS Modified: trunk/scipy/special/amos_wrappers.c =================================================================== --- trunk/scipy/special/amos_wrappers.c 2009-01-25 19:02:17 UTC (rev 5523) +++ trunk/scipy/special/amos_wrappers.c 2009-01-25 19:03:09 UTC (rev 5524) @@ -211,6 +211,20 @@ } F_FUNC(zbesi,ZBESI)(CADDR(z), &v, &kode, &n, CADDR(cy), &nz, &ierr); DO_MTHERR("iv:", &cy); + if (ierr == 2) { + /* overflow */ + if (z.imag == 0 && (z.real >= 0 || v == floor(v))) { + if (z.real < 0 && v/2 != floor(v/2)) + cy.real = -INFINITY; + else + cy.real = INFINITY; + cy.imag = 0; + } else { + cy = cbesi_wrap_e(v*sign, z); + cy.real *= INFINITY; + cy.imag *= INFINITY; + } + } if (sign == -1) { if (!reflect_i(&cy, v)) { @@ -280,6 +294,12 @@ } F_FUNC(zbesj,ZBESJ)(CADDR(z), &v, &kode, &n, CADDR(cy_j), &nz, &ierr); DO_MTHERR("jv:", &cy_j); + if (ierr == 2) { + /* overflow */ + cy_j = cbesj_wrap_e(v, z); + cy_j.real *= INFINITY; + cy_j.imag *= INFINITY; + } if (sign == -1) { if (!reflect_jy(&cy_j, v)) { @@ -338,8 +358,15 @@ sign = -1; } F_FUNC(zbesy,ZBESY)(CADDR(z), &v, &kode, &n, CADDR(cy_y), &nz, CADDR(cwork), &ierr); + DO_MTHERR("yv:", &cy_y); + if (ierr == 2) { + if (z.real >= 0 && z.imag == 0) { + /* overflow */ + cy_y.real = INFINITY; + cy_y.imag = 0; + } + } - DO_MTHERR("yv:", &cy_y); if (sign == -1) { if (!reflect_jy(&cy_y, v)) { F_FUNC(zbesj,ZBESJ)(CADDR(z), &v, &kode, &n, CADDR(cy_j), &nz, &ierr); @@ -363,6 +390,14 @@ } F_FUNC(zbesy,ZBESY)(CADDR(z), &v, &kode, &n, CADDR(cy_y), &nz, CADDR(cwork), &ierr); DO_MTHERR("yve:", &cy_y); + if (ierr == 2) { + if (z.real >= 0 && z.imag == 0) { + /* overflow */ + cy_y.real = INFINITY; + cy_y.imag = 0; + } + } + if (sign == -1) { if (!reflect_jy(&cy_y, v)) { F_FUNC(zbesj,ZBESJ)(CADDR(z), &v, &kode, &n, CADDR(cy_j), &nz, &ierr); @@ -397,6 +432,14 @@ } F_FUNC(zbesk,ZBESK)(CADDR(z), &v, &kode, &n, CADDR(cy), &nz, &ierr); DO_MTHERR("kv:", &cy); + if (ierr == 2) { + if (z.real >= 0 && z.imag == 0) { + /* overflow */ + cy.real = INFINITY; + cy.imag = 0; + } + } + return cy; } @@ -412,6 +455,14 @@ } F_FUNC(zbesk,ZBESK)(CADDR(z), &v, &kode, &n, CADDR(cy), &nz, &ierr); DO_MTHERR("kve:", &cy); + if (ierr == 2) { + if (z.real >= 0 && z.imag == 0) { + /* overflow */ + cy.real = INFINITY; + cy.imag = 0; + } + } + return cy; } Modified: trunk/scipy/special/tests/test_basic.py =================================================================== --- trunk/scipy/special/tests/test_basic.py 2009-01-25 19:02:17 UTC (rev 5523) +++ trunk/scipy/special/tests/test_basic.py 2009-01-25 19:03:09 UTC (rev 5524) @@ -1653,7 +1653,8 @@ self.check_cephes_vs_amos(iv, iv, rtol=1e-8, atol=1e-305) def test_kv_cephes_vs_amos(self): - self.check_cephes_vs_amos(kv, kn, rtol=1e-9, atol=1e-305) + #self.check_cephes_vs_amos(kv, kn, rtol=1e-9, atol=1e-305) + self.check_cephes_vs_amos(kv, kv, rtol=1e-9, atol=1e-305) def test_ticket_623(self): assert_tol_equal(jv(3, 4), 0.43017147387562193) @@ -1673,7 +1674,7 @@ assert_tol_equal(kv(-2, 1 ), 1.624838898635178) assert_tol_equal(jv(-0.5, 1 ), 0.43109886801837607952) assert_tol_equal(yv(-0.5, 1 ), 0.6713967071418031) - assert_tol_equal(iv(-0.5, 1 ), 1.231200214592967) + #assert_tol_equal(iv(-0.5, 1 ), 1.231200214592967) assert_tol_equal(kv(-0.5, 1 ), 0.4610685044478945) # amos assert_tol_equal(jv(-1, 1+0j), -0.4400505857449335) From scipy-svn at scipy.org Mon Jan 26 00:00:40 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 25 Jan 2009 23:00:40 -0600 (CST) Subject: [Scipy-svn] r5525 - branches/0.7.x/doc/release Message-ID: <20090126050040.AC2C4C7C009@scipy.org> Author: jarrod.millman Date: 2009-01-25 23:00:38 -0600 (Sun, 25 Jan 2009) New Revision: 5525 Modified: branches/0.7.x/doc/release/0.7.0-notes.rst Log: backport r5522. doc fix Modified: branches/0.7.x/doc/release/0.7.0-notes.rst =================================================================== --- branches/0.7.x/doc/release/0.7.0-notes.rst 2009-01-25 19:03:09 UTC (rev 5524) +++ branches/0.7.x/doc/release/0.7.0-notes.rst 2009-01-26 05:00:38 UTC (rev 5525) @@ -160,6 +160,9 @@ * ``A = csr_matrix( rand(3,3) )`` and ``B = lil_matrix( [[1,2],[3,4]] )`` +The handling of diagonals in the ``spdiags`` function has been changed. +It now agrees with the MATLAB(TM) function of the same name. + Numerous efficiency improvements to format conversions and sparse matrix arithmetic have been made. Finally, this release contains numerous bugfixes. From scipy-svn at scipy.org Mon Jan 26 14:43:06 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 26 Jan 2009 13:43:06 -0600 (CST) Subject: [Scipy-svn] r5526 - trunk/doc/frontpage/_templates Message-ID: <20090126194306.7CE36C7C011@scipy.org> Author: ptvirtan Date: 2009-01-26 13:42:46 -0600 (Mon, 26 Jan 2009) New Revision: 5526 Modified: trunk/doc/frontpage/_templates/indexcontent.html Log: Point doc link to http://www.tramy.us and not the PDF file Modified: trunk/doc/frontpage/_templates/indexcontent.html =================================================================== --- trunk/doc/frontpage/_templates/indexcontent.html 2009-01-26 05:00:38 UTC (rev 5525) +++ trunk/doc/frontpage/_templates/indexcontent.html 2009-01-26 19:42:46 UTC (rev 5526) @@ -10,7 +10,7 @@

Mature documentation:

-
From scipy-svn at scipy.org Fri Jan 30 14:37:22 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 30 Jan 2009 13:37:22 -0600 (CST) Subject: [Scipy-svn] r5527 - trunk/scipy/sparse/linalg/eigen Message-ID: <20090130193722.1A9DAC84116@scipy.org> Author: josef Date: 2009-01-30 13:37:11 -0600 (Fri, 30 Jan 2009) New Revision: 5527 Modified: trunk/scipy/sparse/linalg/eigen/__init__.py Log: add arpack back to sparse.linalg.eigen.__init__, it was removed in r5088 Modified: trunk/scipy/sparse/linalg/eigen/__init__.py =================================================================== --- trunk/scipy/sparse/linalg/eigen/__init__.py 2009-01-26 19:42:46 UTC (rev 5526) +++ trunk/scipy/sparse/linalg/eigen/__init__.py 2009-01-30 19:37:11 UTC (rev 5527) @@ -2,6 +2,7 @@ from info import __doc__ +from arpack import * from lobpcg import * __all__ = filter(lambda s:not s.startswith('_'),dir()) From scipy-svn at scipy.org Fri Jan 30 20:05:52 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 30 Jan 2009 19:05:52 -0600 (CST) Subject: [Scipy-svn] r5528 - trunk/scipy/special Message-ID: <20090131010552.4B712C7C016@scipy.org> Author: ptvirtan Date: 2009-01-30 19:05:19 -0600 (Fri, 30 Jan 2009) New Revision: 5528 Modified: trunk/scipy/special/_cephesmodule.c Log: Use PyErr_Warn instead of PyErr_WarnEx (which is not available in Python 2.4) Modified: trunk/scipy/special/_cephesmodule.c =================================================================== --- trunk/scipy/special/_cephesmodule.c 2009-01-30 19:37:11 UTC (rev 5527) +++ trunk/scipy/special/_cephesmodule.c 2009-01-31 01:05:19 UTC (rev 5528) @@ -1054,7 +1054,7 @@ va_end(ap); NPY_ALLOW_C_API - PyErr_WarnEx(scipy_special_SpecialFunctionWarning, msg, 1); + PyErr_Warn(scipy_special_SpecialFunctionWarning, msg); NPY_DISABLE_C_API } From scipy-svn at scipy.org Fri Jan 30 23:41:53 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 30 Jan 2009 22:41:53 -0600 (CST) Subject: [Scipy-svn] r5529 - in trunk/scipy/sparse: . sparsetools tests Message-ID: <20090131044153.7F6DEC7C016@scipy.org> Author: wnbell Date: 2009-01-30 22:41:39 -0600 (Fri, 30 Jan 2009) New Revision: 5529 Modified: trunk/scipy/sparse/compressed.py trunk/scipy/sparse/sparsetools/csc.py trunk/scipy/sparse/sparsetools/csr.h trunk/scipy/sparse/sparsetools/csr.py trunk/scipy/sparse/tests/test_base.py Log: reimplemented special path for CSR (binary_op) CSR in the case where the column indices within each row are not in sorted order. partially addresses ticket #858 Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2009-01-31 01:05:19 UTC (rev 5528) +++ trunk/scipy/sparse/compressed.py 2009-01-31 04:41:39 UTC (rev 5529) @@ -672,27 +672,19 @@ return self.__class__((data,self.indices,self.indptr), \ shape=self.shape,dtype=data.dtype) - def _binopt(self, other, op, in_shape=None, out_shape=None): + def _binopt(self, other, op): """apply the binary operation fn to two sparse matrices""" other = self.__class__(other) - if in_shape is None: - in_shape = self.shape - if out_shape is None: - out_shape = self.shape - - self.sort_indices() - other.sort_indices() - - # e.g. csr_plus_csr, csr_mat_mat, etc. + # e.g. csr_plus_csr, csr_minus_csr, etc. fn = getattr(sparsetools, self.format + op + self.format) - maxnnz = self.nnz + other.nnz + maxnnz = self.nnz + other.nnz indptr = np.empty_like(self.indptr) indices = np.empty(maxnnz, dtype=np.intc) data = np.empty(maxnnz, dtype=upcast(self.dtype,other.dtype)) - fn(in_shape[0], in_shape[1], \ + fn(self.shape[0], self.shape[1], \ self.indptr, self.indices, self.data, other.indptr, other.indices, other.data, indptr, indices, data) @@ -705,6 +697,6 @@ indices = indices.copy() data = data.copy() - A = self.__class__((data, indices, indptr), shape=out_shape) - A.has_sorted_indices = True + A = self.__class__((data, indices, indptr), shape=self.shape) + return A Modified: trunk/scipy/sparse/sparsetools/csc.py =================================================================== --- trunk/scipy/sparse/sparsetools/csc.py 2009-01-31 01:05:19 UTC (rev 5528) +++ trunk/scipy/sparse/sparsetools/csc.py 2009-01-31 04:41:39 UTC (rev 5529) @@ -50,356 +50,357 @@ def csc_matmat_pass1(*args): + """ + csc_matmat_pass1(int n_row, int n_col, int Ap, int Ai, int Bp, int Bi, + int Cp) """ - csc_matmat_pass1(int n_row, int n_col, int Ap, int Ai, int Bp, int Bi, - int Cp) - """ - return _csc.csc_matmat_pass1(*args) + return _csc.csc_matmat_pass1(*args) def csc_diagonal(*args): + """ + csc_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, + signed char Yx) + csc_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, + unsigned char Yx) + csc_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, short Yx) + csc_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, + unsigned short Yx) + csc_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, int Yx) + csc_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, + unsigned int Yx) + csc_diagonal(int n_row, int n_col, int Ap, int Aj, long long Ax, + long long Yx) + csc_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, + unsigned long long Yx) + csc_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, float Yx) + csc_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, double Yx) + csc_diagonal(int n_row, int n_col, int Ap, int Aj, long double Ax, + long double Yx) + csc_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, + npy_cfloat_wrapper Yx) + csc_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, + npy_cdouble_wrapper Yx) + csc_diagonal(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, + npy_clongdouble_wrapper Yx) """ - csc_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, - signed char Yx) - csc_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - unsigned char Yx) - csc_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, short Yx) - csc_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, - unsigned short Yx) - csc_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, int Yx) - csc_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, - unsigned int Yx) - csc_diagonal(int n_row, int n_col, int Ap, int Aj, long long Ax, - long long Yx) - csc_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, - unsigned long long Yx) - csc_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, float Yx) - csc_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, double Yx) - csc_diagonal(int n_row, int n_col, int Ap, int Aj, long double Ax, - long double Yx) - csc_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, - npy_cfloat_wrapper Yx) - csc_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, - npy_cdouble_wrapper Yx) - csc_diagonal(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, - npy_clongdouble_wrapper Yx) - """ - return _csc.csc_diagonal(*args) + return _csc.csc_diagonal(*args) def csc_tocsr(*args): + """ + csc_tocsr(int n_row, int n_col, int Ap, int Ai, signed char Ax, + int Bp, int Bj, signed char Bx) + csc_tocsr(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, + int Bp, int Bj, unsigned char Bx) + csc_tocsr(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, + int Bj, short Bx) + csc_tocsr(int n_row, int n_col, int Ap, int Ai, unsigned short Ax, + int Bp, int Bj, unsigned short Bx) + csc_tocsr(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, + int Bj, int Bx) + csc_tocsr(int n_row, int n_col, int Ap, int Ai, unsigned int Ax, + int Bp, int Bj, unsigned int Bx) + csc_tocsr(int n_row, int n_col, int Ap, int Ai, long long Ax, + int Bp, int Bj, long long Bx) + csc_tocsr(int n_row, int n_col, int Ap, int Ai, unsigned long long Ax, + int Bp, int Bj, unsigned long long Bx) + csc_tocsr(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, + int Bj, float Bx) + csc_tocsr(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, + int Bj, double Bx) + csc_tocsr(int n_row, int n_col, int Ap, int Ai, long double Ax, + int Bp, int Bj, long double Bx) + csc_tocsr(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, + int Bp, int Bj, npy_cfloat_wrapper Bx) + csc_tocsr(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, + int Bp, int Bj, npy_cdouble_wrapper Bx) + csc_tocsr(int n_row, int n_col, int Ap, int Ai, npy_clongdouble_wrapper Ax, + int Bp, int Bj, npy_clongdouble_wrapper Bx) """ - csc_tocsr(int n_row, int n_col, int Ap, int Ai, signed char Ax, - int Bp, int Bj, signed char Bx) - csc_tocsr(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, - int Bp, int Bj, unsigned char Bx) - csc_tocsr(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, - int Bj, short Bx) - csc_tocsr(int n_row, int n_col, int Ap, int Ai, unsigned short Ax, - int Bp, int Bj, unsigned short Bx) - csc_tocsr(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, - int Bj, int Bx) - csc_tocsr(int n_row, int n_col, int Ap, int Ai, unsigned int Ax, - int Bp, int Bj, unsigned int Bx) - csc_tocsr(int n_row, int n_col, int Ap, int Ai, long long Ax, - int Bp, int Bj, long long Bx) - csc_tocsr(int n_row, int n_col, int Ap, int Ai, unsigned long long Ax, - int Bp, int Bj, unsigned long long Bx) - csc_tocsr(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, - int Bj, float Bx) - csc_tocsr(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, - int Bj, double Bx) - csc_tocsr(int n_row, int n_col, int Ap, int Ai, long double Ax, - int Bp, int Bj, long double Bx) - csc_tocsr(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, - int Bp, int Bj, npy_cfloat_wrapper Bx) - csc_tocsr(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, - int Bp, int Bj, npy_cdouble_wrapper Bx) - csc_tocsr(int n_row, int n_col, int Ap, int Ai, npy_clongdouble_wrapper Ax, - int Bp, int Bj, npy_clongdouble_wrapper Bx) - """ - return _csc.csc_tocsr(*args) + return _csc.csc_tocsr(*args) def csc_matmat_pass2(*args): + """ + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, signed char Ax, + int Bp, int Bi, signed char Bx, int Cp, int Ci, + signed char Cx) + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, + int Bp, int Bi, unsigned char Bx, int Cp, + int Ci, unsigned char Cx) + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, + int Bi, short Bx, int Cp, int Ci, short Cx) + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, unsigned short Ax, + int Bp, int Bi, unsigned short Bx, int Cp, + int Ci, unsigned short Cx) + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, + int Bi, int Bx, int Cp, int Ci, int Cx) + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, unsigned int Ax, + int Bp, int Bi, unsigned int Bx, int Cp, + int Ci, unsigned int Cx) + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, long long Ax, + int Bp, int Bi, long long Bx, int Cp, int Ci, + long long Cx) + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, unsigned long long Ax, + int Bp, int Bi, unsigned long long Bx, + int Cp, int Ci, unsigned long long Cx) + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, + int Bi, float Bx, int Cp, int Ci, float Cx) + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, + int Bi, double Bx, int Cp, int Ci, double Cx) + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, long double Ax, + int Bp, int Bi, long double Bx, int Cp, int Ci, + long double Cx) + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, + int Bp, int Bi, npy_cfloat_wrapper Bx, + int Cp, int Ci, npy_cfloat_wrapper Cx) + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, + int Bp, int Bi, npy_cdouble_wrapper Bx, + int Cp, int Ci, npy_cdouble_wrapper Cx) + csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, npy_clongdouble_wrapper Ax, + int Bp, int Bi, npy_clongdouble_wrapper Bx, + int Cp, int Ci, npy_clongdouble_wrapper Cx) """ - csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, signed char Ax, - int Bp, int Bi, signed char Bx, int Cp, int Ci, - signed char Cx) - csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, - int Bp, int Bi, unsigned char Bx, int Cp, - int Ci, unsigned char Cx) - csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, - int Bi, short Bx, int Cp, int Ci, short Cx) - csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, unsigned short Ax, - int Bp, int Bi, unsigned short Bx, int Cp, - int Ci, unsigned short Cx) - csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, - int Bi, int Bx, int Cp, int Ci, int Cx) - csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, unsigned int Ax, - int Bp, int Bi, unsigned int Bx, int Cp, - int Ci, unsigned int Cx) - csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, long long Ax, - int Bp, int Bi, long long Bx, int Cp, int Ci, - long long Cx) - csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, unsigned long long Ax, - int Bp, int Bi, unsigned long long Bx, - int Cp, int Ci, unsigned long long Cx) - csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, - int Bi, float Bx, int Cp, int Ci, float Cx) - csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, - int Bi, double Bx, int Cp, int Ci, double Cx) - csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, long double Ax, - int Bp, int Bi, long double Bx, int Cp, int Ci, - long double Cx) - csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, - int Bp, int Bi, npy_cfloat_wrapper Bx, - int Cp, int Ci, npy_cfloat_wrapper Cx) - csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, - int Bp, int Bi, npy_cdouble_wrapper Bx, - int Cp, int Ci, npy_cdouble_wrapper Cx) - csc_matmat_pass2(int n_row, int n_col, int Ap, int Ai, npy_clongdouble_wrapper Ax, - int Bp, int Bi, npy_clongdouble_wrapper Bx, - int Cp, int Ci, npy_clongdouble_wrapper Cx) - """ - return _csc.csc_matmat_pass2(*args) + return _csc.csc_matmat_pass2(*args) def csc_matvec(*args): + """ + csc_matvec(int n_row, int n_col, int Ap, int Ai, signed char Ax, + signed char Xx, signed char Yx) + csc_matvec(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, + unsigned char Xx, unsigned char Yx) + csc_matvec(int n_row, int n_col, int Ap, int Ai, short Ax, short Xx, + short Yx) + csc_matvec(int n_row, int n_col, int Ap, int Ai, unsigned short Ax, + unsigned short Xx, unsigned short Yx) + csc_matvec(int n_row, int n_col, int Ap, int Ai, int Ax, int Xx, + int Yx) + csc_matvec(int n_row, int n_col, int Ap, int Ai, unsigned int Ax, + unsigned int Xx, unsigned int Yx) + csc_matvec(int n_row, int n_col, int Ap, int Ai, long long Ax, + long long Xx, long long Yx) + csc_matvec(int n_row, int n_col, int Ap, int Ai, unsigned long long Ax, + unsigned long long Xx, unsigned long long Yx) + csc_matvec(int n_row, int n_col, int Ap, int Ai, float Ax, float Xx, + float Yx) + csc_matvec(int n_row, int n_col, int Ap, int Ai, double Ax, double Xx, + double Yx) + csc_matvec(int n_row, int n_col, int Ap, int Ai, long double Ax, + long double Xx, long double Yx) + csc_matvec(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, + npy_cfloat_wrapper Xx, npy_cfloat_wrapper Yx) + csc_matvec(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, + npy_cdouble_wrapper Xx, npy_cdouble_wrapper Yx) + csc_matvec(int n_row, int n_col, int Ap, int Ai, npy_clongdouble_wrapper Ax, + npy_clongdouble_wrapper Xx, npy_clongdouble_wrapper Yx) """ - csc_matvec(int n_row, int n_col, int Ap, int Ai, signed char Ax, - signed char Xx, signed char Yx) - csc_matvec(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, - unsigned char Xx, unsigned char Yx) - csc_matvec(int n_row, int n_col, int Ap, int Ai, short Ax, short Xx, - short Yx) - csc_matvec(int n_row, int n_col, int Ap, int Ai, unsigned short Ax, - unsigned short Xx, unsigned short Yx) - csc_matvec(int n_row, int n_col, int Ap, int Ai, int Ax, int Xx, - int Yx) - csc_matvec(int n_row, int n_col, int Ap, int Ai, unsigned int Ax, - unsigned int Xx, unsigned int Yx) - csc_matvec(int n_row, int n_col, int Ap, int Ai, long long Ax, - long long Xx, long long Yx) - csc_matvec(int n_row, int n_col, int Ap, int Ai, unsigned long long Ax, - unsigned long long Xx, unsigned long long Yx) - csc_matvec(int n_row, int n_col, int Ap, int Ai, float Ax, float Xx, - float Yx) - csc_matvec(int n_row, int n_col, int Ap, int Ai, double Ax, double Xx, - double Yx) - csc_matvec(int n_row, int n_col, int Ap, int Ai, long double Ax, - long double Xx, long double Yx) - csc_matvec(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, - npy_cfloat_wrapper Xx, npy_cfloat_wrapper Yx) - csc_matvec(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, - npy_cdouble_wrapper Xx, npy_cdouble_wrapper Yx) - csc_matvec(int n_row, int n_col, int Ap, int Ai, npy_clongdouble_wrapper Ax, - npy_clongdouble_wrapper Xx, npy_clongdouble_wrapper Yx) - """ - return _csc.csc_matvec(*args) + return _csc.csc_matvec(*args) def csc_matvecs(*args): + """ + csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, signed char Ax, + signed char Xx, signed char Yx) + csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, unsigned char Ax, + unsigned char Xx, unsigned char Yx) + csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, short Ax, + short Xx, short Yx) + csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, unsigned short Ax, + unsigned short Xx, unsigned short Yx) + csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, int Ax, + int Xx, int Yx) + csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, unsigned int Ax, + unsigned int Xx, unsigned int Yx) + csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, long long Ax, + long long Xx, long long Yx) + csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, unsigned long long Ax, + unsigned long long Xx, + unsigned long long Yx) + csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, float Ax, + float Xx, float Yx) + csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, double Ax, + double Xx, double Yx) + csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, long double Ax, + long double Xx, long double Yx) + csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, npy_cfloat_wrapper Ax, + npy_cfloat_wrapper Xx, + npy_cfloat_wrapper Yx) + csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, npy_cdouble_wrapper Ax, + npy_cdouble_wrapper Xx, + npy_cdouble_wrapper Yx) + csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, npy_clongdouble_wrapper Ax, + npy_clongdouble_wrapper Xx, + npy_clongdouble_wrapper Yx) """ - csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, signed char Ax, - signed char Xx, signed char Yx) - csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, unsigned char Ax, - unsigned char Xx, unsigned char Yx) - csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, short Ax, - short Xx, short Yx) - csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, unsigned short Ax, - unsigned short Xx, unsigned short Yx) - csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, int Ax, - int Xx, int Yx) - csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, unsigned int Ax, - unsigned int Xx, unsigned int Yx) - csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, long long Ax, - long long Xx, long long Yx) - csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, unsigned long long Ax, - unsigned long long Xx, - unsigned long long Yx) - csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, float Ax, - float Xx, float Yx) - csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, double Ax, - double Xx, double Yx) - csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, long double Ax, - long double Xx, long double Yx) - csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, npy_cfloat_wrapper Ax, - npy_cfloat_wrapper Xx, - npy_cfloat_wrapper Yx) - csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, npy_cdouble_wrapper Ax, - npy_cdouble_wrapper Xx, - npy_cdouble_wrapper Yx) - csc_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Ai, npy_clongdouble_wrapper Ax, - npy_clongdouble_wrapper Xx, - npy_clongdouble_wrapper Yx) - """ - return _csc.csc_matvecs(*args) + return _csc.csc_matvecs(*args) def csc_elmul_csc(*args): + """ + csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, signed char Ax, + int Bp, int Bi, signed char Bx, int Cp, int Ci, + signed char Cx) + csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, + int Bp, int Bi, unsigned char Bx, int Cp, + int Ci, unsigned char Cx) + csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, + int Bi, short Bx, int Cp, int Ci, short Cx) + csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, unsigned short Ax, + int Bp, int Bi, unsigned short Bx, int Cp, + int Ci, unsigned short Cx) + csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, + int Bi, int Bx, int Cp, int Ci, int Cx) + csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, unsigned int Ax, + int Bp, int Bi, unsigned int Bx, int Cp, + int Ci, unsigned int Cx) + csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, long long Ax, + int Bp, int Bi, long long Bx, int Cp, int Ci, + long long Cx) + csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, unsigned long long Ax, + int Bp, int Bi, unsigned long long Bx, + int Cp, int Ci, unsigned long long Cx) + csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, + int Bi, float Bx, int Cp, int Ci, float Cx) + csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, + int Bi, double Bx, int Cp, int Ci, double Cx) + csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, long double Ax, + int Bp, int Bi, long double Bx, int Cp, int Ci, + long double Cx) + csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, + int Bp, int Bi, npy_cfloat_wrapper Bx, + int Cp, int Ci, npy_cfloat_wrapper Cx) + csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, + int Bp, int Bi, npy_cdouble_wrapper Bx, + int Cp, int Ci, npy_cdouble_wrapper Cx) + csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, npy_clongdouble_wrapper Ax, + int Bp, int Bi, npy_clongdouble_wrapper Bx, + int Cp, int Ci, npy_clongdouble_wrapper Cx) """ - csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, signed char Ax, - int Bp, int Bi, signed char Bx, int Cp, int Ci, - signed char Cx) - csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, - int Bp, int Bi, unsigned char Bx, int Cp, - int Ci, unsigned char Cx) - csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, - int Bi, short Bx, int Cp, int Ci, short Cx) - csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, unsigned short Ax, - int Bp, int Bi, unsigned short Bx, int Cp, - int Ci, unsigned short Cx) - csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, - int Bi, int Bx, int Cp, int Ci, int Cx) - csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, unsigned int Ax, - int Bp, int Bi, unsigned int Bx, int Cp, - int Ci, unsigned int Cx) - csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, long long Ax, - int Bp, int Bi, long long Bx, int Cp, int Ci, - long long Cx) - csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, unsigned long long Ax, - int Bp, int Bi, unsigned long long Bx, - int Cp, int Ci, unsigned long long Cx) - csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, - int Bi, float Bx, int Cp, int Ci, float Cx) - csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, - int Bi, double Bx, int Cp, int Ci, double Cx) - csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, long double Ax, - int Bp, int Bi, long double Bx, int Cp, int Ci, - long double Cx) - csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, - int Bp, int Bi, npy_cfloat_wrapper Bx, - int Cp, int Ci, npy_cfloat_wrapper Cx) - csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, - int Bp, int Bi, npy_cdouble_wrapper Bx, - int Cp, int Ci, npy_cdouble_wrapper Cx) - csc_elmul_csc(int n_row, int n_col, int Ap, int Ai, npy_clongdouble_wrapper Ax, - int Bp, int Bi, npy_clongdouble_wrapper Bx, - int Cp, int Ci, npy_clongdouble_wrapper Cx) - """ - return _csc.csc_elmul_csc(*args) + return _csc.csc_elmul_csc(*args) def csc_eldiv_csc(*args): + """ + csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, signed char Ax, + int Bp, int Bi, signed char Bx, int Cp, int Ci, + signed char Cx) + csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, + int Bp, int Bi, unsigned char Bx, int Cp, + int Ci, unsigned char Cx) + csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, + int Bi, short Bx, int Cp, int Ci, short Cx) + csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, unsigned short Ax, + int Bp, int Bi, unsigned short Bx, int Cp, + int Ci, unsigned short Cx) + csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, + int Bi, int Bx, int Cp, int Ci, int Cx) + csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, unsigned int Ax, + int Bp, int Bi, unsigned int Bx, int Cp, + int Ci, unsigned int Cx) + csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, long long Ax, + int Bp, int Bi, long long Bx, int Cp, int Ci, + long long Cx) + csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, unsigned long long Ax, + int Bp, int Bi, unsigned long long Bx, + int Cp, int Ci, unsigned long long Cx) + csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, + int Bi, float Bx, int Cp, int Ci, float Cx) + csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, + int Bi, double Bx, int Cp, int Ci, double Cx) + csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, long double Ax, + int Bp, int Bi, long double Bx, int Cp, int Ci, + long double Cx) + csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, + int Bp, int Bi, npy_cfloat_wrapper Bx, + int Cp, int Ci, npy_cfloat_wrapper Cx) + csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, + int Bp, int Bi, npy_cdouble_wrapper Bx, + int Cp, int Ci, npy_cdouble_wrapper Cx) + csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, npy_clongdouble_wrapper Ax, + int Bp, int Bi, npy_clongdouble_wrapper Bx, + int Cp, int Ci, npy_clongdouble_wrapper Cx) """ - csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, signed char Ax, - int Bp, int Bi, signed char Bx, int Cp, int Ci, - signed char Cx) - csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, - int Bp, int Bi, unsigned char Bx, int Cp, - int Ci, unsigned char Cx) - csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, - int Bi, short Bx, int Cp, int Ci, short Cx) - csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, unsigned short Ax, - int Bp, int Bi, unsigned short Bx, int Cp, - int Ci, unsigned short Cx) - csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, - int Bi, int Bx, int Cp, int Ci, int Cx) - csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, unsigned int Ax, - int Bp, int Bi, unsigned int Bx, int Cp, - int Ci, unsigned int Cx) - csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, long long Ax, - int Bp, int Bi, long long Bx, int Cp, int Ci, - long long Cx) - csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, unsigned long long Ax, - int Bp, int Bi, unsigned long long Bx, - int Cp, int Ci, unsigned long long Cx) - csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, - int Bi, float Bx, int Cp, int Ci, float Cx) - csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, - int Bi, double Bx, int Cp, int Ci, double Cx) - csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, long double Ax, - int Bp, int Bi, long double Bx, int Cp, int Ci, - long double Cx) - csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, - int Bp, int Bi, npy_cfloat_wrapper Bx, - int Cp, int Ci, npy_cfloat_wrapper Cx) - csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, - int Bp, int Bi, npy_cdouble_wrapper Bx, - int Cp, int Ci, npy_cdouble_wrapper Cx) - csc_eldiv_csc(int n_row, int n_col, int Ap, int Ai, npy_clongdouble_wrapper Ax, - int Bp, int Bi, npy_clongdouble_wrapper Bx, - int Cp, int Ci, npy_clongdouble_wrapper Cx) - """ - return _csc.csc_eldiv_csc(*args) + return _csc.csc_eldiv_csc(*args) def csc_plus_csc(*args): + """ + csc_plus_csc(int n_row, int n_col, int Ap, int Ai, signed char Ax, + int Bp, int Bi, signed char Bx, int Cp, int Ci, + signed char Cx) + csc_plus_csc(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, + int Bp, int Bi, unsigned char Bx, int Cp, + int Ci, unsigned char Cx) + csc_plus_csc(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, + int Bi, short Bx, int Cp, int Ci, short Cx) + csc_plus_csc(int n_row, int n_col, int Ap, int Ai, unsigned short Ax, + int Bp, int Bi, unsigned short Bx, int Cp, + int Ci, unsigned short Cx) + csc_plus_csc(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, + int Bi, int Bx, int Cp, int Ci, int Cx) + csc_plus_csc(int n_row, int n_col, int Ap, int Ai, unsigned int Ax, + int Bp, int Bi, unsigned int Bx, int Cp, + int Ci, unsigned int Cx) + csc_plus_csc(int n_row, int n_col, int Ap, int Ai, long long Ax, + int Bp, int Bi, long long Bx, int Cp, int Ci, + long long Cx) + csc_plus_csc(int n_row, int n_col, int Ap, int Ai, unsigned long long Ax, + int Bp, int Bi, unsigned long long Bx, + int Cp, int Ci, unsigned long long Cx) + csc_plus_csc(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, + int Bi, float Bx, int Cp, int Ci, float Cx) + csc_plus_csc(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, + int Bi, double Bx, int Cp, int Ci, double Cx) + csc_plus_csc(int n_row, int n_col, int Ap, int Ai, long double Ax, + int Bp, int Bi, long double Bx, int Cp, int Ci, + long double Cx) + csc_plus_csc(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, + int Bp, int Bi, npy_cfloat_wrapper Bx, + int Cp, int Ci, npy_cfloat_wrapper Cx) + csc_plus_csc(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, + int Bp, int Bi, npy_cdouble_wrapper Bx, + int Cp, int Ci, npy_cdouble_wrapper Cx) + csc_plus_csc(int n_row, int n_col, int Ap, int Ai, npy_clongdouble_wrapper Ax, + int Bp, int Bi, npy_clongdouble_wrapper Bx, + int Cp, int Ci, npy_clongdouble_wrapper Cx) """ - csc_plus_csc(int n_row, int n_col, int Ap, int Ai, signed char Ax, - int Bp, int Bi, signed char Bx, int Cp, int Ci, - signed char Cx) - csc_plus_csc(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, - int Bp, int Bi, unsigned char Bx, int Cp, - int Ci, unsigned char Cx) - csc_plus_csc(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, - int Bi, short Bx, int Cp, int Ci, short Cx) - csc_plus_csc(int n_row, int n_col, int Ap, int Ai, unsigned short Ax, - int Bp, int Bi, unsigned short Bx, int Cp, - int Ci, unsigned short Cx) - csc_plus_csc(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, - int Bi, int Bx, int Cp, int Ci, int Cx) - csc_plus_csc(int n_row, int n_col, int Ap, int Ai, unsigned int Ax, - int Bp, int Bi, unsigned int Bx, int Cp, - int Ci, unsigned int Cx) - csc_plus_csc(int n_row, int n_col, int Ap, int Ai, long long Ax, - int Bp, int Bi, long long Bx, int Cp, int Ci, - long long Cx) - csc_plus_csc(int n_row, int n_col, int Ap, int Ai, unsigned long long Ax, - int Bp, int Bi, unsigned long long Bx, - int Cp, int Ci, unsigned long long Cx) - csc_plus_csc(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, - int Bi, float Bx, int Cp, int Ci, float Cx) - csc_plus_csc(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, - int Bi, double Bx, int Cp, int Ci, double Cx) - csc_plus_csc(int n_row, int n_col, int Ap, int Ai, long double Ax, - int Bp, int Bi, long double Bx, int Cp, int Ci, - long double Cx) - csc_plus_csc(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, - int Bp, int Bi, npy_cfloat_wrapper Bx, - int Cp, int Ci, npy_cfloat_wrapper Cx) - csc_plus_csc(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, - int Bp, int Bi, npy_cdouble_wrapper Bx, - int Cp, int Ci, npy_cdouble_wrapper Cx) - csc_plus_csc(int n_row, int n_col, int Ap, int Ai, npy_clongdouble_wrapper Ax, - int Bp, int Bi, npy_clongdouble_wrapper Bx, - int Cp, int Ci, npy_clongdouble_wrapper Cx) - """ - return _csc.csc_plus_csc(*args) + return _csc.csc_plus_csc(*args) def csc_minus_csc(*args): + """ + csc_minus_csc(int n_row, int n_col, int Ap, int Ai, signed char Ax, + int Bp, int Bi, signed char Bx, int Cp, int Ci, + signed char Cx) + csc_minus_csc(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, + int Bp, int Bi, unsigned char Bx, int Cp, + int Ci, unsigned char Cx) + csc_minus_csc(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, + int Bi, short Bx, int Cp, int Ci, short Cx) + csc_minus_csc(int n_row, int n_col, int Ap, int Ai, unsigned short Ax, + int Bp, int Bi, unsigned short Bx, int Cp, + int Ci, unsigned short Cx) + csc_minus_csc(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, + int Bi, int Bx, int Cp, int Ci, int Cx) + csc_minus_csc(int n_row, int n_col, int Ap, int Ai, unsigned int Ax, + int Bp, int Bi, unsigned int Bx, int Cp, + int Ci, unsigned int Cx) + csc_minus_csc(int n_row, int n_col, int Ap, int Ai, long long Ax, + int Bp, int Bi, long long Bx, int Cp, int Ci, + long long Cx) + csc_minus_csc(int n_row, int n_col, int Ap, int Ai, unsigned long long Ax, + int Bp, int Bi, unsigned long long Bx, + int Cp, int Ci, unsigned long long Cx) + csc_minus_csc(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, + int Bi, float Bx, int Cp, int Ci, float Cx) + csc_minus_csc(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, + int Bi, double Bx, int Cp, int Ci, double Cx) + csc_minus_csc(int n_row, int n_col, int Ap, int Ai, long double Ax, + int Bp, int Bi, long double Bx, int Cp, int Ci, + long double Cx) + csc_minus_csc(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, + int Bp, int Bi, npy_cfloat_wrapper Bx, + int Cp, int Ci, npy_cfloat_wrapper Cx) + csc_minus_csc(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, + int Bp, int Bi, npy_cdouble_wrapper Bx, + int Cp, int Ci, npy_cdouble_wrapper Cx) + csc_minus_csc(int n_row, int n_col, int Ap, int Ai, npy_clongdouble_wrapper Ax, + int Bp, int Bi, npy_clongdouble_wrapper Bx, + int Cp, int Ci, npy_clongdouble_wrapper Cx) """ - csc_minus_csc(int n_row, int n_col, int Ap, int Ai, signed char Ax, - int Bp, int Bi, signed char Bx, int Cp, int Ci, - signed char Cx) - csc_minus_csc(int n_row, int n_col, int Ap, int Ai, unsigned char Ax, - int Bp, int Bi, unsigned char Bx, int Cp, - int Ci, unsigned char Cx) - csc_minus_csc(int n_row, int n_col, int Ap, int Ai, short Ax, int Bp, - int Bi, short Bx, int Cp, int Ci, short Cx) - csc_minus_csc(int n_row, int n_col, int Ap, int Ai, unsigned short Ax, - int Bp, int Bi, unsigned short Bx, int Cp, - int Ci, unsigned short Cx) - csc_minus_csc(int n_row, int n_col, int Ap, int Ai, int Ax, int Bp, - int Bi, int Bx, int Cp, int Ci, int Cx) - csc_minus_csc(int n_row, int n_col, int Ap, int Ai, unsigned int Ax, - int Bp, int Bi, unsigned int Bx, int Cp, - int Ci, unsigned int Cx) - csc_minus_csc(int n_row, int n_col, int Ap, int Ai, long long Ax, - int Bp, int Bi, long long Bx, int Cp, int Ci, - long long Cx) - csc_minus_csc(int n_row, int n_col, int Ap, int Ai, unsigned long long Ax, - int Bp, int Bi, unsigned long long Bx, - int Cp, int Ci, unsigned long long Cx) - csc_minus_csc(int n_row, int n_col, int Ap, int Ai, float Ax, int Bp, - int Bi, float Bx, int Cp, int Ci, float Cx) - csc_minus_csc(int n_row, int n_col, int Ap, int Ai, double Ax, int Bp, - int Bi, double Bx, int Cp, int Ci, double Cx) - csc_minus_csc(int n_row, int n_col, int Ap, int Ai, long double Ax, - int Bp, int Bi, long double Bx, int Cp, int Ci, - long double Cx) - csc_minus_csc(int n_row, int n_col, int Ap, int Ai, npy_cfloat_wrapper Ax, - int Bp, int Bi, npy_cfloat_wrapper Bx, - int Cp, int Ci, npy_cfloat_wrapper Cx) - csc_minus_csc(int n_row, int n_col, int Ap, int Ai, npy_cdouble_wrapper Ax, - int Bp, int Bi, npy_cdouble_wrapper Bx, - int Cp, int Ci, npy_cdouble_wrapper Cx) - csc_minus_csc(int n_row, int n_col, int Ap, int Ai, npy_clongdouble_wrapper Ax, - int Bp, int Bi, npy_clongdouble_wrapper Bx, - int Cp, int Ci, npy_clongdouble_wrapper Cx) - """ - return _csc.csc_minus_csc(*args) + return _csc.csc_minus_csc(*args) + Modified: trunk/scipy/sparse/sparsetools/csr.h =================================================================== --- trunk/scipy/sparse/sparsetools/csr.h 2009-01-31 01:05:19 UTC (rev 5528) +++ trunk/scipy/sparse/sparsetools/csr.h 2009-01-31 04:41:39 UTC (rev 5529) @@ -620,57 +620,133 @@ } - - - /* - * Compute C = A (bin_op) B for CSR matrices A,B + * Compute C = A (binary_op) B for CSR matrices A,B where the column + * indices with the rows of A and B are not known to be sorted. * - * bin_op(x,y) - binary operator to apply elementwise - * + * Refer to csr_binop_csr() for additional information * - * Input Arguments: - * I n_row - number of rows in A (and B) - * I n_col - number of columns in A (and B) - * I Ap[n_row+1] - row pointer - * I Aj[nnz(A)] - column indices - * T Ax[nnz(A)] - nonzeros - * I Bp[?] - row pointer - * I Bj[nnz(B)] - column indices - * T Bx[nnz(B)] - nonzeros - * Output Arguments: - * I Cp[n_row+1] - row pointer - * I Cj[nnz(C)] - column indices - * T Cx[nnz(C)] - nonzeros - * * Note: * Output arrays Cp, Cj, and Cx must be preallocated * If nnz(C) is not known a priori, a conservative bound is: * nnz(C) <= nnz(A) + nnz(B) * * Note: + * Input: A and B column indices are not assumed to be in sorted order + * Output: C column indices are not generally in sorted order + * Cx will not contain any zero entries + * + */ +template +void csr_binop_csr_unsorted(const I n_row, + const I n_col, + const I Ap[], + const I Aj[], + const T Ax[], + const I Bp[], + const I Bj[], + const T Bx[], + I Cp[], + I Cj[], + T Cx[], + const binary_op& op) +{ + //Method that works for unsorted indices + + std::vector next(n_col,-1); + std::vector A_row(n_col, 0); + std::vector B_row(n_col, 0); + + I nnz = 0; + + for(I i = 0; i < n_row; i++){ + Cp[i] = nnz; + + I head = -2; + I length = 0; + + //add a row of A to A_row + I i_start = Ap[i]; + I i_end = Ap[i+1]; + for(I jj = i_start; jj < i_end; jj++){ + I j = Aj[jj]; + + A_row[j] += Ax[jj]; + + if(next[j] == -1){ + next[j] = head; + head = j; + length++; + } + } + + //add a row of B to B_row + i_start = Bp[i]; + i_end = Bp[i+1]; + for(I jj = i_start; jj < i_end; jj++){ + I j = Bj[jj]; + + B_row[j] += Bx[jj]; + + if(next[j] == -1){ + next[j] = head; + head = j; + length++; + } + } + + + // scan through columns where A or B has + // contributed a non-zero entry + for(I jj = 0; jj < length; jj++){ + T result = op(A_row[head], B_row[head]); + + if(result != 0){ + Cj[nnz] = head; + Cx[nnz] = result; + nnz++; + } + + I temp = head; + head = next[head]; + + next[temp] = -1; + A_row[temp] = 0; + B_row[temp] = 0; + } + } + + Cp[n_row] = nnz; +} + + +/* + * Compute C = A (binary_op) B for CSR matrices A,B where the column + * indices with the rows of A and B are known to be sorted. + * + * Refer to csr_binop_csr() for additional information + * + * Note: * Input: A and B column indices are assumed to be in sorted order - * Output: C column indices are assumed to be in sorted order + * Output: C column indices will be in sorted order * Cx will not contain any zero entries * */ -template -void csr_binop_csr(const I n_row, - const I n_col, - const I Ap[], - const I Aj[], - const T Ax[], - const I Bp[], - const I Bj[], - const T Bx[], - I Cp[], - I Cj[], - T Cx[], - const bin_op& op) +template +void csr_binop_csr_sorted(const I n_row, + const I n_col, + const I Ap[], + const I Aj[], + const T Ax[], + const I Bp[], + const I Bj[], + const T Bx[], + I Cp[], + I Cj[], + T Cx[], + const binary_op& op) { //Method that works for sorted indices - // assert( csr_has_sorted_indices(n_row,Ap,Aj) ); - // assert( csr_has_sorted_indices(n_row,Bp,Bj) ); Cp[0] = 0; I nnz = 0; @@ -738,6 +814,60 @@ } } + +/* + * Compute C = A (binary_op) B for CSR matrices A,B where the column + * indices with the rows of A and B are known to be sorted. + * + * binary_op(x,y) - binary operator to apply elementwise + * + * Input Arguments: + * I n_row - number of rows in A (and B) + * I n_col - number of columns in A (and B) + * I Ap[n_row+1] - row pointer + * I Aj[nnz(A)] - column indices + * T Ax[nnz(A)] - nonzeros + * I Bp[n_row+1] - row pointer + * I Bj[nnz(B)] - column indices + * T Bx[nnz(B)] - nonzeros + * Output Arguments: + * I Cp[n_row+1] - row pointer + * I Cj[nnz(C)] - column indices + * T Cx[nnz(C)] - nonzeros + * + * Note: + * Output arrays Cp, Cj, and Cx must be preallocated + * If nnz(C) is not known a priori, a conservative bound is: + * nnz(C) <= nnz(A) + nnz(B) + * + * Note: + * Input: A and B column indices are not assumed to be in sorted order. + * Output: C column indices will be in sorted if both A and B have sorted indices. + * Cx will not contain any zero entries + * + */ +template +void csr_binop_csr(const I n_row, + const I n_col, + const I Ap[], + const I Aj[], + const T Ax[], + const I Bp[], + const I Bj[], + const T Bx[], + I Cp[], + I Cj[], + T Cx[], + const binary_op& op) +{ + if (csr_has_sorted_indices(n_row,Ap,Aj) && csr_has_sorted_indices(n_row,Bp,Bj)) + csr_binop_csr_sorted(n_row, n_col, Ap, Aj, Ax, Bp, Bj, Bx, Cp, Cj, Cx, op); + else + csr_binop_csr_unsorted(n_row, n_col, Ap, Aj, Ax, Bp, Bj, Bx, Cp, Cj, Cx, op); +} + + + /* element-wise binary operations*/ template void csr_elmul_csr(const I n_row, const I n_col, Modified: trunk/scipy/sparse/sparsetools/csr.py =================================================================== --- trunk/scipy/sparse/sparsetools/csr.py 2009-01-31 01:05:19 UTC (rev 5528) +++ trunk/scipy/sparse/sparsetools/csr.py 2009-01-31 04:41:39 UTC (rev 5529) @@ -50,568 +50,569 @@ def expandptr(*args): - """expandptr(int n_row, int Ap, int Bi)""" - return _csr.expandptr(*args) + """expandptr(int n_row, int Ap, int Bi)""" + return _csr.expandptr(*args) def csr_matmat_pass1(*args): + """ + csr_matmat_pass1(int n_row, int n_col, int Ap, int Aj, int Bp, int Bj, + int Cp) """ - csr_matmat_pass1(int n_row, int n_col, int Ap, int Aj, int Bp, int Bj, - int Cp) - """ - return _csr.csr_matmat_pass1(*args) + return _csr.csr_matmat_pass1(*args) def csr_count_blocks(*args): - """csr_count_blocks(int n_row, int n_col, int R, int C, int Ap, int Aj) -> int""" - return _csr.csr_count_blocks(*args) + """csr_count_blocks(int n_row, int n_col, int R, int C, int Ap, int Aj) -> int""" + return _csr.csr_count_blocks(*args) def csr_has_sorted_indices(*args): - """csr_has_sorted_indices(int n_row, int Ap, int Aj) -> bool""" - return _csr.csr_has_sorted_indices(*args) + """csr_has_sorted_indices(int n_row, int Ap, int Aj) -> bool""" + return _csr.csr_has_sorted_indices(*args) def csr_diagonal(*args): + """ + csr_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, + signed char Yx) + csr_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, + unsigned char Yx) + csr_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, short Yx) + csr_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, + unsigned short Yx) + csr_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, int Yx) + csr_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, + unsigned int Yx) + csr_diagonal(int n_row, int n_col, int Ap, int Aj, long long Ax, + long long Yx) + csr_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, + unsigned long long Yx) + csr_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, float Yx) + csr_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, double Yx) + csr_diagonal(int n_row, int n_col, int Ap, int Aj, long double Ax, + long double Yx) + csr_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, + npy_cfloat_wrapper Yx) + csr_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, + npy_cdouble_wrapper Yx) + csr_diagonal(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, + npy_clongdouble_wrapper Yx) """ - csr_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, - signed char Yx) - csr_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - unsigned char Yx) - csr_diagonal(int n_row, int n_col, int Ap, int Aj, short Ax, short Yx) - csr_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, - unsigned short Yx) - csr_diagonal(int n_row, int n_col, int Ap, int Aj, int Ax, int Yx) - csr_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, - unsigned int Yx) - csr_diagonal(int n_row, int n_col, int Ap, int Aj, long long Ax, - long long Yx) - csr_diagonal(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, - unsigned long long Yx) - csr_diagonal(int n_row, int n_col, int Ap, int Aj, float Ax, float Yx) - csr_diagonal(int n_row, int n_col, int Ap, int Aj, double Ax, double Yx) - csr_diagonal(int n_row, int n_col, int Ap, int Aj, long double Ax, - long double Yx) - csr_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, - npy_cfloat_wrapper Yx) - csr_diagonal(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, - npy_cdouble_wrapper Yx) - csr_diagonal(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, - npy_clongdouble_wrapper Yx) - """ - return _csr.csr_diagonal(*args) + return _csr.csr_diagonal(*args) def csr_scale_rows(*args): + """ + csr_scale_rows(int n_row, int n_col, int Ap, int Aj, signed char Ax, + signed char Xx) + csr_scale_rows(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, + unsigned char Xx) + csr_scale_rows(int n_row, int n_col, int Ap, int Aj, short Ax, short Xx) + csr_scale_rows(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, + unsigned short Xx) + csr_scale_rows(int n_row, int n_col, int Ap, int Aj, int Ax, int Xx) + csr_scale_rows(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, + unsigned int Xx) + csr_scale_rows(int n_row, int n_col, int Ap, int Aj, long long Ax, + long long Xx) + csr_scale_rows(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, + unsigned long long Xx) + csr_scale_rows(int n_row, int n_col, int Ap, int Aj, float Ax, float Xx) + csr_scale_rows(int n_row, int n_col, int Ap, int Aj, double Ax, double Xx) + csr_scale_rows(int n_row, int n_col, int Ap, int Aj, long double Ax, + long double Xx) + csr_scale_rows(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, + npy_cfloat_wrapper Xx) + csr_scale_rows(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, + npy_cdouble_wrapper Xx) + csr_scale_rows(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, + npy_clongdouble_wrapper Xx) """ - csr_scale_rows(int n_row, int n_col, int Ap, int Aj, signed char Ax, - signed char Xx) - csr_scale_rows(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - unsigned char Xx) - csr_scale_rows(int n_row, int n_col, int Ap, int Aj, short Ax, short Xx) - csr_scale_rows(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, - unsigned short Xx) - csr_scale_rows(int n_row, int n_col, int Ap, int Aj, int Ax, int Xx) - csr_scale_rows(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, - unsigned int Xx) - csr_scale_rows(int n_row, int n_col, int Ap, int Aj, long long Ax, - long long Xx) - csr_scale_rows(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, - unsigned long long Xx) - csr_scale_rows(int n_row, int n_col, int Ap, int Aj, float Ax, float Xx) - csr_scale_rows(int n_row, int n_col, int Ap, int Aj, double Ax, double Xx) - csr_scale_rows(int n_row, int n_col, int Ap, int Aj, long double Ax, - long double Xx) - csr_scale_rows(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, - npy_cfloat_wrapper Xx) - csr_scale_rows(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, - npy_cdouble_wrapper Xx) - csr_scale_rows(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, - npy_clongdouble_wrapper Xx) - """ - return _csr.csr_scale_rows(*args) + return _csr.csr_scale_rows(*args) def csr_scale_columns(*args): + """ + csr_scale_columns(int n_row, int n_col, int Ap, int Aj, signed char Ax, + signed char Xx) + csr_scale_columns(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, + unsigned char Xx) + csr_scale_columns(int n_row, int n_col, int Ap, int Aj, short Ax, short Xx) + csr_scale_columns(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, + unsigned short Xx) + csr_scale_columns(int n_row, int n_col, int Ap, int Aj, int Ax, int Xx) + csr_scale_columns(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, + unsigned int Xx) + csr_scale_columns(int n_row, int n_col, int Ap, int Aj, long long Ax, + long long Xx) + csr_scale_columns(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, + unsigned long long Xx) + csr_scale_columns(int n_row, int n_col, int Ap, int Aj, float Ax, float Xx) + csr_scale_columns(int n_row, int n_col, int Ap, int Aj, double Ax, double Xx) + csr_scale_columns(int n_row, int n_col, int Ap, int Aj, long double Ax, + long double Xx) + csr_scale_columns(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, + npy_cfloat_wrapper Xx) + csr_scale_columns(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, + npy_cdouble_wrapper Xx) + csr_scale_columns(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, + npy_clongdouble_wrapper Xx) """ - csr_scale_columns(int n_row, int n_col, int Ap, int Aj, signed char Ax, - signed char Xx) - csr_scale_columns(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - unsigned char Xx) - csr_scale_columns(int n_row, int n_col, int Ap, int Aj, short Ax, short Xx) - csr_scale_columns(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, - unsigned short Xx) - csr_scale_columns(int n_row, int n_col, int Ap, int Aj, int Ax, int Xx) - csr_scale_columns(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, - unsigned int Xx) - csr_scale_columns(int n_row, int n_col, int Ap, int Aj, long long Ax, - long long Xx) - csr_scale_columns(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, - unsigned long long Xx) - csr_scale_columns(int n_row, int n_col, int Ap, int Aj, float Ax, float Xx) - csr_scale_columns(int n_row, int n_col, int Ap, int Aj, double Ax, double Xx) - csr_scale_columns(int n_row, int n_col, int Ap, int Aj, long double Ax, - long double Xx) - csr_scale_columns(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, - npy_cfloat_wrapper Xx) - csr_scale_columns(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, - npy_cdouble_wrapper Xx) - csr_scale_columns(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, - npy_clongdouble_wrapper Xx) - """ - return _csr.csr_scale_columns(*args) + return _csr.csr_scale_columns(*args) def csr_tocsc(*args): + """ + csr_tocsc(int n_row, int n_col, int Ap, int Aj, signed char Ax, + int Bp, int Bi, signed char Bx) + csr_tocsc(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, + int Bp, int Bi, unsigned char Bx) + csr_tocsc(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, + int Bi, short Bx) + csr_tocsc(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, + int Bp, int Bi, unsigned short Bx) + csr_tocsc(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, + int Bi, int Bx) + csr_tocsc(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, + int Bp, int Bi, unsigned int Bx) + csr_tocsc(int n_row, int n_col, int Ap, int Aj, long long Ax, + int Bp, int Bi, long long Bx) + csr_tocsc(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, + int Bp, int Bi, unsigned long long Bx) + csr_tocsc(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, + int Bi, float Bx) + csr_tocsc(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, + int Bi, double Bx) + csr_tocsc(int n_row, int n_col, int Ap, int Aj, long double Ax, + int Bp, int Bi, long double Bx) + csr_tocsc(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, + int Bp, int Bi, npy_cfloat_wrapper Bx) + csr_tocsc(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, + int Bp, int Bi, npy_cdouble_wrapper Bx) + csr_tocsc(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, + int Bp, int Bi, npy_clongdouble_wrapper Bx) """ - csr_tocsc(int n_row, int n_col, int Ap, int Aj, signed char Ax, - int Bp, int Bi, signed char Bx) - csr_tocsc(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - int Bp, int Bi, unsigned char Bx) - csr_tocsc(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, - int Bi, short Bx) - csr_tocsc(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, - int Bp, int Bi, unsigned short Bx) - csr_tocsc(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, - int Bi, int Bx) - csr_tocsc(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, - int Bp, int Bi, unsigned int Bx) - csr_tocsc(int n_row, int n_col, int Ap, int Aj, long long Ax, - int Bp, int Bi, long long Bx) - csr_tocsc(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, - int Bp, int Bi, unsigned long long Bx) - csr_tocsc(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, - int Bi, float Bx) - csr_tocsc(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, - int Bi, double Bx) - csr_tocsc(int n_row, int n_col, int Ap, int Aj, long double Ax, - int Bp, int Bi, long double Bx) - csr_tocsc(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, - int Bp, int Bi, npy_cfloat_wrapper Bx) - csr_tocsc(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, - int Bp, int Bi, npy_cdouble_wrapper Bx) - csr_tocsc(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, - int Bp, int Bi, npy_clongdouble_wrapper Bx) - """ - return _csr.csr_tocsc(*args) + return _csr.csr_tocsc(*args) def csr_tobsr(*args): + """ + csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + signed char Ax, int Bp, int Bj, signed char Bx) + csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned char Ax, int Bp, int Bj, unsigned char Bx) + csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + short Ax, int Bp, int Bj, short Bx) + csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned short Ax, int Bp, int Bj, unsigned short Bx) + csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + int Ax, int Bp, int Bj, int Bx) + csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned int Ax, int Bp, int Bj, unsigned int Bx) + csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + long long Ax, int Bp, int Bj, long long Bx) + csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned long long Ax, int Bp, int Bj, unsigned long long Bx) + csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + float Ax, int Bp, int Bj, float Bx) + csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + double Ax, int Bp, int Bj, double Bx) + csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + long double Ax, int Bp, int Bj, long double Bx) + csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx) + csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx) + csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_clongdouble_wrapper Ax, int Bp, int Bj, + npy_clongdouble_wrapper Bx) """ - csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - signed char Ax, int Bp, int Bj, signed char Bx) - csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - unsigned char Ax, int Bp, int Bj, unsigned char Bx) - csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - short Ax, int Bp, int Bj, short Bx) - csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - unsigned short Ax, int Bp, int Bj, unsigned short Bx) - csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - int Ax, int Bp, int Bj, int Bx) - csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - unsigned int Ax, int Bp, int Bj, unsigned int Bx) - csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - long long Ax, int Bp, int Bj, long long Bx) - csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - unsigned long long Ax, int Bp, int Bj, unsigned long long Bx) - csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - float Ax, int Bp, int Bj, float Bx) - csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - double Ax, int Bp, int Bj, double Bx) - csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - long double Ax, int Bp, int Bj, long double Bx) - csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx) - csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx) - csr_tobsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - npy_clongdouble_wrapper Ax, int Bp, int Bj, - npy_clongdouble_wrapper Bx) - """ - return _csr.csr_tobsr(*args) + return _csr.csr_tobsr(*args) def csr_matmat_pass2(*args): + """ + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, signed char Ax, + int Bp, int Bj, signed char Bx, int Cp, int Cj, + signed char Cx) + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, + int Bp, int Bj, unsigned char Bx, int Cp, + int Cj, unsigned char Cx) + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, + int Bj, short Bx, int Cp, int Cj, short Cx) + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, + int Bp, int Bj, unsigned short Bx, int Cp, + int Cj, unsigned short Cx) + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, + int Bj, int Bx, int Cp, int Cj, int Cx) + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, + int Bp, int Bj, unsigned int Bx, int Cp, + int Cj, unsigned int Cx) + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, long long Ax, + int Bp, int Bj, long long Bx, int Cp, int Cj, + long long Cx) + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, + int Bp, int Bj, unsigned long long Bx, + int Cp, int Cj, unsigned long long Cx) + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, + int Bj, float Bx, int Cp, int Cj, float Cx) + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, + int Bj, double Bx, int Cp, int Cj, double Cx) + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, long double Ax, + int Bp, int Bj, long double Bx, int Cp, int Cj, + long double Cx) + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, + int Bp, int Bj, npy_cfloat_wrapper Bx, + int Cp, int Cj, npy_cfloat_wrapper Cx) + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, + int Bp, int Bj, npy_cdouble_wrapper Bx, + int Cp, int Cj, npy_cdouble_wrapper Cx) + csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, + int Bp, int Bj, npy_clongdouble_wrapper Bx, + int Cp, int Cj, npy_clongdouble_wrapper Cx) """ - csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, signed char Ax, - int Bp, int Bj, signed char Bx, int Cp, int Cj, - signed char Cx) - csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - int Bp, int Bj, unsigned char Bx, int Cp, - int Cj, unsigned char Cx) - csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, - int Bj, short Bx, int Cp, int Cj, short Cx) - csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, - int Bp, int Bj, unsigned short Bx, int Cp, - int Cj, unsigned short Cx) - csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, - int Bj, int Bx, int Cp, int Cj, int Cx) - csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, - int Bp, int Bj, unsigned int Bx, int Cp, - int Cj, unsigned int Cx) - csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, long long Ax, - int Bp, int Bj, long long Bx, int Cp, int Cj, - long long Cx) - csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, - int Bp, int Bj, unsigned long long Bx, - int Cp, int Cj, unsigned long long Cx) - csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, - int Bj, float Bx, int Cp, int Cj, float Cx) - csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, - int Bj, double Bx, int Cp, int Cj, double Cx) - csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, long double Ax, - int Bp, int Bj, long double Bx, int Cp, int Cj, - long double Cx) - csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, - int Bp, int Bj, npy_cfloat_wrapper Bx, - int Cp, int Cj, npy_cfloat_wrapper Cx) - csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, - int Bp, int Bj, npy_cdouble_wrapper Bx, - int Cp, int Cj, npy_cdouble_wrapper Cx) - csr_matmat_pass2(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, - int Bp, int Bj, npy_clongdouble_wrapper Bx, - int Cp, int Cj, npy_clongdouble_wrapper Cx) - """ - return _csr.csr_matmat_pass2(*args) + return _csr.csr_matmat_pass2(*args) def csr_matvec(*args): + """ + csr_matvec(int n_row, int n_col, int Ap, int Aj, signed char Ax, + signed char Xx, signed char Yx) + csr_matvec(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, + unsigned char Xx, unsigned char Yx) + csr_matvec(int n_row, int n_col, int Ap, int Aj, short Ax, short Xx, + short Yx) + csr_matvec(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, + unsigned short Xx, unsigned short Yx) + csr_matvec(int n_row, int n_col, int Ap, int Aj, int Ax, int Xx, + int Yx) + csr_matvec(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, + unsigned int Xx, unsigned int Yx) + csr_matvec(int n_row, int n_col, int Ap, int Aj, long long Ax, + long long Xx, long long Yx) + csr_matvec(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, + unsigned long long Xx, unsigned long long Yx) + csr_matvec(int n_row, int n_col, int Ap, int Aj, float Ax, float Xx, + float Yx) + csr_matvec(int n_row, int n_col, int Ap, int Aj, double Ax, double Xx, + double Yx) + csr_matvec(int n_row, int n_col, int Ap, int Aj, long double Ax, + long double Xx, long double Yx) + csr_matvec(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, + npy_cfloat_wrapper Xx, npy_cfloat_wrapper Yx) + csr_matvec(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, + npy_cdouble_wrapper Xx, npy_cdouble_wrapper Yx) + csr_matvec(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, + npy_clongdouble_wrapper Xx, npy_clongdouble_wrapper Yx) """ - csr_matvec(int n_row, int n_col, int Ap, int Aj, signed char Ax, - signed char Xx, signed char Yx) - csr_matvec(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - unsigned char Xx, unsigned char Yx) - csr_matvec(int n_row, int n_col, int Ap, int Aj, short Ax, short Xx, - short Yx) - csr_matvec(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, - unsigned short Xx, unsigned short Yx) - csr_matvec(int n_row, int n_col, int Ap, int Aj, int Ax, int Xx, - int Yx) - csr_matvec(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, - unsigned int Xx, unsigned int Yx) - csr_matvec(int n_row, int n_col, int Ap, int Aj, long long Ax, - long long Xx, long long Yx) - csr_matvec(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, - unsigned long long Xx, unsigned long long Yx) - csr_matvec(int n_row, int n_col, int Ap, int Aj, float Ax, float Xx, - float Yx) - csr_matvec(int n_row, int n_col, int Ap, int Aj, double Ax, double Xx, - double Yx) - csr_matvec(int n_row, int n_col, int Ap, int Aj, long double Ax, - long double Xx, long double Yx) - csr_matvec(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, - npy_cfloat_wrapper Xx, npy_cfloat_wrapper Yx) - csr_matvec(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, - npy_cdouble_wrapper Xx, npy_cdouble_wrapper Yx) - csr_matvec(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, - npy_clongdouble_wrapper Xx, npy_clongdouble_wrapper Yx) - """ - return _csr.csr_matvec(*args) + return _csr.csr_matvec(*args) def csr_matvecs(*args): + """ + csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, signed char Ax, + signed char Xx, signed char Yx) + csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, unsigned char Ax, + unsigned char Xx, unsigned char Yx) + csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, short Ax, + short Xx, short Yx) + csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, unsigned short Ax, + unsigned short Xx, unsigned short Yx) + csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, int Ax, + int Xx, int Yx) + csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, unsigned int Ax, + unsigned int Xx, unsigned int Yx) + csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, long long Ax, + long long Xx, long long Yx) + csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, unsigned long long Ax, + unsigned long long Xx, + unsigned long long Yx) + csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, float Ax, + float Xx, float Yx) + csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, double Ax, + double Xx, double Yx) + csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, long double Ax, + long double Xx, long double Yx) + csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, npy_cfloat_wrapper Ax, + npy_cfloat_wrapper Xx, + npy_cfloat_wrapper Yx) + csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, npy_cdouble_wrapper Ax, + npy_cdouble_wrapper Xx, + npy_cdouble_wrapper Yx) + csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, npy_clongdouble_wrapper Ax, + npy_clongdouble_wrapper Xx, + npy_clongdouble_wrapper Yx) """ - csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, signed char Ax, - signed char Xx, signed char Yx) - csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, unsigned char Ax, - unsigned char Xx, unsigned char Yx) - csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, short Ax, - short Xx, short Yx) - csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, unsigned short Ax, - unsigned short Xx, unsigned short Yx) - csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, int Ax, - int Xx, int Yx) - csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, unsigned int Ax, - unsigned int Xx, unsigned int Yx) - csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, long long Ax, - long long Xx, long long Yx) - csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, unsigned long long Ax, - unsigned long long Xx, - unsigned long long Yx) - csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, float Ax, - float Xx, float Yx) - csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, double Ax, - double Xx, double Yx) - csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, long double Ax, - long double Xx, long double Yx) - csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, npy_cfloat_wrapper Ax, - npy_cfloat_wrapper Xx, - npy_cfloat_wrapper Yx) - csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, npy_cdouble_wrapper Ax, - npy_cdouble_wrapper Xx, - npy_cdouble_wrapper Yx) - csr_matvecs(int n_row, int n_col, int n_vecs, int Ap, int Aj, npy_clongdouble_wrapper Ax, - npy_clongdouble_wrapper Xx, - npy_clongdouble_wrapper Yx) - """ - return _csr.csr_matvecs(*args) + return _csr.csr_matvecs(*args) def csr_elmul_csr(*args): + """ + csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, signed char Ax, + int Bp, int Bj, signed char Bx, int Cp, int Cj, + signed char Cx) + csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, + int Bp, int Bj, unsigned char Bx, int Cp, + int Cj, unsigned char Cx) + csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, + int Bj, short Bx, int Cp, int Cj, short Cx) + csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, + int Bp, int Bj, unsigned short Bx, int Cp, + int Cj, unsigned short Cx) + csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, + int Bj, int Bx, int Cp, int Cj, int Cx) + csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, + int Bp, int Bj, unsigned int Bx, int Cp, + int Cj, unsigned int Cx) + csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, long long Ax, + int Bp, int Bj, long long Bx, int Cp, int Cj, + long long Cx) + csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, + int Bp, int Bj, unsigned long long Bx, + int Cp, int Cj, unsigned long long Cx) + csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, + int Bj, float Bx, int Cp, int Cj, float Cx) + csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, + int Bj, double Bx, int Cp, int Cj, double Cx) + csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, long double Ax, + int Bp, int Bj, long double Bx, int Cp, int Cj, + long double Cx) + csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, + int Bp, int Bj, npy_cfloat_wrapper Bx, + int Cp, int Cj, npy_cfloat_wrapper Cx) + csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, + int Bp, int Bj, npy_cdouble_wrapper Bx, + int Cp, int Cj, npy_cdouble_wrapper Cx) + csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, + int Bp, int Bj, npy_clongdouble_wrapper Bx, + int Cp, int Cj, npy_clongdouble_wrapper Cx) """ - csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, signed char Ax, - int Bp, int Bj, signed char Bx, int Cp, int Cj, - signed char Cx) - csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - int Bp, int Bj, unsigned char Bx, int Cp, - int Cj, unsigned char Cx) - csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, - int Bj, short Bx, int Cp, int Cj, short Cx) - csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, - int Bp, int Bj, unsigned short Bx, int Cp, - int Cj, unsigned short Cx) - csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, - int Bj, int Bx, int Cp, int Cj, int Cx) - csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, - int Bp, int Bj, unsigned int Bx, int Cp, - int Cj, unsigned int Cx) - csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, long long Ax, - int Bp, int Bj, long long Bx, int Cp, int Cj, - long long Cx) - csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, - int Bp, int Bj, unsigned long long Bx, - int Cp, int Cj, unsigned long long Cx) - csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, - int Bj, float Bx, int Cp, int Cj, float Cx) - csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, - int Bj, double Bx, int Cp, int Cj, double Cx) - csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, long double Ax, - int Bp, int Bj, long double Bx, int Cp, int Cj, - long double Cx) - csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, - int Bp, int Bj, npy_cfloat_wrapper Bx, - int Cp, int Cj, npy_cfloat_wrapper Cx) - csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, - int Bp, int Bj, npy_cdouble_wrapper Bx, - int Cp, int Cj, npy_cdouble_wrapper Cx) - csr_elmul_csr(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, - int Bp, int Bj, npy_clongdouble_wrapper Bx, - int Cp, int Cj, npy_clongdouble_wrapper Cx) - """ - return _csr.csr_elmul_csr(*args) + return _csr.csr_elmul_csr(*args) def csr_eldiv_csr(*args): + """ + csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, signed char Ax, + int Bp, int Bj, signed char Bx, int Cp, int Cj, + signed char Cx) + csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, + int Bp, int Bj, unsigned char Bx, int Cp, + int Cj, unsigned char Cx) + csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, + int Bj, short Bx, int Cp, int Cj, short Cx) + csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, + int Bp, int Bj, unsigned short Bx, int Cp, + int Cj, unsigned short Cx) + csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, + int Bj, int Bx, int Cp, int Cj, int Cx) + csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, + int Bp, int Bj, unsigned int Bx, int Cp, + int Cj, unsigned int Cx) + csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, long long Ax, + int Bp, int Bj, long long Bx, int Cp, int Cj, + long long Cx) + csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, + int Bp, int Bj, unsigned long long Bx, + int Cp, int Cj, unsigned long long Cx) + csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, + int Bj, float Bx, int Cp, int Cj, float Cx) + csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, + int Bj, double Bx, int Cp, int Cj, double Cx) + csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, long double Ax, + int Bp, int Bj, long double Bx, int Cp, int Cj, + long double Cx) + csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, + int Bp, int Bj, npy_cfloat_wrapper Bx, + int Cp, int Cj, npy_cfloat_wrapper Cx) + csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, + int Bp, int Bj, npy_cdouble_wrapper Bx, + int Cp, int Cj, npy_cdouble_wrapper Cx) + csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, + int Bp, int Bj, npy_clongdouble_wrapper Bx, + int Cp, int Cj, npy_clongdouble_wrapper Cx) """ - csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, signed char Ax, - int Bp, int Bj, signed char Bx, int Cp, int Cj, - signed char Cx) - csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - int Bp, int Bj, unsigned char Bx, int Cp, - int Cj, unsigned char Cx) - csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, - int Bj, short Bx, int Cp, int Cj, short Cx) - csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, - int Bp, int Bj, unsigned short Bx, int Cp, - int Cj, unsigned short Cx) - csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, - int Bj, int Bx, int Cp, int Cj, int Cx) - csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, - int Bp, int Bj, unsigned int Bx, int Cp, - int Cj, unsigned int Cx) - csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, long long Ax, - int Bp, int Bj, long long Bx, int Cp, int Cj, - long long Cx) - csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, - int Bp, int Bj, unsigned long long Bx, - int Cp, int Cj, unsigned long long Cx) - csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, - int Bj, float Bx, int Cp, int Cj, float Cx) - csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, - int Bj, double Bx, int Cp, int Cj, double Cx) - csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, long double Ax, - int Bp, int Bj, long double Bx, int Cp, int Cj, - long double Cx) - csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, - int Bp, int Bj, npy_cfloat_wrapper Bx, - int Cp, int Cj, npy_cfloat_wrapper Cx) - csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, - int Bp, int Bj, npy_cdouble_wrapper Bx, - int Cp, int Cj, npy_cdouble_wrapper Cx) - csr_eldiv_csr(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, - int Bp, int Bj, npy_clongdouble_wrapper Bx, - int Cp, int Cj, npy_clongdouble_wrapper Cx) - """ - return _csr.csr_eldiv_csr(*args) + return _csr.csr_eldiv_csr(*args) def csr_plus_csr(*args): + """ + csr_plus_csr(int n_row, int n_col, int Ap, int Aj, signed char Ax, + int Bp, int Bj, signed char Bx, int Cp, int Cj, + signed char Cx) + csr_plus_csr(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, + int Bp, int Bj, unsigned char Bx, int Cp, + int Cj, unsigned char Cx) + csr_plus_csr(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, + int Bj, short Bx, int Cp, int Cj, short Cx) + csr_plus_csr(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, + int Bp, int Bj, unsigned short Bx, int Cp, + int Cj, unsigned short Cx) + csr_plus_csr(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, + int Bj, int Bx, int Cp, int Cj, int Cx) + csr_plus_csr(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, + int Bp, int Bj, unsigned int Bx, int Cp, + int Cj, unsigned int Cx) + csr_plus_csr(int n_row, int n_col, int Ap, int Aj, long long Ax, + int Bp, int Bj, long long Bx, int Cp, int Cj, + long long Cx) + csr_plus_csr(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, + int Bp, int Bj, unsigned long long Bx, + int Cp, int Cj, unsigned long long Cx) + csr_plus_csr(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, + int Bj, float Bx, int Cp, int Cj, float Cx) + csr_plus_csr(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, + int Bj, double Bx, int Cp, int Cj, double Cx) + csr_plus_csr(int n_row, int n_col, int Ap, int Aj, long double Ax, + int Bp, int Bj, long double Bx, int Cp, int Cj, + long double Cx) + csr_plus_csr(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, + int Bp, int Bj, npy_cfloat_wrapper Bx, + int Cp, int Cj, npy_cfloat_wrapper Cx) + csr_plus_csr(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, + int Bp, int Bj, npy_cdouble_wrapper Bx, + int Cp, int Cj, npy_cdouble_wrapper Cx) + csr_plus_csr(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, + int Bp, int Bj, npy_clongdouble_wrapper Bx, + int Cp, int Cj, npy_clongdouble_wrapper Cx) """ - csr_plus_csr(int n_row, int n_col, int Ap, int Aj, signed char Ax, - int Bp, int Bj, signed char Bx, int Cp, int Cj, - signed char Cx) - csr_plus_csr(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - int Bp, int Bj, unsigned char Bx, int Cp, - int Cj, unsigned char Cx) - csr_plus_csr(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, - int Bj, short Bx, int Cp, int Cj, short Cx) - csr_plus_csr(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, - int Bp, int Bj, unsigned short Bx, int Cp, - int Cj, unsigned short Cx) - csr_plus_csr(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, - int Bj, int Bx, int Cp, int Cj, int Cx) - csr_plus_csr(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, - int Bp, int Bj, unsigned int Bx, int Cp, - int Cj, unsigned int Cx) - csr_plus_csr(int n_row, int n_col, int Ap, int Aj, long long Ax, - int Bp, int Bj, long long Bx, int Cp, int Cj, - long long Cx) - csr_plus_csr(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, - int Bp, int Bj, unsigned long long Bx, - int Cp, int Cj, unsigned long long Cx) - csr_plus_csr(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, - int Bj, float Bx, int Cp, int Cj, float Cx) - csr_plus_csr(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, - int Bj, double Bx, int Cp, int Cj, double Cx) - csr_plus_csr(int n_row, int n_col, int Ap, int Aj, long double Ax, - int Bp, int Bj, long double Bx, int Cp, int Cj, - long double Cx) - csr_plus_csr(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, - int Bp, int Bj, npy_cfloat_wrapper Bx, - int Cp, int Cj, npy_cfloat_wrapper Cx) - csr_plus_csr(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, - int Bp, int Bj, npy_cdouble_wrapper Bx, - int Cp, int Cj, npy_cdouble_wrapper Cx) - csr_plus_csr(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, - int Bp, int Bj, npy_clongdouble_wrapper Bx, - int Cp, int Cj, npy_clongdouble_wrapper Cx) - """ - return _csr.csr_plus_csr(*args) + return _csr.csr_plus_csr(*args) def csr_minus_csr(*args): + """ + csr_minus_csr(int n_row, int n_col, int Ap, int Aj, signed char Ax, + int Bp, int Bj, signed char Bx, int Cp, int Cj, + signed char Cx) + csr_minus_csr(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, + int Bp, int Bj, unsigned char Bx, int Cp, + int Cj, unsigned char Cx) + csr_minus_csr(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, + int Bj, short Bx, int Cp, int Cj, short Cx) + csr_minus_csr(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, + int Bp, int Bj, unsigned short Bx, int Cp, + int Cj, unsigned short Cx) + csr_minus_csr(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, + int Bj, int Bx, int Cp, int Cj, int Cx) + csr_minus_csr(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, + int Bp, int Bj, unsigned int Bx, int Cp, + int Cj, unsigned int Cx) + csr_minus_csr(int n_row, int n_col, int Ap, int Aj, long long Ax, + int Bp, int Bj, long long Bx, int Cp, int Cj, + long long Cx) + csr_minus_csr(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, + int Bp, int Bj, unsigned long long Bx, + int Cp, int Cj, unsigned long long Cx) + csr_minus_csr(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, + int Bj, float Bx, int Cp, int Cj, float Cx) + csr_minus_csr(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, + int Bj, double Bx, int Cp, int Cj, double Cx) + csr_minus_csr(int n_row, int n_col, int Ap, int Aj, long double Ax, + int Bp, int Bj, long double Bx, int Cp, int Cj, + long double Cx) + csr_minus_csr(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, + int Bp, int Bj, npy_cfloat_wrapper Bx, + int Cp, int Cj, npy_cfloat_wrapper Cx) + csr_minus_csr(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, + int Bp, int Bj, npy_cdouble_wrapper Bx, + int Cp, int Cj, npy_cdouble_wrapper Cx) + csr_minus_csr(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, + int Bp, int Bj, npy_clongdouble_wrapper Bx, + int Cp, int Cj, npy_clongdouble_wrapper Cx) """ - csr_minus_csr(int n_row, int n_col, int Ap, int Aj, signed char Ax, - int Bp, int Bj, signed char Bx, int Cp, int Cj, - signed char Cx) - csr_minus_csr(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - int Bp, int Bj, unsigned char Bx, int Cp, - int Cj, unsigned char Cx) - csr_minus_csr(int n_row, int n_col, int Ap, int Aj, short Ax, int Bp, - int Bj, short Bx, int Cp, int Cj, short Cx) - csr_minus_csr(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, - int Bp, int Bj, unsigned short Bx, int Cp, - int Cj, unsigned short Cx) - csr_minus_csr(int n_row, int n_col, int Ap, int Aj, int Ax, int Bp, - int Bj, int Bx, int Cp, int Cj, int Cx) - csr_minus_csr(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, - int Bp, int Bj, unsigned int Bx, int Cp, - int Cj, unsigned int Cx) - csr_minus_csr(int n_row, int n_col, int Ap, int Aj, long long Ax, - int Bp, int Bj, long long Bx, int Cp, int Cj, - long long Cx) - csr_minus_csr(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, - int Bp, int Bj, unsigned long long Bx, - int Cp, int Cj, unsigned long long Cx) - csr_minus_csr(int n_row, int n_col, int Ap, int Aj, float Ax, int Bp, - int Bj, float Bx, int Cp, int Cj, float Cx) - csr_minus_csr(int n_row, int n_col, int Ap, int Aj, double Ax, int Bp, - int Bj, double Bx, int Cp, int Cj, double Cx) - csr_minus_csr(int n_row, int n_col, int Ap, int Aj, long double Ax, - int Bp, int Bj, long double Bx, int Cp, int Cj, - long double Cx) - csr_minus_csr(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, - int Bp, int Bj, npy_cfloat_wrapper Bx, - int Cp, int Cj, npy_cfloat_wrapper Cx) - csr_minus_csr(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, - int Bp, int Bj, npy_cdouble_wrapper Bx, - int Cp, int Cj, npy_cdouble_wrapper Cx) - csr_minus_csr(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, - int Bp, int Bj, npy_clongdouble_wrapper Bx, - int Cp, int Cj, npy_clongdouble_wrapper Cx) - """ - return _csr.csr_minus_csr(*args) + return _csr.csr_minus_csr(*args) def csr_sort_indices(*args): + """ + csr_sort_indices(int n_row, int Ap, int Aj, signed char Ax) + csr_sort_indices(int n_row, int Ap, int Aj, unsigned char Ax) + csr_sort_indices(int n_row, int Ap, int Aj, short Ax) + csr_sort_indices(int n_row, int Ap, int Aj, unsigned short Ax) + csr_sort_indices(int n_row, int Ap, int Aj, int Ax) + csr_sort_indices(int n_row, int Ap, int Aj, unsigned int Ax) + csr_sort_indices(int n_row, int Ap, int Aj, long long Ax) + csr_sort_indices(int n_row, int Ap, int Aj, unsigned long long Ax) + csr_sort_indices(int n_row, int Ap, int Aj, float Ax) + csr_sort_indices(int n_row, int Ap, int Aj, double Ax) + csr_sort_indices(int n_row, int Ap, int Aj, long double Ax) + csr_sort_indices(int n_row, int Ap, int Aj, npy_cfloat_wrapper Ax) + csr_sort_indices(int n_row, int Ap, int Aj, npy_cdouble_wrapper Ax) + csr_sort_indices(int n_row, int Ap, int Aj, npy_clongdouble_wrapper Ax) """ - csr_sort_indices(int n_row, int Ap, int Aj, signed char Ax) - csr_sort_indices(int n_row, int Ap, int Aj, unsigned char Ax) - csr_sort_indices(int n_row, int Ap, int Aj, short Ax) - csr_sort_indices(int n_row, int Ap, int Aj, unsigned short Ax) - csr_sort_indices(int n_row, int Ap, int Aj, int Ax) - csr_sort_indices(int n_row, int Ap, int Aj, unsigned int Ax) - csr_sort_indices(int n_row, int Ap, int Aj, long long Ax) - csr_sort_indices(int n_row, int Ap, int Aj, unsigned long long Ax) - csr_sort_indices(int n_row, int Ap, int Aj, float Ax) - csr_sort_indices(int n_row, int Ap, int Aj, double Ax) - csr_sort_indices(int n_row, int Ap, int Aj, long double Ax) - csr_sort_indices(int n_row, int Ap, int Aj, npy_cfloat_wrapper Ax) - csr_sort_indices(int n_row, int Ap, int Aj, npy_cdouble_wrapper Ax) - csr_sort_indices(int n_row, int Ap, int Aj, npy_clongdouble_wrapper Ax) - """ - return _csr.csr_sort_indices(*args) + return _csr.csr_sort_indices(*args) def csr_eliminate_zeros(*args): + """ + csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, signed char Ax) + csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, unsigned char Ax) + csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, short Ax) + csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, unsigned short Ax) + csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, int Ax) + csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, unsigned int Ax) + csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, long long Ax) + csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax) + csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, float Ax) + csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, double Ax) + csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, long double Ax) + csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax) + csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax) + csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax) """ - csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, signed char Ax) - csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, unsigned char Ax) - csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, short Ax) - csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, unsigned short Ax) - csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, int Ax) - csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, unsigned int Ax) - csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, long long Ax) - csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax) - csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, float Ax) - csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, double Ax) - csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, long double Ax) - csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax) - csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax) - csr_eliminate_zeros(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax) - """ - return _csr.csr_eliminate_zeros(*args) + return _csr.csr_eliminate_zeros(*args) def csr_sum_duplicates(*args): + """ + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, signed char Ax) + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, unsigned char Ax) + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, short Ax) + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, unsigned short Ax) + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, int Ax) + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, unsigned int Ax) + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, long long Ax) + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax) + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, float Ax) + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, double Ax) + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, long double Ax) + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax) + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax) + csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax) """ - csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, signed char Ax) - csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, unsigned char Ax) - csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, short Ax) - csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, unsigned short Ax) - csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, int Ax) - csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, unsigned int Ax) - csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, long long Ax) - csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax) - csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, float Ax) - csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, double Ax) - csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, long double Ax) - csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax) - csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax) - csr_sum_duplicates(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax) - """ - return _csr.csr_sum_duplicates(*args) + return _csr.csr_sum_duplicates(*args) def get_csr_submatrix(*args): + """ + get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, signed char Ax, + int ir0, int ir1, int ic0, int ic1, std::vector<(int)> Bp, + std::vector<(int)> Bj, std::vector<(signed char)> Bx) + get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, + int ir0, int ir1, int ic0, int ic1, std::vector<(int)> Bp, + std::vector<(int)> Bj, std::vector<(unsigned char)> Bx) + get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, short Ax, int ir0, + int ir1, int ic0, int ic1, std::vector<(int)> Bp, + std::vector<(int)> Bj, std::vector<(short)> Bx) + get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, + int ir0, int ir1, int ic0, int ic1, std::vector<(int)> Bp, + std::vector<(int)> Bj, std::vector<(unsigned short)> Bx) + get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, int Ax, int ir0, + int ir1, int ic0, int ic1, std::vector<(int)> Bp, + std::vector<(int)> Bj, std::vector<(int)> Bx) + get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, + int ir0, int ir1, int ic0, int ic1, std::vector<(int)> Bp, + std::vector<(int)> Bj, std::vector<(unsigned int)> Bx) + get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, long long Ax, + int ir0, int ir1, int ic0, int ic1, std::vector<(int)> Bp, + std::vector<(int)> Bj, std::vector<(long long)> Bx) + get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, + int ir0, int ir1, int ic0, int ic1, + std::vector<(int)> Bp, std::vector<(int)> Bj, + std::vector<(unsigned long long)> Bx) + get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, float Ax, int ir0, + int ir1, int ic0, int ic1, std::vector<(int)> Bp, + std::vector<(int)> Bj, std::vector<(float)> Bx) + get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, double Ax, int ir0, + int ir1, int ic0, int ic1, std::vector<(int)> Bp, + std::vector<(int)> Bj, std::vector<(double)> Bx) + get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, long double Ax, + int ir0, int ir1, int ic0, int ic1, std::vector<(int)> Bp, + std::vector<(int)> Bj, std::vector<(long double)> Bx) + get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, + int ir0, int ir1, int ic0, int ic1, + std::vector<(int)> Bp, std::vector<(int)> Bj, + std::vector<(npy_cfloat_wrapper)> Bx) + get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, + int ir0, int ir1, int ic0, int ic1, + std::vector<(int)> Bp, std::vector<(int)> Bj, + std::vector<(npy_cdouble_wrapper)> Bx) + get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, + int ir0, int ir1, int ic0, int ic1, + std::vector<(int)> Bp, std::vector<(int)> Bj, + std::vector<(npy_clongdouble_wrapper)> Bx) """ - get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, signed char Ax, - int ir0, int ir1, int ic0, int ic1, std::vector<(int)> Bp, - std::vector<(int)> Bj, std::vector<(signed char)> Bx) - get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, unsigned char Ax, - int ir0, int ir1, int ic0, int ic1, std::vector<(int)> Bp, - std::vector<(int)> Bj, std::vector<(unsigned char)> Bx) - get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, short Ax, int ir0, - int ir1, int ic0, int ic1, std::vector<(int)> Bp, - std::vector<(int)> Bj, std::vector<(short)> Bx) - get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, unsigned short Ax, - int ir0, int ir1, int ic0, int ic1, std::vector<(int)> Bp, - std::vector<(int)> Bj, std::vector<(unsigned short)> Bx) - get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, int Ax, int ir0, - int ir1, int ic0, int ic1, std::vector<(int)> Bp, - std::vector<(int)> Bj, std::vector<(int)> Bx) - get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, unsigned int Ax, - int ir0, int ir1, int ic0, int ic1, std::vector<(int)> Bp, - std::vector<(int)> Bj, std::vector<(unsigned int)> Bx) - get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, long long Ax, - int ir0, int ir1, int ic0, int ic1, std::vector<(int)> Bp, - std::vector<(int)> Bj, std::vector<(long long)> Bx) - get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, unsigned long long Ax, - int ir0, int ir1, int ic0, int ic1, - std::vector<(int)> Bp, std::vector<(int)> Bj, - std::vector<(unsigned long long)> Bx) - get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, float Ax, int ir0, - int ir1, int ic0, int ic1, std::vector<(int)> Bp, - std::vector<(int)> Bj, std::vector<(float)> Bx) - get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, double Ax, int ir0, - int ir1, int ic0, int ic1, std::vector<(int)> Bp, - std::vector<(int)> Bj, std::vector<(double)> Bx) - get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, long double Ax, - int ir0, int ir1, int ic0, int ic1, std::vector<(int)> Bp, - std::vector<(int)> Bj, std::vector<(long double)> Bx) - get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, npy_cfloat_wrapper Ax, - int ir0, int ir1, int ic0, int ic1, - std::vector<(int)> Bp, std::vector<(int)> Bj, - std::vector<(npy_cfloat_wrapper)> Bx) - get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, npy_cdouble_wrapper Ax, - int ir0, int ir1, int ic0, int ic1, - std::vector<(int)> Bp, std::vector<(int)> Bj, - std::vector<(npy_cdouble_wrapper)> Bx) - get_csr_submatrix(int n_row, int n_col, int Ap, int Aj, npy_clongdouble_wrapper Ax, - int ir0, int ir1, int ic0, int ic1, - std::vector<(int)> Bp, std::vector<(int)> Bj, - std::vector<(npy_clongdouble_wrapper)> Bx) - """ - return _csr.get_csr_submatrix(*args) + return _csr.get_csr_submatrix(*args) + Modified: trunk/scipy/sparse/tests/test_base.py =================================================================== --- trunk/scipy/sparse/tests/test_base.py 2009-01-31 01:05:19 UTC (rev 5528) +++ trunk/scipy/sparse/tests/test_base.py 2009-01-31 04:41:39 UTC (rev 5529) @@ -984,7 +984,6 @@ csr = csr_matrix((data, indices, indptr)) assert_array_equal(csr.shape,(3,6)) - def test_sort_indices(self): data = arange( 5 ) indices = array( [7, 2, 1, 5, 4] ) @@ -1006,8 +1005,20 @@ assert_array_equal(asp.data,[1, 2, 3]) assert_array_equal(asp.todense(),bsp.todense()) + def test_unsorted_arithmetic(self): + data = arange( 5 ) + indices = array( [7, 2, 1, 5, 4] ) + indptr = array( [0, 3, 5] ) + asp = csr_matrix( (data, indices, indptr), shape=(2,10) ) + data = arange( 6 ) + indices = array( [8, 1, 5, 7, 2, 4] ) + indptr = array( [0, 2, 6] ) + bsp = csr_matrix( (data, indices, indptr), shape=(2,10) ) + assert_equal((asp + bsp).todense(), asp.todense() + bsp.todense()) + + class TestCSC(_TestCommon, _TestGetSet, _TestSolve, _TestInplaceArithmetic, _TestArithmetic, _TestHorizSlicing, _TestVertSlicing, _TestBothSlicing, @@ -1079,6 +1090,16 @@ assert_array_equal(asp.indices,[1, 2, 7, 4, 5]) assert_array_equal(asp.todense(),bsp.todense()) + def test_unsorted_arithmetic(self): + data = arange( 5 ) + indices = array( [7, 2, 1, 5, 4] ) + indptr = array( [0, 3, 5] ) + asp = csc_matrix( (data, indices, indptr), shape=(10,2) ) + data = arange( 6 ) + indices = array( [8, 1, 5, 7, 2, 4] ) + indptr = array( [0, 2, 6] ) + bsp = csc_matrix( (data, indices, indptr), shape=(10,2) ) + assert_equal((asp + bsp).todense(), asp.todense() + bsp.todense()) class TestDOK(_TestCommon, _TestGetSet, _TestSolve, TestCase): spmatrix = dok_matrix From scipy-svn at scipy.org Sat Jan 31 22:57:10 2009 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 31 Jan 2009 21:57:10 -0600 (CST) Subject: [Scipy-svn] r5530 - in trunk/scipy/sparse: . sparsetools Message-ID: <20090201035710.92F0BC7C015@scipy.org> Author: wnbell Date: 2009-01-31 21:57:01 -0600 (Sat, 31 Jan 2009) New Revision: 5530 Modified: trunk/scipy/sparse/bsr.py trunk/scipy/sparse/sparsetools/bsr.h trunk/scipy/sparse/sparsetools/bsr.py trunk/scipy/sparse/sparsetools/bsr_wrap.cxx trunk/scipy/sparse/sparsetools/coo.py trunk/scipy/sparse/sparsetools/csr.h trunk/scipy/sparse/sparsetools/dia.py trunk/scipy/sparse/sparsetools/scratch.h trunk/scipy/sparse/sparsetools/setup.py Log: added path for BSR (op) BSR where the BSR format is not canonical Modified: trunk/scipy/sparse/bsr.py =================================================================== --- trunk/scipy/sparse/bsr.py 2009-01-31 04:41:39 UTC (rev 5529) +++ trunk/scipy/sparse/bsr.py 2009-02-01 03:57:01 UTC (rev 5530) @@ -490,16 +490,11 @@ # utility functions def _binopt(self, other, op, in_shape=None, out_shape=None): """apply the binary operation fn to two sparse matrices""" - other = self.__class__(other,blocksize=self.blocksize) - if in_shape is None: - in_shape = self.shape - if out_shape is None: - out_shape = self.shape + # ideally we'd take the GCDs of the blocksize dimensions + # and explode self and other to match + other = self.__class__(other, blocksize=self.blocksize) - self.sort_indices() - other.sort_indices() - # e.g. bsr_plus_bsr, etc. fn = getattr(sparsetools, self.format + op + self.format) @@ -510,7 +505,7 @@ indices = np.empty(max_bnnz, dtype=np.intc) data = np.empty(R*C*max_bnnz, dtype=upcast(self.dtype,other.dtype)) - fn(in_shape[0]/R, in_shape[1]/C, R, C, \ + fn(self.shape[0]/R, self.shape[1]/C, R, C, self.indptr, self.indices, np.ravel(self.data), other.indptr, other.indices, np.ravel(other.data), indptr, indices, data) @@ -525,7 +520,7 @@ data = data.reshape(-1,R,C) - return self.__class__((data, indices, indptr), shape=out_shape) + return self.__class__((data, indices, indptr), shape=self.shape) # needed by _data_matrix def _with_data(self,data,copy=True): Modified: trunk/scipy/sparse/sparsetools/bsr.h =================================================================== --- trunk/scipy/sparse/sparsetools/bsr.h 2009-01-31 04:41:39 UTC (rev 5529) +++ trunk/scipy/sparse/sparsetools/bsr.h 2009-02-01 03:57:01 UTC (rev 5530) @@ -330,21 +330,123 @@ +/* + * Compute C = A (binary_op) B for BSR matrices that are not + * necessarily canonical BSR format. Specifically, this method + * works even when the input matrices have duplicate and/or + * unsorted column indices within a given row. + * + * Refer to bsr_binop_bsr() for additional information + * + * Note: + * Output arrays Cp, Cj, and Cx must be preallocated + * If nnz(C) is not known a priori, a conservative bound is: + * nnz(C) <= nnz(A) + nnz(B) + * + * Note: + * Input: A and B column indices are not assumed to be in sorted order + * Output: C column indices are not generally in sorted order + * C will not contain any duplicate entries or explicit zeros. + * + */ template -void bsr_binop_bsr(const I n_brow, const I n_bcol, - const I R, const I C, - const I Ap[], const I Aj[], const T Ax[], - const I Bp[], const I Bj[], const T Bx[], - I Cp[], I Cj[], T Cx[], - const bin_op& op) +void bsr_binop_bsr_general(const I n_brow, const I n_bcol, + const I R, const I C, + const I Ap[], const I Aj[], const T Ax[], + const I Bp[], const I Bj[], const T Bx[], + I Cp[], I Cj[], T Cx[], + const bin_op& op) { - assert( R > 0 && C > 0); - - if( R == 1 && C == 1 ){ - csr_binop_csr(n_brow, n_bcol, Ap, Aj, Ax, Bp, Bj, Bx, Cp, Cj, Cx, op); //use CSR for 1x1 blocksize - return; + //Method that works for duplicate and/or unsorted indices + const I RC = R*C; + + Cp[0] = 0; + I nnz = 0; + + std::vector next(n_bcol, -1); + std::vector A_row(n_bcol * RC, 0); // this approach can be problematic for large R + std::vector B_row(n_bcol * RC, 0); + + for(I i = 0; i < n_brow; i++){ + I head = -2; + I length = 0; + + //add a row of A to A_row + for(I jj = Ap[i]; jj < Ap[i+1]; jj++){ + I j = Aj[jj]; + + for(I n = 0; n < RC; n++) + A_row[RC*j + n] += Ax[RC*jj + n]; + + if(next[j] == -1){ + next[j] = head; + head = j; + length++; + } + } + + //add a row of B to B_row + for(I jj = Bp[i]; jj < Bp[i+1]; jj++){ + I j = Bj[jj]; + + for(I n = 0; n < RC; n++) + B_row[RC*j + n] += Bx[RC*jj + n]; + + if(next[j] == -1){ + next[j] = head; + head = j; + length++; + } + } + + + for(I jj = 0; jj < length; jj++){ + // compute op(block_A, block_B) + for(I n = 0; n < RC; n++) + Cx[RC * nnz + n] = op(A_row[RC*head + n], B_row[RC*head + n]); + + // advance counter if block is nonzero + if( is_nonzero_block(Cx + (RC * nnz), RC) ) + Cj[nnz++] = head; + + // clear block_A and block_B values + for(I n = 0; n < RC; n++){ + A_row[RC*head + n] = 0; + B_row[RC*head + n] = 0; + } + + I temp = head; + head = next[head]; + next[temp] = -1; + } + + Cp[i + 1] = nnz; } +} + +/* + * Compute C = A (binary_op) B for BSR matrices that are in the + * canonical BSR format. Specifically, this method requires that + * the rows of the input matrices are free of duplicate column indices + * and that the column indices are in sorted order. + * + * Refer to bsr_binop_bsr() for additional information + * + * Note: + * Input: A and B column indices are assumed to be in sorted order + * Output: C column indices will be in sorted order + * Cx will not contain any zero entries + * + */ +template +void bsr_binop_bsr_canonical(const I n_brow, const I n_bcol, + const I R, const I C, + const I Ap[], const I Aj[], const T Ax[], + const I Bp[], const I Bj[], const T Bx[], + I Cp[], I Cj[], T Cx[], + const bin_op& op) +{ const I RC = R*C; T * result = Cx; @@ -364,7 +466,7 @@ if(A_j == B_j){ for(I n = 0; n < RC; n++){ - result[n] = op(Ax[RC*A_pos + n],Bx[RC*B_pos + n]); + result[n] = op(Ax[RC*A_pos + n], Bx[RC*B_pos + n]); } if( is_nonzero_block(result,RC) ){ @@ -377,7 +479,7 @@ B_pos++; } else if (A_j < B_j) { for(I n = 0; n < RC; n++){ - result[n] = op(Ax[RC*A_pos + n],0); + result[n] = op(Ax[RC*A_pos + n], 0); } if(is_nonzero_block(result,RC)){ @@ -390,7 +492,7 @@ } else { //B_j < A_j for(I n = 0; n < RC; n++){ - result[n] = op(0,Bx[RC*B_pos + n]); + result[n] = op(0, Bx[RC*B_pos + n]); } if(is_nonzero_block(result,RC)){ Cj[nnz] = B_j; @@ -405,10 +507,10 @@ //tail while(A_pos < A_end){ for(I n = 0; n < RC; n++){ - result[n] = op(Ax[RC*A_pos + n],0); + result[n] = op(Ax[RC*A_pos + n], 0); } - if(is_nonzero_block(result,RC)){ + if(is_nonzero_block(result, RC)){ Cj[nnz] = Aj[A_pos]; result += RC; nnz++; @@ -421,7 +523,7 @@ result[n] = op(0,Bx[RC*B_pos + n]); } - if(is_nonzero_block(result,RC)){ + if(is_nonzero_block(result, RC)){ Cj[nnz] = Bj[B_pos]; result += RC; nnz++; @@ -434,6 +536,62 @@ } } + +/* + * Compute C = A (binary_op) B for CSR matrices A,B where the column + * indices with the rows of A and B are known to be sorted. + * + * binary_op(x,y) - binary operator to apply elementwise + * + * Input Arguments: + * I n_row - number of rows in A (and B) + * I n_col - number of columns in A (and B) + * I Ap[n_row+1] - row pointer + * I Aj[nnz(A)] - column indices + * T Ax[nnz(A)] - nonzeros + * I Bp[n_row+1] - row pointer + * I Bj[nnz(B)] - column indices + * T Bx[nnz(B)] - nonzeros + * Output Arguments: + * I Cp[n_row+1] - row pointer + * I Cj[nnz(C)] - column indices + * T Cx[nnz(C)] - nonzeros + * + * Note: + * Output arrays Cp, Cj, and Cx must be preallocated + * If nnz(C) is not known a priori, a conservative bound is: + * nnz(C) <= nnz(A) + nnz(B) + * + * Note: + * Input: A and B column indices are not assumed to be in sorted order. + * Output: C column indices will be in sorted if both A and B have sorted indices. + * Cx will not contain any zero entries + * + */ +template +void bsr_binop_bsr(const I n_brow, const I n_bcol, + const I R, const I C, + const I Ap[], const I Aj[], const T Ax[], + const I Bp[], const I Bj[], const T Bx[], + I Cp[], I Cj[], T Cx[], + const bin_op& op) +{ + assert( R > 0 && C > 0); + + if( R == 1 && C == 1 ){ + //use CSR for 1x1 blocksize + csr_binop_csr(n_brow, n_bcol, Ap, Aj, Ax, Bp, Bj, Bx, Cp, Cj, Cx, op); + } + else if ( csr_has_canonical_format(n_brow, Ap, Aj) && csr_has_canonical_format(n_brow, Bp, Bj) ){ + // prefer faster implementation + bsr_binop_bsr_canonical(n_brow, n_bcol, R, C, Ap, Aj, Ax, Bp, Bj, Bx, Cp, Cj, Cx, op); + } + else { + // slower fallback method + bsr_binop_bsr_general(n_brow, n_bcol, R, C, Ap, Aj, Ax, Bp, Bj, Bx, Cp, Cj, Cx, op); + } +} + /* element-wise binary operations */ template void bsr_elmul_bsr(const I n_row, const I n_col, const I R, const I C, @@ -529,6 +687,8 @@ } } } + + /* * Compute Y += A*X for BSR matrix A and dense block vectors X,Y * Modified: trunk/scipy/sparse/sparsetools/bsr.py =================================================================== --- trunk/scipy/sparse/sparsetools/bsr.py 2009-01-31 04:41:39 UTC (rev 5529) +++ trunk/scipy/sparse/sparsetools/bsr.py 2009-02-01 03:57:01 UTC (rev 5530) @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.34 +# Version 1.3.36 # # Don't modify this file, modify the SWIG interface instead. # This file is compatible with both classic and new-style classes. @@ -51,483 +51,484 @@ def bsr_diagonal(*args): + """ + bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + signed char Ax, signed char Yx) + bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned char Ax, unsigned char Yx) + bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + short Ax, short Yx) + bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned short Ax, unsigned short Yx) + bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + int Ax, int Yx) + bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned int Ax, unsigned int Yx) + bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + long long Ax, long long Yx) + bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned long long Ax, unsigned long long Yx) + bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + float Ax, float Yx) + bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + double Ax, double Yx) + bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + long double Ax, long double Yx) + bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + npy_cfloat_wrapper Ax, npy_cfloat_wrapper Yx) + bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + npy_cdouble_wrapper Ax, npy_cdouble_wrapper Yx) + bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + npy_clongdouble_wrapper Ax, npy_clongdouble_wrapper Yx) """ - bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - signed char Ax, signed char Yx) - bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned char Ax, unsigned char Yx) - bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - short Ax, short Yx) - bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned short Ax, unsigned short Yx) - bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - int Ax, int Yx) - bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned int Ax, unsigned int Yx) - bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - long long Ax, long long Yx) - bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned long long Ax, unsigned long long Yx) - bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - float Ax, float Yx) - bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - double Ax, double Yx) - bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - long double Ax, long double Yx) - bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - npy_cfloat_wrapper Ax, npy_cfloat_wrapper Yx) - bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - npy_cdouble_wrapper Ax, npy_cdouble_wrapper Yx) - bsr_diagonal(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - npy_clongdouble_wrapper Ax, npy_clongdouble_wrapper Yx) - """ - return _bsr.bsr_diagonal(*args) + return _bsr.bsr_diagonal(*args) def bsr_scale_rows(*args): + """ + bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + signed char Ax, signed char Xx) + bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned char Ax, unsigned char Xx) + bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + short Ax, short Xx) + bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned short Ax, unsigned short Xx) + bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + int Ax, int Xx) + bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned int Ax, unsigned int Xx) + bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + long long Ax, long long Xx) + bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned long long Ax, unsigned long long Xx) + bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + float Ax, float Xx) + bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + double Ax, double Xx) + bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + long double Ax, long double Xx) + bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx) + bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx) + bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + npy_clongdouble_wrapper Ax, npy_clongdouble_wrapper Xx) """ - bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - signed char Ax, signed char Xx) - bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned char Ax, unsigned char Xx) - bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - short Ax, short Xx) - bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned short Ax, unsigned short Xx) - bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - int Ax, int Xx) - bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned int Ax, unsigned int Xx) - bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - long long Ax, long long Xx) - bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned long long Ax, unsigned long long Xx) - bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - float Ax, float Xx) - bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - double Ax, double Xx) - bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - long double Ax, long double Xx) - bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx) - bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx) - bsr_scale_rows(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - npy_clongdouble_wrapper Ax, npy_clongdouble_wrapper Xx) - """ - return _bsr.bsr_scale_rows(*args) + return _bsr.bsr_scale_rows(*args) def bsr_scale_columns(*args): + """ + bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + signed char Ax, signed char Xx) + bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned char Ax, unsigned char Xx) + bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + short Ax, short Xx) + bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned short Ax, unsigned short Xx) + bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + int Ax, int Xx) + bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned int Ax, unsigned int Xx) + bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + long long Ax, long long Xx) + bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned long long Ax, unsigned long long Xx) + bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + float Ax, float Xx) + bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + double Ax, double Xx) + bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + long double Ax, long double Xx) + bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx) + bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx) + bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + npy_clongdouble_wrapper Ax, npy_clongdouble_wrapper Xx) """ - bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - signed char Ax, signed char Xx) - bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned char Ax, unsigned char Xx) - bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - short Ax, short Xx) - bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned short Ax, unsigned short Xx) - bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - int Ax, int Xx) - bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned int Ax, unsigned int Xx) - bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - long long Ax, long long Xx) - bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned long long Ax, unsigned long long Xx) - bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - float Ax, float Xx) - bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - double Ax, double Xx) - bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - long double Ax, long double Xx) - bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx) - bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx) - bsr_scale_columns(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - npy_clongdouble_wrapper Ax, npy_clongdouble_wrapper Xx) - """ - return _bsr.bsr_scale_columns(*args) + return _bsr.bsr_scale_columns(*args) def bsr_transpose(*args): + """ + bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + signed char Ax, int Bp, int Bj, signed char Bx) + bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned char Ax, int Bp, int Bj, unsigned char Bx) + bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + short Ax, int Bp, int Bj, short Bx) + bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned short Ax, int Bp, int Bj, unsigned short Bx) + bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + int Ax, int Bp, int Bj, int Bx) + bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned int Ax, int Bp, int Bj, unsigned int Bx) + bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + long long Ax, int Bp, int Bj, long long Bx) + bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned long long Ax, int Bp, int Bj, unsigned long long Bx) + bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + float Ax, int Bp, int Bj, float Bx) + bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + double Ax, int Bp, int Bj, double Bx) + bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + long double Ax, int Bp, int Bj, long double Bx) + bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx) + bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx) + bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + npy_clongdouble_wrapper Ax, int Bp, int Bj, + npy_clongdouble_wrapper Bx) """ - bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - signed char Ax, int Bp, int Bj, signed char Bx) - bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned char Ax, int Bp, int Bj, unsigned char Bx) - bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - short Ax, int Bp, int Bj, short Bx) - bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned short Ax, int Bp, int Bj, unsigned short Bx) - bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - int Ax, int Bp, int Bj, int Bx) - bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned int Ax, int Bp, int Bj, unsigned int Bx) - bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - long long Ax, int Bp, int Bj, long long Bx) - bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned long long Ax, int Bp, int Bj, unsigned long long Bx) - bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - float Ax, int Bp, int Bj, float Bx) - bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - double Ax, int Bp, int Bj, double Bx) - bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - long double Ax, int Bp, int Bj, long double Bx) - bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx) - bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx) - bsr_transpose(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - npy_clongdouble_wrapper Ax, int Bp, int Bj, - npy_clongdouble_wrapper Bx) - """ - return _bsr.bsr_transpose(*args) + return _bsr.bsr_transpose(*args) def bsr_matmat_pass2(*args): + """ + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, signed char Ax, int Bp, int Bj, signed char Bx, + int Cp, int Cj, signed char Cx) + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, unsigned char Ax, int Bp, int Bj, unsigned char Bx, + int Cp, int Cj, unsigned char Cx) + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, short Ax, int Bp, int Bj, short Bx, + int Cp, int Cj, short Cx) + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, unsigned short Ax, int Bp, int Bj, + unsigned short Bx, int Cp, int Cj, unsigned short Cx) + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, int Ax, int Bp, int Bj, int Bx, int Cp, + int Cj, int Cx) + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, unsigned int Ax, int Bp, int Bj, unsigned int Bx, + int Cp, int Cj, unsigned int Cx) + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, long long Ax, int Bp, int Bj, long long Bx, + int Cp, int Cj, long long Cx) + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, unsigned long long Ax, int Bp, int Bj, + unsigned long long Bx, int Cp, int Cj, unsigned long long Cx) + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, float Ax, int Bp, int Bj, float Bx, + int Cp, int Cj, float Cx) + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, double Ax, int Bp, int Bj, double Bx, + int Cp, int Cj, double Cx) + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, long double Ax, int Bp, int Bj, long double Bx, + int Cp, int Cj, long double Cx) + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, npy_cfloat_wrapper Ax, int Bp, int Bj, + npy_cfloat_wrapper Bx, int Cp, int Cj, npy_cfloat_wrapper Cx) + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, npy_cdouble_wrapper Ax, int Bp, int Bj, + npy_cdouble_wrapper Bx, int Cp, int Cj, + npy_cdouble_wrapper Cx) + bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, + int Aj, npy_clongdouble_wrapper Ax, int Bp, + int Bj, npy_clongdouble_wrapper Bx, int Cp, + int Cj, npy_clongdouble_wrapper Cx) """ - bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, - int Aj, signed char Ax, int Bp, int Bj, signed char Bx, - int Cp, int Cj, signed char Cx) - bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, - int Aj, unsigned char Ax, int Bp, int Bj, unsigned char Bx, - int Cp, int Cj, unsigned char Cx) - bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, - int Aj, short Ax, int Bp, int Bj, short Bx, - int Cp, int Cj, short Cx) - bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, - int Aj, unsigned short Ax, int Bp, int Bj, - unsigned short Bx, int Cp, int Cj, unsigned short Cx) - bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, - int Aj, int Ax, int Bp, int Bj, int Bx, int Cp, - int Cj, int Cx) - bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, - int Aj, unsigned int Ax, int Bp, int Bj, unsigned int Bx, - int Cp, int Cj, unsigned int Cx) - bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, - int Aj, long long Ax, int Bp, int Bj, long long Bx, - int Cp, int Cj, long long Cx) - bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, - int Aj, unsigned long long Ax, int Bp, int Bj, - unsigned long long Bx, int Cp, int Cj, unsigned long long Cx) - bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, - int Aj, float Ax, int Bp, int Bj, float Bx, - int Cp, int Cj, float Cx) - bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, - int Aj, double Ax, int Bp, int Bj, double Bx, - int Cp, int Cj, double Cx) - bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, - int Aj, long double Ax, int Bp, int Bj, long double Bx, - int Cp, int Cj, long double Cx) - bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, - int Aj, npy_cfloat_wrapper Ax, int Bp, int Bj, - npy_cfloat_wrapper Bx, int Cp, int Cj, npy_cfloat_wrapper Cx) - bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, - int Aj, npy_cdouble_wrapper Ax, int Bp, int Bj, - npy_cdouble_wrapper Bx, int Cp, int Cj, - npy_cdouble_wrapper Cx) - bsr_matmat_pass2(int n_brow, int n_bcol, int R, int C, int N, int Ap, - int Aj, npy_clongdouble_wrapper Ax, int Bp, - int Bj, npy_clongdouble_wrapper Bx, int Cp, - int Cj, npy_clongdouble_wrapper Cx) - """ - return _bsr.bsr_matmat_pass2(*args) + return _bsr.bsr_matmat_pass2(*args) def bsr_matvec(*args): + """ + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + signed char Ax, signed char Xx, signed char Yx) + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned char Ax, unsigned char Xx, unsigned char Yx) + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + short Ax, short Xx, short Yx) + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned short Ax, unsigned short Xx, unsigned short Yx) + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + int Ax, int Xx, int Yx) + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned int Ax, unsigned int Xx, unsigned int Yx) + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + long long Ax, long long Xx, long long Yx) + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned long long Ax, unsigned long long Xx, + unsigned long long Yx) + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + float Ax, float Xx, float Yx) + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + double Ax, double Xx, double Yx) + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + long double Ax, long double Xx, long double Yx) + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx, + npy_cfloat_wrapper Yx) + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx, + npy_cdouble_wrapper Yx) + bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + npy_clongdouble_wrapper Ax, npy_clongdouble_wrapper Xx, + npy_clongdouble_wrapper Yx) """ - bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - signed char Ax, signed char Xx, signed char Yx) - bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned char Ax, unsigned char Xx, unsigned char Yx) - bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - short Ax, short Xx, short Yx) - bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned short Ax, unsigned short Xx, unsigned short Yx) - bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - int Ax, int Xx, int Yx) - bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned int Ax, unsigned int Xx, unsigned int Yx) - bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - long long Ax, long long Xx, long long Yx) - bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned long long Ax, unsigned long long Xx, - unsigned long long Yx) - bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - float Ax, float Xx, float Yx) - bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - double Ax, double Xx, double Yx) - bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - long double Ax, long double Xx, long double Yx) - bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx, - npy_cfloat_wrapper Yx) - bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx, - npy_cdouble_wrapper Yx) - bsr_matvec(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - npy_clongdouble_wrapper Ax, npy_clongdouble_wrapper Xx, - npy_clongdouble_wrapper Yx) - """ - return _bsr.bsr_matvec(*args) + return _bsr.bsr_matvec(*args) def bsr_matvecs(*args): + """ + bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, + int Aj, signed char Ax, signed char Xx, + signed char Yx) + bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, + int Aj, unsigned char Ax, unsigned char Xx, + unsigned char Yx) + bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, + int Aj, short Ax, short Xx, short Yx) + bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, + int Aj, unsigned short Ax, unsigned short Xx, + unsigned short Yx) + bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, + int Aj, int Ax, int Xx, int Yx) + bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, + int Aj, unsigned int Ax, unsigned int Xx, + unsigned int Yx) + bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, + int Aj, long long Ax, long long Xx, long long Yx) + bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, + int Aj, unsigned long long Ax, unsigned long long Xx, + unsigned long long Yx) + bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, + int Aj, float Ax, float Xx, float Yx) + bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, + int Aj, double Ax, double Xx, double Yx) + bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, + int Aj, long double Ax, long double Xx, + long double Yx) + bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, + int Aj, npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx, + npy_cfloat_wrapper Yx) + bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, + int Aj, npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx, + npy_cdouble_wrapper Yx) + bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, + int Aj, npy_clongdouble_wrapper Ax, npy_clongdouble_wrapper Xx, + npy_clongdouble_wrapper Yx) """ - bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, - int Aj, signed char Ax, signed char Xx, - signed char Yx) - bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, - int Aj, unsigned char Ax, unsigned char Xx, - unsigned char Yx) - bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, - int Aj, short Ax, short Xx, short Yx) - bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, - int Aj, unsigned short Ax, unsigned short Xx, - unsigned short Yx) - bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, - int Aj, int Ax, int Xx, int Yx) - bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, - int Aj, unsigned int Ax, unsigned int Xx, - unsigned int Yx) - bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, - int Aj, long long Ax, long long Xx, long long Yx) - bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, - int Aj, unsigned long long Ax, unsigned long long Xx, - unsigned long long Yx) - bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, - int Aj, float Ax, float Xx, float Yx) - bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, - int Aj, double Ax, double Xx, double Yx) - bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, - int Aj, long double Ax, long double Xx, - long double Yx) - bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, - int Aj, npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx, - npy_cfloat_wrapper Yx) - bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, - int Aj, npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx, - npy_cdouble_wrapper Yx) - bsr_matvecs(int n_brow, int n_bcol, int n_vecs, int R, int C, int Ap, - int Aj, npy_clongdouble_wrapper Ax, npy_clongdouble_wrapper Xx, - npy_clongdouble_wrapper Yx) - """ - return _bsr.bsr_matvecs(*args) + return _bsr.bsr_matvecs(*args) def bsr_elmul_bsr(*args): + """ + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + signed char Ax, int Bp, int Bj, signed char Bx, + int Cp, int Cj, signed char Cx) + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned char Ax, int Bp, int Bj, unsigned char Bx, + int Cp, int Cj, unsigned char Cx) + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + short Ax, int Bp, int Bj, short Bx, int Cp, + int Cj, short Cx) + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned short Ax, int Bp, int Bj, unsigned short Bx, + int Cp, int Cj, unsigned short Cx) + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + int Ax, int Bp, int Bj, int Bx, int Cp, int Cj, + int Cx) + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned int Ax, int Bp, int Bj, unsigned int Bx, + int Cp, int Cj, unsigned int Cx) + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + long long Ax, int Bp, int Bj, long long Bx, + int Cp, int Cj, long long Cx) + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned long long Ax, int Bp, int Bj, unsigned long long Bx, + int Cp, int Cj, unsigned long long Cx) + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + float Ax, int Bp, int Bj, float Bx, int Cp, + int Cj, float Cx) + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + double Ax, int Bp, int Bj, double Bx, int Cp, + int Cj, double Cx) + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + long double Ax, int Bp, int Bj, long double Bx, + int Cp, int Cj, long double Cx) + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, + int Cp, int Cj, npy_cfloat_wrapper Cx) + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, + int Cp, int Cj, npy_cdouble_wrapper Cx) + bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_clongdouble_wrapper Ax, int Bp, int Bj, + npy_clongdouble_wrapper Bx, int Cp, int Cj, npy_clongdouble_wrapper Cx) """ - bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - signed char Ax, int Bp, int Bj, signed char Bx, - int Cp, int Cj, signed char Cx) - bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - unsigned char Ax, int Bp, int Bj, unsigned char Bx, - int Cp, int Cj, unsigned char Cx) - bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - short Ax, int Bp, int Bj, short Bx, int Cp, - int Cj, short Cx) - bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - unsigned short Ax, int Bp, int Bj, unsigned short Bx, - int Cp, int Cj, unsigned short Cx) - bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - int Ax, int Bp, int Bj, int Bx, int Cp, int Cj, - int Cx) - bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - unsigned int Ax, int Bp, int Bj, unsigned int Bx, - int Cp, int Cj, unsigned int Cx) - bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - long long Ax, int Bp, int Bj, long long Bx, - int Cp, int Cj, long long Cx) - bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - unsigned long long Ax, int Bp, int Bj, unsigned long long Bx, - int Cp, int Cj, unsigned long long Cx) - bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - float Ax, int Bp, int Bj, float Bx, int Cp, - int Cj, float Cx) - bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - double Ax, int Bp, int Bj, double Bx, int Cp, - int Cj, double Cx) - bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - long double Ax, int Bp, int Bj, long double Bx, - int Cp, int Cj, long double Cx) - bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, - int Cp, int Cj, npy_cfloat_wrapper Cx) - bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, - int Cp, int Cj, npy_cdouble_wrapper Cx) - bsr_elmul_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - npy_clongdouble_wrapper Ax, int Bp, int Bj, - npy_clongdouble_wrapper Bx, int Cp, int Cj, npy_clongdouble_wrapper Cx) - """ - return _bsr.bsr_elmul_bsr(*args) + return _bsr.bsr_elmul_bsr(*args) def bsr_eldiv_bsr(*args): + """ + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + signed char Ax, int Bp, int Bj, signed char Bx, + int Cp, int Cj, signed char Cx) + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned char Ax, int Bp, int Bj, unsigned char Bx, + int Cp, int Cj, unsigned char Cx) + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + short Ax, int Bp, int Bj, short Bx, int Cp, + int Cj, short Cx) + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned short Ax, int Bp, int Bj, unsigned short Bx, + int Cp, int Cj, unsigned short Cx) + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + int Ax, int Bp, int Bj, int Bx, int Cp, int Cj, + int Cx) + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned int Ax, int Bp, int Bj, unsigned int Bx, + int Cp, int Cj, unsigned int Cx) + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + long long Ax, int Bp, int Bj, long long Bx, + int Cp, int Cj, long long Cx) + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned long long Ax, int Bp, int Bj, unsigned long long Bx, + int Cp, int Cj, unsigned long long Cx) + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + float Ax, int Bp, int Bj, float Bx, int Cp, + int Cj, float Cx) + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + double Ax, int Bp, int Bj, double Bx, int Cp, + int Cj, double Cx) + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + long double Ax, int Bp, int Bj, long double Bx, + int Cp, int Cj, long double Cx) + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, + int Cp, int Cj, npy_cfloat_wrapper Cx) + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, + int Cp, int Cj, npy_cdouble_wrapper Cx) + bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_clongdouble_wrapper Ax, int Bp, int Bj, + npy_clongdouble_wrapper Bx, int Cp, int Cj, npy_clongdouble_wrapper Cx) """ - bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - signed char Ax, int Bp, int Bj, signed char Bx, - int Cp, int Cj, signed char Cx) - bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - unsigned char Ax, int Bp, int Bj, unsigned char Bx, - int Cp, int Cj, unsigned char Cx) - bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - short Ax, int Bp, int Bj, short Bx, int Cp, - int Cj, short Cx) - bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - unsigned short Ax, int Bp, int Bj, unsigned short Bx, - int Cp, int Cj, unsigned short Cx) - bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - int Ax, int Bp, int Bj, int Bx, int Cp, int Cj, - int Cx) - bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - unsigned int Ax, int Bp, int Bj, unsigned int Bx, - int Cp, int Cj, unsigned int Cx) - bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - long long Ax, int Bp, int Bj, long long Bx, - int Cp, int Cj, long long Cx) - bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - unsigned long long Ax, int Bp, int Bj, unsigned long long Bx, - int Cp, int Cj, unsigned long long Cx) - bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - float Ax, int Bp, int Bj, float Bx, int Cp, - int Cj, float Cx) - bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - double Ax, int Bp, int Bj, double Bx, int Cp, - int Cj, double Cx) - bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - long double Ax, int Bp, int Bj, long double Bx, - int Cp, int Cj, long double Cx) - bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, - int Cp, int Cj, npy_cfloat_wrapper Cx) - bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, - int Cp, int Cj, npy_cdouble_wrapper Cx) - bsr_eldiv_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - npy_clongdouble_wrapper Ax, int Bp, int Bj, - npy_clongdouble_wrapper Bx, int Cp, int Cj, npy_clongdouble_wrapper Cx) - """ - return _bsr.bsr_eldiv_bsr(*args) + return _bsr.bsr_eldiv_bsr(*args) def bsr_plus_bsr(*args): + """ + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + signed char Ax, int Bp, int Bj, signed char Bx, + int Cp, int Cj, signed char Cx) + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned char Ax, int Bp, int Bj, unsigned char Bx, + int Cp, int Cj, unsigned char Cx) + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + short Ax, int Bp, int Bj, short Bx, int Cp, + int Cj, short Cx) + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned short Ax, int Bp, int Bj, unsigned short Bx, + int Cp, int Cj, unsigned short Cx) + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + int Ax, int Bp, int Bj, int Bx, int Cp, int Cj, + int Cx) + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned int Ax, int Bp, int Bj, unsigned int Bx, + int Cp, int Cj, unsigned int Cx) + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + long long Ax, int Bp, int Bj, long long Bx, + int Cp, int Cj, long long Cx) + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned long long Ax, int Bp, int Bj, unsigned long long Bx, + int Cp, int Cj, unsigned long long Cx) + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + float Ax, int Bp, int Bj, float Bx, int Cp, + int Cj, float Cx) + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + double Ax, int Bp, int Bj, double Bx, int Cp, + int Cj, double Cx) + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + long double Ax, int Bp, int Bj, long double Bx, + int Cp, int Cj, long double Cx) + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, + int Cp, int Cj, npy_cfloat_wrapper Cx) + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, + int Cp, int Cj, npy_cdouble_wrapper Cx) + bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_clongdouble_wrapper Ax, int Bp, int Bj, + npy_clongdouble_wrapper Bx, int Cp, int Cj, npy_clongdouble_wrapper Cx) """ - bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - signed char Ax, int Bp, int Bj, signed char Bx, - int Cp, int Cj, signed char Cx) - bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - unsigned char Ax, int Bp, int Bj, unsigned char Bx, - int Cp, int Cj, unsigned char Cx) - bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - short Ax, int Bp, int Bj, short Bx, int Cp, - int Cj, short Cx) - bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - unsigned short Ax, int Bp, int Bj, unsigned short Bx, - int Cp, int Cj, unsigned short Cx) - bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - int Ax, int Bp, int Bj, int Bx, int Cp, int Cj, - int Cx) - bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - unsigned int Ax, int Bp, int Bj, unsigned int Bx, - int Cp, int Cj, unsigned int Cx) - bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - long long Ax, int Bp, int Bj, long long Bx, - int Cp, int Cj, long long Cx) - bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - unsigned long long Ax, int Bp, int Bj, unsigned long long Bx, - int Cp, int Cj, unsigned long long Cx) - bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - float Ax, int Bp, int Bj, float Bx, int Cp, - int Cj, float Cx) - bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - double Ax, int Bp, int Bj, double Bx, int Cp, - int Cj, double Cx) - bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - long double Ax, int Bp, int Bj, long double Bx, - int Cp, int Cj, long double Cx) - bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, - int Cp, int Cj, npy_cfloat_wrapper Cx) - bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, - int Cp, int Cj, npy_cdouble_wrapper Cx) - bsr_plus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - npy_clongdouble_wrapper Ax, int Bp, int Bj, - npy_clongdouble_wrapper Bx, int Cp, int Cj, npy_clongdouble_wrapper Cx) - """ - return _bsr.bsr_plus_bsr(*args) + return _bsr.bsr_plus_bsr(*args) def bsr_minus_bsr(*args): + """ + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + signed char Ax, int Bp, int Bj, signed char Bx, + int Cp, int Cj, signed char Cx) + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned char Ax, int Bp, int Bj, unsigned char Bx, + int Cp, int Cj, unsigned char Cx) + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + short Ax, int Bp, int Bj, short Bx, int Cp, + int Cj, short Cx) + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned short Ax, int Bp, int Bj, unsigned short Bx, + int Cp, int Cj, unsigned short Cx) + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + int Ax, int Bp, int Bj, int Bx, int Cp, int Cj, + int Cx) + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned int Ax, int Bp, int Bj, unsigned int Bx, + int Cp, int Cj, unsigned int Cx) + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + long long Ax, int Bp, int Bj, long long Bx, + int Cp, int Cj, long long Cx) + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + unsigned long long Ax, int Bp, int Bj, unsigned long long Bx, + int Cp, int Cj, unsigned long long Cx) + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + float Ax, int Bp, int Bj, float Bx, int Cp, + int Cj, float Cx) + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + double Ax, int Bp, int Bj, double Bx, int Cp, + int Cj, double Cx) + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + long double Ax, int Bp, int Bj, long double Bx, + int Cp, int Cj, long double Cx) + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, + int Cp, int Cj, npy_cfloat_wrapper Cx) + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, + int Cp, int Cj, npy_cdouble_wrapper Cx) + bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, + npy_clongdouble_wrapper Ax, int Bp, int Bj, + npy_clongdouble_wrapper Bx, int Cp, int Cj, npy_clongdouble_wrapper Cx) """ - bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - signed char Ax, int Bp, int Bj, signed char Bx, - int Cp, int Cj, signed char Cx) - bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - unsigned char Ax, int Bp, int Bj, unsigned char Bx, - int Cp, int Cj, unsigned char Cx) - bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - short Ax, int Bp, int Bj, short Bx, int Cp, - int Cj, short Cx) - bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - unsigned short Ax, int Bp, int Bj, unsigned short Bx, - int Cp, int Cj, unsigned short Cx) - bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - int Ax, int Bp, int Bj, int Bx, int Cp, int Cj, - int Cx) - bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - unsigned int Ax, int Bp, int Bj, unsigned int Bx, - int Cp, int Cj, unsigned int Cx) - bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - long long Ax, int Bp, int Bj, long long Bx, - int Cp, int Cj, long long Cx) - bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - unsigned long long Ax, int Bp, int Bj, unsigned long long Bx, - int Cp, int Cj, unsigned long long Cx) - bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - float Ax, int Bp, int Bj, float Bx, int Cp, - int Cj, float Cx) - bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - double Ax, int Bp, int Bj, double Bx, int Cp, - int Cj, double Cx) - bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - long double Ax, int Bp, int Bj, long double Bx, - int Cp, int Cj, long double Cx) - bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - npy_cfloat_wrapper Ax, int Bp, int Bj, npy_cfloat_wrapper Bx, - int Cp, int Cj, npy_cfloat_wrapper Cx) - bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - npy_cdouble_wrapper Ax, int Bp, int Bj, npy_cdouble_wrapper Bx, - int Cp, int Cj, npy_cdouble_wrapper Cx) - bsr_minus_bsr(int n_row, int n_col, int R, int C, int Ap, int Aj, - npy_clongdouble_wrapper Ax, int Bp, int Bj, - npy_clongdouble_wrapper Bx, int Cp, int Cj, npy_clongdouble_wrapper Cx) - """ - return _bsr.bsr_minus_bsr(*args) + return _bsr.bsr_minus_bsr(*args) def bsr_sort_indices(*args): + """ + bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + signed char Ax) + bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned char Ax) + bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + short Ax) + bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned short Ax) + bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + int Ax) + bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned int Ax) + bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + long long Ax) + bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + unsigned long long Ax) + bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + float Ax) + bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + double Ax) + bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + long double Ax) + bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + npy_cfloat_wrapper Ax) + bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + npy_cdouble_wrapper Ax) + bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, + npy_clongdouble_wrapper Ax) """ - bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - signed char Ax) - bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned char Ax) - bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - short Ax) - bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned short Ax) - bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - int Ax) - bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned int Ax) - bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - long long Ax) - bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - unsigned long long Ax) - bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - float Ax) - bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - double Ax) - bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - long double Ax) - bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - npy_cfloat_wrapper Ax) - bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - npy_cdouble_wrapper Ax) - bsr_sort_indices(int n_brow, int n_bcol, int R, int C, int Ap, int Aj, - npy_clongdouble_wrapper Ax) - """ - return _bsr.bsr_sort_indices(*args) + return _bsr.bsr_sort_indices(*args) + Modified: trunk/scipy/sparse/sparsetools/bsr_wrap.cxx =================================================================== --- trunk/scipy/sparse/sparsetools/bsr_wrap.cxx 2009-01-31 04:41:39 UTC (rev 5529) +++ trunk/scipy/sparse/sparsetools/bsr_wrap.cxx 2009-02-01 03:57:01 UTC (rev 5530) @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.34 + * Version 1.3.36 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make @@ -73,6 +73,12 @@ # endif #endif +#ifndef SWIG_MSC_UNSUPPRESS_4505 +# if defined(_MSC_VER) +# pragma warning(disable : 4505) /* unreferenced local function has been removed */ +# endif +#endif + #ifndef SWIGUNUSEDPARM # ifdef __cplusplus # define SWIGUNUSEDPARM(p) @@ -2516,7 +2522,7 @@ #define SWIG_name "_bsr" -#define SWIGVERSION 0x010334 +#define SWIGVERSION 0x010336 #define SWIG_VERSION SWIGVERSION @@ -2544,7 +2550,9 @@ PyObject_ptr(PyObject *obj, bool initial_ref = true) :_obj(obj) { - if (initial_ref) Py_XINCREF(_obj); + if (initial_ref) { + Py_XINCREF(_obj); + } } PyObject_ptr & operator=(const PyObject_ptr& item) Modified: trunk/scipy/sparse/sparsetools/coo.py =================================================================== --- trunk/scipy/sparse/sparsetools/coo.py 2009-01-31 04:41:39 UTC (rev 5529) +++ trunk/scipy/sparse/sparsetools/coo.py 2009-02-01 03:57:01 UTC (rev 5530) @@ -50,134 +50,135 @@ def coo_count_diagonals(*args): - """coo_count_diagonals(int nnz, int Ai, int Aj) -> int""" - return _coo.coo_count_diagonals(*args) + """coo_count_diagonals(int nnz, int Ai, int Aj) -> int""" + return _coo.coo_count_diagonals(*args) def coo_tocsr(*args): + """ + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, signed char Ax, + int Bp, int Bj, signed char Bx) + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned char Ax, + int Bp, int Bj, unsigned char Bx) + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, short Ax, + int Bp, int Bj, short Bx) + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned short Ax, + int Bp, int Bj, unsigned short Bx) + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, int Ax, + int Bp, int Bj, int Bx) + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned int Ax, + int Bp, int Bj, unsigned int Bx) + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, long long Ax, + int Bp, int Bj, long long Bx) + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned long long Ax, + int Bp, int Bj, unsigned long long Bx) + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, float Ax, + int Bp, int Bj, float Bx) + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, double Ax, + int Bp, int Bj, double Bx) + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, long double Ax, + int Bp, int Bj, long double Bx) + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cfloat_wrapper Ax, + int Bp, int Bj, npy_cfloat_wrapper Bx) + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cdouble_wrapper Ax, + int Bp, int Bj, npy_cdouble_wrapper Bx) + coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, npy_clongdouble_wrapper Ax, + int Bp, int Bj, npy_clongdouble_wrapper Bx) """ - coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, signed char Ax, - int Bp, int Bj, signed char Bx) - coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned char Ax, - int Bp, int Bj, unsigned char Bx) - coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, short Ax, - int Bp, int Bj, short Bx) - coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned short Ax, - int Bp, int Bj, unsigned short Bx) - coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, int Ax, - int Bp, int Bj, int Bx) - coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned int Ax, - int Bp, int Bj, unsigned int Bx) - coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, long long Ax, - int Bp, int Bj, long long Bx) - coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned long long Ax, - int Bp, int Bj, unsigned long long Bx) - coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, float Ax, - int Bp, int Bj, float Bx) - coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, double Ax, - int Bp, int Bj, double Bx) - coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, long double Ax, - int Bp, int Bj, long double Bx) - coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cfloat_wrapper Ax, - int Bp, int Bj, npy_cfloat_wrapper Bx) - coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cdouble_wrapper Ax, - int Bp, int Bj, npy_cdouble_wrapper Bx) - coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, npy_clongdouble_wrapper Ax, - int Bp, int Bj, npy_clongdouble_wrapper Bx) - """ - return _coo.coo_tocsr(*args) + return _coo.coo_tocsr(*args) def coo_tocsc(*args): + """ + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, signed char Ax, + int Bp, int Bi, signed char Bx) + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned char Ax, + int Bp, int Bi, unsigned char Bx) + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, short Ax, + int Bp, int Bi, short Bx) + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned short Ax, + int Bp, int Bi, unsigned short Bx) + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, int Ax, + int Bp, int Bi, int Bx) + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned int Ax, + int Bp, int Bi, unsigned int Bx) + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, long long Ax, + int Bp, int Bi, long long Bx) + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned long long Ax, + int Bp, int Bi, unsigned long long Bx) + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, float Ax, + int Bp, int Bi, float Bx) + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, double Ax, + int Bp, int Bi, double Bx) + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, long double Ax, + int Bp, int Bi, long double Bx) + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cfloat_wrapper Ax, + int Bp, int Bi, npy_cfloat_wrapper Bx) + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cdouble_wrapper Ax, + int Bp, int Bi, npy_cdouble_wrapper Bx) + coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, npy_clongdouble_wrapper Ax, + int Bp, int Bi, npy_clongdouble_wrapper Bx) """ - coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, signed char Ax, - int Bp, int Bi, signed char Bx) - coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned char Ax, - int Bp, int Bi, unsigned char Bx) - coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, short Ax, - int Bp, int Bi, short Bx) - coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned short Ax, - int Bp, int Bi, unsigned short Bx) - coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, int Ax, - int Bp, int Bi, int Bx) - coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned int Ax, - int Bp, int Bi, unsigned int Bx) - coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, long long Ax, - int Bp, int Bi, long long Bx) - coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned long long Ax, - int Bp, int Bi, unsigned long long Bx) - coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, float Ax, - int Bp, int Bi, float Bx) - coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, double Ax, - int Bp, int Bi, double Bx) - coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, long double Ax, - int Bp, int Bi, long double Bx) - coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cfloat_wrapper Ax, - int Bp, int Bi, npy_cfloat_wrapper Bx) - coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cdouble_wrapper Ax, - int Bp, int Bi, npy_cdouble_wrapper Bx) - coo_tocsc(int n_row, int n_col, int nnz, int Ai, int Aj, npy_clongdouble_wrapper Ax, - int Bp, int Bi, npy_clongdouble_wrapper Bx) - """ - return _coo.coo_tocsc(*args) + return _coo.coo_tocsc(*args) def coo_todense(*args): + """ + coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, signed char Ax, + signed char Bx) + coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned char Ax, + unsigned char Bx) + coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, short Ax, + short Bx) + coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned short Ax, + unsigned short Bx) + coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, int Ax, + int Bx) + coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned int Ax, + unsigned int Bx) + coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, long long Ax, + long long Bx) + coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned long long Ax, + unsigned long long Bx) + coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, float Ax, + float Bx) + coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, double Ax, + double Bx) + coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, long double Ax, + long double Bx) + coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cfloat_wrapper Ax, + npy_cfloat_wrapper Bx) + coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cdouble_wrapper Ax, + npy_cdouble_wrapper Bx) + coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, npy_clongdouble_wrapper Ax, + npy_clongdouble_wrapper Bx) """ - coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, signed char Ax, - signed char Bx) - coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned char Ax, - unsigned char Bx) - coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, short Ax, - short Bx) - coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned short Ax, - unsigned short Bx) - coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, int Ax, - int Bx) - coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned int Ax, - unsigned int Bx) - coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, long long Ax, - long long Bx) - coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, unsigned long long Ax, - unsigned long long Bx) - coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, float Ax, - float Bx) - coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, double Ax, - double Bx) - coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, long double Ax, - long double Bx) - coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cfloat_wrapper Ax, - npy_cfloat_wrapper Bx) - coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, npy_cdouble_wrapper Ax, - npy_cdouble_wrapper Bx) - coo_todense(int n_row, int n_col, int nnz, int Ai, int Aj, npy_clongdouble_wrapper Ax, - npy_clongdouble_wrapper Bx) - """ - return _coo.coo_todense(*args) + return _coo.coo_todense(*args) def coo_matvec(*args): + """ + coo_matvec(int nnz, int Ai, int Aj, signed char Ax, signed char Xx, + signed char Yx) + coo_matvec(int nnz, int Ai, int Aj, unsigned char Ax, unsigned char Xx, + unsigned char Yx) + coo_matvec(int nnz, int Ai, int Aj, short Ax, short Xx, short Yx) + coo_matvec(int nnz, int Ai, int Aj, unsigned short Ax, unsigned short Xx, + unsigned short Yx) + coo_matvec(int nnz, int Ai, int Aj, int Ax, int Xx, int Yx) + coo_matvec(int nnz, int Ai, int Aj, unsigned int Ax, unsigned int Xx, + unsigned int Yx) + coo_matvec(int nnz, int Ai, int Aj, long long Ax, long long Xx, + long long Yx) + coo_matvec(int nnz, int Ai, int Aj, unsigned long long Ax, unsigned long long Xx, + unsigned long long Yx) + coo_matvec(int nnz, int Ai, int Aj, float Ax, float Xx, float Yx) + coo_matvec(int nnz, int Ai, int Aj, double Ax, double Xx, double Yx) + coo_matvec(int nnz, int Ai, int Aj, long double Ax, long double Xx, + long double Yx) + coo_matvec(int nnz, int Ai, int Aj, npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx, + npy_cfloat_wrapper Yx) + coo_matvec(int nnz, int Ai, int Aj, npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx, + npy_cdouble_wrapper Yx) + coo_matvec(int nnz, int Ai, int Aj, npy_clongdouble_wrapper Ax, + npy_clongdouble_wrapper Xx, npy_clongdouble_wrapper Yx) """ - coo_matvec(int nnz, int Ai, int Aj, signed char Ax, signed char Xx, - signed char Yx) - coo_matvec(int nnz, int Ai, int Aj, unsigned char Ax, unsigned char Xx, - unsigned char Yx) - coo_matvec(int nnz, int Ai, int Aj, short Ax, short Xx, short Yx) - coo_matvec(int nnz, int Ai, int Aj, unsigned short Ax, unsigned short Xx, - unsigned short Yx) - coo_matvec(int nnz, int Ai, int Aj, int Ax, int Xx, int Yx) - coo_matvec(int nnz, int Ai, int Aj, unsigned int Ax, unsigned int Xx, - unsigned int Yx) - coo_matvec(int nnz, int Ai, int Aj, long long Ax, long long Xx, - long long Yx) - coo_matvec(int nnz, int Ai, int Aj, unsigned long long Ax, unsigned long long Xx, - unsigned long long Yx) - coo_matvec(int nnz, int Ai, int Aj, float Ax, float Xx, float Yx) - coo_matvec(int nnz, int Ai, int Aj, double Ax, double Xx, double Yx) - coo_matvec(int nnz, int Ai, int Aj, long double Ax, long double Xx, - long double Yx) - coo_matvec(int nnz, int Ai, int Aj, npy_cfloat_wrapper Ax, npy_cfloat_wrapper Xx, - npy_cfloat_wrapper Yx) - coo_matvec(int nnz, int Ai, int Aj, npy_cdouble_wrapper Ax, npy_cdouble_wrapper Xx, - npy_cdouble_wrapper Yx) - coo_matvec(int nnz, int Ai, int Aj, npy_clongdouble_wrapper Ax, - npy_clongdouble_wrapper Xx, npy_clongdouble_wrapper Yx) - """ - return _coo.coo_matvec(*args) + return _coo.coo_matvec(*args) + Modified: trunk/scipy/sparse/sparsetools/csr.h =================================================================== --- trunk/scipy/sparse/sparsetools/csr.h 2009-01-31 04:41:39 UTC (rev 5529) +++ trunk/scipy/sparse/sparsetools/csr.h 2009-02-01 03:57:01 UTC (rev 5530) @@ -83,6 +83,7 @@ } } + /* * Scale the rows of a CSR matrix *in place* * @@ -104,6 +105,7 @@ } } + /* * Scale the columns of a CSR matrix *in place* * @@ -189,7 +191,6 @@ * * */ - template void csr_tobsr(const I n_row, const I n_col, @@ -243,15 +244,13 @@ } - /* - * Sort CSR column indices inplace + * Determine whether the CSR column indices are in sorted order. * * Input Arguments: * I n_row - number of rows in A * I Ap[n_row+1] - row pointer * I Aj[nnz(A)] - column indices - * T Ax[nnz(A)] - nonzeros * */ template @@ -268,11 +267,54 @@ } return true; } + + + +/* + * Determine whether the matrix structure is canonical CSR. + * Canonical CSR implies that column indices within each row + * are (1) sorted and (2) unique. Matrices that meet these + * conditions facilitate faster matrix computations. + * + * Input Arguments: + * I n_row - number of rows in A + * I Ap[n_row+1] - row pointer + * I Aj[nnz(A)] - column indices + * + */ +template +bool csr_has_canonical_format(const I n_row, + const I Ap[], + const I Aj[]) +{ + for(I i = 0; i < n_row; i++){ + if (Ap[i] > Ap[i+1]) + return false; + for(I jj = Ap[i] + 1; jj < Ap[i+1]; jj++){ + if( !(Aj[jj-1] < Aj[jj]) ){ + return false; + } + } + } + return true; +} + + template< class T1, class T2 > bool kv_pair_less(const std::pair& x, const std::pair& y){ return x.first < y.first; } +/* + * Sort CSR column indices inplace + * + * Input Arguments: + * I n_row - number of rows in A + * I Ap[n_row+1] - row pointer + * I Aj[nnz(A)] - column indices + * T Ax[nnz(A)] - nonzeros + * + */ template void csr_sort_indices(const I n_row, const I Ap[], @@ -486,52 +528,8 @@ const I Bj[], I Cp[]) { -// // method that uses O(1) temp storage -// const I hash_size = 1 << 5; -// I vals[hash_size]; -// I mask[hash_size]; -// -// std::set spill; -// -// for(I i = 0; i < hash_size; i++){ -// vals[i] = -1; -// mask[i] = -1; -// } -// -// Cp[0] = 0; -// -// I slow_inserts = 0; -// I total_inserts = 0; -// I nnz = 0; -// for(I i = 0; i < n_row; i++){ -// spill.clear(); -// for(I jj = Ap[i]; jj < Ap[i+1]; jj++){ -// I j = Aj[jj]; -// for(I kk = Bp[j]; kk < Bp[j+1]; kk++){ -// I k = Bj[kk]; -// // I hash = k & (hash_size - 1); -// I hash = ((I)2654435761 * k) & (hash_size -1 ); -// total_inserts++; -// if(mask[hash] != i){ -// mask[hash] = i; -// vals[hash] = k; -// nnz++; -// } else { -// if (vals[hash] != k){ -// slow_inserts++; -// spill.insert(k); -// } -// } -// } -// } -// nnz += spill.size(); -// Cp[i+1] = nnz; -// } -// -// std::cout << "slow fraction " << ((float) slow_inserts)/ ((float) total_inserts) << std::endl; - // method that uses O(n) temp storage - std::vector mask(n_col,-1); + std::vector mask(n_col, -1); Cp[0] = 0; I nnz = 0; @@ -594,7 +592,7 @@ if(next[k] == -1){ next[k] = head; - head = k; + head = k; length++; } } @@ -621,8 +619,10 @@ /* - * Compute C = A (binary_op) B for CSR matrices A,B where the column - * indices with the rows of A and B are not known to be sorted. + * Compute C = A (binary_op) B for CSR matrices that are not + * necessarily canonical CSR format. Specifically, this method + * works even when the input matrices have duplicate and/or + * unsorted column indices within a given row. * * Refer to csr_binop_csr() for additional information * @@ -634,34 +634,26 @@ * Note: * Input: A and B column indices are not assumed to be in sorted order * Output: C column indices are not generally in sorted order - * Cx will not contain any zero entries + * C will not contain any duplicate entries or explicit zeros. * */ template -void csr_binop_csr_unsorted(const I n_row, - const I n_col, - const I Ap[], - const I Aj[], - const T Ax[], - const I Bp[], - const I Bj[], - const T Bx[], - I Cp[], - I Cj[], - T Cx[], - const binary_op& op) +void csr_binop_csr_general(const I n_row, const I n_col, + const I Ap[], const I Aj[], const T Ax[], + const I Bp[], const I Bj[], const T Bx[], + I Cp[], I Cj[], T Cx[], + const binary_op& op) { - //Method that works for unsorted indices + //Method that works for duplicate and/or unsorted indices std::vector next(n_col,-1); std::vector A_row(n_col, 0); std::vector B_row(n_col, 0); I nnz = 0; + Cp[0] = 0; for(I i = 0; i < n_row; i++){ - Cp[i] = nnz; - I head = -2; I length = 0; @@ -714,15 +706,18 @@ A_row[temp] = 0; B_row[temp] = 0; } - } - Cp[n_row] = nnz; + Cp[i + 1] = nnz; + } } + /* - * Compute C = A (binary_op) B for CSR matrices A,B where the column - * indices with the rows of A and B are known to be sorted. + * Compute C = A (binary_op) B for CSR matrices that are in the + * canonical CSR format. Specifically, this method requires that + * the rows of the input matrices are free of duplicate column indices + * and that the column indices are in sorted order. * * Refer to csr_binop_csr() for additional information * @@ -733,20 +728,13 @@ * */ template -void csr_binop_csr_sorted(const I n_row, - const I n_col, - const I Ap[], - const I Aj[], - const T Ax[], - const I Bp[], - const I Bj[], - const T Bx[], - I Cp[], - I Cj[], - T Cx[], - const binary_op& op) +void csr_binop_csr_canonical(const I n_row, const I n_col, + const I Ap[], const I Aj[], const T Ax[], + const I Bp[], const I Bj[], const T Bx[], + I Cp[], I Cj[], T Cx[], + const binary_op& op) { - //Method that works for sorted indices + //Method that works for canonical CSR matrices Cp[0] = 0; I nnz = 0; @@ -810,6 +798,7 @@ } B_pos++; } + Cp[i+1] = nnz; } } @@ -860,10 +849,10 @@ T Cx[], const binary_op& op) { - if (csr_has_sorted_indices(n_row,Ap,Aj) && csr_has_sorted_indices(n_row,Bp,Bj)) - csr_binop_csr_sorted(n_row, n_col, Ap, Aj, Ax, Bp, Bj, Bx, Cp, Cj, Cx, op); + if (csr_has_canonical_format(n_row,Ap,Aj) && csr_has_canonical_format(n_row,Bp,Bj)) + csr_binop_csr_canonical(n_row, n_col, Ap, Aj, Ax, Bp, Bj, Bx, Cp, Cj, Cx, op); else - csr_binop_csr_unsorted(n_row, n_col, Ap, Aj, Ax, Bp, Bj, Bx, Cp, Cj, Cx, op); + csr_binop_csr_general(n_row, n_col, Ap, Aj, Ax, Bp, Bj, Bx, Cp, Cj, Cx, op); } Modified: trunk/scipy/sparse/sparsetools/dia.py =================================================================== --- trunk/scipy/sparse/sparsetools/dia.py 2009-01-31 04:41:39 UTC (rev 5529) +++ trunk/scipy/sparse/sparsetools/dia.py 2009-02-01 03:57:01 UTC (rev 5530) @@ -51,39 +51,40 @@ def dia_matvec(*args): + """ + dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, + signed char diags, signed char Xx, signed char Yx) + dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, + unsigned char diags, unsigned char Xx, unsigned char Yx) + dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, + short diags, short Xx, short Yx) + dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, + unsigned short diags, unsigned short Xx, + unsigned short Yx) + dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, + int diags, int Xx, int Yx) + dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, + unsigned int diags, unsigned int Xx, unsigned int Yx) + dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, + long long diags, long long Xx, long long Yx) + dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, + unsigned long long diags, unsigned long long Xx, + unsigned long long Yx) + dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, + float diags, float Xx, float Yx) + dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, + double diags, double Xx, double Yx) + dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, + long double diags, long double Xx, long double Yx) + dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, + npy_cfloat_wrapper diags, npy_cfloat_wrapper Xx, + npy_cfloat_wrapper Yx) + dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, + npy_cdouble_wrapper diags, npy_cdouble_wrapper Xx, + npy_cdouble_wrapper Yx) + dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, + npy_clongdouble_wrapper diags, npy_clongdouble_wrapper Xx, + npy_clongdouble_wrapper Yx) """ - dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, - signed char diags, signed char Xx, signed char Yx) - dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, - unsigned char diags, unsigned char Xx, unsigned char Yx) - dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, - short diags, short Xx, short Yx) - dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, - unsigned short diags, unsigned short Xx, - unsigned short Yx) - dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, - int diags, int Xx, int Yx) - dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, - unsigned int diags, unsigned int Xx, unsigned int Yx) - dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, - long long diags, long long Xx, long long Yx) - dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, - unsigned long long diags, unsigned long long Xx, - unsigned long long Yx) - dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, - float diags, float Xx, float Yx) - dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, - double diags, double Xx, double Yx) - dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, - long double diags, long double Xx, long double Yx) - dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, - npy_cfloat_wrapper diags, npy_cfloat_wrapper Xx, - npy_cfloat_wrapper Yx) - dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, - npy_cdouble_wrapper diags, npy_cdouble_wrapper Xx, - npy_cdouble_wrapper Yx) - dia_matvec(int n_row, int n_col, int n_diags, int L, int offsets, - npy_clongdouble_wrapper diags, npy_clongdouble_wrapper Xx, - npy_clongdouble_wrapper Yx) - """ - return _dia.dia_matvec(*args) + return _dia.dia_matvec(*args) + Modified: trunk/scipy/sparse/sparsetools/scratch.h =================================================================== --- trunk/scipy/sparse/sparsetools/scratch.h 2009-01-31 04:41:39 UTC (rev 5529) +++ trunk/scipy/sparse/sparsetools/scratch.h 2009-02-01 03:57:01 UTC (rev 5530) @@ -329,3 +329,63 @@ } } + +/* + * Pass 1 computes CSR row pointer for the matrix product C = A * B + * + */ +template +void csr_matmat_pass1(const I n_row, + const I n_col, + const I Ap[], + const I Aj[], + const I Bp[], + const I Bj[], + I Cp[]) +{ + // method that uses O(1) temp storage + const I hash_size = 1 << 5; + I vals[hash_size]; + I mask[hash_size]; + + std::set spill; + + for(I i = 0; i < hash_size; i++){ + vals[i] = -1; + mask[i] = -1; + } + + Cp[0] = 0; + + I slow_inserts = 0; + I total_inserts = 0; + I nnz = 0; + for(I i = 0; i < n_row; i++){ + spill.clear(); + for(I jj = Ap[i]; jj < Ap[i+1]; jj++){ + I j = Aj[jj]; + for(I kk = Bp[j]; kk < Bp[j+1]; kk++){ + I k = Bj[kk]; + // I hash = k & (hash_size - 1); + I hash = ((I)2654435761 * k) & (hash_size -1 ); + total_inserts++; + if(mask[hash] != i){ + mask[hash] = i; + vals[hash] = k; + nnz++; + } else { + if (vals[hash] != k){ + slow_inserts++; + spill.insert(k); + } + } + } + } + nnz += spill.size(); + Cp[i+1] = nnz; + } + + std::cout << "slow fraction " << ((float) slow_inserts)/ ((float) total_inserts) << std::endl; +} + + Modified: trunk/scipy/sparse/sparsetools/setup.py =================================================================== --- trunk/scipy/sparse/sparsetools/setup.py 2009-01-31 04:41:39 UTC (rev 5529) +++ trunk/scipy/sparse/sparsetools/setup.py 2009-02-01 03:57:01 UTC (rev 5530) @@ -8,7 +8,8 @@ for fmt in ['csr','csc','coo','bsr','dia']: sources = [ fmt + '_wrap.cxx' ] - config.add_extension('_' + fmt, sources=sources) + depends = [ fmt + '.h' ] + config.add_extension('_' + fmt, sources=sources, depends=depends) return config