[Scipy-svn] r3863 - in trunk/scipy/splinalg: . dsolve/tests isolve
scipy-svn at scipy.org
scipy-svn at scipy.org
Fri Jan 25 17:28:09 EST 2008
Author: wnbell
Date: 2008-01-25 16:28:00 -0600 (Fri, 25 Jan 2008)
New Revision: 3863
Added:
trunk/scipy/splinalg/__init__.py
trunk/scipy/splinalg/dsolve/tests/test_linsolve.py
trunk/scipy/splinalg/info.py
trunk/scipy/splinalg/isolve/__init__.py
trunk/scipy/splinalg/isolve/setup.py
trunk/scipy/splinalg/setup.py
Log:
commit missing files
Added: trunk/scipy/splinalg/__init__.py
===================================================================
--- trunk/scipy/splinalg/__init__.py 2008-01-25 22:23:52 UTC (rev 3862)
+++ trunk/scipy/splinalg/__init__.py 2008-01-25 22:28:00 UTC (rev 3863)
@@ -0,0 +1,11 @@
+"Sparse Linear Algebra routines"
+
+from info import __doc__
+
+from isolve import *
+from dsolve import *
+
+__all__ = filter(lambda s:not s.startswith('_'),dir())
+from scipy.testing.pkgtester import Tester
+test = Tester().test
+bench = Tester().bench
Added: trunk/scipy/splinalg/dsolve/tests/test_linsolve.py
===================================================================
--- trunk/scipy/splinalg/dsolve/tests/test_linsolve.py 2008-01-25 22:23:52 UTC (rev 3862)
+++ trunk/scipy/splinalg/dsolve/tests/test_linsolve.py 2008-01-25 22:28:00 UTC (rev 3863)
@@ -0,0 +1,41 @@
+
+from numpy import array, finfo
+from scipy.testing import *
+
+from scipy.linalg import norm, inv
+from scipy.sparse import spdiags, csc_matrix
+from scipy.splinalg.dsolve import spsolve, use_solver
+
+#TODO add more comprehensive tests
+use_solver( useUmfpack = False )
+
+class TestLinsolve(TestCase):
+ ## this crashes SuperLU
+ #def test_singular(self):
+ # A = csc_matrix( (5,5), dtype='d' )
+ # b = array([1, 2, 3, 4, 5],dtype='d')
+ # x = spsolve(A,b)
+
+ def test_twodiags(self):
+ A = spdiags([[1, 2, 3, 4, 5], [6, 5, 8, 9, 10]], [0, 1], 5, 5)
+ b = array([1, 2, 3, 4, 5])
+
+ # condition number of A
+ cond_A = norm(A.todense(),2) * norm(inv(A.todense()),2)
+
+
+ for t in ['f','d','F','D']:
+ eps = finfo(t).eps #floating point epsilon
+ b = b.astype(t)
+
+ for format in ['csc','csr']:
+ Asp = A.astype(t).asformat(format)
+
+ x = spsolve(Asp,b)
+
+ assert( norm(b - Asp*x) < 10 * cond_A * eps )
+
+
+if __name__ == "__main__":
+ nose.run(argv=['', __file__])
+
Added: trunk/scipy/splinalg/info.py
===================================================================
--- trunk/scipy/splinalg/info.py 2008-01-25 22:23:52 UTC (rev 3862)
+++ trunk/scipy/splinalg/info.py 2008-01-25 22:28:00 UTC (rev 3863)
@@ -0,0 +1,19 @@
+"""
+Sparse Linear Algebra
+=====================
+
+There are submodules of splinalg:
+ 1. eigen: sparse eigenvalue problem solvers
+ 2. isolve: iterative methods for solving linear systems
+ 3. dsolve: direct factorization methods for solving linear systems
+
+Examples
+========
+
+
+
+"""
+
+#TODO show examples
+
+postpone_import = 1
Added: trunk/scipy/splinalg/isolve/__init__.py
===================================================================
--- trunk/scipy/splinalg/isolve/__init__.py 2008-01-25 22:23:52 UTC (rev 3862)
+++ trunk/scipy/splinalg/isolve/__init__.py 2008-01-25 22:28:00 UTC (rev 3863)
@@ -0,0 +1,10 @@
+"Iterative Solvers for Sparse Linear Systems"
+
+#from info import __doc__
+from iterative import *
+
+__all__ = filter(lambda s:not s.startswith('_'),dir())
+from scipy.testing.pkgtester import Tester
+test = Tester().test
+bench = Tester().bench
+
Added: trunk/scipy/splinalg/isolve/setup.py
===================================================================
--- trunk/scipy/splinalg/isolve/setup.py 2008-01-25 22:23:52 UTC (rev 3862)
+++ trunk/scipy/splinalg/isolve/setup.py 2008-01-25 22:28:00 UTC (rev 3863)
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+## Automatically adapted for scipy Oct 18, 2005 by
+
+import os
+import sys
+import re
+from distutils.dep_util import newer_group, newer
+from glob import glob
+from os.path import join
+
+def configuration(parent_package='',top_path=None):
+ from numpy.distutils.system_info import get_info, NotFoundError
+
+ from numpy.distutils.misc_util import Configuration
+
+ config = Configuration('isolve',parent_package,top_path)
+
+ lapack_opt = get_info('lapack_opt')
+
+ if not lapack_opt:
+ raise NotFoundError,'no lapack/blas resources found'
+
+ # iterative methods
+ methods = ['BiCGREVCOM.f.src',
+ 'BiCGSTABREVCOM.f.src',
+ 'CGREVCOM.f.src',
+ 'CGSREVCOM.f.src',
+# 'ChebyREVCOM.f.src',
+ 'GMRESREVCOM.f.src',
+# 'JacobiREVCOM.f.src',
+ 'QMRREVCOM.f.src',
+# 'SORREVCOM.f.src'
+ ]
+ Util = ['STOPTEST2.f.src','getbreak.f.src']
+ sources = Util + methods + ['_iterative.pyf.src']
+ config.add_extension('_iterative',
+ sources = [join('iterative',x) for x in sources],
+ extra_info = lapack_opt
+ )
+
+ config.add_data_dir('tests')
+
+ return config
+
+if __name__ == '__main__':
+ from numpy.distutils.core import setup
+
+ setup(**configuration(top_path='').todict())
Property changes on: trunk/scipy/splinalg/isolve/setup.py
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/scipy/splinalg/setup.py
===================================================================
--- trunk/scipy/splinalg/setup.py 2008-01-25 22:23:52 UTC (rev 3862)
+++ trunk/scipy/splinalg/setup.py 2008-01-25 22:28:00 UTC (rev 3863)
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+
+def configuration(parent_package='',top_path=None):
+ from numpy.distutils.misc_util import Configuration
+
+ config = Configuration('splinalg',parent_package,top_path)
+
+ config.add_subpackage(('isolve'))
+ config.add_subpackage(('dsolve'))
+
+ return config
+
+if __name__ == '__main__':
+ from numpy.distutils.core import setup
+ setup(**configuration(top_path='').todict())
Property changes on: trunk/scipy/splinalg/setup.py
___________________________________________________________________
Name: svn:executable
+ *
More information about the Scipy-svn
mailing list