[Scipy-svn] r4828 - in branches/refactor_fft: . scipy scipy/cluster scipy/cluster/src scipy/cluster/tests scipy/fftpack/benchmarks scipy/fftpack/tests scipy/integrate scipy/integrate/tests scipy/interpolate scipy/interpolate/tests scipy/io scipy/io/arff scipy/io/arff/tests scipy/io/matlab scipy/io/matlab/tests scipy/io/matlab/tests/data scipy/io/tests scipy/lib/blas/tests scipy/lib/lapack/tests scipy/linalg scipy/linalg/benchmarks scipy/linalg/tests scipy/maxentropy scipy/maxentropy/examples scipy/maxentropy/tests scipy/misc scipy/misc/tests scipy/ndimage scipy/odr/tests scipy/optimize scipy/optimize/nnls scipy/optimize/tests scipy/signal scipy/sparse scipy/sparse/benchmarks scipy/sparse/linalg/dsolve/SuperLU/SRC scipy/sparse/linalg/dsolve/tests scipy/sparse/linalg/dsolve/umfpack scipy/sparse/linalg/dsolve/umfpack/tests scipy/sparse/linalg/eigen/arpack scipy/sparse/linalg/eigen/arpack/tests scipy/sparse/linalg/eigen/lobpcg scipy/sparse/linalg/eigen/lobpcg/tests scipy/sparse/linalg/isolve scipy/sparse/linalg/isolve/tests scipy/sparse/linalg/tests scipy/sparse/sparsetools scipy/sparse/tests scipy/special scipy/special/cephes scipy/special/tests scipy/stats scipy/stats/tests scipy/stsci/convolve/lib scipy/stsci/image/lib scipy/weave scipy/weave/examples scipy/weave/tests tools tools/win32 tools/win32/build_scripts tools/win32/build_scripts/nsis_scripts

scipy-svn at scipy.org scipy-svn at scipy.org
Thu Oct 23 08:33:46 EDT 2008


Author: cdavid
Date: 2008-10-23 07:30:20 -0500 (Thu, 23 Oct 2008)
New Revision: 4828

Added:
   branches/refactor_fft/scipy/cluster/tests/cdist-X1.txt
   branches/refactor_fft/scipy/cluster/tests/cdist-X2.txt
   branches/refactor_fft/scipy/io/matlab/byteordercodes.py
   branches/refactor_fft/scipy/io/matlab/tests/data/testhdf5_7.4_GLNX86.mat
   branches/refactor_fft/scipy/io/matlab/tests/gen_unittests.m
   branches/refactor_fft/scipy/io/matlab/tests/gen_unittests4.m
   branches/refactor_fft/scipy/io/matlab/tests/save_test.m
   branches/refactor_fft/scipy/io/matlab/tests/test_byteordercodes.py
   branches/refactor_fft/scipy/optimize/nnls.py
   branches/refactor_fft/scipy/optimize/nnls/
   branches/refactor_fft/scipy/optimize/nnls/nnls.f
   branches/refactor_fft/scipy/optimize/nnls/nnls.pyf
   branches/refactor_fft/scipy/optimize/tests/test_nnls.py
   branches/refactor_fft/scipy/stats/vonmises.py
   branches/refactor_fft/scipy/stats/vonmises_cython.c
   branches/refactor_fft/scipy/stats/vonmises_cython.pyx
   branches/refactor_fft/tools/
   branches/refactor_fft/tools/win32/
   branches/refactor_fft/tools/win32/build_scripts/
   branches/refactor_fft/tools/win32/build_scripts/nsis_scripts/
   branches/refactor_fft/tools/win32/build_scripts/nsis_scripts/scipy-superinstaller.nsi.in
   branches/refactor_fft/tools/win32/build_scripts/pavement.py
Removed:
   branches/refactor_fft/scipy/io/tests/gen_unittests.m
   branches/refactor_fft/scipy/io/tests/gen_unittests4.m
   branches/refactor_fft/scipy/io/tests/save_test.m
   branches/refactor_fft/scipy/optimize/nnls/nnls.f
   branches/refactor_fft/scipy/optimize/nnls/nnls.pyf
   branches/refactor_fft/scipy/weave/tests/test_scxx.py
   branches/refactor_fft/tools/win32/
   branches/refactor_fft/tools/win32/build_scripts/
   branches/refactor_fft/tools/win32/build_scripts/nsis_scripts/
   branches/refactor_fft/tools/win32/build_scripts/nsis_scripts/scipy-superinstaller.nsi.in
   branches/refactor_fft/tools/win32/build_scripts/pavement.py
Modified:
   branches/refactor_fft/
   branches/refactor_fft/THANKS.txt
   branches/refactor_fft/scipy/__init__.py
   branches/refactor_fft/scipy/cluster/distance.py
   branches/refactor_fft/scipy/cluster/hierarchy.py
   branches/refactor_fft/scipy/cluster/src/distance.c
   branches/refactor_fft/scipy/cluster/src/distance.h
   branches/refactor_fft/scipy/cluster/src/distance_wrap.c
   branches/refactor_fft/scipy/cluster/tests/test_distance.py
   branches/refactor_fft/scipy/cluster/tests/test_hierarchy.py
   branches/refactor_fft/scipy/cluster/tests/test_vq.py
   branches/refactor_fft/scipy/fftpack/benchmarks/bench_basic.py
   branches/refactor_fft/scipy/fftpack/benchmarks/bench_pseudo_diffs.py
   branches/refactor_fft/scipy/fftpack/tests/test_basic.py
   branches/refactor_fft/scipy/fftpack/tests/test_helper.py
   branches/refactor_fft/scipy/fftpack/tests/test_pseudo_diffs.py
   branches/refactor_fft/scipy/integrate/ode.py
   branches/refactor_fft/scipy/integrate/quadpack.py
   branches/refactor_fft/scipy/integrate/quadrature.py
   branches/refactor_fft/scipy/integrate/tests/test_integrate.py
   branches/refactor_fft/scipy/integrate/tests/test_quadpack.py
   branches/refactor_fft/scipy/interpolate/SConscript
   branches/refactor_fft/scipy/interpolate/interpolate.py
   branches/refactor_fft/scipy/interpolate/polyint.py
   branches/refactor_fft/scipy/interpolate/tests/test_fitpack.py
   branches/refactor_fft/scipy/io/__init__.py
   branches/refactor_fft/scipy/io/arff/arffread.py
   branches/refactor_fft/scipy/io/arff/tests/test_data.py
   branches/refactor_fft/scipy/io/arff/tests/test_header.py
   branches/refactor_fft/scipy/io/fopen.py
   branches/refactor_fft/scipy/io/matlab/mio.py
   branches/refactor_fft/scipy/io/matlab/mio4.py
   branches/refactor_fft/scipy/io/matlab/mio5.py
   branches/refactor_fft/scipy/io/matlab/miobase.py
   branches/refactor_fft/scipy/io/matlab/tests/test_mio.py
   branches/refactor_fft/scipy/io/mmio.py
   branches/refactor_fft/scipy/io/netcdf.py
   branches/refactor_fft/scipy/io/tests/test_mmio.py
   branches/refactor_fft/scipy/lib/blas/tests/test_blas.py
   branches/refactor_fft/scipy/lib/blas/tests/test_fblas.py
   branches/refactor_fft/scipy/lib/lapack/tests/test_lapack.py
   branches/refactor_fft/scipy/linalg/benchmarks/bench_basic.py
   branches/refactor_fft/scipy/linalg/benchmarks/bench_decom.py
   branches/refactor_fft/scipy/linalg/matfuncs.py
   branches/refactor_fft/scipy/linalg/tests/test_atlas_version.py
   branches/refactor_fft/scipy/linalg/tests/test_basic.py
   branches/refactor_fft/scipy/linalg/tests/test_blas.py
   branches/refactor_fft/scipy/linalg/tests/test_decomp.py
   branches/refactor_fft/scipy/linalg/tests/test_fblas.py
   branches/refactor_fft/scipy/linalg/tests/test_lapack.py
   branches/refactor_fft/scipy/linalg/tests/test_matfuncs.py
   branches/refactor_fft/scipy/maxentropy/examples/bergerexample.py
   branches/refactor_fft/scipy/maxentropy/examples/conditionalexample2.py
   branches/refactor_fft/scipy/maxentropy/maxentropy.py
   branches/refactor_fft/scipy/maxentropy/maxentutils.py
   branches/refactor_fft/scipy/maxentropy/tests/test_maxentropy.py
   branches/refactor_fft/scipy/misc/common.py
   branches/refactor_fft/scipy/misc/pilutil.py
   branches/refactor_fft/scipy/misc/tests/test_pilutil.py
   branches/refactor_fft/scipy/ndimage/SConscript
   branches/refactor_fft/scipy/ndimage/fourier.py
   branches/refactor_fft/scipy/ndimage/interpolation.py
   branches/refactor_fft/scipy/ndimage/morphology.py
   branches/refactor_fft/scipy/odr/tests/test_odr.py
   branches/refactor_fft/scipy/optimize/SConscript
   branches/refactor_fft/scipy/optimize/linesearch.py
   branches/refactor_fft/scipy/optimize/minpack.py
   branches/refactor_fft/scipy/optimize/optimize.py
   branches/refactor_fft/scipy/optimize/setup.py
   branches/refactor_fft/scipy/optimize/slsqp.py
   branches/refactor_fft/scipy/optimize/tests/test_optimize.py
   branches/refactor_fft/scipy/optimize/tests/test_slsqp.py
   branches/refactor_fft/scipy/optimize/tests/test_zeros.py
   branches/refactor_fft/scipy/optimize/zeros.py
   branches/refactor_fft/scipy/signal/bsplines.py
   branches/refactor_fft/scipy/signal/signaltools.py
   branches/refactor_fft/scipy/signal/wavelets.py
   branches/refactor_fft/scipy/sparse/benchmarks/bench_sparse.py
   branches/refactor_fft/scipy/sparse/bsr.py
   branches/refactor_fft/scipy/sparse/compressed.py
   branches/refactor_fft/scipy/sparse/construct.py
   branches/refactor_fft/scipy/sparse/coo.py
   branches/refactor_fft/scipy/sparse/csc.py
   branches/refactor_fft/scipy/sparse/csr.py
   branches/refactor_fft/scipy/sparse/dia.py
   branches/refactor_fft/scipy/sparse/dok.py
   branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/cgsequ.c
   branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/cgsrfs.c
   branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/clacon.c
   branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/clangs.c
   branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/cpivotL.c
   branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/cpivotgrowth.c
   branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/cutil.c
   branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/scomplex.c
   branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/scomplex.h
   branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/scsum1.c
   branches/refactor_fft/scipy/sparse/linalg/dsolve/tests/test_linsolve.py
   branches/refactor_fft/scipy/sparse/linalg/dsolve/umfpack/tests/test_umfpack.py
   branches/refactor_fft/scipy/sparse/linalg/dsolve/umfpack/umfpack.py
   branches/refactor_fft/scipy/sparse/linalg/eigen/arpack/speigs.py
   branches/refactor_fft/scipy/sparse/linalg/eigen/arpack/tests/test_arpack.py
   branches/refactor_fft/scipy/sparse/linalg/eigen/lobpcg/lobpcg.py
   branches/refactor_fft/scipy/sparse/linalg/eigen/lobpcg/tests/test_lobpcg.py
   branches/refactor_fft/scipy/sparse/linalg/isolve/iterative.py
   branches/refactor_fft/scipy/sparse/linalg/isolve/minres.py
   branches/refactor_fft/scipy/sparse/linalg/isolve/tests/test_iterative.py
   branches/refactor_fft/scipy/sparse/linalg/tests/test_interface.py
   branches/refactor_fft/scipy/sparse/sparsetools/coo.h
   branches/refactor_fft/scipy/sparse/sparsetools/coo.i
   branches/refactor_fft/scipy/sparse/sparsetools/coo.py
   branches/refactor_fft/scipy/sparse/sparsetools/coo_wrap.cxx
   branches/refactor_fft/scipy/sparse/sparsetools/csc.i
   branches/refactor_fft/scipy/sparse/sparsetools/csc.py
   branches/refactor_fft/scipy/sparse/sparsetools/csc_wrap.cxx
   branches/refactor_fft/scipy/sparse/sparsetools/csr.h
   branches/refactor_fft/scipy/sparse/sparsetools/csr.i
   branches/refactor_fft/scipy/sparse/sparsetools/csr.py
   branches/refactor_fft/scipy/sparse/sparsetools/csr_wrap.cxx
   branches/refactor_fft/scipy/sparse/sparsetools/dia.py
   branches/refactor_fft/scipy/sparse/sparsetools/dia_wrap.cxx
   branches/refactor_fft/scipy/sparse/sparsetools/sparsetools.i
   branches/refactor_fft/scipy/sparse/spfuncs.py
   branches/refactor_fft/scipy/sparse/sputils.py
   branches/refactor_fft/scipy/sparse/tests/test_base.py
   branches/refactor_fft/scipy/sparse/tests/test_extract.py
   branches/refactor_fft/scipy/sparse/tests/test_sputils.py
   branches/refactor_fft/scipy/special/cephes/jv.c
   branches/refactor_fft/scipy/special/cephes_doc.h
   branches/refactor_fft/scipy/special/info.py
   branches/refactor_fft/scipy/special/tests/test_basic.py
   branches/refactor_fft/scipy/stats/_support.py
   branches/refactor_fft/scipy/stats/continuous.lyx
   branches/refactor_fft/scipy/stats/distributions.py
   branches/refactor_fft/scipy/stats/mmorestats.py
   branches/refactor_fft/scipy/stats/morestats.py
   branches/refactor_fft/scipy/stats/mstats.py
   branches/refactor_fft/scipy/stats/setup.py
   branches/refactor_fft/scipy/stats/stats.py
   branches/refactor_fft/scipy/stats/tests/test_distributions.py
   branches/refactor_fft/scipy/stats/tests/test_mmorestats.py
   branches/refactor_fft/scipy/stats/tests/test_mstats.py
   branches/refactor_fft/scipy/stats/tests/test_stats.py
   branches/refactor_fft/scipy/stsci/convolve/lib/Convolve.py
   branches/refactor_fft/scipy/stsci/convolve/lib/iraf_frame.py
   branches/refactor_fft/scipy/stsci/convolve/lib/lineshape.py
   branches/refactor_fft/scipy/stsci/image/lib/_image.py
   branches/refactor_fft/scipy/stsci/image/lib/combine.py
   branches/refactor_fft/scipy/weave/accelerate_tools.py
   branches/refactor_fft/scipy/weave/examples/vq.py
   branches/refactor_fft/scipy/weave/tests/test_blitz_tools.py
   branches/refactor_fft/scipy/weave/tests/test_c_spec.py
   branches/refactor_fft/scipy/weave/tests/test_ext_tools.py
   branches/refactor_fft/scipy/weave/tests/test_inline_tools.py
   branches/refactor_fft/scipy/weave/tests/test_numpy_scalar_spec.py
   branches/refactor_fft/scipy/weave/tests/test_scxx_dict.py
   branches/refactor_fft/scipy/weave/tests/test_scxx_object.py
   branches/refactor_fft/scipy/weave/tests/test_scxx_sequence.py
   branches/refactor_fft/scipy/weave/tests/test_size_check.py
   branches/refactor_fft/scipy/weave/tests/weave_test_utils.py
Log:
Merged revisions 4694-4827 via svnmerge from 
http://svn.scipy.org/svn/scipy/trunk

........
  r4694 | damian.eads | 2008-09-08 04:28:06 +0900 (Mon, 08 Sep 2008) | 1 line
  
  Added cdist function for computing distances between two collections of vectors. Added tests for the cdist function.
........
  r4696 | damian.eads | 2008-09-08 14:01:06 +0900 (Mon, 08 Sep 2008) | 1 line
  
  RSTified more hierarchy docs.
........
  r4697 | pierregm | 2008-09-08 14:01:53 +0900 (Mon, 08 Sep 2008) | 1 line
  
  mstats.mode: make sure that mode returns a tuple.
........
  r4700 | pierregm | 2008-09-08 17:05:22 +0900 (Mon, 08 Sep 2008) | 1 line
  
  * force compatibility between mstats.mode and stats.mode
........
  r4703 | damian.eads | 2008-09-08 23:47:40 +0900 (Mon, 08 Sep 2008) | 1 line
  
  RSTified more hierarchy docs.
........
  r4704 | ptvirtan | 2008-09-09 03:57:39 +0900 (Tue, 09 Sep 2008) | 1 line
  
  Fix Bessel K_nu function name in docstrings: 'modified Bessel function of the second kind' is the more common name, rather than the 'third kind'
........
  r4705 | alan.mcintyre | 2008-09-09 22:46:55 +0900 (Tue, 09 Sep 2008) | 4 lines
  
  Standardize NumPy import as "import numpy as np".
  Removed unused numpy import.
  Clean up alignment of multiline statements.
........
  r4706 | alan.mcintyre | 2008-09-09 22:55:11 +0900 (Tue, 09 Sep 2008) | 2 lines
  
  Standardize NumPy import as "import numpy as np".
........
  r4707 | alan.mcintyre | 2008-09-09 23:16:57 +0900 (Tue, 09 Sep 2008) | 3 lines
  
  Standardize NumPy import as "import numpy as np".
  Removed unused numpy import.
........
  r4708 | cdavid | 2008-09-10 02:11:12 +0900 (Wed, 10 Sep 2008) | 2 lines
  
  Start the prepare bootstrap for scipy.
........
  r4709 | cdavid | 2008-09-10 02:12:17 +0900 (Wed, 10 Sep 2008) | 2 lines
  
  Add func to build scipy tarball.
........
  r4710 | cdavid | 2008-09-10 02:12:59 +0900 (Wed, 10 Sep 2008) | 2 lines
  
  Fix mising dot between release version and dev.
........
  r4711 | cdavid | 2008-09-10 02:13:49 +0900 (Wed, 10 Sep 2008) | 2 lines
  
  Full version string correctly generated.
........
  r4712 | cdavid | 2008-09-10 02:14:37 +0900 (Wed, 10 Sep 2008) | 2 lines
  
  Bootsrap script can now prepare scipy sources.
........
  r4713 | cdavid | 2008-09-10 02:15:25 +0900 (Wed, 10 Sep 2008) | 2 lines
  
  Remove global var reference.
........
  r4714 | cdavid | 2008-09-10 02:16:19 +0900 (Wed, 10 Sep 2008) | 2 lines
  
  Add build script for scipy.
........
  r4715 | cdavid | 2008-09-10 02:17:02 +0900 (Wed, 10 Sep 2008) | 2 lines
  
  Copy build script in bootstrapped sources.
........
  r4716 | cdavid | 2008-09-10 02:17:57 +0900 (Wed, 10 Sep 2008) | 2 lines
  
  Remove numpy references in scipy build script.
........
  r4717 | cdavid | 2008-09-10 02:18:55 +0900 (Wed, 10 Sep 2008) | 2 lines
  
  Add nsis script to bootstap.
........
  r4718 | cdavid | 2008-09-10 02:19:48 +0900 (Wed, 10 Sep 2008) | 2 lines
  
  Add nsis script to build super installer.
........
  r4719 | cdavid | 2008-09-10 02:20:26 +0900 (Wed, 10 Sep 2008) | 2 lines
  
  Fix numpy script leftover.
........
  r4720 | cdavid | 2008-09-10 02:21:11 +0900 (Wed, 10 Sep 2008) | 2 lines
  
  Forgot to pass ROOT dir to scipy_version func.
........
  r4721 | cdavid | 2008-09-10 02:22:00 +0900 (Wed, 10 Sep 2008) | 2 lines
  
  Rename nsis script.
........
  r4722 | cdavid | 2008-09-10 03:11:27 +0900 (Wed, 10 Sep 2008) | 1 line
  
  Fix missing imports.
........
  r4723 | alan.mcintyre | 2008-09-19 04:12:41 +0900 (Fri, 19 Sep 2008) | 3 lines
  
  Removed unused imports.
  PEP8 conformance (one import per line).
........
  r4724 | alan.mcintyre | 2008-09-19 04:15:47 +0900 (Fri, 19 Sep 2008) | 3 lines
  
  Removed unused imports.
  Standardized NumPy import as "import numpy as np".
........
  r4725 | alan.mcintyre | 2008-09-19 04:23:58 +0900 (Fri, 19 Sep 2008) | 4 lines
  
  Removed unused imports.
  Standardized NumPy import as "import numpy as np".
  PEP8 conformance (one import per line).
........
  r4726 | alan.mcintyre | 2008-09-19 04:27:00 +0900 (Fri, 19 Sep 2008) | 2 lines
  
  Removed unused imports.
........
  r4727 | alan.mcintyre | 2008-09-19 04:28:38 +0900 (Fri, 19 Sep 2008) | 2 lines
  
  Removed unused imports.
........
  r4728 | alan.mcintyre | 2008-09-19 04:30:13 +0900 (Fri, 19 Sep 2008) | 2 lines
  
  Remove unused imports.
........
  r4729 | alan.mcintyre | 2008-09-19 04:31:49 +0900 (Fri, 19 Sep 2008) | 2 lines
  
  Remove unused/redundant imports.
........
  r4730 | alan.mcintyre | 2008-09-19 04:34:57 +0900 (Fri, 19 Sep 2008) | 2 lines
  
  Removed unused/redundant imports.
........
  r4731 | alan.mcintyre | 2008-09-19 04:37:37 +0900 (Fri, 19 Sep 2008) | 2 lines
  
  Removed unused imports.
........
  r4732 | alan.mcintyre | 2008-09-19 04:45:20 +0900 (Fri, 19 Sep 2008) | 3 lines
  
  Removed unused imports.
  Removed test_scxx.py (the nose framework doesn't need to import the test_scxx* modules to find the tests).
........
  r4733 | alan.mcintyre | 2008-09-19 04:50:45 +0900 (Fri, 19 Sep 2008) | 2 lines
  
  Removed unused imports.
........
  r4734 | alan.mcintyre | 2008-09-19 04:55:02 +0900 (Fri, 19 Sep 2008) | 2 lines
  
  Removed unused imports.
........
  r4735 | alan.mcintyre | 2008-09-19 04:57:42 +0900 (Fri, 19 Sep 2008) | 2 lines
  
  Removed unused imports.
........
  r4736 | alan.mcintyre | 2008-09-19 05:00:22 +0900 (Fri, 19 Sep 2008) | 3 lines
  
  Removed unused imports.
  Moved imports to the top of modules.
........
  r4737 | alan.mcintyre | 2008-09-19 06:20:05 +0900 (Fri, 19 Sep 2008) | 3 lines
  
  Removed unused imports.
  Standardize NumPy import as "import numpy as np".
........
  r4738 | alan.mcintyre | 2008-09-21 08:00:11 +0900 (Sun, 21 Sep 2008) | 2 lines
  
  Remove unused imports.
........
  r4739 | alan.mcintyre | 2008-09-21 08:01:08 +0900 (Sun, 21 Sep 2008) | 2 lines
  
  Silence debugging print statements when verbosity < 3.
........
  r4740 | damian.eads | 2008-09-21 12:15:27 +0900 (Sun, 21 Sep 2008) | 1 line
  
  Corrected spelling of hierarchical.
........
  r4741 | oliphant | 2008-09-25 02:17:51 +0900 (Thu, 25 Sep 2008) | 1 line
  
  Remove typecode from _support
........
  r4742 | cdavid | 2008-09-26 13:00:25 +0900 (Fri, 26 Sep 2008) | 2 lines
  
  Deprecate scipy.stats.var for numpy.var.
........
  r4743 | cdavid | 2008-09-26 13:01:16 +0900 (Fri, 26 Sep 2008) | 2 lines
  
  scipy.stats.warn raise a DeprecationWarning.
........
  r4744 | cdavid | 2008-09-26 13:02:08 +0900 (Fri, 26 Sep 2008) | 2 lines
  
  Deprecate scipy.stats.std.
........
  r4745 | cdavid | 2008-09-26 13:02:51 +0900 (Fri, 26 Sep 2008) | 2 lines
  
  Fix deprecation warning for stats.var.
........
  r4746 | cdavid | 2008-09-26 13:03:37 +0900 (Fri, 26 Sep 2008) | 2 lines
  
  Deprecate stats.mean.
........
  r4747 | cdavid | 2008-09-26 13:04:19 +0900 (Fri, 26 Sep 2008) | 2 lines
  
  Deprecate stats.median.
........
  r4748 | cdavid | 2008-09-26 13:05:03 +0900 (Fri, 26 Sep 2008) | 2 lines
  
  Deprecate stats.cov.
........
  r4749 | cdavid | 2008-09-26 13:05:42 +0900 (Fri, 26 Sep 2008) | 2 lines
  
  Deprecate stats.corrcoef.
........
  r4750 | cdavid | 2008-09-26 13:06:26 +0900 (Fri, 26 Sep 2008) | 2 lines
  
  Fix cov/corrcoef deprecation.
........
  r4751 | cdavid | 2008-09-26 13:25:25 +0900 (Fri, 26 Sep 2008) | 1 line
  
  Do not modify error handling when importing scipy.
........
  r4752 | oliphant | 2008-09-26 21:53:59 +0900 (Fri, 26 Sep 2008) | 1 line
  
  Fix distributions to return numpy scalars instead of 0-d arrays.
........
  r4753 | oliphant | 2008-09-28 06:46:03 +0900 (Sun, 28 Sep 2008) | 1 line
  
  Fix error in est_loc_scale.
........
  r4754 | uwe.schmitt | 2008-09-30 05:13:24 +0900 (Tue, 30 Sep 2008) | 1 line
  
  added nnls, incl. test script
........
  r4755 | uwe.schmitt | 2008-09-30 15:45:52 +0900 (Tue, 30 Sep 2008) | 1 line
  
  removed obsolete default parameters from nnls()
........
  r4756 | uwe.schmitt | 2008-09-30 15:48:15 +0900 (Tue, 30 Sep 2008) | 1 line
  
  removed NNLS type from setup.py and Sconscript
........
  r4757 | uwe.schmitt | 2008-09-30 16:00:07 +0900 (Tue, 30 Sep 2008) | 1 line
  
  renamed NNLS.F to nnls.f
........
  r4758 | damian.eads | 2008-10-01 04:14:59 +0900 (Wed, 01 Oct 2008) | 1 line
  
  Fixed minor bug in cophenet.
........
  r4759 | peridot | 2008-10-01 08:55:21 +0900 (Wed, 01 Oct 2008) | 2 lines
  
  New module for spatial data structure. Currently contains one pure-python implementation of a kd-tree.
........
  r4760 | damian.eads | 2008-10-01 09:10:16 +0900 (Wed, 01 Oct 2008) | 1 line
  
  Added order keyword in asarray statements to ensure contiguity of data prior to passing to C functions.
........
  r4761 | damian.eads | 2008-10-01 09:14:20 +0900 (Wed, 01 Oct 2008) | 1 line
  
  Added order keyword in asarray statements to ensure contiguity of data prior to passing to C functions.
........
  r4763 | peridot | 2008-10-01 18:52:45 +0900 (Wed, 01 Oct 2008) | 2 lines
  
  Removed spatial; it's in a branch now so that it won't interfere with 0.7.
........
  r4764 | rkern | 2008-10-02 04:38:40 +0900 (Thu, 02 Oct 2008) | 1 line
  
  BUG: Remove mistaken commit.
........
  r4765 | oliphant | 2008-10-03 23:31:41 +0900 (Fri, 03 Oct 2008) | 1 line
  
  Fix jv(3,4) case by special casing.  The problem is in the recur function which seems to have a special-case problem with n=3 and x=4 because pk=qk in that case.
........
  r4766 | oliphant | 2008-10-04 03:57:20 +0900 (Sat, 04 Oct 2008) | 1 line
  
  Improve docstring of lognorm a bit.
........
  r4767 | wnbell | 2008-10-05 07:22:39 +0900 (Sun, 05 Oct 2008) | 4 lines
  
  rename c_abs() and c_abs1() to slu_c_abs() and slu_c_abs() to
  avoid conflict with Python headers
  hopefully resolves ticket #735
........
  r4768 | wnbell | 2008-10-05 07:33:54 +0900 (Sun, 05 Oct 2008) | 2 lines
  
  fix spelling in c_abs renaming
........
  r4770 | matthew.brett at gmail.com | 2008-10-05 09:58:08 +0900 (Sun, 05 Oct 2008) | 1 line
  
  Centralize recognition of matfile type, apply patch for ticket #743 by Ray Jones, with thanks
........
  r4771 | matthew.brett at gmail.com | 2008-10-05 10:54:59 +0900 (Sun, 05 Oct 2008) | 1 line
  
  Restore matlab m files for creating test mat files
........
  r4772 | wnbell | 2008-10-05 11:23:37 +0900 (Sun, 05 Oct 2008) | 2 lines
  
  minor additions to sparsetools
........
  r4773 | wnbell | 2008-10-05 11:28:14 +0900 (Sun, 05 Oct 2008) | 2 lines
  
  renamed diags to offsets to avoid possible confusion
........
  r4774 | alan.mcintyre | 2008-10-05 12:36:54 +0900 (Sun, 05 Oct 2008) | 2 lines
  
  Don't print debug information for low verbosity.
........
  r4775 | matthew.brett at gmail.com | 2008-10-05 13:49:23 +0900 (Sun, 05 Oct 2008) | 1 line
  
  Fixing long-broken mio tests
........
  r4781 | matthew.brett at gmail.com | 2008-10-05 18:36:46 +0900 (Sun, 05 Oct 2008) | 1 line
  
  Removed m files; now moved to matlab test directory
........
  r4783 | matthew.brett at gmail.com | 2008-10-06 01:55:22 +0900 (Mon, 06 Oct 2008) | 1 line
  
  Take matlab io tests out for now, known to fail (and have been failing silently for a long time)
........
  r4784 | wnbell | 2008-10-06 13:29:46 +0900 (Mon, 06 Oct 2008) | 2 lines
  
  added csr_toell()
........
  r4785 | wnbell | 2008-10-06 16:36:43 +0900 (Mon, 06 Oct 2008) | 2 lines
  
  writing of MatrixMarket now works for all integer kinds
........
  r4786 | uwe.schmitt | 2008-10-06 20:49:39 +0900 (Mon, 06 Oct 2008) | 1 line
  
  fixed comments in test_nnls.py
........
  r4787 | peridot | 2008-10-09 14:26:59 +0900 (Thu, 09 Oct 2008) | 2 lines
  
  Fixed and installed tests for scipy.stats.vonmises. Closes tickets #747, #748, and #749.
........
  r4788 | peridot | 2008-10-09 16:29:54 +0900 (Thu, 09 Oct 2008) | 4 lines
  
  Replaced implementation of von Mises CDF with cython implementation that should have better numerical performance. Note that for large k it uses array operations rather than cython code since we need scipy.stats.norm.cdf and scipy.special.i0. 
  
  Note also that the C code is *not* automatically rebuilt when the cython code changes.
........
  r4789 | wnbell | 2008-10-10 12:17:27 +0900 (Fri, 10 Oct 2008) | 2 lines
  
  (hopefully) fix ticket #736
........
  r4790 | cdavid | 2008-10-10 16:00:56 +0900 (Fri, 10 Oct 2008) | 1 line
  
  Update numscons build to cope with recent changes in scipy.interpolate.
........
  r4791 | cdavid | 2008-10-10 16:02:20 +0900 (Fri, 10 Oct 2008) | 1 line
  
  Update numscons build of scipy.ndimage.
........
  r4792 | wnbell | 2008-10-11 02:13:10 +0900 (Sat, 11 Oct 2008) | 2 lines
  
  fix CSR[:,array([1,2])] slicing problem
........
  r4793 | wnbell | 2008-10-11 19:36:17 +0900 (Sat, 11 Oct 2008) | 2 lines
  
  added missing import
........
  r4798 | cdavid | 2008-10-17 19:34:01 +0900 (Fri, 17 Oct 2008) | 1 line
  
  Add a dummy pavement file.
........
  r4799 | cdavid | 2008-10-17 19:34:18 +0900 (Fri, 17 Oct 2008) | 1 line
  
  The pavement file can now bootstrap the sources.
........
  r4800 | cdavid | 2008-10-17 19:38:23 +0900 (Fri, 17 Oct 2008) | 1 line
  
  Trailing spaces.
........
  r4801 | cdavid | 2008-10-17 19:44:28 +0900 (Fri, 17 Oct 2008) | 1 line
  
  Bootstrap is now working with paver.
........
  r4802 | wnbell | 2008-10-20 06:18:35 +0900 (Mon, 20 Oct 2008) | 7 lines
  
  added DOK matrix patch by James Philbin
  
  i. Improved the docstring.
  ii. Fixed the constructor (this fixes #755).
  iii. Reduced the codepath for the common case of setting an individual element (~2x speedup).
........
  r4803 | cdavid | 2008-10-21 13:04:36 +0900 (Tue, 21 Oct 2008) | 1 line
  
  Add clean_bootstrap task.
........
  r4804 | cdavid | 2008-10-21 14:09:27 +0900 (Tue, 21 Oct 2008) | 1 line
  
  Cosmetic change to pavement file.
........
  r4805 | cdavid | 2008-10-21 14:11:03 +0900 (Tue, 21 Oct 2008) | 1 line
  
  Start the build task.
........
  r4806 | cdavid | 2008-10-21 14:31:55 +0900 (Tue, 21 Oct 2008) | 1 line
  
  More on build.
........
  r4807 | cdavid | 2008-10-21 14:44:14 +0900 (Tue, 21 Oct 2008) | 1 line
  
  Rename pavement build task to build_binary.
........
  r4808 | cdavid | 2008-10-21 14:58:20 +0900 (Tue, 21 Oct 2008) | 1 line
  
  Add bootstrap_arch task.
........
  r4809 | cdavid | 2008-10-21 15:13:48 +0900 (Tue, 21 Oct 2008) | 1 line
  
  Re-enable the build log.
........
  r4810 | cdavid | 2008-10-21 15:23:28 +0900 (Tue, 21 Oct 2008) | 1 line
  
  Bootstrap build now OK.
........
  r4811 | cdavid | 2008-10-21 15:26:54 +0900 (Tue, 21 Oct 2008) | 1 line
  
  Fix clean_bootstrap task.
........
  r4812 | cdavid | 2008-10-21 15:43:17 +0900 (Tue, 21 Oct 2008) | 1 line
  
  Generate nsis script in bootstrap task.
........
  r4813 | cdavid | 2008-10-21 16:22:36 +0900 (Tue, 21 Oct 2008) | 1 line
  
  Fix nsis script generation.
........
  r4814 | cdavid | 2008-10-21 16:26:04 +0900 (Tue, 21 Oct 2008) | 1 line
  
  Make build_binary a raw task.
........
  r4815 | cdavid | 2008-10-21 16:36:36 +0900 (Tue, 21 Oct 2008) | 1 line
  
  Better error checking when running scipy setup.py from paver.
........
  r4816 | cdavid | 2008-10-21 18:28:34 +0900 (Tue, 21 Oct 2008) | 1 line
  
  Put clean action into separate function.
........
  r4817 | cdavid | 2008-10-21 18:30:05 +0900 (Tue, 21 Oct 2008) | 1 line
  
  Put clean_bootstrap action into separate function.
........
  r4818 | cdavid | 2008-10-21 18:39:47 +0900 (Tue, 21 Oct 2008) | 1 line
  
  Build nsis installer should work now.
........
  r4819 | cdavid | 2008-10-21 18:55:54 +0900 (Tue, 21 Oct 2008) | 1 line
  
  Fix wrong order of dependencies for build_nsis task.
........
  r4820 | cdavid | 2008-10-21 18:58:35 +0900 (Tue, 21 Oct 2008) | 1 line
  
  nsis_script preparation is common to all arches.
........
  r4821 | cdavid | 2008-10-21 19:40:18 +0900 (Tue, 21 Oct 2008) | 1 line
  
  nsis task to build the nsis installer from scratch should now work.
........
  r4822 | cdavid | 2008-10-21 19:46:57 +0900 (Tue, 21 Oct 2008) | 1 line
  
  Disable LZMA compressor for scipy nsis installer: do not give much, and is slow.
........
  r4823 | cdavid | 2008-10-21 19:51:18 +0900 (Tue, 21 Oct 2008) | 1 line
  
  Remove unused code.
........
  r4824 | cdavid | 2008-10-22 17:15:58 +0900 (Wed, 22 Oct 2008) | 1 line
  
  Use np instead of numpy in morestats.
........
  r4825 | cdavid | 2008-10-22 17:29:55 +0900 (Wed, 22 Oct 2008) | 1 line
  
  Replace numpy imports with np.
........
  r4826 | cdavid | 2008-10-22 17:31:32 +0900 (Wed, 22 Oct 2008) | 1 line
  
  Revert bogus change.
........
  r4827 | cdavid | 2008-10-22 22:52:41 +0900 (Wed, 22 Oct 2008) | 1 line
  
  Emit a warning if numpy is < 1.2.0.
........



Property changes on: branches/refactor_fft
___________________________________________________________________
Name: svnmerge-integrated
   - /branches/build_with_scons:1-3868 /branches/scipy.scons:1-3533 /branches/sparse_build_reduce_mem:1-4005 /branches/testing_cleanup:1-3662 /trunk:1-4693
   + /branches/build_with_scons:1-3868 /branches/scipy.scons:1-3533 /branches/sparse_build_reduce_mem:1-4005 /branches/testing_cleanup:1-3662 /trunk:1-4827

Modified: branches/refactor_fft/THANKS.txt
===================================================================
--- branches/refactor_fft/THANKS.txt	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/THANKS.txt	2008-10-23 12:30:20 UTC (rev 4828)
@@ -30,7 +30,8 @@
 Travis Vaught       -- initial work on stats module clean up
 Jeff Whitaker       -- Mac OS X support
 David Cournapeau    -- bug-fixes, refactor of fftpack and cluster, numscons build.
-Damian Eads         -- hiearchical clustering
+Damian Eads         -- hierarchical clustering, dendrogram plotting,
+                       distance functions, vq documentation
 
 
 Testing:

Modified: branches/refactor_fft/scipy/__init__.py
===================================================================
--- branches/refactor_fft/scipy/__init__.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/__init__.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -28,8 +28,15 @@
 from numpy.random import rand, randn
 from numpy.fft import fft, ifft
 from numpy.lib.scimath import *
-_num.seterr(all='ignore')
 
+# Emit a warning if numpy is too old
+majver, minver = [float(i) for i in _num.version.version.split('.')[:2]]
+if majver < 1 or (majver == 1 and minver < 2):
+    import warnings
+    warnings.warn("Numpy 1.2.0 or above is recommended for this version of " \
+                  "scipy (detected version %s)" % _num.version.version,
+                  UserWarning)
+
 __all__ += ['oldnumeric']+_num.__all__
 
 __all__ += ['randn', 'rand', 'fft', 'ifft']
@@ -67,7 +74,7 @@
 # Remove subpackage names from __all__ such that they are not imported via
 # "from scipy import *". This works around a numpy bug present in < 1.2.
 subpackages = """cluster constants fftpack integrate interpolate io lib linalg
-linsolve maxentropy misc ndimage odr optimize signal sparse special
+linsolve maxentropy misc ndimage odr optimize signal sparse special 
 splinalg stats stsci weave""".split()
 for name in subpackages:
     try:

Modified: branches/refactor_fft/scipy/cluster/distance.py
===================================================================
--- branches/refactor_fft/scipy/cluster/distance.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/cluster/distance.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -193,12 +193,41 @@
        d : double
            The Minkowski distance between vectors ``u`` and ``v``.
     """
-    u = np.asarray(u)
-    v = np.asarray(v)
+    u = np.asarray(u, order='c')
+    v = np.asarray(v, order='c')
     if p < 1:
         raise ValueError("p must be at least 1")
     return (abs(u-v)**p).sum() ** (1.0 / p)
 
+def wminkowski(u, v, p, w):
+    """
+    Computes the weighted Minkowski distance between two vectors ``u``
+    and ``v``, defined as
+
+    .. math::
+
+       \sum {(w_i*|u_i - v_i|)^p})^(1/p).
+
+    :Parameters:
+       u : ndarray
+           An :math:`n`-dimensional vector.
+       v : ndarray
+           An :math:`n`-dimensional vector.
+       p : ndarray
+           The norm of the difference :math:`${||u-v||}_p$`.
+       w : ndarray
+           The weight vector.
+
+    :Returns:
+       d : double
+           The Minkowski distance between vectors ``u`` and ``v``.
+    """
+    u = np.asarray(u, order='c')
+    v = np.asarray(v, order='c')
+    if p < 1:
+        raise ValueError("p must be at least 1")
+    return ((w * abs(u-v))**p).sum() ** (1.0 / p)
+
 def euclidean(u, v):
     """
     Computes the Euclidean distance between two n-vectors ``u`` and ``v``,
@@ -218,8 +247,8 @@
        d : double
            The Euclidean distance between vectors ``u`` and ``v``.
     """
-    u = np.asarray(u)
-    v = np.asarray(v)
+    u = np.asarray(u, order='c')
+    v = np.asarray(v, order='c')
     q=np.matrix(u-v)
     return np.sqrt((q*q.T).sum())
 
@@ -243,8 +272,8 @@
        d : double
            The squared Euclidean distance between vectors ``u`` and ``v``.
     """
-    u = np.asarray(u)
-    v = np.asarray(v)
+    u = np.asarray(u, order='c')
+    v = np.asarray(v, order='c')
     return ((u-v)*(u-v).T).sum()
 
 def cosine(u, v):
@@ -266,8 +295,8 @@
        d : double
            The Cosine distance between vectors ``u`` and ``v``.
     """
-    u = np.asarray(u)
-    v = np.asarray(v)
+    u = np.asarray(u, order='c')
+    v = np.asarray(v, order='c')
     return (1.0 - (np.dot(u, v.T) / \
                    (np.sqrt(np.dot(u, u.T)) * np.sqrt(np.dot(v, v.T)))))
 
@@ -327,8 +356,8 @@
        d : double
            The Hamming distance between vectors ``u`` and ``v``.
     """
-    u = np.asarray(u)
-    v = np.asarray(v)
+    u = np.asarray(u, order='c')
+    v = np.asarray(v, order='c')
     return (u != v).mean()
 
 def jaccard(u, v):
@@ -355,8 +384,8 @@
        d : double
            The Jaccard distance between vectors ``u`` and ``v``.
     """
-    u = np.asarray(u)
-    v = np.asarray(v)
+    u = np.asarray(u, order='c')
+    v = np.asarray(v, order='c')
     return (np.double(np.bitwise_and((u != v),
                      np.bitwise_or(u != 0, v != 0)).sum())
             /  np.double(np.bitwise_or(u != 0, v != 0).sum()))
@@ -385,8 +414,8 @@
        d : double
            The Kulsinski distance between vectors ``u`` and ``v``.
     """
-    u = np.asarray(u)
-    v = np.asarray(v)
+    u = np.asarray(u, order='c')
+    v = np.asarray(v, order='c')
     n = len(u)
     (nff, nft, ntf, ntt) = _nbool_correspond_all(u, v)
 
@@ -409,9 +438,9 @@
        d : double
            The standardized Euclidean distance between vectors ``u`` and ``v``.
     """
-    u = np.asarray(u)
-    v = np.asarray(v)
-    V = np.asarray(V)
+    u = np.asarray(u, order='c')
+    v = np.asarray(v, order='c')
+    V = np.asarray(V, order='c')
     if len(V.shape) != 1 or V.shape[0] != u.shape[0] or u.shape[0] != v.shape[0]:
         raise TypeError('V must be a 1-D array of the same dimension as u and v.')
     return np.sqrt(((u-v)**2 / V).sum())
@@ -435,8 +464,8 @@
        d : double
            The City Block distance between vectors ``u`` and ``v``.
     """
-    u = np.asarray(u)
-    v = np.asarray(v)
+    u = np.asarray(u, order='c')
+    v = np.asarray(v, order='c')
     return abs(u-v).sum()
 
 def mahalanobis(u, v, VI):
@@ -459,9 +488,9 @@
        d : double
            The Mahalanobis distance between vectors ``u`` and ``v``.
     """
-    u = np.asarray(u)
-    v = np.asarray(v)
-    VI = np.asarray(VI)
+    u = np.asarray(u, order='c')
+    v = np.asarray(v, order='c')
+    VI = np.asarray(VI, order='c')
     return np.sqrt(np.dot(np.dot((u-v),VI),(u-v).T).sum())
 
 def chebyshev(u, v):
@@ -482,8 +511,8 @@
        d : double
            The Chebyshev distance between vectors ``u`` and ``v``.
     """
-    u = np.asarray(u)
-    v = np.asarray(v)
+    u = np.asarray(u, order='c')
+    v = np.asarray(v, order='c')
     return max(abs(u-v))
 
 def braycurtis(u, v):
@@ -505,8 +534,8 @@
        d : double
            The Bray-Curtis distance between vectors ``u`` and ``v``.
     """
-    u = np.asarray(u)
-    v = np.asarray(v)
+    u = np.asarray(u, order='c')
+    v = np.asarray(v, order='c')
     return abs(u-v).sum() / abs(u+v).sum()
 
 def canberra(u, v):
@@ -530,8 +559,8 @@
        d : double
            The Canberra distance between vectors ``u`` and ``v``.
     """
-    u = np.asarray(u)
-    v = np.asarray(v)
+    u = np.asarray(u, order='c')
+    v = np.asarray(v, order='c')
     return abs(u-v).sum() / (abs(u).sum() + abs(v).sum())
 
 def _nbool_correspond_all(u, v):
@@ -597,8 +626,8 @@
        d : double
            The Yule dissimilarity between vectors ``u`` and ``v``.
     """
-    u = np.asarray(u)
-    v = np.asarray(v)
+    u = np.asarray(u, order='c')
+    v = np.asarray(v, order='c')
     (nff, nft, ntf, ntt) = _nbool_correspond_all(u, v)
     return float(2.0 * ntf * nft) / float(ntt * nff + ntf * nft)
 
@@ -625,8 +654,8 @@
        d : double
            The Matching dissimilarity between vectors ``u`` and ``v``.
     """
-    u = np.asarray(u)
-    v = np.asarray(v)
+    u = np.asarray(u, order='c')
+    v = np.asarray(v, order='c')
     (nft, ntf) = _nbool_correspond_ft_tf(u, v)
     return float(nft + ntf) / float(len(u))
 
@@ -654,8 +683,8 @@
        d : double
            The Dice dissimilarity between vectors ``u`` and ``v``.
     """
-    u = np.asarray(u)
-    v = np.asarray(v)
+    u = np.asarray(u, order='c')
+    v = np.asarray(v, order='c')
     if u.dtype == np.bool:
         ntt = (u & v).sum()
     else:
@@ -687,8 +716,8 @@
            The Rogers-Tanimoto dissimilarity between vectors
            ``u`` and ``v``.
     """
-    u = np.asarray(u)
-    v = np.asarray(v)
+    u = np.asarray(u, order='c')
+    v = np.asarray(v, order='c')
     (nff, nft, ntf, ntt) = _nbool_correspond_all(u, v)
     return float(2.0 * (ntf + nft)) / float(ntt + nff + (2.0 * (ntf + nft)))
 
@@ -716,8 +745,8 @@
        d : double
            The Russell-Rao dissimilarity between vectors ``u`` and ``v``.
     """
-    u = np.asarray(u)
-    v = np.asarray(v)
+    u = np.asarray(u, order='c')
+    v = np.asarray(v, order='c')
     if u.dtype == np.bool:
         ntt = (u & v).sum()
     else:
@@ -749,8 +778,8 @@
        d : double
            The Sokal-Michener dissimilarity between vectors ``u`` and ``v``.
     """
-    u = np.asarray(u)
-    v = np.asarray(v)
+    u = np.asarray(u, order='c')
+    v = np.asarray(v, order='c')
     if u.dtype == np.bool:
         ntt = (u & v).sum()
         nff = (~u & ~v).sum()
@@ -784,8 +813,8 @@
        d : double
            The Sokal-Sneath dissimilarity between vectors ``u`` and ``v``.
     """
-    u = np.asarray(u)
-    v = np.asarray(v)
+    u = np.asarray(u, order='c')
+    v = np.asarray(v, order='c')
     if u.dtype == np.bool:
         ntt = (u & v).sum()
     else:
@@ -796,7 +825,7 @@
 
 def pdist(X, metric='euclidean', p=2, V=None, VI=None):
     """
-    Computes the distance between m original observations in
+    Computes the pairwise distances between m original observations in
     n-dimensional space. Returns a condensed distance matrix Y.  For
     each :math:`$i$` and :math:`$j$` (where :math:`$i<j<n$), the
     metric ``dist(u=X[i], v=X[j])`` is computed and stored in the
@@ -817,6 +846,14 @@
            'jaccard', 'kulsinski', 'mahalanobis', 'matching',
            'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean',
            'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule'.
+       w : ndarray
+           The weight vector (for weighted Minkowski).
+       p : double
+           The p-norm to apply (for Minkowski, weighted and unweighted)
+       V : ndarray
+           The variance vector (for standardized Euclidean).
+       VI : ndarray
+           The inverse of the covariance matrix (for Mahalanobis).
 
     :Returns:
        Y : ndarray
@@ -978,6 +1015,11 @@
        Computes the Sokal-Sneath distance between each pair of
        boolean vectors. (see sokalsneath function documentation)
 
+    22. ``Y = pdist(X, 'wminkowski')``
+
+       Computes the weighted Minkowski distance between each pair of
+       vectors. (see wminkowski function documentation)
+
     22. ``Y = pdist(X, f)``
 
        Computes the distance between all pairs of vectors in X
@@ -1001,6 +1043,8 @@
          dm = pdist(X, 'sokalsneath')
 
        """
+
+
 #         21. Y = pdist(X, 'test_Y')
 #
 #           Computes the distance between all pairs of vectors in X
@@ -1008,7 +1052,7 @@
 #           verifiable, but less efficient implementation.
 
 
-    X = np.asarray(X)
+    X = np.asarray(X, order='c')
 
     #if np.issubsctype(X, np.floating) and not np.issubsctype(X, np.double):
     #    raise TypeError('Floating point arrays must be 64-bit (got %r).' %
@@ -1034,6 +1078,11 @@
                 for j in xrange(i+1, m):
                     dm[k] = minkowski(X[i, :], X[j, :], p)
                     k = k + 1
+        elif metric == wminkowski:
+            for i in xrange(0, m - 1):
+                for j in xrange(i+1, m):
+                    dm[k] = wminkowski(X[i, :], X[j, :], p, w)
+                    k = k + 1
         elif metric == seuclidean:
             for i in xrange(0, m - 1):
                 for j in xrange(i+1, m):
@@ -1077,9 +1126,12 @@
             _distance_wrap.pdist_chebyshev_wrap(_convert_to_double(X), dm)
         elif mstr in set(['minkowski', 'mi', 'm']):
             _distance_wrap.pdist_minkowski_wrap(_convert_to_double(X), dm, p)
+        elif mstr in set(['wminkowski', 'wmi', 'wm', 'wpnorm']):
+            _distance_wrap.cdist_weighted_minkowski_wrap(_convert_to_double(X),
+                                                         dm, p, w)
         elif mstr in set(['seuclidean', 'se', 's']):
             if V is not None:
-                V = np.asarray(V)
+                V = np.asarray(V, order='c')
                 if type(V) != np.ndarray:
                     raise TypeError('Variance vector V must be a numpy array')
                 if V.dtype != np.double:
@@ -1117,7 +1169,7 @@
             _distance_wrap.pdist_cosine_wrap(_convert_to_double(X2), _convert_to_double(dm), _convert_to_double(norms))
         elif mstr in set(['mahalanobis', 'mahal', 'mah']):
             if VI is not None:
-                VI = _convert_to_double(np.asarray(VI))
+                VI = _convert_to_double(np.asarray(VI, order='c'))
                 if type(VI) != np.ndarray:
                     raise TypeError('VI must be a numpy array.')
                 if VI.dtype != np.double:
@@ -1131,7 +1183,7 @@
         elif mstr == 'canberra':
             _distance_wrap.pdist_canberra_wrap(_convert_to_double(X), dm)
         elif mstr == 'braycurtis':
-            _distance_wrap.pdist_bray_curtis_wrap(_convert_to_bool(X), dm)
+            _distance_wrap.pdist_bray_curtis_wrap(_convert_to_double(X), dm)
         elif mstr == 'yule':
             _distance_wrap.pdist_yule_bool_wrap(_convert_to_bool(X), dm)
         elif mstr == 'matching':
@@ -1154,7 +1206,7 @@
             if V is None:
                 V = np.var(X, axis=0, ddof=1)
             else:
-                V = np.asarray(V)
+                V = np.asarray(V, order='c')
             dm = pdist(X, lambda u, v: seuclidean(u, v, V))
         elif metric == 'test_braycurtis':
             dm = pdist(X, braycurtis)
@@ -1163,7 +1215,7 @@
                 V = np.cov(X.T)
                 VI = np.linalg.inv(V)
             else:
-                VI = np.asarray(VI)
+                VI = np.asarray(VI, order='c')
             [VI] = _copy_arrays_if_base_present([VI])
             # (u-v)V^(-1)(u-v)^T
             dm = pdist(X, (lambda u, v: mahalanobis(u, v, VI)))
@@ -1172,7 +1224,9 @@
         elif metric == 'test_cityblock':
             dm = pdist(X, cityblock)
         elif metric == 'test_minkowski':
-            dm = pdist(X, minkowski, p)
+            dm = pdist(X, minkowski, p=p)
+        elif metric == 'test_wminkowski':
+            dm = pdist(X, wminkowski, p=p, w=w)
         elif metric == 'test_cosine':
             dm = pdist(X, cosine)
         elif metric == 'test_correlation':
@@ -1204,6 +1258,7 @@
     else:
         raise TypeError('2nd argument metric must be a string identifier or a function.')
     return dm
+
 def squareform(X, force="no", checks=True):
     """
     Converts a vector-form distance vector to a square-form distance
@@ -1255,7 +1310,7 @@
 
     """
 
-    X = _convert_to_double(np.asarray(X))
+    X = _convert_to_double(np.asarray(X, order='c'))
 
     if not np.issubsctype(X, np.double):
         raise TypeError('A double array must be passed.')
@@ -1353,7 +1408,7 @@
        ``D.T`` and non-zeroness of the diagonal are ignored if they are
        within the tolerance specified by ``tol``.
     """
-    D = np.asarray(D)
+    D = np.asarray(D, order='c')
     valid = True
     try:
         if type(D) != np.ndarray:
@@ -1429,7 +1484,7 @@
            warning or exception message.
 
     """
-    y = np.asarray(y)
+    y = np.asarray(y, order='c')
     valid = True
     try:
         if type(y) != np.ndarray:
@@ -1474,7 +1529,7 @@
     :Returns:
        The number of observations in the redundant distance matrix.
     """
-    D = np.asarray(D)
+    D = np.asarray(D, order='c')
     is_valid_dm(D, tol=np.inf, throw=True, name='D')
     return D.shape[0]
 
@@ -1493,7 +1548,485 @@
            The number of observations in the condensed distance matrix
            passed.
     """
-    Y = np.asarray(Y)
+    Y = np.asarray(Y, order='c')
     is_valid_y(Y, throw=True, name='Y')
     d = int(np.ceil(np.sqrt(Y.shape[0] * 2)))
     return d
+
+
+def cdist(XA, XB, metric='euclidean', p=2, V=None, VI=None, w=None):
+    """
+    Computes distance between each pair of observations between two
+    collections of vectors. ``XA`` is a :math:`$m_A$` by :math:`$n$`
+    array while ``XB`` is a :math:`$m_B$` by :math:`$n$` array. A
+    :math:`$m_A$` by :math:`$m_B$` array is returned. An exception is
+    thrown if ``XA`` and ``XB`` do not have the same number of
+    columns.
+
+    A rectangular distance matrix Y is returned. For each :math:`$i$`
+    and :math:`$j$`, the metric ``dist(u=XA[i], v=XB[j])`` is computed
+    and stored in the :math:`ij`th entry.
+
+
+    :Parameters:
+       XA : ndarray
+           An :math:`$m_A$` by :math:`$n$` array of :math:`$m_A$`
+           original observations in an n-dimensional space.
+       XB : ndarray
+           An :math:`$m_B$` by :math:`$n$` array of :math:`$m_B$`
+           original observations in an n-dimensional space.
+       metric : string or function
+           The distance metric to use. The distance function can
+           be 'braycurtis', 'canberra', 'chebyshev', 'cityblock',
+           'correlation', 'cosine', 'dice', 'euclidean', 'hamming',
+           'jaccard', 'kulsinski', 'mahalanobis', 'matching',
+           'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean',
+           'sokalmichener', 'sokalsneath', 'sqeuclidean', 'wminkowski',
+           'yule'.
+       w : ndarray
+           The weight vector (for weighted Minkowski).
+       p : double
+           The p-norm to apply (for Minkowski, weighted and unweighted)
+       V : ndarray
+           The variance vector (for standardized Euclidean).
+       VI : ndarray
+           The inverse of the covariance matrix (for Mahalanobis).
+
+
+    :Returns:
+       Y : ndarray
+           A :math:`$m_A$` by :math:`$m_B$` distance matrix.
+
+    Calling Conventions
+    -------------------
+
+    1. ``Y = cdist(X, 'euclidean')``
+
+       Computes the distance between m points using Euclidean distance
+       (2-norm) as the distance metric between the points. The points
+       are arranged as m n-dimensional row vectors in the matrix X.
+
+    2. ``Y = cdist(X, 'minkowski', p)``
+
+       Computes the distances using the Minkowski distance
+       :math:`$||u-v||_p$` (p-norm) where :math:`$p \geq 1$`.
+
+    3. ``Y = cdist(X, 'cityblock')``
+
+       Computes the city block or Manhattan distance between the
+       points.
+
+    4. ``Y = cdist(X, 'seuclidean', V=None)``
+
+       Computes the standardized Euclidean distance. The standardized
+       Euclidean distance between two n-vectors ``u`` and ``v`` is
+
+       .. math:
+
+          sqrt(\sum {(u_i-v_i)^2 / V[x_i]}).
+
+       V is the variance vector; V[i] is the variance computed over all
+          the i'th components of the points. If not passed, it is
+          automatically computed.
+
+    5. ``Y = cdist(X, 'sqeuclidean')``
+
+       Computes the squared Euclidean distance ||u-v||_2^2 between
+       the vectors.
+
+    6. ``Y = cdist(X, 'cosine')``
+
+       Computes the cosine distance between vectors u and v,
+
+       .. math:
+
+          \frac{1 - uv^T}
+               {{|u|}_2 {|v|}_2}
+
+       where |*|_2 is the 2 norm of its argument *.
+
+    7. ``Y = cdist(X, 'correlation')``
+
+       Computes the correlation distance between vectors u and v. This is
+
+       .. math:
+
+          \frac{1 - (u - n{|u|}_1){(v - n{|v|}_1)}^T}
+               {{|(u - n{|u|}_1)|}_2 {|(v - n{|v|}_1)|}^T}
+
+       where :math:`$|*|_1$` is the Manhattan (or 1-norm) of its
+       argument, and :math:`$n$` is the common dimensionality of the
+       vectors.
+
+    8. ``Y = cdist(X, 'hamming')``
+
+       Computes the normalized Hamming distance, or the proportion of
+       those vector elements between two n-vectors ``u`` and ``v``
+       which disagree. To save memory, the matrix ``X`` can be of type
+       boolean.
+
+    9. ``Y = cdist(X, 'jaccard')``
+
+       Computes the Jaccard distance between the points. Given two
+       vectors, ``u`` and ``v``, the Jaccard distance is the
+       proportion of those elements ``u[i]`` and ``v[i]`` that
+       disagree where at least one of them is non-zero.
+
+    10. ``Y = cdist(X, 'chebyshev')``
+
+       Computes the Chebyshev distance between the points. The
+       Chebyshev distance between two n-vectors ``u`` and ``v`` is the
+       maximum norm-1 distance between their respective elements. More
+       precisely, the distance is given by
+
+       .. math:
+
+          d(u,v) = max_i {|u_i-v_i|}.
+
+    11. ``Y = cdist(X, 'canberra')``
+
+       Computes the Canberra distance between the points. The
+       Canberra distance between two points ``u`` and ``v`` is
+
+       .. math:
+
+         d(u,v) = \sum_u {|u_i-v_i|}
+                         {|u_i|+|v_i|}
+                         
+
+    12. ``Y = cdist(X, 'braycurtis')``
+
+       Computes the Bray-Curtis distance between the points. The
+       Bray-Curtis distance between two points ``u`` and ``v`` is
+
+
+       .. math:
+
+            d(u,v) = \frac{\sum_i {u_i-v_i}}
+                          {\sum_i {u_i+v_i}}
+
+    13. ``Y = cdist(X, 'mahalanobis', VI=None)``
+
+       Computes the Mahalanobis distance between the points. The
+       Mahalanobis distance between two points ``u`` and ``v`` is
+       :math:`$(u-v)(1/V)(u-v)^T$` where :math:`$(1/V)$` (the ``VI``
+       variable) is the inverse covariance. If ``VI`` is not None,
+       ``VI`` will be used as the inverse covariance matrix.
+
+    14. ``Y = cdist(X, 'yule')``
+
+       Computes the Yule distance between each pair of boolean
+       vectors. (see yule function documentation)
+
+    15. ``Y = cdist(X, 'matching')``
+
+       Computes the matching distance between each pair of boolean
+       vectors. (see matching function documentation)
+
+    16. ``Y = cdist(X, 'dice')``
+
+       Computes the Dice distance between each pair of boolean
+       vectors. (see dice function documentation)
+
+    17. ``Y = cdist(X, 'kulsinski')``
+
+       Computes the Kulsinski distance between each pair of
+       boolean vectors. (see kulsinski function documentation)
+
+    18. ``Y = cdist(X, 'rogerstanimoto')``
+
+       Computes the Rogers-Tanimoto distance between each pair of
+       boolean vectors. (see rogerstanimoto function documentation)
+
+    19. ``Y = cdist(X, 'russellrao')``
+
+       Computes the Russell-Rao distance between each pair of
+       boolean vectors. (see russellrao function documentation)
+
+    20. ``Y = cdist(X, 'sokalmichener')``
+
+       Computes the Sokal-Michener distance between each pair of
+       boolean vectors. (see sokalmichener function documentation)
+
+    21. ``Y = cdist(X, 'sokalsneath')``
+
+       Computes the Sokal-Sneath distance between the vectors. (see
+       sokalsneath function documentation)
+
+
+    22. ``Y = cdist(X, 'wminkowski')``
+
+       Computes the weighted Minkowski distance between the
+       vectors. (see sokalsneath function documentation)
+
+    23. ``Y = cdist(X, f)``
+
+       Computes the distance between all pairs of vectors in X
+       using the user supplied 2-arity function f. For example,
+       Euclidean distance between the vectors could be computed
+       as follows::
+
+         dm = cdist(X, (lambda u, v: np.sqrt(((u-v)*(u-v).T).sum())))
+
+       Note that you should avoid passing a reference to one of
+       the distance functions defined in this library. For example,::
+
+         dm = cdist(X, sokalsneath)
+
+       would calculate the pair-wise distances between the vectors in
+       X using the Python function sokalsneath. This would result in
+       sokalsneath being called :math:`${n \choose 2}$` times, which
+       is inefficient. Instead, the optimized C version is more
+       efficient, and we call it using the following syntax.::
+
+         dm = cdist(X, 'sokalsneath')
+
+       """
+
+
+#         21. Y = cdist(X, 'test_Y')
+#
+#           Computes the distance between all pairs of vectors in X
+#           using the distance metric Y but with a more succint,
+#           verifiable, but less efficient implementation.
+
+
+    XA = np.asarray(XA, order='c')
+    XB = np.asarray(XB, order='c')
+
+    #if np.issubsctype(X, np.floating) and not np.issubsctype(X, np.double):
+    #    raise TypeError('Floating point arrays must be 64-bit (got %r).' %
+    #    (X.dtype.type,))
+
+    # The C code doesn't do striding.
+    [XA] = _copy_arrays_if_base_present([_convert_to_double(XA)])
+    [XB] = _copy_arrays_if_base_present([_convert_to_double(XB)])
+
+    s = XA.shape
+    sB = XB.shape
+
+    if len(s) != 2:
+        raise ValueError('XA must be a 2-dimensional array.');
+    if len(sB) != 2:
+        raise ValueError('XB must be a 2-dimensional array.');
+    if s[1] != sB[1]:
+        raise ValueError('XA and XB must have the same number of columns (i.e. feature dimension.)')
+
+    mA = s[0]
+    mB = sB[0]
+    n = s[1]
+    dm = np.zeros((mA, mB), dtype=np.double)
+
+    mtype = type(metric)
+    if mtype is types.FunctionType:
+        if metric == minkowski:
+            for i in xrange(0, mA):
+                for j in xrange(0, mB):
+                    dm[i, j] = minkowski(XA[i, :], XB[j, :], p)
+        elif metric == wminkowski:
+            for i in xrange(0, mA):
+                for j in xrange(0, mB):
+                    dm[i, j] = wminkowski(XA[i, :], XB[j, :], p, w)
+        elif metric == seuclidean:
+            for i in xrange(0, mA):
+                for j in xrange(0, mB):
+                    dm[i, j] = seuclidean(XA[i, :], XB[j, :], V)
+        elif metric == mahalanobis:
+            for i in xrange(0, mA):
+                for j in xrange(0, mB):
+                    dm[i, j] = mahalanobis(XA[i, :], XB[j, :], V)
+        else:
+            for i in xrange(0, mA):
+                for j in xrange(0, mB):
+                    dm[i, j] = metric(XA[i, :], XB[j, :])
+    elif mtype is types.StringType:
+        mstr = metric.lower()
+
+        #if XA.dtype != np.double and \
+        #       (mstr != 'hamming' and mstr != 'jaccard'):
+        #    TypeError('A double array must be passed.')
+        if mstr in set(['euclidean', 'euclid', 'eu', 'e']):
+            _distance_wrap.cdist_euclidean_wrap(_convert_to_double(XA),
+                                                _convert_to_double(XB), dm)
+        elif mstr in set(['sqeuclidean', 'sqe', 'sqeuclid']):
+            _distance_wrap.cdist_euclidean_wrap(_convert_to_double(XA),
+                                                _convert_to_double(XB), dm)
+            dm **= 2.0
+        elif mstr in set(['cityblock', 'cblock', 'cb', 'c']):
+            _distance_wrap.cdist_city_block_wrap(_convert_to_double(XA),
+                                                 _convert_to_double(XB), dm)
+        elif mstr in set(['hamming', 'hamm', 'ha', 'h']):
+            if XA.dtype == np.bool:
+                _distance_wrap.cdist_hamming_bool_wrap(_convert_to_bool(XA),
+                                                       _convert_to_bool(XB), dm)
+            else:
+                _distance_wrap.cdist_hamming_wrap(_convert_to_double(XA),
+                                                  _convert_to_double(XB), dm)
+        elif mstr in set(['jaccard', 'jacc', 'ja', 'j']):
+            if XA.dtype == np.bool:
+                _distance_wrap.cdist_jaccard_bool_wrap(_convert_to_bool(XA),
+                                                       _convert_to_bool(XB), dm)
+            else:
+                _distance_wrap.cdist_jaccard_wrap(_convert_to_double(XA),
+                                                  _convert_to_double(XB), dm)
+        elif mstr in set(['chebychev', 'chebyshev', 'cheby', 'cheb', 'ch']):
+            _distance_wrap.cdist_chebyshev_wrap(_convert_to_double(XA),
+                                                _convert_to_double(XB), dm)
+        elif mstr in set(['minkowski', 'mi', 'm', 'pnorm']):
+            _distance_wrap.cdist_minkowski_wrap(_convert_to_double(XA),
+                                                _convert_to_double(XB), dm, p)
+        elif mstr in set(['wminkowski', 'wmi', 'wm', 'wpnorm']):
+            _distance_wrap.cdist_weighted_minkowski_wrap(_convert_to_double(XA),
+                                                         _convert_to_double(XB), dm, p, _convert_to_double(w))
+        elif mstr in set(['seuclidean', 'se', 's']):
+            if V is not None:
+                V = np.asarray(V, order='c')
+                if type(V) != np.ndarray:
+                    raise TypeError('Variance vector V must be a numpy array')
+                if V.dtype != np.double:
+                    raise TypeError('Variance vector V must contain doubles.')
+                if len(V.shape) != 1:
+                    raise ValueError('Variance vector V must be one-dimensional.')
+                if V.shape[0] != n:
+                    raise ValueError('Variance vector V must be of the same dimension as the vectors on which the distances are computed.')
+                # The C code doesn't do striding.
+                [VV] = _copy_arrays_if_base_present([_convert_to_double(V)])
+            else:
+                X = np.vstack([XA, XB])
+                VV = np.var(X, axis=0, ddof=1)
+                X = None
+                del X
+            _distance_wrap.cdist_seuclidean_wrap(_convert_to_double(XA),
+                                                 _convert_to_double(XB), VV, dm)
+        # Need to test whether vectorized cosine works better.
+        # Find out: Is there a dot subtraction operator so I can
+        # subtract matrices in a similar way to multiplying them?
+        # Need to get rid of as much unnecessary C code as possible.
+        elif mstr in set(['cosine', 'cos']):
+            normsA = np.sqrt(np.sum(XA * XA, axis=1))
+            normsB = np.sqrt(np.sum(XB * XB, axis=1))
+            _distance_wrap.cdist_cosine_wrap(_convert_to_double(XA),
+                                             _convert_to_double(XB), dm,
+                                             normsA,
+                                             normsB)
+        elif mstr in set(['correlation', 'co']):
+            XA2 = XA - XA.mean(1)[:,np.newaxis]
+            XB2 = XB - XB.mean(1)[:,np.newaxis]
+            #X2 = X - np.matlib.repmat(np.mean(X, axis=1).reshape(m, 1), 1, n)
+            normsA = np.sqrt(np.sum(XA2 * XA2, axis=1))
+            normsB = np.sqrt(np.sum(XB2 * XB2, axis=1))
+            _distance_wrap.cdist_cosine_wrap(_convert_to_double(XA2),
+                                             _convert_to_double(XB2),
+                                             _convert_to_double(dm),
+                                             _convert_to_double(normsA),
+                                             _convert_to_double(normsB))
+        elif mstr in set(['mahalanobis', 'mahal', 'mah']):
+            if VI is not None:
+                VI = _convert_to_double(np.asarray(VI, order='c'))
+                if type(VI) != np.ndarray:
+                    raise TypeError('VI must be a numpy array.')
+                if VI.dtype != np.double:
+                    raise TypeError('The array must contain 64-bit floats.')
+                [VI] = _copy_arrays_if_base_present([VI])
+            else:
+                X = np.vstack([XA, XB])
+                V = np.cov(X.T)
+                X = None
+                del X
+                VI = _convert_to_double(np.linalg.inv(V).T.copy())
+            # (u-v)V^(-1)(u-v)^T
+            _distance_wrap.cdist_mahalanobis_wrap(_convert_to_double(XA),
+                                                  _convert_to_double(XB), VI, dm)
+        elif mstr == 'canberra':
+            _distance_wrap.cdist_canberra_wrap(_convert_to_double(XA),
+                                               _convert_to_double(XB), dm)
+        elif mstr == 'braycurtis':
+            _distance_wrap.cdist_bray_curtis_wrap(_convert_to_double(XA),
+                                                  _convert_to_double(XB), dm)
+        elif mstr == 'yule':
+            _distance_wrap.cdist_yule_bool_wrap(_convert_to_bool(XA),
+                                                _convert_to_bool(XB), dm)
+        elif mstr == 'matching':
+            _distance_wrap.cdist_matching_bool_wrap(_convert_to_bool(XA),
+                                                    _convert_to_bool(XB), dm)
+        elif mstr == 'kulsinski':
+            _distance_wrap.cdist_kulsinski_bool_wrap(_convert_to_bool(XA),
+                                                     _convert_to_bool(XB), dm)
+        elif mstr == 'dice':
+            _distance_wrap.cdist_dice_bool_wrap(_convert_to_bool(XA),
+                                                _convert_to_bool(XB), dm)
+        elif mstr == 'rogerstanimoto':
+            _distance_wrap.cdist_rogerstanimoto_bool_wrap(_convert_to_bool(XA),
+                                                          _convert_to_bool(XB), dm)
+        elif mstr == 'russellrao':
+            _distance_wrap.cdist_russellrao_bool_wrap(_convert_to_bool(XA),
+                                                      _convert_to_bool(XB), dm)
+        elif mstr == 'sokalmichener':
+            _distance_wrap.cdist_sokalmichener_bool_wrap(_convert_to_bool(XA),
+                                                         _convert_to_bool(XB), dm)
+        elif mstr == 'sokalsneath':
+            _distance_wrap.cdist_sokalsneath_bool_wrap(_convert_to_bool(XA),
+                                                       _convert_to_bool(XB), dm)
+        elif metric == 'test_euclidean':
+            dm = cdist(XA, XB, euclidean)
+        elif metric == 'test_seuclidean':
+            if V is None:
+                V = np.var(np.vstack([XA, XB]), axis=0, ddof=1)
+            else:
+                V = np.asarray(V, order='c')
+            dm = cdist(XA, XB, lambda u, v: seuclidean(u, v, V))
+        elif metric == 'test_sqeuclidean':
+            dm = cdist(XA, XB, lambda u, v: sqeuclidean(u, v))
+        elif metric == 'test_braycurtis':
+            dm = cdist(XA, XB, braycurtis)
+        elif metric == 'test_mahalanobis':
+            if VI is None:
+                X = np.vstack([XA, XB])
+                V = np.cov(X.T)
+                VI = np.linalg.inv(V)
+                X = None
+                del X
+            else:
+                VI = np.asarray(VI, order='c')
+            [VI] = _copy_arrays_if_base_present([VI])
+            # (u-v)V^(-1)(u-v)^T
+            dm = cdist(XA, XB, (lambda u, v: mahalanobis(u, v, VI)))
+        elif metric == 'test_canberra':
+            dm = cdist(XA, XB, canberra)
+        elif metric == 'test_cityblock':
+            dm = cdist(XA, XB, cityblock)
+        elif metric == 'test_minkowski':
+            dm = cdist(XA, XB, minkowski, p=p)
+        elif metric == 'test_wminkowski':
+            dm = cdist(XA, XB, wminkowski, p=p, w=w)
+        elif metric == 'test_cosine':
+            dm = cdist(XA, XB, cosine)
+        elif metric == 'test_correlation':
+            dm = cdist(XA, XB, correlation)
+        elif metric == 'test_hamming':
+            dm = cdist(XA, XB, hamming)
+        elif metric == 'test_jaccard':
+            dm = cdist(XA, XB, jaccard)
+        elif metric == 'test_chebyshev' or metric == 'test_chebychev':
+            dm = cdist(XA, XB, chebyshev)
+        elif metric == 'test_yule':
+            dm = cdist(XA, XB, yule)
+        elif metric == 'test_matching':
+            dm = cdist(XA, XB, matching)
+        elif metric == 'test_dice':
+            dm = cdist(XA, XB, dice)
+        elif metric == 'test_kulsinski':
+            dm = cdist(XA, XB, kulsinski)
+        elif metric == 'test_rogerstanimoto':
+            dm = cdist(XA, XB, rogerstanimoto)
+        elif metric == 'test_russellrao':
+            dm = cdist(XA, XB, russellrao)
+        elif metric == 'test_sokalsneath':
+            dm = cdist(XA, XB, sokalsneath)
+        elif metric == 'test_sokalmichener':
+            dm = cdist(XA, XB, sokalmichener)
+        else:
+            raise ValueError('Unknown Distance Metric: %s' % mstr)
+    else:
+        raise TypeError('2nd argument metric must be a string identifier or a function.')
+    return dm

Modified: branches/refactor_fft/scipy/cluster/hierarchy.py
===================================================================
--- branches/refactor_fft/scipy/cluster/hierarchy.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/cluster/hierarchy.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -577,7 +577,7 @@
     if not isinstance(method, str):
         raise TypeError("Argument 'method' must be a string.")
 
-    y = _convert_to_double(np.asarray(y))
+    y = _convert_to_double(np.asarray(y, order='c'))
 
     s = y.shape
     if len(s) == 1:
@@ -800,7 +800,7 @@
     library.
     """
 
-    Z = np.asarray(Z)
+    Z = np.asarray(Z, order='c')
 
     is_valid_linkage(Z, throw=True, name='Z')
 
@@ -866,48 +866,57 @@
 
 def cophenet(*args, **kwargs):
     """
+    Calculates the cophenetic distances between each observation in
+    the hierarchical clustering defined by the linkage ``Z``.
 
+    Suppose :math:`$p$` and :math:`$q$` are original observations in
+    disjoint clusters :math:`$s$` and :math:`$t$`, respectively and
+    :math:`$s$` and :math:`$t$` are joined by a direct parent cluster
+    :math:`$u$`. The cophenetic distance between observations
+    :math:`$i$` and :math:`$j$` is simply the distance between
+    clusters :math:`$s$` and :math:`$t$`.
 
+    :Parameters:
+       - Z : ndarray
+         The encoded linkage matrix on which to perform the calculation.
+
+       - Y : ndarray (optional)
+         Calculates the cophenetic correlation coefficient ``c`` of a
+         hierarchical clustering defined by the linkage matrix ``Z``
+         of a set of :math:`$n$` observations in :math:`$m$`
+         dimensions. ``Y`` is the condensed distance matrix from which
+         ``Z`` was generated. 
+
+    :Returns:
+       - c : ndarray
+         The cophentic correlation distance (if ``y`` is passed).
+ 
+       - d : ndarray
+         The cophenetic distance matrix in condensed form. The
+         :math:`$ij$`th entry is the cophenetic distance between
+         original observations :math:`$i$` and :math:`$j$`.
+
     Calling Conventions
     -------------------
 
       1. ``d = cophenet(Z)``
+         Returns just the cophentic distance matrix.
 
-      Calculates the cophenetic distances between each observation in the
-      hierarchical clustering defined by the linkage ``Z``.
-
-      Suppose :math:`$p$` and :math:`$q$` are original observations in
-      disjoint clusters :math:`$s$` and :math:`$t$`, respectively and
-      :math:`$s$` and :math:`$t$` are joined by a direct parent
-      cluster :math:`$u$`. The cophenetic distance between
-      observations :math:`$i$` and :math:`$j$` is simply the distance
-      between clusters :math:`$s$` and :math:`$t$`.
-
-      ``d`` is cophenetic distance matrix in condensed form. The
-      :math:`$ij$`th entry is the cophenetic distance between original
-      observations :math:`$i$` and :math:`$j$`.
-
       2. ``c = cophenet(Z, Y)``
+         Returns just the cophentic correlation coefficient.
 
-      Calculates the cophenetic correlation coefficient ``c`` of a
-      hierarchical clustering defined by the linkage matrix ``Z`` of a
-      set of :math:`$n$` observations in :math:`$m$` dimensions. ``Y``
-      is the condensed distance matrix from which ``Z`` was generated.
-
       3. ``(c, d) = cophenet(Z, Y, [])``
-
-      Returns a tuple instead, (c, d). The cophenetic distance matrix
-      ``d`` is included in condensed (upper triangular) form.
-
+         Returns a tuple, ``(c, d)`` where ``c`` is the cophenetic
+         correlation coefficient and ``d`` is the condensed cophentic
+         distance matrix (upper triangular form).
     """
-    Z = np.asarray(Z)
-
     nargs = len(args)
 
     if nargs < 1:
         raise ValueError('At least one argument must be passed to cophenet.')
 
     Z = args[0]
+    Z = np.asarray(Z, order='c')
     is_valid_linkage(Z, throw=True, name='Z')
     Zs = Z.shape
     n = Zs[0] + 1
@@ -922,6 +931,7 @@
         return zz
 
     Y = args[1]
+    Y = np.asarray(Y, order='c')
     Ys = Y.shape
     distance.is_valid_y(Y, throw=True, name='Y')
 
@@ -943,23 +953,37 @@
 
 def inconsistent(Z, d=2):
     """
-    R = inconsistent(Z, d=2)
+    Calculates inconsistency statistics on a linkage.
 
-      Calculates statistics on links up to d levels below each
-      non-singleton cluster defined in the (n-1)x4 linkage matrix Z.
+    :Parameters:
+       - d : int
+           The number of links up to ``d`` levels below each
+           non-singleton cluster
 
-      R is a (n-1)x5 matrix where the i'th row contains the link
-      statistics for the non-singleton cluster i. The link statistics
-      are computed over the link heights for links d levels below the
-      cluster i. R[i,0] and R[i,1] are the mean and standard deviation of
-      the link heights, respectively; R[i,2] is the number of links
-      included in the calculation; and R[i,3] is the inconsistency
-      coefficient, (Z[i, 2]-R[i,0])/R[i,2].
+       - Z : ndarray
+           The :math:`$(n-1)$` by 4 matrix encoding the linkage
+           (hierarchical clustering).  See ``linkage`` documentation
+           for more information on its form.
+       
 
-      This function behaves similarly to the MATLAB(TM) inconsistent
-      function.
+    :Returns:
+       - R : ndarray
+           A :math:`$(n-1)$` by 5 matrix where the ``i``'th row
+           contains the link statistics for the non-singleton cluster
+           ``i``. The link statistics are computed over the link
+           heights for links :math:`$d$` levels below the cluster
+           ``i``. ``R[i,0]`` and ``R[i,1]`` are the mean and standard
+           deviation of the link heights, respectively; ``R[i,2]`` is
+           the number of links included in the calculation; and
+           ``R[i,3]`` is the inconsistency coefficient,
+           .. math:
+               \frac{\mathtt{Z[i,2]}-\mathtt{R[i,0]}}
+                    {R[i,2]}.
+
+    This function behaves similarly to the MATLAB(TM) inconsistent
+    function.
     """
-    Z = np.asarray(Z)
+    Z = np.asarray(Z, order='c')
 
     Zs = Z.shape
     is_valid_linkage(Z, throw=True, name='Z')
@@ -980,19 +1004,31 @@
 
 def from_mlab_linkage(Z):
     """
-    Z2 = from_mlab_linkage(Z)
+    Converts a linkage matrix generated by MATLAB(TM) to a new
+    linkage matrix compatible with this module. The conversion does
+    two things:
 
-    Converts a linkage matrix Z generated by MATLAB(TM) to a new linkage
-    matrix Z2 compatible with this module. The conversion does two
-    things:
+     * the indices are converted from ``1..N`` to ``0..(N-1)`` form,
+       and
 
-     * the indices are converted from 1..N to 0..(N-1) form, and
+     * a fourth column Z[:,3] is added where Z[i,3] is represents the
+       number of original observations (leaves) in the non-singleton
+       cluster i.
 
-     * a fourth column Z[:,3] is added where Z[i,3] is equal to
-       the number of original observations (leaves) in the non-singleton
-       cluster i.
+    This function is useful when loading in linkages from legacy data
+    files generated by MATLAB.
+
+    :Arguments:
+
+       - Z : ndarray
+           A linkage matrix generated by MATLAB(TM)
+
+    :Returns:
+
+       - ZS : ndarray
+           A linkage matrix compatible with this library.
     """
-    Z = np.asarray(Z)
+    Z = np.asarray(Z, order='c')
     Zs = Z.shape
     Zpart = Z[:,0:2]
     Zd = Z[:,2].reshape(Zs[0], 1)
@@ -1007,27 +1043,41 @@
 
 def to_mlab_linkage(Z):
     """
-    Z2 = to_mlab_linkage(Z)
+    Converts a linkage matrix ``Z`` generated by the linkage function
+    of this module to a MATLAB(TM) compatible one. The return linkage
+    matrix has the last column removed and the cluster indices are
+    converted to ``1..N`` indexing.
 
-    Converts a linkage matrix Z generated by the linkage function of this
-    module to one compatible with MATLAB(TM). Z2 is the same as Z with the
-    last column removed and the cluster indices converted to use
-    1..N indexing.
+    :Arguments:
+       - Z : ndarray
+           A linkage matrix generated by this library.
+
+    :Returns:
+       - ZM : ndarray
+           A linkage matrix compatible with MATLAB(TM)'s hierarchical
+           clustering functions.
     """
-    Z = np.asarray(Z)
+    Z = np.asarray(Z, order='c')
     is_valid_linkage(Z, throw=True, name='Z')
 
     return np.hstack([Z[:,0:2] + 1, Z[:,2]])
 
 def is_monotonic(Z):
     """
-    is_monotonic(Z)
+    Returns ``True`` if the linkage passed is monotonic. The linkage
+    is monotonic if for every cluster :math:`$s$` and :math:`$t$`
+    joined, the distance between them is no less than the distance
+    between any previously joined clusters.
 
-      Returns True if the linkage Z is monotonic. The linkage is monotonic
-      if for every cluster s and t joined, the distance between them is
-      no less than the distance between any previously joined clusters.
+    :Arguments:
+        - Z : ndarray
+          The linkage matrix to check for monotonicity.
+
+    :Returns:
+        - b : bool
+          A boolean indicating whether the linkage is monotonic.
     """
-    Z = np.asarray(Z)
+    Z = np.asarray(Z, order='c')
     is_valid_linkage(Z, throw=True, name='Z')
 
     # We expect the i'th value to be greater than its successor.
@@ -1035,14 +1085,33 @@
 
 def is_valid_im(R, warning=False, throw=False, name=None):
     """
-    is_valid_im(R)
 
-      Returns True if the inconsistency matrix passed is valid. It must
-      be a n by 4 numpy array of doubles. The standard deviations R[:,1]
-      must be nonnegative. The link counts R[:,2] must be positive and
-      no greater than n-1.
+    Returns True if the inconsistency matrix passed is valid. It must
+    be a :math:`$n$` by 4 numpy array of doubles. The standard
+    deviations ``R[:,1]`` must be nonnegative. The link counts
+    ``R[:,2]`` must be positive and no greater than :math:`$n-1$`.
+
+    :Arguments:
+         - R : ndarray
+           The inconsistency matrix to check for validity.
+
+         - warning : bool
+           When ``True``, issues a Python warning if the linkage
+           matrix passed is invalid.
+
+         - throw : bool
+           When ``True``, throws a Python exception if the linkage
+           matrix passed is invalid.
+
+         - name : string
+           This string refers to the variable name of the invalid
+           linkage matrix.
+
+    :Returns:
+         - b : bool
+           True iff the inconsistency matrix is valid.
     """
-    R = np.asarray(R)
+    R = np.asarray(R, order='c')
     valid = True
     try:
         if type(R) != np.ndarray:
@@ -1080,29 +1149,35 @@
 
 def is_valid_linkage(Z, warning=False, throw=False, name=None):
     """
-    is_valid_linkage(Z, t)
+    Checks the validity of a linkage matrix. A linkage matrix is valid
+    if it is a two dimensional nd-array (type double) with :math:`$n$`
+    rows and 4 columns.  The first two columns must contain indices
+    between 0 and :math:`$2n-1$`. For a given row ``i``,
+    :math:`$0 \leq \mathtt{Z[i,0]} \leq i+n-1$` and
+    :math:`$0 \leq Z[i,1] \leq i+n-1$` (i.e.  a cluster
+    cannot join another cluster unless the cluster being joined has
+    been generated.)
 
-      Returns True if Z is a valid linkage matrix. The variable must
-      be a 2-dimensional double numpy array with n rows and 4 columns.
-      The first two columns must contain indices between 0 and 2n-1. For a
-      given row i, 0 <= Z[i,0] <= i+n-1 and 0 <= Z[i,1] <= i+n-1 (i.e.
-      a cluster cannot join another cluster unless the cluster being joined
-      has been generated.)
+    :Arguments:
 
-    is_valid_linkage(..., warning=True, name='V')
+         - warning : bool
+           When ``True``, issues a Python warning if the linkage
+           matrix passed is invalid.
 
-      Invokes a warning if the variable passed is not a valid linkage. The message
-      explains why the distance matrix is not valid. 'name' is used when referencing
-      the offending variable.
+         - throw : bool
+           When ``True``, throws a Python exception if the linkage
+           matrix passed is invalid.
 
-    is_valid_linkage(..., throw=True, name='V')
+         - name : string
+           This string refers to the variable name of the invalid
+           linkage matrix.
 
-      Throws an exception if the variable passed is not a valid linkage. The message
-      explains why variable is not valid. 'name' is used when referencing the offending
-      variable.
+    :Returns:
+         - b : bool
+            True iff the inconsistency matrix is valid.
 
     """
-    Z = np.asarray(Z)
+    Z = np.asarray(Z, order='c')
     valid = True
     try:
         if type(Z) != np.ndarray:
@@ -1143,25 +1218,47 @@
 
 def numobs_linkage(Z):
     """
-    Returns the number of original observations that correspond to a
-    linkage matrix Z.
+    Returns the number of original observations of the linkage matrix
+    passed.
+
+    :Arguments:
+        - Z : ndarray
+            The linkage matrix on which to perform the operation.
+
+    :Returns:
+        - n : int
+            The number of original observations in the linkage.
     """
-    Z = np.asarray(Z)
+    Z = np.asarray(Z, order='c')
     is_valid_linkage(Z, throw=True, name='Z')
     return (Z.shape[0] + 1)
 
 def Z_y_correspond(Z, Y):
     """
-    yesno = Z_y_correspond(Z, Y)
+    Checks if a linkage matrix Z and condensed distance matrix
+    Y could possibly correspond to one another.
 
-      Returns True if a linkage matrix Z and condensed distance matrix
-      Y could possibly correspond to one another. They must have the same
-      number of original observations. This function is useful as a sanity
-      check in algorithms that make extensive use of linkage and distance
-      matrices that must correspond to the same set of original observations.
+    They must have the same number of original observations for
+    the check to succeed.
+
+    This function is useful as a sanity check in algorithms that make
+    extensive use of linkage and distance matrices that must
+    correspond to the same set of original observations.
+
+    :Arguments:
+        - Z : ndarray
+            The linkage matrix to check for correspondance.
+
+        - Y : ndarray
+            The condensed distance matrix to check for correspondance.
+
+    :Returns:
+        - b : bool
+            A boolean indicating whether the linkage matrix and distance
+            matrix could possibly correspond to one another.
     """
-    Z = np.asarray(Z)
-    Y = np.asarray(Y)
+    Z = np.asarray(Z, order='c')
+    Y = np.asarray(Y, order='c')
     return numobs_y(Y) == numobs_linkage(Z)
 
 def fcluster(Z, t, criterion='inconsistent', depth=2, R=None, monocrit=None):
@@ -1221,7 +1318,7 @@
           cluster(Z, t=3, criterion='maxclust_monocrit', monocrit=MI)
 
     """
-    Z = np.asarray(Z)
+    Z = np.asarray(Z, order='c')
     is_valid_linkage(Z, throw=True, name='Z')
 
     n = Z.shape[0] + 1
@@ -1235,7 +1332,7 @@
         if R is None:
             R = inconsistent(Z, depth)
         else:
-            R = np.asarray(R)
+            R = np.asarray(R, order='c')
             is_valid_im(R, throw=True, name='R')
             # Since the C code does not support striding using strides.
             # The dimensions are used instead.
@@ -1305,7 +1402,7 @@
 
     This function is similar to MATLAB(TM) clusterdata function.
     """
-    X = np.asarray(X)
+    X = np.asarray(X, order='c')
 
     if type(X) != np.ndarray or len(X.shape) != 2:
         raise TypeError('The observation matrix X must be an n by m numpy array.')
@@ -1315,7 +1412,7 @@
     if R is None:
         R = inconsistent(Z, d=depth)
     else:
-        R = np.asarray(R)
+        R = np.asarray(R, order='c')
     T = fcluster(Z, criterion=criterion, depth=depth, R=R, t=t)
     return T
 
@@ -1326,7 +1423,7 @@
       Returns a list of leaf node ids as they appear in the tree from
       left to right. Z is a linkage matrix.
     """
-    Z = np.asarray(Z)
+    Z = np.asarray(Z, order='c')
     is_valid_linkage(Z, throw=True, name='Z')
     n = Z.shape[0] + 1
     ML = np.zeros((n,), dtype=np.int)
@@ -1765,7 +1862,7 @@
     #         or results in a crossing, an exception will be thrown. Passing
     #         None orders leaf nodes based on the order they appear in the
     #         pre-order traversal.
-    Z = np.asarray(Z)
+    Z = np.asarray(Z, order='c')
 
     is_valid_linkage(Z, throw=True, name='Z')
     Zs = Z.shape
@@ -2129,8 +2226,8 @@
       Returns True iff two different cluster assignments T1 and T2 are
       equivalent. T1 and T2 must be arrays of the same size.
     """
-    T1 = np.asarray(T1)
-    T2 = np.asarray(T2)
+    T1 = np.asarray(T1, order='c')
+    T2 = np.asarray(T2, order='c')
 
     if type(T1) != np.ndarray:
         raise TypeError('T1 must be a numpy array.')
@@ -2169,7 +2266,7 @@
       Note that when Z[:,2] is monotonic, Z[:,2] and MD should not differ.
       See linkage for more information on this issue.
     """
-    Z = np.asarray(Z)
+    Z = np.asarray(Z, order='c')
     is_valid_linkage(Z, throw=True, name='Z')
 
     n = Z.shape[0] + 1
@@ -2187,8 +2284,8 @@
       inconsistency matrix. MI is a monotonic (n-1)-sized numpy array of
       doubles.
     """
-    Z = np.asarray(Z)
-    R = np.asarray(R)
+    Z = np.asarray(Z, order='c')
+    R = np.asarray(R, order='c')
     is_valid_linkage(Z, throw=True, name='Z')
     is_valid_im(R, throw=True, name='R')
 
@@ -2207,8 +2304,8 @@
     is the maximum over R[Q(j)-n, i] where Q(j) the set of all node ids
     corresponding to nodes below and including j.
     """
-    Z = np.asarray(Z)
-    R = np.asarray(R)
+    Z = np.asarray(Z, order='c')
+    R = np.asarray(R, order='c')
     is_valid_linkage(Z, throw=True, name='Z')
     is_valid_im(R, throw=True, name='R')
     if type(i) is not types.IntType:
@@ -2244,8 +2341,8 @@
     i < n, i corresponds to an original observation, otherwise it
     corresponds to a non-singleton cluster.
     """
-    Z = np.asarray(Z)
-    T = np.asarray(T)
+    Z = np.asarray(Z, order='c')
+    T = np.asarray(T, order='c')
     if type(T) != np.ndarray or T.dtype != np.int:
         raise TypeError('T must be a one-dimensional numpy array of integers.')
     is_valid_linkage(Z, throw=True, name='Z')

Modified: branches/refactor_fft/scipy/cluster/src/distance.c
===================================================================
--- branches/refactor_fft/scipy/cluster/src/distance.c	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/cluster/src/distance.c	2008-10-23 12:30:20 UTC (rev 4828)
@@ -294,6 +294,16 @@
   return pow(s, 1.0 / p);
 }
 
+double weighted_minkowski_distance(const double *u, const double *v, int n, double p, const double *w) {
+  int i = 0;
+  double s = 0.0, d;
+  for (i = 0; i < n; i++) {
+    d = fabs(u[i] - v[i]) * w[i];
+    s = s + pow(d, p);
+  }
+  return pow(s, 1.0 / p);
+}
+
 void compute_mean_vector(double *res, const double *X, int m, int n) {
   int i, j;
   const double *v;
@@ -489,6 +499,19 @@
   }
 }
 
+void pdist_weighted_minkowski(const double *X, double *dm, int m, int n, double p, const double *w) {
+  int i, j;
+  const double *u, *v;
+  double *it = dm;
+  for (i = 0; i < m; i++) {
+    for (j = i + 1; j < m; j++, it++) {
+      u = X + (n * i);
+      v = X + (n * j);
+      *it = weighted_minkowski_distance(u, v, n, p, w);
+    }
+  }
+}
+
 void pdist_yule_bool(const char *X, double *dm, int m, int n) {
   int i, j;
   const char *u, *v;
@@ -700,7 +723,7 @@
 }
 
 void cdist_hamming_bool(const char *XA,
-			const char *XB, const char *X, double *dm, int mA, int mB, int n) {
+			const char *XB, double *dm, int mA, int mB, int n) {
   int i, j;
   const char *u, *v;
   double *it = dm;
@@ -813,6 +836,19 @@
   }
 }
 
+void cdist_weighted_minkowski(const double *XA, const double *XB, double *dm, int mA, int mB, int n, double p, const double *w) {
+  int i, j;
+  const double *u, *v;
+  double *it = dm;
+  for (i = 0; i < mA; i++) {
+    for (j = 0; j < mB; j++, it++) {
+      u = XA + (n * i);
+      v = XB + (n * j);
+      *it = weighted_minkowski_distance(u, v, n, p, w);
+    }
+  }
+}
+
 void cdist_yule_bool(const char *XA, const char *XB, double *dm, int mA, int mB, int n) {
   int i, j;
   const char *u, *v;

Modified: branches/refactor_fft/scipy/cluster/src/distance.h
===================================================================
--- branches/refactor_fft/scipy/cluster/src/distance.h	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/cluster/src/distance.h	2008-10-23 12:30:20 UTC (rev 4828)
@@ -55,6 +55,7 @@
 void pdist_jaccard_bool(const char *X, double *dm, int m, int n);
 void pdist_kulsinski_bool(const char *X, double *dm, int m, int n);
 void pdist_minkowski(const double *X, double *dm, int m, int n, double p);
+void pdist_weighted_minkowski(const double *X, double *dm, int m, int n, double p, const double *w);
 void pdist_yule_bool(const char *X, double *dm, int m, int n);
 void pdist_matching_bool(const char *X, double *dm, int m, int n);
 void pdist_dice_bool(const char *X, double *dm, int m, int n);
@@ -74,7 +75,7 @@
 void cdist_hamming(const double *XA,
 		   const double *XB, double *dm, int mA, int mB, int n);
 void cdist_hamming_bool(const char *XA,
-			const char *XB, const char *X, double *dm,
+			const char *XB, double *dm,
 			int mA, int mB, int n);
 void cdist_jaccard(const double *XA,
 		   const double *XB, double *dm, int mA, int mB, int n);
@@ -93,6 +94,8 @@
 		      int mA, int mB, int n);
 void cdist_minkowski(const double *XA, const double *XB, double *dm,
 		     int mA, int mB, int n, double p);
+void cdist_weighted_minkowski(const double *XA, const double *XB, double *dm,
+			      int mA, int mB, int n, double p, const double *w);
 void cdist_yule_bool(const char *XA, const char *XB, double *dm,
 		     int mA, int mB, int n);
 void cdist_matching_bool(const char *XA, const char *XB, double *dm,

Modified: branches/refactor_fft/scipy/cluster/src/distance_wrap.c
===================================================================
--- branches/refactor_fft/scipy/cluster/src/distance_wrap.c	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/cluster/src/distance_wrap.c	2008-10-23 12:30:20 UTC (rev 4828)
@@ -40,6 +40,530 @@
 #include <numpy/arrayobject.h>
 #include <stdio.h>
 
+extern PyObject *cdist_euclidean_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *XA_, *XB_, *dm_;
+  int mA, mB, n;
+  double *dm;
+  const double *XA, *XB;
+  if (!PyArg_ParseTuple(args, "O!O!O!",
+			&PyArray_Type, &XA_, &PyArray_Type, &XB_, 
+			&PyArray_Type, &dm_)) {
+    return 0;
+  }
+  else {
+    XA = (const double*)XA_->data;
+    XB = (const double*)XB_->data;
+    dm = (double*)dm_->data;
+    mA = XA_->dimensions[0];
+    mB = XB_->dimensions[0];
+    n = XA_->dimensions[1];
+
+    cdist_euclidean(XA, XB, dm, mA, mB, n);
+  }
+  return Py_BuildValue("d", 0.0);
+}
+
+extern PyObject *cdist_canberra_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *XA_, *XB_, *dm_;
+  int mA, mB, n;
+  double *dm;
+  const double *XA, *XB;
+  if (!PyArg_ParseTuple(args, "O!O!O!",
+			&PyArray_Type, &XA_, &PyArray_Type, &XB_, 
+			&PyArray_Type, &dm_)) {
+    return 0;
+  }
+  else {
+    XA = (const double*)XA_->data;
+    XB = (const double*)XB_->data;
+    dm = (double*)dm_->data;
+    mA = XA_->dimensions[0];
+    mB = XB_->dimensions[0];
+    n = XA_->dimensions[1];
+
+    cdist_canberra(XA, XB, dm, mA, mB, n);
+  }
+  return Py_BuildValue("d", 0.0);
+}
+
+extern PyObject *cdist_bray_curtis_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *XA_, *XB_, *dm_;
+  int mA, mB, n;
+  double *dm;
+  const double *XA, *XB;
+  if (!PyArg_ParseTuple(args, "O!O!O!",
+			&PyArray_Type, &XA_, &PyArray_Type, &XB_, 
+			&PyArray_Type, &dm_)) {
+    return 0;
+  }
+  else {
+    XA = (const double*)XA_->data;
+    XB = (const double*)XB_->data;
+    dm = (double*)dm_->data;
+    mA = XA_->dimensions[0];
+    mB = XB_->dimensions[0];
+    n = XA_->dimensions[1];
+
+    cdist_bray_curtis(XA, XB, dm, mA, mB, n);
+  }
+  return Py_BuildValue("d", 0.0);
+}
+
+
+extern PyObject *cdist_mahalanobis_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *XA_, *XB_, *covinv_, *dm_;
+  int mA, mB, n;
+  double *dm;
+  const double *XA, *XB;
+  const double *covinv;
+  if (!PyArg_ParseTuple(args, "O!O!O!O!",
+			&PyArray_Type, &XA_, &PyArray_Type, &XB_, 
+			&PyArray_Type, &covinv_,
+			&PyArray_Type, &dm_)) {
+    return 0;
+  }
+  else {
+    XA = (const double*)XA_->data;
+    XB = (const double*)XB_->data;
+    covinv = (const double*)covinv_->data;
+    dm = (double*)dm_->data;
+    mA = XA_->dimensions[0];
+    mB = XB_->dimensions[0];
+    n = XA_->dimensions[1];
+
+    cdist_mahalanobis(XA, XB, covinv, dm, mA, mB, n);
+  }
+  return Py_BuildValue("d", 0.0);
+}
+
+
+extern PyObject *cdist_chebyshev_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *XA_, *XB_, *dm_;
+  int mA, mB, n;
+  double *dm;
+  const double *XA, *XB;
+  if (!PyArg_ParseTuple(args, "O!O!O!",
+			&PyArray_Type, &XA_, &PyArray_Type, &XB_, 
+			&PyArray_Type, &dm_)) {
+    return 0;
+  }
+  else {
+    XA = (const double*)XA_->data;
+    XB = (const double*)XB_->data;
+    dm = (double*)dm_->data;
+    mA = XA_->dimensions[0];
+    mB = XB_->dimensions[0];
+    n = XA_->dimensions[1];
+
+    cdist_chebyshev(XA, XB, dm, mA, mB, n);
+  }
+  return Py_BuildValue("d", 0.0);
+}
+
+
+extern PyObject *cdist_cosine_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *XA_, *XB_, *dm_, *normsA_, *normsB_;
+  int mA, mB, n;
+  double *dm;
+  const double *XA, *XB, *normsA, *normsB;
+  if (!PyArg_ParseTuple(args, "O!O!O!O!O!",
+			&PyArray_Type, &XA_, &PyArray_Type, &XB_, 
+			&PyArray_Type, &dm_,
+			&PyArray_Type, &normsA_,
+			&PyArray_Type, &normsB_)) {
+    return 0;
+  }
+  else {
+    XA = (const double*)XA_->data;
+    XB = (const double*)XB_->data;
+    dm = (double*)dm_->data;
+    normsA = (const double*)normsA_->data;
+    normsB = (const double*)normsB_->data;
+    mA = XA_->dimensions[0];
+    mB = XB_->dimensions[0];
+    n = XA_->dimensions[1];
+
+    cdist_cosine(XA, XB, dm, mA, mB, n, normsA, normsB);
+  }
+  return Py_BuildValue("d", 0.0);
+}
+
+extern PyObject *cdist_seuclidean_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *XA_, *XB_, *dm_, *var_;
+  int mA, mB, n;
+  double *dm;
+  const double *XA, *XB, *var;
+  if (!PyArg_ParseTuple(args, "O!O!O!O!",
+			&PyArray_Type, &XA_, &PyArray_Type, &XB_, 
+			&PyArray_Type, &var_,
+			&PyArray_Type, &dm_)) {
+    return 0;
+  }
+  else {
+    XA = (const double*)XA_->data;
+    XB = (const double*)XB_->data;
+    dm = (double*)dm_->data;
+    var = (double*)var_->data;
+    mA = XA_->dimensions[0];
+    mB = XB_->dimensions[0];
+    n = XA_->dimensions[1];
+
+    cdist_seuclidean(XA, XB, var, dm, mA, mB, n);
+  }
+  return Py_BuildValue("d", 0.0);
+}
+
+extern PyObject *cdist_city_block_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *XA_, *XB_, *dm_;
+  int mA, mB, n;
+  double *dm;
+  const double *XA, *XB;
+  if (!PyArg_ParseTuple(args, "O!O!O!",
+			&PyArray_Type, &XA_, &PyArray_Type, &XB_, 
+			&PyArray_Type, &dm_)) {
+    return 0;
+  }
+  else {
+    XA = (const double*)XA_->data;
+    XB = (const double*)XB_->data;
+    dm = (double*)dm_->data;
+    mA = XA_->dimensions[0];
+    mB = XB_->dimensions[0];
+    n = XA_->dimensions[1];
+
+    cdist_city_block(XA, XB, dm, mA, mB, n);
+  }
+  return Py_BuildValue("d", 0.0);
+}
+
+extern PyObject *cdist_hamming_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *XA_, *XB_, *dm_;
+  int mA, mB, n;
+  double *dm;
+  const double *XA, *XB;
+  if (!PyArg_ParseTuple(args, "O!O!O!",
+			&PyArray_Type, &XA_, &PyArray_Type, &XB_, 
+			&PyArray_Type, &dm_)) {
+    return 0;
+  }
+  else {
+    XA = (const double*)XA_->data;
+    XB = (const double*)XB_->data;
+    dm = (double*)dm_->data;
+    mA = XA_->dimensions[0];
+    mB = XB_->dimensions[0];
+    n = XA_->dimensions[1];
+
+    cdist_hamming(XA, XB, dm, mA, mB, n);
+  }
+  return Py_BuildValue("d", 0.0);
+}
+
+extern PyObject *cdist_hamming_bool_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *XA_, *XB_, *dm_;
+  int mA, mB, n;
+  double *dm;
+  const char *XA, *XB;
+  if (!PyArg_ParseTuple(args, "O!O!O!",
+			&PyArray_Type, &XA_, &PyArray_Type, &XB_, 
+			&PyArray_Type, &dm_)) {
+    return 0;
+  }
+  else {
+    XA = (const char*)XA_->data;
+    XB = (const char*)XB_->data;
+    dm = (double*)dm_->data;
+    mA = XA_->dimensions[0];
+    mB = XB_->dimensions[0];
+    n = XA_->dimensions[1];
+
+    cdist_hamming_bool(XA, XB, dm, mA, mB, n);
+  }
+  return Py_BuildValue("d", 0.0);
+}
+
+extern PyObject *cdist_jaccard_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *XA_, *XB_, *dm_;
+  int mA, mB, n;
+  double *dm;
+  const double *XA, *XB;
+  if (!PyArg_ParseTuple(args, "O!O!O!",
+			&PyArray_Type, &XA_, &PyArray_Type, &XB_, 
+			&PyArray_Type, &dm_)) {
+    return 0;
+  }
+  else {
+    XA = (const double*)XA_->data;
+    XB = (const double*)XB_->data;
+    dm = (double*)dm_->data;
+    mA = XA_->dimensions[0];
+    mB = XB_->dimensions[0];
+    n = XA_->dimensions[1];
+
+    cdist_jaccard(XA, XB, dm, mA, mB, n);
+  }
+  return Py_BuildValue("d", 0.0);
+}
+
+extern PyObject *cdist_jaccard_bool_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *XA_, *XB_, *dm_;
+  int mA, mB, n;
+  double *dm;
+  const char *XA, *XB;
+  if (!PyArg_ParseTuple(args, "O!O!O!",
+			&PyArray_Type, &XA_, &PyArray_Type, &XB_, 
+			&PyArray_Type, &dm_)) {
+    return 0;
+  }
+  else {
+    XA = (const char*)XA_->data;
+    XB = (const char*)XB_->data;
+    dm = (double*)dm_->data;
+    mA = XA_->dimensions[0];
+    mB = XB_->dimensions[0];
+    n = XA_->dimensions[1];
+
+    cdist_jaccard_bool(XA, XB, dm, mA, mB, n);
+  }
+  return Py_BuildValue("d", 0.0);
+}
+
+extern PyObject *cdist_minkowski_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *XA_, *XB_, *dm_;
+  int mA, mB, n;
+  double *dm;
+  const double *XA, *XB;
+  double p;
+  if (!PyArg_ParseTuple(args, "O!O!O!d",
+			&PyArray_Type, &XA_, &PyArray_Type, &XB_, 
+			&PyArray_Type, &dm_,
+			&p)) {
+    return 0;
+  }
+  else {
+    XA = (const double*)XA_->data;
+    XB = (const double*)XB_->data;
+    dm = (double*)dm_->data;
+    mA = XA_->dimensions[0];
+    mB = XB_->dimensions[0];
+    n = XA_->dimensions[1];
+    cdist_minkowski(XA, XB, dm, mA, mB, n, p);
+  }
+  return Py_BuildValue("d", 0.0);
+}
+
+extern PyObject *cdist_weighted_minkowski_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *XA_, *XB_, *dm_, *w_;
+  int mA, mB, n;
+  double *dm;
+  const double *XA, *XB, *w;
+  double p;
+  if (!PyArg_ParseTuple(args, "O!O!O!dO!",
+			&PyArray_Type, &XA_, &PyArray_Type, &XB_, 
+			&PyArray_Type, &dm_,
+			&p,
+			&PyArray_Type, &w_)) {
+    return 0;
+  }
+  else {
+    XA = (const double*)XA_->data;
+    XB = (const double*)XB_->data;
+    w = (const double*)w_->data;
+    dm = (double*)dm_->data;
+    mA = XA_->dimensions[0];
+    mB = XB_->dimensions[0];
+    n = XA_->dimensions[1];
+    cdist_weighted_minkowski(XA, XB, dm, mA, mB, n, p, w);
+  }
+  return Py_BuildValue("d", 0.0);
+}
+
+extern PyObject *cdist_yule_bool_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *XA_, *XB_, *dm_;
+  int mA, mB, n;
+  double *dm;
+  const char *XA, *XB;
+  if (!PyArg_ParseTuple(args, "O!O!O!",
+			&PyArray_Type, &XA_, &PyArray_Type, &XB_, 
+			&PyArray_Type, &dm_)) {
+    return 0;
+  }
+  else {
+    XA = (const char*)XA_->data;
+    XB = (const char*)XB_->data;
+    dm = (double*)dm_->data;
+    mA = XA_->dimensions[0];
+    mB = XB_->dimensions[0];
+    n = XA_->dimensions[1];
+
+    cdist_yule_bool(XA, XB, dm, mA, mB, n);
+  }
+  return Py_BuildValue("");
+}
+
+extern PyObject *cdist_matching_bool_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *XA_, *XB_, *dm_;
+  int mA, mB, n;
+  double *dm;
+  const char *XA, *XB;
+  if (!PyArg_ParseTuple(args, "O!O!O!",
+			&PyArray_Type, &XA_, &PyArray_Type, &XB_, 
+			&PyArray_Type, &dm_)) {
+    return 0;
+  }
+  else {
+    XA = (const char*)XA_->data;
+    XB = (const char*)XB_->data;
+    dm = (double*)dm_->data;
+    mA = XA_->dimensions[0];
+    mB = XB_->dimensions[0];
+    n = XA_->dimensions[1];
+
+    cdist_matching_bool(XA, XB, dm, mA, mB, n);
+  }
+  return Py_BuildValue("");
+}
+
+extern PyObject *cdist_dice_bool_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *XA_, *XB_, *dm_;
+  int mA, mB, n;
+  double *dm;
+  const char *XA, *XB;
+  if (!PyArg_ParseTuple(args, "O!O!O!",
+			&PyArray_Type, &XA_, &PyArray_Type, &XB_, 
+			&PyArray_Type, &dm_)) {
+    return 0;
+  }
+  else {
+    XA = (const char*)XA_->data;
+    XB = (const char*)XB_->data;
+    dm = (double*)dm_->data;
+    mA = XA_->dimensions[0];
+    mB = XB_->dimensions[0];
+    n = XA_->dimensions[1];
+
+    cdist_dice_bool(XA, XB, dm, mA, mB, n);
+  }
+  return Py_BuildValue("");
+}
+
+extern PyObject *cdist_rogerstanimoto_bool_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *XA_, *XB_, *dm_;
+  int mA, mB, n;
+  double *dm;
+  const char *XA, *XB;
+  if (!PyArg_ParseTuple(args, "O!O!O!",
+			&PyArray_Type, &XA_, &PyArray_Type, &XB_, 
+			&PyArray_Type, &dm_)) {
+    return 0;
+  }
+  else {
+    XA = (const char*)XA_->data;
+    XB = (const char*)XB_->data;
+    dm = (double*)dm_->data;
+    mA = XA_->dimensions[0];
+    mB = XB_->dimensions[0];
+    n = XA_->dimensions[1];
+
+    cdist_rogerstanimoto_bool(XA, XB, dm, mA, mB, n);
+  }
+  return Py_BuildValue("");
+}
+
+extern PyObject *cdist_russellrao_bool_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *XA_, *XB_, *dm_;
+  int mA, mB, n;
+  double *dm;
+  const char *XA, *XB;
+  if (!PyArg_ParseTuple(args, "O!O!O!",
+			&PyArray_Type, &XA_, &PyArray_Type, &XB_, 
+			&PyArray_Type, &dm_)) {
+    return 0;
+  }
+  else {
+    XA = (const char*)XA_->data;
+    XB = (const char*)XB_->data;
+    dm = (double*)dm_->data;
+    mA = XA_->dimensions[0];
+    mB = XB_->dimensions[0];
+    n = XA_->dimensions[1];
+
+    cdist_russellrao_bool(XA, XB, dm, mA, mB, n);
+  }
+  return Py_BuildValue("");
+}
+
+extern PyObject *cdist_kulsinski_bool_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *XA_, *XB_, *dm_;
+  int mA, mB, n;
+  double *dm;
+  const char *XA, *XB;
+  if (!PyArg_ParseTuple(args, "O!O!O!",
+			&PyArray_Type, &XA_, &PyArray_Type, &XB_, 
+			&PyArray_Type, &dm_)) {
+    return 0;
+  }
+  else {
+    XA = (const char*)XA_->data;
+    XB = (const char*)XB_->data;
+    dm = (double*)dm_->data;
+    mA = XA_->dimensions[0];
+    mB = XB_->dimensions[0];
+    n = XA_->dimensions[1];
+
+    cdist_kulsinski_bool(XA, XB, dm, mA, mB, n);
+  }
+  return Py_BuildValue("");
+}
+
+extern PyObject *cdist_sokalmichener_bool_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *XA_, *XB_, *dm_;
+  int mA, mB, n;
+  double *dm;
+  const char *XA, *XB;
+  if (!PyArg_ParseTuple(args, "O!O!O!",
+			&PyArray_Type, &XA_, &PyArray_Type, &XB_, 
+			&PyArray_Type, &dm_)) {
+    return 0;
+  }
+  else {
+    XA = (const char*)XA_->data;
+    XB = (const char*)XB_->data;
+    dm = (double*)dm_->data;
+    mA = XA_->dimensions[0];
+    mB = XB_->dimensions[0];
+    n = XA_->dimensions[1];
+
+    cdist_sokalmichener_bool(XA, XB, dm, mA, mB, n);
+  }
+  return Py_BuildValue("");
+}
+
+extern PyObject *cdist_sokalsneath_bool_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *XA_, *XB_, *dm_;
+  int mA, mB, n;
+  double *dm;
+  const char *XA, *XB;
+  if (!PyArg_ParseTuple(args, "O!O!O!",
+			&PyArray_Type, &XA_, &PyArray_Type, &XB_, 
+			&PyArray_Type, &dm_)) {
+    return 0;
+  }
+  else {
+    XA = (const char*)XA_->data;
+    XB = (const char*)XB_->data;
+    dm = (double*)dm_->data;
+    mA = XA_->dimensions[0];
+    mB = XB_->dimensions[0];
+    n = XA_->dimensions[1];
+
+    cdist_sokalsneath_bool(XA, XB, dm, mA, mB, n);
+  }
+  return Py_BuildValue("");
+}
+
+/***************************** pdist ***/
+
 extern PyObject *pdist_euclidean_wrap(PyObject *self, PyObject *args) {
   PyArrayObject *X_, *dm_;
   int m, n;
@@ -324,7 +848,31 @@
   return Py_BuildValue("d", 0.0);
 }
 
+extern PyObject *pdist_weighted_minkowski_wrap(PyObject *self, PyObject *args) {
+  PyArrayObject *X_, *dm_, *w_;
+  int m, n;
+  double *dm, *X, *w;
+  double p;
+  if (!PyArg_ParseTuple(args, "O!O!dO!",
+			&PyArray_Type, &X_,
+			&PyArray_Type, &dm_,
+			&p,
+			&PyArray_Type, &w_)) {
+    return 0;
+  }
+  else {
+    X = (double*)X_->data;
+    dm = (double*)dm_->data;
+    w = (const double*)w_->data;
+    m = X_->dimensions[0];
+    n = X_->dimensions[1];
 
+    pdist_weighted_minkowski(X, dm, m, n, p, w);
+  }
+  return Py_BuildValue("d", 0.0);
+}
+
+
 extern PyObject *pdist_yule_bool_wrap(PyObject *self, PyObject *args) {
   PyArrayObject *X_, *dm_;
   int m, n;
@@ -533,6 +1081,28 @@
 
 
 static PyMethodDef _distanceWrapMethods[] = {
+  {"cdist_bray_curtis_wrap", cdist_bray_curtis_wrap, METH_VARARGS},
+  {"cdist_canberra_wrap", cdist_canberra_wrap, METH_VARARGS},
+  {"cdist_chebyshev_wrap", cdist_chebyshev_wrap, METH_VARARGS},
+  {"cdist_city_block_wrap", cdist_city_block_wrap, METH_VARARGS},
+  {"cdist_cosine_wrap", cdist_cosine_wrap, METH_VARARGS},
+  {"cdist_dice_bool_wrap", cdist_dice_bool_wrap, METH_VARARGS},
+  {"cdist_euclidean_wrap", cdist_euclidean_wrap, METH_VARARGS},
+  {"cdist_hamming_wrap", cdist_hamming_wrap, METH_VARARGS},
+  {"cdist_hamming_bool_wrap", cdist_hamming_bool_wrap, METH_VARARGS},
+  {"cdist_jaccard_wrap", cdist_jaccard_wrap, METH_VARARGS},
+  {"cdist_jaccard_bool_wrap", cdist_jaccard_bool_wrap, METH_VARARGS},
+  {"cdist_kulsinski_bool_wrap", cdist_kulsinski_bool_wrap, METH_VARARGS},
+  {"cdist_mahalanobis_wrap", cdist_mahalanobis_wrap, METH_VARARGS},
+  {"cdist_matching_bool_wrap", cdist_matching_bool_wrap, METH_VARARGS},
+  {"cdist_minkowski_wrap", cdist_minkowski_wrap, METH_VARARGS},
+  {"cdist_weighted_minkowski_wrap", cdist_weighted_minkowski_wrap, METH_VARARGS},
+  {"cdist_rogerstanimoto_bool_wrap", cdist_rogerstanimoto_bool_wrap, METH_VARARGS},
+  {"cdist_russellrao_bool_wrap", cdist_russellrao_bool_wrap, METH_VARARGS},
+  {"cdist_seuclidean_wrap", cdist_seuclidean_wrap, METH_VARARGS},
+  {"cdist_sokalmichener_bool_wrap", cdist_sokalmichener_bool_wrap, METH_VARARGS},
+  {"cdist_sokalsneath_bool_wrap", cdist_sokalsneath_bool_wrap, METH_VARARGS},
+  {"cdist_yule_bool_wrap", cdist_yule_bool_wrap, METH_VARARGS},
   {"pdist_bray_curtis_wrap", pdist_bray_curtis_wrap, METH_VARARGS},
   {"pdist_canberra_wrap", pdist_canberra_wrap, METH_VARARGS},
   {"pdist_chebyshev_wrap", pdist_chebyshev_wrap, METH_VARARGS},
@@ -548,6 +1118,7 @@
   {"pdist_mahalanobis_wrap", pdist_mahalanobis_wrap, METH_VARARGS},
   {"pdist_matching_bool_wrap", pdist_matching_bool_wrap, METH_VARARGS},
   {"pdist_minkowski_wrap", pdist_minkowski_wrap, METH_VARARGS},
+  {"pdist_weighted_minkowski_wrap", pdist_weighted_minkowski_wrap, METH_VARARGS},
   {"pdist_rogerstanimoto_bool_wrap", pdist_rogerstanimoto_bool_wrap, METH_VARARGS},
   {"pdist_russellrao_bool_wrap", pdist_russellrao_bool_wrap, METH_VARARGS},
   {"pdist_seuclidean_wrap", pdist_seuclidean_wrap, METH_VARARGS},

Copied: branches/refactor_fft/scipy/cluster/tests/cdist-X1.txt (from rev 4827, trunk/scipy/cluster/tests/cdist-X1.txt)

Copied: branches/refactor_fft/scipy/cluster/tests/cdist-X2.txt (from rev 4827, trunk/scipy/cluster/tests/cdist-X2.txt)

Modified: branches/refactor_fft/scipy/cluster/tests/test_distance.py
===================================================================
--- branches/refactor_fft/scipy/cluster/tests/test_distance.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/cluster/tests/test_distance.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -34,17 +34,16 @@
 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
-import sys
 import os.path
 
 import numpy as np
 from numpy.testing import *
-from scipy.cluster.hierarchy import linkage, from_mlab_linkage, numobs_linkage
-from scipy.cluster.distance import squareform, pdist, matching, jaccard, dice, sokalsneath, rogerstanimoto, russellrao, yule, numobs_dm, numobs_y
+from scipy.cluster.distance import squareform, pdist, cdist, matching, \
+    jaccard, dice, sokalsneath, rogerstanimoto, russellrao, yule
 
-#from scipy.cluster.hierarchy import pdist, euclidean
-
 _filenames = ["iris.txt",
+              "cdist-X1.txt",
+              "cdist-X2.txt",
               "pdist-hamming-ml.txt",
               "pdist-boolean-inp.txt",
               "pdist-jaccard-ml.txt",
@@ -97,6 +96,365 @@
 #print np.abs(Y_test2 - Y_right).max()
 #print np.abs(Y_test1 - Y_right).max()
 
+class TestCdist(TestCase):
+    """
+    Test suite for the pdist function.
+    """
+
+    def test_cdist_euclidean_random(self):
+        "Tests cdist(X, 'euclidean') on random data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1']
+        X2 = eo['cdist-X2']
+        Y1 = cdist(X1, X2, 'euclidean')
+        Y2 = cdist(X1, X2, 'test_euclidean')
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_sqeuclidean_random(self):
+        "Tests cdist(X, 'sqeuclidean') on random data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1']
+        X2 = eo['cdist-X2']
+        Y1 = cdist(X1, X2, 'sqeuclidean')
+        Y2 = cdist(X1, X2, 'test_sqeuclidean')
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_cityblock_random(self):
+        "Tests cdist(X, 'sqeuclidean') on random data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1']
+        X2 = eo['cdist-X2']
+        Y1 = cdist(X1, X2, 'cityblock')
+        Y2 = cdist(X1, X2, 'test_cityblock')
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_hamming_double_random(self):
+        "Tests cdist(X, 'hamming') on random data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1']
+        X2 = eo['cdist-X2']
+        Y1 = cdist(X1, X2, 'hamming')
+        Y2 = cdist(X1, X2, 'test_hamming')
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_hamming_bool_random(self):
+        "Tests cdist(X, 'hamming') on random boolean data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1'] < 0.5
+        X2 = eo['cdist-X2'] < 0.5
+        Y1 = cdist(X1, X2, 'hamming')
+        Y2 = cdist(X1, X2, 'test_hamming')
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_jaccard_double_random(self):
+        "Tests cdist(X, 'jaccard') on random data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1']
+        X2 = eo['cdist-X2']
+        Y1 = cdist(X1, X2, 'jaccard')
+        Y2 = cdist(X1, X2, 'test_jaccard')
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_jaccard_bool_random(self):
+        "Tests cdist(X, 'jaccard') on random boolean data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1'] < 0.5
+        X2 = eo['cdist-X2'] < 0.5
+        Y1 = cdist(X1, X2, 'jaccard')
+        Y2 = cdist(X1, X2, 'test_jaccard')
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_chebychev_random(self):
+        "Tests cdist(X, 'chebychev') on random data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1']
+        X2 = eo['cdist-X2']
+        Y1 = cdist(X1, X2, 'chebychev')
+        Y2 = cdist(X1, X2, 'test_chebychev')
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_minkowski_random_p3d8(self):
+        "Tests cdist(X, 'minkowski') on random data. (p=3.8)"
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1']
+        X2 = eo['cdist-X2']
+        Y1 = cdist(X1, X2, 'minkowski', p=3.8)
+        Y2 = cdist(X1, X2, 'test_minkowski', p=3.8)
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_minkowski_random_p4d6(self):
+        "Tests cdist(X, 'minkowski') on random data. (p=4.6)"
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1']
+        X2 = eo['cdist-X2']
+        Y1 = cdist(X1, X2, 'minkowski', p=4.6)
+        Y2 = cdist(X1, X2, 'test_minkowski', p=4.6)
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_minkowski_random_p1d23(self):
+        "Tests cdist(X, 'minkowski') on random data. (p=1.23)"
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1']
+        X2 = eo['cdist-X2']
+        Y1 = cdist(X1, X2, 'minkowski', p=1.23)
+        Y2 = cdist(X1, X2, 'test_minkowski', p=1.23)
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+
+    def test_cdist_wminkowski_random_p3d8(self):
+        "Tests cdist(X, 'wminkowski') on random data. (p=3.8)"
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1']
+        X2 = eo['cdist-X2']
+        w = 1.0 / X1.std(axis=0)
+        Y1 = cdist(X1, X2, 'wminkowski', p=3.8, w=w)
+        Y2 = cdist(X1, X2, 'test_wminkowski', p=3.8, w=w)
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_wminkowski_random_p4d6(self):
+        "Tests cdist(X, 'wminkowski') on random data. (p=4.6)"
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1']
+        X2 = eo['cdist-X2']
+        w = 1.0 / X1.std(axis=0)
+        Y1 = cdist(X1, X2, 'wminkowski', p=4.6, w=w)
+        Y2 = cdist(X1, X2, 'test_wminkowski', p=4.6, w=w)
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_wminkowski_random_p1d23(self):
+        "Tests cdist(X, 'wminkowski') on random data. (p=1.23)"
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1']
+        X2 = eo['cdist-X2']
+        w = 1.0 / X1.std(axis=0)
+        Y1 = cdist(X1, X2, 'wminkowski', p=1.23, w=w)
+        Y2 = cdist(X1, X2, 'test_wminkowski', p=1.23, w=w)
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+
+    def test_cdist_seuclidean_random(self):
+        "Tests cdist(X, 'seuclidean') on random data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1']
+        X2 = eo['cdist-X2']
+        Y1 = cdist(X1, X2, 'seuclidean')
+        Y2 = cdist(X1, X2, 'test_seuclidean')
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_sqeuclidean_random(self):
+        "Tests cdist(X, 'sqeuclidean') on random data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1']
+        X2 = eo['cdist-X2']
+        Y1 = cdist(X1, X2, 'sqeuclidean')
+        Y2 = cdist(X1, X2, 'test_sqeuclidean')
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_cosine_random(self):
+        "Tests cdist(X, 'cosine') on random data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1']
+        X2 = eo['cdist-X2']
+        Y1 = cdist(X1, X2, 'cosine')
+        Y2 = cdist(X1, X2, 'test_cosine')
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_correlation_random(self):
+        "Tests cdist(X, 'correlation') on random data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1']
+        X2 = eo['cdist-X2']
+        Y1 = cdist(X1, X2, 'correlation')
+        Y2 = cdist(X1, X2, 'test_correlation')
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_mahalanobis_random(self):
+        "Tests cdist(X, 'mahalanobis') on random data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1']
+        X2 = eo['cdist-X2']
+        Y1 = cdist(X1, X2, 'mahalanobis')
+        Y2 = cdist(X1, X2, 'test_mahalanobis')
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_canberra_random(self):
+        "Tests cdist(X, 'canberra') on random data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1'] < 0.5
+        X2 = eo['cdist-X2'] < 0.5
+        Y1 = cdist(X1, X2, 'canberra')
+        Y2 = cdist(X1, X2, 'test_canberra')
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_braycurtis_random(self):
+        "Tests cdist(X, 'braycurtis') on random data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1'] < 0.5
+        X2 = eo['cdist-X2'] < 0.5
+        Y1 = cdist(X1, X2, 'braycurtis')
+        Y2 = cdist(X1, X2, 'test_braycurtis')
+        if verbose > 2:
+            print Y1, Y2
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_yule_random(self):
+        "Tests cdist(X, 'yule') on random data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1'] < 0.5
+        X2 = eo['cdist-X2'] < 0.5
+        Y1 = cdist(X1, X2, 'yule')
+        Y2 = cdist(X1, X2, 'test_yule')
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_matching_random(self):
+        "Tests cdist(X, 'matching') on random data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1'] < 0.5
+        X2 = eo['cdist-X2'] < 0.5
+        Y1 = cdist(X1, X2, 'matching')
+        Y2 = cdist(X1, X2, 'test_matching')
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_kulsinski_random(self):
+        "Tests cdist(X, 'kulsinski') on random data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1'] < 0.5
+        X2 = eo['cdist-X2'] < 0.5
+        Y1 = cdist(X1, X2, 'kulsinski')
+        Y2 = cdist(X1, X2, 'test_kulsinski')
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_dice_random(self):
+        "Tests cdist(X, 'dice') on random data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1'] < 0.5
+        X2 = eo['cdist-X2'] < 0.5
+        Y1 = cdist(X1, X2, 'dice')
+        Y2 = cdist(X1, X2, 'test_dice')
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_rogerstanimoto_random(self):
+        "Tests cdist(X, 'rogerstanimoto') on random data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1'] < 0.5
+        X2 = eo['cdist-X2'] < 0.5
+        Y1 = cdist(X1, X2, 'rogerstanimoto')
+        Y2 = cdist(X1, X2, 'test_rogerstanimoto')
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_russellrao_random(self):
+        "Tests cdist(X, 'russellrao') on random data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1'] < 0.5
+        X2 = eo['cdist-X2'] < 0.5
+        Y1 = cdist(X1, X2, 'russellrao')
+        Y2 = cdist(X1, X2, 'test_russellrao')
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_sokalmichener_random(self):
+        "Tests cdist(X, 'sokalmichener') on random data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1'] < 0.5
+        X2 = eo['cdist-X2'] < 0.5
+        Y1 = cdist(X1, X2, 'sokalmichener')
+        Y2 = cdist(X1, X2, 'test_sokalmichener')
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
+    def test_cdist_sokalsneath_random(self):
+        "Tests cdist(X, 'sokalsneath') on random data."
+        eps = 1e-07
+        # Get the data: the input matrix and the right output.
+        X1 = eo['cdist-X1'] < 0.5
+        X2 = eo['cdist-X2'] < 0.5
+        Y1 = cdist(X1, X2, 'sokalsneath')
+        Y2 = cdist(X1, X2, 'test_sokalsneath')
+        if verbose > 2:
+            print (Y1-Y2).max()
+        self.failUnless(within_tol(Y1, Y2, eps))
+
 class TestPdist(TestCase):
     """
     Test suite for the pdist function.

Modified: branches/refactor_fft/scipy/cluster/tests/test_hierarchy.py
===================================================================
--- branches/refactor_fft/scipy/cluster/tests/test_hierarchy.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/cluster/tests/test_hierarchy.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -33,14 +33,13 @@
 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-import sys
 import os.path
 
 import numpy as np
 from numpy.testing import *
 
 from scipy.cluster.hierarchy import linkage, from_mlab_linkage, numobs_linkage, inconsistent
-from scipy.cluster.distance import squareform, pdist, matching, jaccard, dice, sokalsneath, rogerstanimoto, russellrao, yule, numobs_dm, numobs_y
+from scipy.cluster.distance import squareform, pdist, numobs_dm, numobs_y
 
 _tdist = np.array([[0,    662,  877,  255,  412,  996],
                    [662,  0,    295,  468,  268,  400],

Modified: branches/refactor_fft/scipy/cluster/tests/test_vq.py
===================================================================
--- branches/refactor_fft/scipy/cluster/tests/test_vq.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/cluster/tests/test_vq.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -3,13 +3,12 @@
 # David Cournapeau
 # Last Change: Tue Jun 24 04:00 PM 2008 J
 
-import sys
 import os.path
 
 import numpy as np
 from numpy.testing import *
 
-from scipy.cluster.vq import kmeans, kmeans2, py_vq, py_vq2, _py_vq_1d, vq, ClusterError
+from scipy.cluster.vq import kmeans, kmeans2, py_vq, py_vq2, vq, ClusterError
 try:
     from scipy.cluster import _vq
     TESTC=True

Modified: branches/refactor_fft/scipy/fftpack/benchmarks/bench_basic.py
===================================================================
--- branches/refactor_fft/scipy/fftpack/benchmarks/bench_basic.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/fftpack/benchmarks/bench_basic.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -2,11 +2,9 @@
 """
 import sys
 from numpy.testing import *
-from scipy.fftpack import ifft,fft,fftn,ifftn,rfft,irfft
-from scipy.fftpack import _fftpack as fftpack
+from scipy.fftpack import ifft, fft, fftn, irfft
 
-from numpy import arange, add, array, asarray, zeros, dot, exp, pi,\
-     swapaxes, double, cdouble
+from numpy import arange, asarray, zeros, dot, exp, pi, double, cdouble
 import numpy.fft
 
 from numpy.random import rand

Modified: branches/refactor_fft/scipy/fftpack/benchmarks/bench_pseudo_diffs.py
===================================================================
--- branches/refactor_fft/scipy/fftpack/benchmarks/bench_pseudo_diffs.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/fftpack/benchmarks/bench_pseudo_diffs.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -2,12 +2,10 @@
 """
 import sys
 
-from numpy import arange, add, array, sin, cos, pi,exp,tanh,sum,sign
+from numpy import arange, sin, cos, pi, exp, tanh, sign
 
 from numpy.testing import *
-from scipy.fftpack import diff,fft,ifft,tilbert,itilbert,hilbert,ihilbert,rfft
-from scipy.fftpack import shift
-from scipy.fftpack import fftfreq
+from scipy.fftpack import diff, fft, ifft, tilbert, hilbert, shift, fftfreq
 
 def random(size):
     return rand(*size)

Modified: branches/refactor_fft/scipy/fftpack/tests/test_basic.py
===================================================================
--- branches/refactor_fft/scipy/fftpack/tests/test_basic.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/fftpack/tests/test_basic.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -10,7 +10,7 @@
 Run tests if fftpack is not installed:
   python tests/test_basic.py
 """
-import sys
+
 from numpy.testing import *
 from scipy.fftpack import ifft,fft,fftn,ifftn,rfft,irfft
 

Modified: branches/refactor_fft/scipy/fftpack/tests/test_helper.py
===================================================================
--- branches/refactor_fft/scipy/fftpack/tests/test_helper.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/fftpack/tests/test_helper.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -11,7 +11,6 @@
   python tests/test_helper.py [<level>]
 """
 
-import sys
 from numpy.testing import *
 from scipy.fftpack import fftshift,ifftshift,fftfreq,rfftfreq
 

Modified: branches/refactor_fft/scipy/fftpack/tests/test_pseudo_diffs.py
===================================================================
--- branches/refactor_fft/scipy/fftpack/tests/test_pseudo_diffs.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/fftpack/tests/test_pseudo_diffs.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -10,13 +10,12 @@
 Run tests if fftpack is not installed:
   python tests/test_pseudo_diffs.py [<level>]
 """
-import sys
+
 from numpy.testing import *
-from scipy.fftpack import diff,fft,ifft,tilbert,itilbert,hilbert,ihilbert,rfft
-from scipy.fftpack import shift
-from scipy.fftpack import fftfreq
+from scipy.fftpack import diff, fft, ifft, tilbert, itilbert, hilbert, \
+                          ihilbert, shift, fftfreq
 
-from numpy import arange, add, array, sin, cos, pi,exp,tanh,sum,sign
+from numpy import arange, sin, cos, pi, exp, tanh, sum, sign
 
 def random(size):
     return rand(*size)

Modified: branches/refactor_fft/scipy/integrate/ode.py
===================================================================
--- branches/refactor_fft/scipy/integrate/ode.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/integrate/ode.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -147,7 +147,7 @@
 __version__ = "$Id$"
 __docformat__ = "restructuredtext en"
 
-from numpy import asarray, array, zeros, sin, int32, isscalar
+from numpy import asarray, array, zeros, int32, isscalar
 import re, sys
 
 #------------------------------------------------------------------------------

Modified: branches/refactor_fft/scipy/integrate/quadpack.py
===================================================================
--- branches/refactor_fft/scipy/integrate/quadpack.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/integrate/quadpack.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -6,10 +6,10 @@
 import _quadpack
 import sys
 import numpy
+from numpy import inf, Inf
 
 error = _quadpack.error
 
-
 def quad_explain(output=sys.stdout):
     output.write("""
 Extra information for quad() inputs and outputs:
@@ -117,8 +117,6 @@
     return
 
 
-from numpy import inf, Inf
-
 def quad(func, a, b, args=(), full_output=0, epsabs=1.49e-8, epsrel=1.49e-8,
          limit=50, points=None, weight=None, wvar=None, wopts=None, maxp1=50,
          limlst=50):

Modified: branches/refactor_fft/scipy/integrate/quadrature.py
===================================================================
--- branches/refactor_fft/scipy/integrate/quadrature.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/integrate/quadrature.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -6,7 +6,6 @@
 from scipy.special import gammaln
 from numpy import sum, ones, add, diff, isinf, isscalar, \
      asarray, real, trapz, arange, empty
-import scipy as sp
 import numpy as np
 
 def fixed_quad(func,a,b,args=(),n=5):

Modified: branches/refactor_fft/scipy/integrate/tests/test_integrate.py
===================================================================
--- branches/refactor_fft/scipy/integrate/tests/test_integrate.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/integrate/tests/test_integrate.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -4,9 +4,8 @@
 """
 
 import numpy
-from numpy import (arange, zeros, array, dot, sqrt, cos, sin, absolute,
-                   eye, pi, exp, allclose)
-from scipy.linalg import norm
+from numpy import arange, zeros, array, dot, sqrt, cos, sin, eye, pi, exp, \
+                  allclose
 
 from numpy.testing import *
 from scipy.integrate import odeint, ode

Modified: branches/refactor_fft/scipy/integrate/tests/test_quadpack.py
===================================================================
--- branches/refactor_fft/scipy/integrate/tests/test_quadpack.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/integrate/tests/test_quadpack.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,4 +1,3 @@
-import numpy
 from numpy import sqrt, cos, sin, arctan, exp, log, pi, Inf
 from numpy.testing import *
 from scipy.integrate import quad, dblquad, tplquad

Modified: branches/refactor_fft/scipy/interpolate/SConscript
===================================================================
--- branches/refactor_fft/scipy/interpolate/SConscript	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/interpolate/SConscript	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,4 +1,4 @@
-# Last Change: Thu Jun 12 07:00 PM 2008 J
+# Last Change: Fri Oct 10 03:00 PM 2008 J
 # vim:syntax=python
 from os.path import join as pjoin
 
@@ -34,7 +34,11 @@
 env.PrependUnique(LIBPATH = ['.'])
 
 # Build _fitpack
-env.NumpyPythonExtension('_fitpack', source = '_fitpackmodule.c')
+env.NumpyPythonExtension('_fitpack', source = 'src/_fitpackmodule.c')
 
 # Build dfitpack
-env.NumpyPythonExtension('dfitpack', source = 'fitpack.pyf')
+env.NumpyPythonExtension('dfitpack', source = 'src/fitpack.pyf')
+
+# Build _interpolate
+env.NumpyPythonExtension('_interpolate', source = 'src/_interpolate.cpp',
+                         CXXFILESUFFIX = ".cpp")

Modified: branches/refactor_fft/scipy/interpolate/interpolate.py
===================================================================
--- branches/refactor_fft/scipy/interpolate/interpolate.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/interpolate/interpolate.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -6,11 +6,10 @@
 __all__ = ['interp1d', 'interp2d', 'spline', 'spleval', 'splmake', 'spltopp',
            'ppform', 'lagrange']
 
-from numpy import shape, sometrue, rank, array, transpose, \
-     swapaxes, searchsorted, clip, take, ones, putmask, less, greater, \
-     logical_or, atleast_1d, atleast_2d, meshgrid, ravel, dot, poly1d
+from numpy import shape, sometrue, rank, array, transpose, searchsorted, \
+                  ones, logical_or, atleast_1d, atleast_2d, meshgrid, ravel, \
+                  dot, poly1d
 import numpy as np
-import scipy.linalg as slin
 import scipy.special as spec
 import math
 

Modified: branches/refactor_fft/scipy/interpolate/polyint.py
===================================================================
--- branches/refactor_fft/scipy/interpolate/polyint.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/interpolate/polyint.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,6 +1,5 @@
 import numpy as np
 from scipy import factorial
-from numpy import poly1d
 
 __all__ = ["KroghInterpolator", "krogh_interpolate", "BarycentricInterpolator", "barycentric_interpolate", "PiecewisePolynomial", "piecewise_polynomial_interpolate","approximate_taylor_polynomial"]
 

Modified: branches/refactor_fft/scipy/interpolate/tests/test_fitpack.py
===================================================================
--- branches/refactor_fft/scipy/interpolate/tests/test_fitpack.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/interpolate/tests/test_fitpack.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -12,13 +12,10 @@
 """
 #import libwadpy
 
-import sys
 from numpy.testing import *
 from numpy import array, diff
-from scipy.interpolate.fitpack2 import UnivariateSpline,LSQUnivariateSpline,\
-     InterpolatedUnivariateSpline
-from scipy.interpolate.fitpack2 import LSQBivariateSpline, \
-     SmoothBivariateSpline, RectBivariateSpline
+from scipy.interpolate.fitpack2 import UnivariateSpline, LSQBivariateSpline, \
+    SmoothBivariateSpline, RectBivariateSpline
 
 class TestUnivariateSpline(TestCase):
     def test_linear_constant(self):

Modified: branches/refactor_fft/scipy/io/__init__.py
===================================================================
--- branches/refactor_fft/scipy/io/__init__.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/io/__init__.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -80,6 +80,7 @@
 from netcdf import netcdf_file, netcdf_variable
 
 from recaster import sctype_attributes, Recaster
+import matlab.byteordercodes as byteordercodes
 from data_store import save_as_module
 from mmio import mminfo, mmread, mmwrite
 

Modified: branches/refactor_fft/scipy/io/arff/arffread.py
===================================================================
--- branches/refactor_fft/scipy/io/arff/arffread.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/io/arff/arffread.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -2,7 +2,6 @@
 # Last Change: Mon Aug 20 08:00 PM 2007 J
 import re
 import itertools
-import sys
 
 import numpy as np
 

Modified: branches/refactor_fft/scipy/io/arff/tests/test_data.py
===================================================================
--- branches/refactor_fft/scipy/io/arff/tests/test_data.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/io/arff/tests/test_data.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -2,7 +2,8 @@
 """Tests for parsing full arff files."""
 import os
 
-import numpy as N
+import numpy as np
+
 from numpy.testing import *
 
 from scipy.io.arff.arffread import loadarff

Modified: branches/refactor_fft/scipy/io/arff/tests/test_header.py
===================================================================
--- branches/refactor_fft/scipy/io/arff/tests/test_header.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/io/arff/tests/test_header.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -4,8 +4,7 @@
 
 from numpy.testing import *
 
-from scipy.io.arff.arffread import read_header, MetaData, parse_type, \
-                                   ParseArffError
+from scipy.io.arff.arffread import read_header, parse_type, ParseArffError
 
 data_path = os.path.join(os.path.dirname(__file__), 'data')
 

Modified: branches/refactor_fft/scipy/io/fopen.py
===================================================================
--- branches/refactor_fft/scipy/io/fopen.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/io/fopen.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -2,7 +2,8 @@
 
 # Author: Travis Oliphant
 
-import struct, os, sys
+import struct
+import sys
 import types
 
 from numpy import *

Copied: branches/refactor_fft/scipy/io/matlab/byteordercodes.py (from rev 4827, trunk/scipy/io/matlab/byteordercodes.py)

Modified: branches/refactor_fft/scipy/io/matlab/mio.py
===================================================================
--- branches/refactor_fft/scipy/io/matlab/mio.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/io/matlab/mio.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -6,7 +6,9 @@
 
 import os
 import sys
+import warnings
 
+from miobase import get_matfile_version
 from mio4 import MatFile4Reader, MatFile4Writer
 from mio5 import MatFile5Reader, MatFile5Writer
 
@@ -57,11 +59,16 @@
             raise IOError, 'Reader needs file name or open file-like object'
         byte_stream = file_name
 
-    MR = MatFile4Reader(byte_stream, **kwargs)
-    if MR.format_looks_right():
-        return MR
-    return MatFile5Reader(byte_stream, **kwargs)
-
+    mjv, mnv = get_matfile_version(byte_stream)
+    if mjv == 0:
+        return MatFile4Reader(byte_stream, **kwargs)
+    elif mjv == 1:
+        return MatFile5Reader(byte_stream, **kwargs)
+    elif mjv == 2:
+        raise NotImplementedError('Please use PyTables for matlab v7.3 (HDF) files')
+    else:
+        raise TypeError('Did not recognize version %s' % mv)
+    
 def loadmat(file_name,  mdict=None, appendmat=True, basename='raw', **kwargs):
     ''' Load Matlab(tm) file
 
@@ -88,10 +95,17 @@
     matlab_compatible   - returns matrices as would be loaded by matlab
                           (implies squeeze_me=False, chars_as_strings=False,
                           mat_dtype=True)
+    struct_as_record    - whether to load matlab structs as numpy record arrays, or
+    			  as old-style numpy arrays with dtype=object.
+                          (warns if not set, and defaults to False.  non-recarrays 
+                          cannot be exported via savemat.)
 
     v4 (Level 1.0), v6 and v7.1 matfiles are supported.
 
     '''
+    if not kwargs.get('struct_as_record', False):
+        warnings.warn("loading matlab structures as arrays of dtype=object is deprecated",
+                      DeprecationWarning, stacklevel=2)
     MR = mat_reader_factory(file_name, appendmat, **kwargs)
     matfile_dict = MR.get_variables()
     if mdict is not None:
@@ -125,7 +139,7 @@
     if format == '4':
         MW = MatFile4Writer(file_stream)
     elif format == '5':
-        MW = MatFile5Writer(file_stream)
+        MW = MatFile5Writer(file_stream, unicode_strings=True)
     else:
         raise ValueError, 'Format should be 4 or 5'
     MW.put_variables(mdict)

Modified: branches/refactor_fft/scipy/io/matlab/mio4.py
===================================================================
--- branches/refactor_fft/scipy/io/matlab/mio4.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/io/matlab/mio4.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,10 +1,14 @@
 ''' Classes for read / write of matlab (TM) 4 files
 '''
+import sys
 
 import numpy as np
 
-from miobase import *
+from miobase import MatFileReader, MatArrayReader, MatMatrixGetter, \
+     MatFileWriter, MatStreamWriter, spsparse
 
+SYS_LITTLE_ENDIAN = sys.byteorder == 'little'
+
 miDOUBLE = 0
 miSINGLE = 1
 miINT32 = 2
@@ -63,7 +67,7 @@
         ''' Read header, return matrix getter '''
         data = self.read_dtype(self.dtypes['header'])
         header = {}
-        header['name'] = self.read_ztstring(data['namlen'])
+        header['name'] = self.read_ztstring(int(data['namlen']))
         if data['mopt'] < 0 or  data['mopt'] > 5000:
             ValueError, 'Mat 4 mopt wrong format, byteswapping problem?'
         M,rest = divmod(data['mopt'], 1000)
@@ -175,8 +179,8 @@
         else:
             V = np.ascontiguousarray(tmp[:,2],dtype='complex')
             V.imag = tmp[:,3]
-        if have_sparse:
-            return scipy.sparse.coo_matrix((V,(I,J)), dims)
+        if spsparse:
+            return spsparse.coo_matrix((V,(I,J)), dims)
         return (dims, I, J, V)
 
 
@@ -198,22 +202,13 @@
     def matrix_getter_factory(self):
         return self._array_reader.matrix_getter_factory()
 
-    def format_looks_right(self):
-        # Mat4 files have a zero somewhere in first 4 bytes
-        self.mat_stream.seek(0)
-        mopt_bytes = np.ndarray(shape=(4,),
-                                dtype=np.uint8,
-                                buffer = self.mat_stream.read(4))
-        self.mat_stream.seek(0)
-        return 0 in mopt_bytes
-
     def guess_byte_order(self):
         self.mat_stream.seek(0)
         mopt = self.read_dtype(np.dtype('i4'))
         self.mat_stream.seek(0)
         if mopt < 0 or mopt > 5000:
-            return ByteOrder.swapped_code
-        return ByteOrder.native_code
+            return SYS_LITTLE_ENDIAN and '>' or '<'
+        return SYS_LITTLE_ENDIAN and '<' or '>'
 
 
 class Mat4MatrixWriter(MatStreamWriter):
@@ -228,7 +223,7 @@
         if dims is None:
             dims = self.arr.shape
         header = np.empty((), mdtypes_template['header'])
-        M = not ByteOrder.little_endian
+        M = not SYS_LITTLE_ENDIAN
         O = 0
         header['mopt'] = (M * 1000 +
                           O * 100 +
@@ -323,8 +318,8 @@
     arr         - array to write
     name        - name in matlab (TM) workspace
     '''
-    if have_sparse:
-        if scipy.sparse.issparse(arr):
+    if spsparse:
+        if spsparse.issparse(arr):
             return Mat4SparseWriter(stream, arr, name)
     arr = np.array(arr)
     dtt = arr.dtype.type

Modified: branches/refactor_fft/scipy/io/matlab/mio5.py
===================================================================
--- branches/refactor_fft/scipy/io/matlab/mio5.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/io/matlab/mio5.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -4,40 +4,16 @@
 # Small fragments of current code adapted from matfile.py by Heiko
 # Henkelmann
 
-## Notice in matfile.py file
-
-# Copyright (c) 2003 Heiko Henkelmann
-
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to
-# deal in the Software without restriction, including without limitation the
-# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-# sell copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-
+import sys
 import zlib
+from cStringIO import StringIO
 from copy import copy as pycopy
-from cStringIO import StringIO
+
 import numpy as np
 
-from miobase import *
+from miobase import MatFileReader, MatArrayReader, MatMatrixGetter, \
+     MatFileWriter, MatStreamWriter, spsparse
 
-try:  # Python 2.3 support
-    from sets import Set as set
-except:
-    pass
-
 miINT8 = 1
 miUINT8 = 2
 miINT16 = 3
@@ -56,6 +32,10 @@
 
 mxCELL_CLASS = 1
 mxSTRUCT_CLASS = 2
+# The March 2008 edition of "Matlab 7 MAT-File Format" says that
+# mxOBJECT_CLASS = 3, whereas matrix.h says that mxLOGICAL = 3.
+# Matlab 2008a appears to save logicals as type 9, so we assume that
+# the document is correct.  See type 18, below.
 mxOBJECT_CLASS = 3
 mxCHAR_CLASS = 4
 mxSPARSE_CLASS = 5
@@ -67,6 +47,14 @@
 mxUINT16_CLASS = 11
 mxINT32_CLASS = 12
 mxUINT32_CLASS = 13
+# The following are not in the March 2008 edition of "Matlab 7
+# MAT-File Format," but were guessed from matrix.h.
+mxINT64_CLASS = 14
+mxUINT64_CLASS = 15
+mxFUNCTION_CLASS = 16
+# Not doing anything with these at the moment.
+mxOPAQUE_CLASS = 17
+mxOBJECT_CLASS_FROM_MATRIX_H = 18
 
 mdtypes_template = {
     miINT8: 'i1',
@@ -102,6 +90,8 @@
     mxUINT16_CLASS: 'u2',
     mxINT32_CLASS: 'i4',
     mxUINT32_CLASS: 'u4',
+    mxINT64_CLASS: 'i8',
+    mxUINT64_CLASS: 'u8',
     mxSINGLE_CLASS: 'f4',
     mxDOUBLE_CLASS: 'f8',
     }
@@ -117,9 +107,11 @@
     'i1': miINT8,
     'i2': miINT16,
     'i4': miINT32,
+    'i8': miINT64,
     'u1': miUINT8,
+    'u2': miUINT16,
     'u4': miUINT32,
-    'u2': miUINT16,
+    'u8': miUINT64,
     'S1': miUINT8,
     'U1': miUTF16,
     }
@@ -132,8 +124,10 @@
     'c16': mxDOUBLE_CLASS,
     'f4': mxSINGLE_CLASS,
     'c8': mxSINGLE_CLASS,
+    'i8': mxINT64_CLASS,
     'i4': mxINT32_CLASS,
     'i2': mxINT16_CLASS,
+    'u8': mxUINT64_CLASS,
     'u2': mxUINT16_CLASS,
     'u1': mxUINT8_CLASS,
     'S1': mxUINT8_CLASS,
@@ -163,16 +157,10 @@
     mxUINT16_CLASS,
     mxINT32_CLASS,
     mxUINT32_CLASS,
+    mxINT64_CLASS,
+    mxUINT64_CLASS,
     )
 
-class mat_struct(object):
-    ''' Placeholder for holding read data from structs '''
-    pass
-
-class mat_obj(object):
-    ''' Placeholder for holding read data from objects '''
-    pass
-
 class Mat5ArrayReader(MatArrayReader):
     ''' Class to get Mat5 arrays
 
@@ -180,13 +168,13 @@
     factory function
     '''
 
-    def __init__(self, mat_stream, dtypes, processor_func, codecs, class_dtypes):
+    def __init__(self, mat_stream, dtypes, processor_func, codecs, class_dtypes, struct_as_record):
         super(Mat5ArrayReader, self).__init__(mat_stream,
                                               dtypes,
-                                              processor_func,
-                                              )
+                                              processor_func)
         self.codecs = codecs
         self.class_dtypes = class_dtypes
+        self.struct_as_record = struct_as_record
 
     def read_element(self, copy=True):
         raw_tag = self.mat_stream.read(8)
@@ -228,7 +216,7 @@
                             buffer=raw_str)
             if copy:
                 el = el.copy()
-
+       
         return el
 
     def matrix_getter_factory(self):
@@ -277,6 +265,8 @@
             return Mat5StructMatrixGetter(self, header)
         if mc == mxOBJECT_CLASS:
             return Mat5ObjectMatrixGetter(self, header)
+        if mc == mxFUNCTION_CLASS:
+            return Mat5FunctionMatrixGetter(self, header)
         raise TypeError, 'No reader for class code %s' % mc
 
 
@@ -294,7 +284,8 @@
             array_reader.dtypes,
             array_reader.processor_func,
             array_reader.codecs,
-            array_reader.class_dtypes)
+            array_reader.class_dtypes,
+            array_reader.struct_as_record)
 
 
 class Mat5MatrixGetter(MatMatrixGetter):
@@ -322,6 +313,7 @@
         self.mat_stream = array_reader.mat_stream
         self.data_position = self.mat_stream.tell()
         self.header = {}
+        self.name = ''
         self.is_global = False
         self.mat_dtype = 'f8'
 
@@ -380,11 +372,10 @@
         nnz = indptr[-1]
         rowind = rowind[:nnz]
         data   = data[:nnz]
-        if have_sparse:
-            from scipy.sparse import csc_matrix
-            return csc_matrix((data,rowind,indptr), shape=(M,N))
+        if spsparse:
+            return spsparse.csc_matrix((data,rowind,indptr), shape=(M,N))
         else:
-            return (dims, data, rowind, indptr)
+            return ((M,N), data, rowind, indptr)
 
 
 class Mat5CharMatrixGetter(Mat5MatrixGetter):
@@ -420,44 +411,91 @@
     def get_item(self):
         return self.read_element()
 
+class mat_struct(object):
+    ''' Placeholder for holding read data from structs '''
+    pass
 
-class Mat5StructMatrixGetter(Mat5CellMatrixGetter):
-    def __init__(self, *args, **kwargs):
-        super(Mat5StructMatrixGetter, self).__init__(*args, **kwargs)
-        self.obj_template = mat_struct()
+class Mat5StructMatrixGetter(Mat5MatrixGetter):
+    def __init__(self, array_reader, header):
+        super(Mat5StructMatrixGetter, self).__init__(array_reader, header)
+        self.struct_as_record = array_reader.struct_as_record
 
     def get_raw_array(self):
         namelength = self.read_element()[0]
-        # get field names
         names = self.read_element()
-        splitnames = [names[i:i+namelength] for i in \
-                      xrange(0,len(names),namelength)]
-        self.obj_template._fieldnames = [x.tostring().strip('\x00')
-                                        for x in splitnames]
-        return super(Mat5StructMatrixGetter, self).get_raw_array()
+        field_names = [names[i:i+namelength].tostring().strip('\x00')
+                       for i in xrange(0,len(names),namelength)]
+        tupdims = tuple(self.header['dims'][::-1])
+        length = np.product(tupdims)
+        if self.struct_as_record:
+            result = np.empty(length, dtype=[(field_name, object) 
+                                             for field_name in field_names])
+            for i in range(length):
+                for field_name in field_names:
+                    result[i][field_name] = self.read_element()
+        else: # Backward compatibility with previous format
+            self.obj_template = mat_struct()
+            self.obj_template._fieldnames = field_names
+            result = np.empty(length, dtype=object)
+            for i in range(length):
+                item = pycopy(self.obj_template)
+                for name in field_names:
+                    item.__dict__[name] = self.read_element()
+                result[i] = item
+        
+        return result.reshape(tupdims).T
 
-    def get_item(self):
-        item = pycopy(self.obj_template)
-        for element in item._fieldnames:
-            item.__dict__[element]  = self.read_element()
-        return item
+class MatlabObject(object):
+    ''' Class to contain read data from matlab objects '''
+    def __init__(self, classname, field_names):
+        self.__dict__['classname'] = classname
+        self.__dict__['mobj_recarray'] = np.empty((1,1), dtype=[(field_name, object) 
+                                            for field_name in field_names])
 
+    def __getattr__(self, name):
+        mobj_recarray = self.__dict__['mobj_recarray']
+        if name in mobj_recarray.dtype.fields:
+            return mobj_recarray[0,0][name]
+        else:
+            raise AttributeError, "no field named %s in MatlabObject"%(name)
 
-class Mat5ObjectMatrixGetter(Mat5StructMatrixGetter):
-    def __init__(self, *args, **kwargs):
-        super(Mat5StructMatrixGetter, self).__init__(*args, **kwargs)
-        self.obj_template = mat_obj()
+    def __setattr__(self, name, value):
+        if name in self.__dict__['mobj_recarray'].dtype.fields:
+            self.__dict__['mobj_recarray'][0,0][name] = value
+        else:
+            self.__dict__[name] = value
+        
 
-    def get_raw_array(self):
-        self.obj_template._classname = self.read_element().tostring()
-        return super(Mat5ObjectMatrixGetter, self).get_raw_array()
+class Mat5ObjectMatrixGetter(Mat5MatrixGetter):
+    def get_array(self):
+        '''Matlab ojects are essentially structs, with an extra field, the classname.'''
+        classname = self.read_element().tostring()
+        namelength = self.read_element()[0]
+        names = self.read_element()
+        field_names = [names[i:i+namelength].tostring().strip('\x00')
+                       for i in xrange(0,len(names),namelength)]
+        result = MatlabObject(classname, field_names)
 
+        for field_name in field_names:
+            result.__setattr__(field_name, self.read_element())
 
+        return result
+
+
+class MatlabFunctionMatrix:
+    ''' Opaque object representing an array of function handles. '''
+    def __init__(self, arr):
+        self.arr = arr
+
+class Mat5FunctionMatrixGetter(Mat5CellMatrixGetter):
+    def get_array(self):
+        return MatlabFunctionMatrix(self.get_raw_array())
+
+
 class MatFile5Reader(MatFileReader):
     ''' Reader for Mat 5 mat files
-
     Adds the following attribute to base class
-
+    
     uint16_codec       - char codec to use for uint16 char arrays
                           (defaults to system default codec)
    '''
@@ -469,15 +507,45 @@
                  squeeze_me=False,
                  chars_as_strings=True,
                  matlab_compatible=False,
+                 struct_as_record=False,
                  uint16_codec=None
                  ):
+        '''
+        mat_stream : file-like
+                     object with file API, open for reading
+        byte_order : {None, string} 
+                      specification of byte order, one of:
+		      ('native', '=', 'little', '<', 'BIG', '>')
+        mat_dtype : {True, False} boolean
+                     If True, return arrays in same dtype as loaded into matlab
+                     otherwise return with dtype with which they were saved
+        squeeze_me : {False, True} boolean
+                     If True, squeezes dimensions of size 1 from arrays
+        chars_as_strings : {True, False} boolean
+                     If True, convert char arrays to string arrays
+        matlab_compatible : {False, True} boolean
+                     If True, returns matrices as would be loaded by matlab
+                     (implies squeeze_me=False, chars_as_strings=False
+                     mat_dtype=True, struct_as_record=True)
+        struct_as_record : {False, True} boolean 
+                     If True, return strutures as numpy records,
+                     otherwise, return as custom object (for
+                     compatibility with scipy 0.6)
+        uint16_codec : {None, string}
+                     Set codec to use for uint16 char arrays
+                     (e.g. 'utf-8').  Use system default codec if None
+        '''
         self.codecs = {}
+        # Missing inputs to array reader set later (processor func
+        # below, dtypes, codecs via our own set_dtype function, called
+        # from parent __init__)
         self._array_reader = Mat5ArrayReader(
             mat_stream,
             None,
             None,
             None,
             None,
+            struct_as_record
             )
         super(MatFile5Reader, self).__init__(
             mat_stream,
@@ -534,6 +602,8 @@
         return self._array_reader.matrix_getter_factory()
 
     def guess_byte_order(self):
+        ''' Guess byte order.
+        Sets stream pointer to 0 '''
         self.mat_stream.seek(126)
         mi = self.mat_stream.read(2)
         self.mat_stream.seek(0)
@@ -549,16 +619,7 @@
         hdict['__version__'] = '%d.%d' % (v_major, v_minor)
         return hdict
 
-    def format_looks_right(self):
-        # Mat4 files have a zero somewhere in first 4 bytes
-        self.mat_stream.seek(0)
-        mopt_bytes = np.ndarray(shape=(4,),
-                                dtype=np.uint8,
-                                buffer = self.mat_stream.read(4))
-        self.mat_stream.seek(0)
-        return 0 not in mopt_bytes
 
-
 class Mat5MatrixWriter(MatStreamWriter):
 
     mat_tag = np.zeros((), mdtypes_template['tag_full'])
@@ -644,7 +705,6 @@
 
 
 class Mat5NumericWriter(Mat5MatrixWriter):
-
     def write(self):
         imagf = self.arr.dtype.kind == 'c'
         try:
@@ -684,10 +744,8 @@
 
 
 class Mat5SparseWriter(Mat5MatrixWriter):
-
     def write(self):
         ''' Sparse matrices are 2D
-
         '''
         A = self.arr.tocsc() # convert to sparse CSC format
         A.sort_indices()     # MATLAB expects sorted row indices
@@ -704,6 +762,80 @@
         self.update_matrix_tag()
 
 
+class Mat5CompositeWriter(Mat5MatrixWriter):
+    def __init__(self, file_stream, arr, name, is_global=False, unicode_strings=False):
+        super(Mat5CompositeWriter, self).__init__(file_stream, arr, name, is_global)
+        self.unicode_strings = unicode_strings
+        
+
+class Mat5CellWriter(Mat5CompositeWriter):
+    def write(self):
+        self.write_header(mclass=mxCELL_CLASS)
+        # loop over data, column major
+        A = np.atleast_2d(self.arr).flatten('F')
+        MWG = Mat5WriterGetter(self.file_stream, self.unicode_strings)
+        for el in A:
+            MW = MWG.matrix_writer_factory(el, '')
+            MW.write()
+        self.update_matrix_tag()
+
+class Mat5FunctionWriter(Mat5CompositeWriter):
+    def __init__(self, file_stream, arr, name, is_global=False, unicode_strings=False):
+        super(Mat5FunctionWriter, self).__init__(file_stream, arr.arr, name, is_global)
+
+    def write(self):
+        self.write_header(mclass=mxFUNCTION_CLASS)
+        # loop over data, column major
+        A = np.atleast_2d(self.arr).flatten('F')
+        MWG = Mat5WriterGetter(self.file_stream, self.unicode_strings)
+        for el in A:
+            MW = MWG.matrix_writer_factory(el, '')
+            MW.write()
+        self.update_matrix_tag()
+
+
+class Mat5StructWriter(Mat5CompositeWriter):
+    def write(self):
+        self.write_header(mclass=mxSTRUCT_CLASS)
+        
+        # write fieldnames
+        fieldnames = [f[0] for f in self.arr.dtype.descr]
+        self.write_element(np.array([32], dtype='i4'))
+        self.write_element(np.array(fieldnames, dtype='S32'), mdtype=miINT8)
+        
+        A = np.atleast_2d(self.arr).flatten('F')
+        MWG = Mat5WriterGetter(self.file_stream, self.unicode_strings)
+        for el in A:
+            for f in fieldnames:
+                MW = MWG.matrix_writer_factory(el[f], '')
+                MW.write()
+        self.update_matrix_tag()
+
+class Mat5ObjectWriter(Mat5CompositeWriter):
+    def __init__(self, file_stream, arr, name, is_global=False, unicode_strings=False):
+        super(Mat5ObjectWriter, self).__init__(file_stream, arr.__dict__['mobj_recarray'], name, is_global)
+        self.classname = arr.classname
+
+    def write(self):
+        self.write_header(mclass=mxOBJECT_CLASS)
+
+        # write classnames
+        self.write_element(np.array(self.classname, dtype='S'), mdtype=miINT8)
+
+        # write fieldnames
+        fieldnames = [f[0] for f in self.arr.dtype.descr]
+        self.write_element(np.array([32], dtype='i4'))
+        self.write_element(np.array(fieldnames, dtype='S32'), mdtype=miINT8)
+        
+        A = np.atleast_2d(self.arr).flatten('F')
+        MWG = Mat5WriterGetter(self.file_stream, self.unicode_strings)
+        for el in A:
+            for f in fieldnames:
+                MW = MWG.matrix_writer_factory(el[f], '')
+                MW.write()
+        self.update_matrix_tag()
+
+    
 class Mat5WriterGetter(object):
     ''' Wraps stream and options, provides methods for getting Writer objects '''
     def __init__(self, stream, unicode_strings):
@@ -719,18 +851,21 @@
         arr         - array to write
         name        - name in matlab (TM) workspace
         '''
-        if have_sparse:
-            if scipy.sparse.issparse(arr):
+        if spsparse:
+            if spsparse.issparse(arr):
                 return Mat5SparseWriter(self.stream, arr, name, is_global)
+            
+        if isinstance(arr, MatlabFunctionMatrix):
+            return Mat5FunctionWriter(self.stream, arr, name, is_global, self.unicode_strings)
+        if isinstance(arr, MatlabObject):
+            return Mat5ObjectWriter(self.stream, arr, name, is_global, self.unicode_strings)
+        
         arr = np.array(arr)
         if arr.dtype.hasobject:
-            types, arr_type = self.classify_mobjects(arr)
-            if arr_type == 'c':
-                return Mat5CellWriter(self.stream, arr, name, is_global, types)
-            elif arr_type == 's':
-                return Mat5StructWriter(self.stream, arr, name, is_global)
-            elif arr_type == 'o':
-                return Mat5ObjectWriter(self.stream, arr, name, is_global)
+            if arr.dtype.fields == None:
+                return Mat5CellWriter(self.stream, arr, name, is_global, self.unicode_strings)
+            else:
+                return Mat5StructWriter(self.stream, arr, name, is_global, self.unicode_strings)
         if arr.dtype.kind in ('U', 'S'):
             if self.unicode_strings:
                 return Mat5UniCharWriter(self.stream, arr, name, is_global)
@@ -739,47 +874,6 @@
         else:
             return Mat5NumericWriter(self.stream, arr, name, is_global)
 
-    def classify_mobjects(self, objarr):
-        ''' Function to classify objects passed for writing
-        returns
-        types         - S1 array of same shape as objarr with codes for each object
-                        i  - invalid object
-                        a  - ndarray
-                        s  - matlab struct
-                        o  - matlab object
-        arr_type       - one of
-                        c  - cell array
-                        s  - struct array
-                        o  - object array
-        '''
-        n = objarr.size
-        types = np.empty((n,), dtype='S1')
-        types[:] = 'i'
-        type_set = set()
-        flato = objarr.flat
-        for i in range(n):
-            obj = flato[i]
-            if isinstance(obj, np.ndarray):
-                types[i] = 'a'
-                continue
-            try:
-                fns = tuple(obj._fieldnames)
-            except AttributeError:
-                continue
-            try:
-                cn = obj._classname
-            except AttributeError:
-                types[i] = 's'
-                type_set.add(fns)
-                continue
-            types[i] = 'o'
-            type_set.add((cn, fns))
-        arr_type = 'c'
-        if len(set(types))==1 and len(type_set) == 1:
-            arr_type = types[0]
-        return types.reshape(objarr.shape), arr_type
-
-
 class MatFile5Writer(MatFileWriter):
     ''' Class for writing mat5 files '''
     def __init__(self, file_stream,
@@ -815,6 +909,8 @@
 
     def put_variables(self, mdict):
         for name, var in mdict.items():
+            if name[0] == '_':
+                continue
             is_global = name in self.global_vars
             self.writer_getter.rewind()
             self.writer_getter.matrix_writer_factory(

Modified: branches/refactor_fft/scipy/io/matlab/miobase.py
===================================================================
--- branches/refactor_fft/scipy/io/matlab/miobase.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/io/matlab/miobase.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -4,17 +4,16 @@
 Base classes for matlab (TM) file stream reading
 """
 
-import sys
-
 import numpy as np
 
+import byteordercodes as boc
+
+# sparse module if available
 try:
-    import scipy.sparse
-    have_sparse = 1
+    import scipy.sparse as spsparse
 except ImportError:
-    have_sparse = 0
+    spsparse = None
 
-
 def small_product(arr):
     ''' Faster than product for small arrays '''
     res = 1
@@ -22,26 +21,68 @@
         res *= e
     return res
 
+def get_matfile_version(fileobj):
+    ''' Return major, minor tuple depending on apparent mat file type
+
+    Where:
+
+     #. 0,x -> version 4 format mat files
+     #. 1,x -> version 5 format mat files
+     #. 2,x -> version 7.3 format mat files (HDF format)
+     
+    Parameters
+    ----------
+    fileobj : {file-like}
+              object implementing seek() and read()
+
+    Returns
+    -------
+    major_version : {0, 1, 2}
+                    major matlab file format version
+    minor_version : int
+                    major matlab file format version
+
+    Notes
+    -----
+    Has the side effect of setting the file read pointer to 0
+    '''
+    # Mat4 files have a zero somewhere in first 4 bytes
+    fileobj.seek(0)
+    mopt_bytes = np.ndarray(shape=(4,),
+                           dtype=np.uint8,
+                           buffer = fileobj.read(4))
+    if 0 in mopt_bytes:
+        fileobj.seek(0)
+        return (0,0)
+    
+    # For 5 format or 7.3 format we need to read an integer in the
+    # header. Bytes 124 through 128 contain a version integer and an
+    # endian test string
+    fileobj.seek(124)
+    tst_str = fileobj.read(4)
+    fileobj.seek(0)
+    maj_ind = int(tst_str[2] == 'I')
+    maj_val = ord(tst_str[maj_ind])
+    min_val = ord(tst_str[1-maj_ind])
+    ret = (maj_val, min_val)
+    if maj_val in (1, 2):
+        return ret
+    else:
+        raise ValueError('Unknown mat file type, version %s' % ret)
+
+
 class ByteOrder(object):
     ''' Namespace for byte ordering '''
-    little_endian = sys.byteorder == 'little'
-    native_code = little_endian and '<' or '>'
-    swapped_code = little_endian and '>' or '<'
+    little_endian = boc.sys_is_le
+    native_code = boc.native_code
+    swapped_code = boc.swapped_code
+    to_numpy_code = boc.to_numpy_code
 
-    def to_numpy_code(code):
-        if code is None:
-            return ByteOrder.native_code
-        if code in ('little', '<', 'l', 'L'):
-            return '<'
-        elif code in ('BIG', '>', 'B', 'b'):
-            return '>'
-        elif code in ('native', '='):
-            return ByteOrder.native_code
-        elif code in ('swapped'):
-            return ByteOrder.swapped_code
-        else:
-            raise ValueError, 'We cannot handle byte order %s' % byte_order
-    to_numpy_code = staticmethod(to_numpy_code)
+ByteOrder = np.deprecate_with_doc("""
+We no longer use the ByteOrder class, and deprecate it; we will remove
+it in future versions of scipy.  Please use the
+scipy.io.matlab.byteordercodes module instead.
+""")(ByteOrder)
 
 
 class MatStreamAgent(object):
@@ -50,7 +91,7 @@
     Attaches to initialized stream
 
     Base class for "getters" - which do store state of what they are
-    reading on itialization, and therefore need to be initialized
+    reading on initialization, and therefore need to be initialized
     before each read, and "readers" which do not store state, and only
     need to be initialized once on object creation
 
@@ -84,26 +125,11 @@
 class MatFileReader(MatStreamAgent):
     """ Base object for reading mat files
 
-    mat_stream         - initialized byte stream object  - file io interface object
-    byte_order         - byte order ('native', 'little', 'BIG')
-                          in ('native', '=')
-                          or in ('little', '<')
-                          or in ('BIG', '>')
-    mat_dtype          - return arrays in same dtype as loaded into matlab
-                         (instead of the dtype with which they were saved)
-    squeeze_me         - whether to squeeze unit dimensions or not
-    chars_as_strings   - whether to convert char arrays to string arrays
-    matlab_compatible  - returns matrices as would be loaded by matlab
-                         (implies squeeze_me=False, chars_as_strings=False
-                         mat_dtype=True)
-
     To make this class functional, you will need to override the
     following methods:
 
     set_dtypes              - sets data types defs from byte order
     matrix_getter_factory   - gives object to fetch next matrix from stream
-    format_looks_right      - returns True if format looks correct for
-                              this file type (Mat4, Mat5)
     guess_byte_order        - guesses file byte order from file
     """
 
@@ -113,7 +139,27 @@
                  squeeze_me=False,
                  chars_as_strings=True,
                  matlab_compatible=False,
+                 struct_as_record=False
                  ):
+        '''
+        mat_stream : file-like
+                     object with file API, open for reading
+        byte_order : {None, string} 
+                      specification of byte order, one of:
+		      ('native', '=', 'little', '<', 'BIG', '>')
+        mat_dtype : {True, False} boolean
+                     If True, return arrays in same dtype as loaded into matlab
+                     otherwise return with dtype with which they were saved
+        squeeze_me : {False, True} boolean
+                     If True, squeezes dimensions of size 1 from arrays
+        chars_as_strings : {True, False} boolean
+                     If True, convert char arrays to string arrays
+        matlab_compatible : {False, True} boolean
+                     If True, returns matrices as would be loaded by matlab
+                     (implies squeeze_me=False, chars_as_strings=False
+                     mat_dtype=True)
+ 
+        '''
         # Initialize stream
         self.mat_stream = mat_stream
         self.dtypes = {}
@@ -163,12 +209,12 @@
     chars_as_strings = property(get_chars_as_strings,
                                 set_chars_as_strings,
                                 None,
-                                'get/set squeeze me property')
+                                'get/set chars_as_strings property')
 
     def get_order_code(self):
         return self._order_code
     def set_order_code(self, order_code):
-        order_code = ByteOrder.to_numpy_code(order_code)
+        order_code = boc.to_numpy_code(order_code)
         self._order_code = order_code
         self.set_dtypes()
     order_code = property(get_order_code,
@@ -177,7 +223,8 @@
                           'get/set order code')
 
     def set_dtypes(self):
-        assert False, 'Not implemented'
+        ''' Set dtype endianness. In this case we have no dtypes '''
+        pass
 
     def convert_dtypes(self, dtype_template):
         dtypes = dtype_template.copy()
@@ -187,16 +234,13 @@
 
     def matrix_getter_factory(self):
         assert False, 'Not implemented'
-
-    def format_looks_right(self):
-        "Return True if the format looks right for this object"
-        assert False, 'Not implemented'
-
+    
     def file_header(self):
         return {}
 
     def guess_byte_order(self):
-        assert 0, 'Not implemented'
+        ''' As we do not know what file type we have, assume native '''
+        return ByteOrder.native_code
 
     def get_processor_func(self):
         ''' Processing to apply to read matrices
@@ -227,7 +271,7 @@
                     str_arr = arr.reshape(
                         (small_product(n_dims),
                          dims[-1]))
-                    arr = np.empty(n_dims, dtype=object)
+                    arr = np.empty(n_dims, dtype='U%d' % dims[-1])
                     for i in range(0, n_dims[-1]):
                         arr[...,i] = self.chars_to_str(str_arr[i])
                 else: # return string

Copied: branches/refactor_fft/scipy/io/matlab/tests/data/testhdf5_7.4_GLNX86.mat (from rev 4827, trunk/scipy/io/matlab/tests/data/testhdf5_7.4_GLNX86.mat)

Copied: branches/refactor_fft/scipy/io/matlab/tests/gen_unittests.m (from rev 4827, trunk/scipy/io/matlab/tests/gen_unittests.m)

Copied: branches/refactor_fft/scipy/io/matlab/tests/gen_unittests4.m (from rev 4827, trunk/scipy/io/matlab/tests/gen_unittests4.m)

Copied: branches/refactor_fft/scipy/io/matlab/tests/save_test.m (from rev 4827, trunk/scipy/io/matlab/tests/save_test.m)

Copied: branches/refactor_fft/scipy/io/matlab/tests/test_byteordercodes.py (from rev 4827, trunk/scipy/io/matlab/tests/test_byteordercodes.py)

Modified: branches/refactor_fft/scipy/io/matlab/tests/test_mio.py
===================================================================
--- branches/refactor_fft/scipy/io/matlab/tests/test_mio.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/io/matlab/tests/test_mio.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -3,26 +3,21 @@
 import os
 from glob import glob
 from cStringIO import StringIO
-from tempfile import mkstemp, mkdtemp
+from tempfile import mkdtemp
 from numpy.testing import *
-from numpy import arange, array, eye, pi, cos, exp, sin, sqrt, ndarray,  \
-     zeros, reshape, transpose, empty
+from numpy import arange, array, pi, cos, exp, sin, sqrt, ndarray,  \
+     zeros, reshape, transpose, dtype, empty
 import scipy.sparse as SP
 
 from scipy.io.matlab.mio import loadmat, savemat
-from scipy.io.matlab.mio5 import mat_obj, mat_struct
+from scipy.io.matlab.mio5 import MatlabObject
 
 import shutil
 import gzip
 
-try:  # Python 2.3 support
-    from sets import Set as set
-except:
-    pass
-
 test_data_path = os.path.join(os.path.dirname(__file__), 'data')
 
-def _check_level(self, label, expected, actual):
+def _check_level(label, expected, actual):
     """ Check one level of a potentially nested object / list """
     # object array is returned from cell array in mat file
     typex = type(expected)
@@ -32,10 +27,10 @@
         assert len(expected) == len(actual), "Different list lengths at %s" % label
         for i, ev in enumerate(expected):
             level_label = "%s, [%d], " % (label, i)
-            self._check_level(level_label, ev, actual[i])
+            _check_level(level_label, ev, actual[i])
         return
     # object, as container for matlab structs and objects
-    elif isinstance(expected, mat_struct) or isinstance(expected, mat_obj):
+    elif isinstance(expected, MatlabObject):
         assert isinstance(actual, typex), \
                "Different types %s and %s at %s" % (typex, typac, label)
         ex_fields = dir(expected)
@@ -47,7 +42,7 @@
             ev = expected.__dict__[k]
             v = actual.__dict__[k]
             level_label = "%s, property %s, " % (label, k)
-            self._check_level(level_label, ev, v)
+            _check_level(level_label, ev, v)
         return
     # hoping this is a single value, which might be an array
     if SP.issparse(expected):
@@ -62,37 +57,28 @@
         assert_array_almost_equal(actual, expected, err_msg=label, decimal=5)
     else:
         assert isinstance(expected, typac), \
-               "Types %s and %s do not match at %s" % (typex, typac, label)
+               "Expected %s and actual %s do not match at %s" % \
+               (typex, typac, label)
         assert_equal(actual, expected, err_msg=label)
 
-def _check_case(self, name, files, case):
+def _check_case(name, files, case):
     for file_name in files:
-        matdict = loadmat(file_name)
+        matdict = loadmat(file_name, struct_as_record=True)
         label = "test %s; file %s" % (name, file_name)
         for k, expected in case.items():
             k_label = "%s, variable %s" % (label, k)
             assert k in matdict, "Missing key at %s" % k_label
-            self._check_level(k_label, expected, matdict[k])
+            _check_level(k_label, expected, matdict[k])
 
-# Add the load tests dynamically, with given parameters
-def _make_check_case(name, files, expected):
-    def cc(self):
-        self._check_case(name, files, expected)
-    cc.__doc__ = "check loadmat case %s" % name
-    return cc
+# Round trip tests 
+def _rt_check_case(name, expected, format):
+    mat_stream = StringIO()
+    savemat(mat_stream, expected, format=format)
+    mat_stream.seek(0)
+    _check_case(name, [mat_stream], expected)
 
-# Add the round trip tests dynamically, with given parameters
-def _make_rt_check_case(name, expected, format):
-    def cc(self):
-        mat_stream = StringIO()
-        savemat(mat_stream, expected, format=format)
-        mat_stream.seek(0)
-        self._check_case(name, [mat_stream], expected)
-    cc.__doc__ = "check loadmat case %s" % name
-    return cc
-
 # Define cases to test
-theta = pi/4*arange(9,dtype=float)
+theta = pi/4*arange(9,dtype=float).reshape(9,1)
 case_table4 = [
     {'name': 'double',
      'expected': {'testdouble': theta}
@@ -169,10 +155,8 @@
      'expected': {'testsparsefloat': SP.csc_matrix(array([[-1+2j,0,2],[0,-3j,0]]))},
      },
     ]
-st = mat_struct()
-st.stringfield = u'Rats live on no evil star.'
-st.doublefield = array([sqrt(2),exp(1),pi])
-st.complexfield = (1+1j)*array([sqrt(2),exp(1),pi])
+st = array([(u'Rats live on no evil star.', array([sqrt(2),exp(1),pi]), (1+1j)*array([sqrt(2),exp(1),pi]))], 
+           dtype=[(n, object) for n in ['stringfield', 'doublefield', 'complexfield']])
 case_table5.append(
     {'name': 'struct',
      'expected': {'teststruct': st}
@@ -187,25 +171,24 @@
     {'name': 'cellnest',
      'expected': {'testcellnest': a},
      })
-st = mat_struct()
-st.one = array(1)
-st.two = mat_struct()
-st.two.three = u'number 3'
+st = empty((1,1), dtype=[(n, object) for n in ['one', 'two']])
+st[0,0]['one'] = array(1)
+st[0,0]['two'] = empty((1,1), dtype=[('three', object)])
+st[0,0]['two'][0,0]['three'] = u'number 3'
 case_table5.append(
     {'name': 'structnest',
      'expected': {'teststructnest': st}
      })
-a = array([mat_struct(), mat_struct()])
-a[0].one = array(1)
-a[0].two = array(2)
-a[1].one = u'number 1'
-a[1].two = u'number 2'
+a = empty((2,1), dtype=[(n, object) for n in ['one', 'two']])
+a[0,0]['one'] = array(1)
+a[0,0]['two'] = array(2)
+a[1,0]['one'] = u'number 1'
+a[1,0]['two'] = u'number 2'
 case_table5.append(
     {'name': 'structarr',
      'expected': {'teststructarr': a}
      })
-a = mat_obj()
-a._classname = 'inline'
+a = MatlabObject('inline', ['expr', 'args', 'isEmpty', 'numArgs', 'version'])
 a.expr = u'x'
 a.inputExpr = u' x = INLINE_INPUTS_{1};'
 a.args = u'x'
@@ -225,6 +208,7 @@
     })
 
 # generator for load tests
+ at dec.knownfailureif(True)
 def test_load():
     for case in case_table4 + case_table5:
         name = case['name']
@@ -232,15 +216,16 @@
         filt = os.path.join(test_data_path, 'test%s_*.mat' % name)
         files = glob(filt)
         assert files, "No files for test %s using filter %s" % (name, filt)
-        yield _make_check_case, name, files, expected
+        yield _check_case, name, files, expected
 
-    # round trip tests
+# generator for round trip tests
+ at dec.knownfailureif(True)
 def test_round_trip():
     for case in case_table4 + case_table5_rt:
         name = case['name'] + '_round_trip'
         expected = case['expected']
         format = case in case_table4 and '4' or '5'
-        yield _make_rt_check_case, name, expected, format
+        #yield _rt_check_case, name, expected, format
 
 def test_gzip_simple():
     xdense = zeros((20,20))
@@ -260,7 +245,7 @@
         mat_stream.close()
 
         mat_stream = gzip.open( fname,mode='rb')
-        actual = loadmat(mat_stream)
+        actual = loadmat(mat_stream, struct_as_record=True)
         mat_stream.close()
     finally:
         shutil.rmtree(tmpdir)
@@ -269,3 +254,9 @@
                               expected['x'].todense())
 
     
+def test_mat73():
+    # Check any hdf5 files raise an error
+    filenames = glob(
+        os.path.join(test_data_path, 'testhdf5*.mat'))
+    for filename in filenames:
+        assert_raises(NotImplementedError, loadmat, filename, struct_as_record=True)

Modified: branches/refactor_fft/scipy/io/mmio.py
===================================================================
--- branches/refactor_fft/scipy/io/mmio.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/io/mmio.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -10,9 +10,8 @@
 #
 
 import os
-from numpy import asarray, real, imag, conj, zeros, ndarray, \
-                  empty, concatenate, ones, ascontiguousarray, \
-                  vstack, savetxt, fromfile, fromstring
+from numpy import asarray, real, imag, conj, zeros, ndarray, concatenate, \
+                  ones, ascontiguousarray, vstack, savetxt, fromfile, fromstring
 
 __all__ = ['mminfo','mmread','mmwrite', 'MMFile']
 
@@ -480,14 +479,15 @@
                 precision = 16
 
         if field is None:
-            if typecode in 'li':
+            kind = a.dtype.kind
+            if kind == 'i':
                 field = 'integer'
-            elif typecode in 'df':
+            elif kind == 'f':
                 field = 'real'
-            elif typecode in 'DF':
+            elif kind == 'c':
                 field = 'complex'
             else:
-                raise TypeError,'unexpected typecode '+typecode
+                raise TypeError('unexpected dtype kind ' + kind)
 
         if rep == self.FORMAT_ARRAY:
             symm = self._get_symmetry(a)
@@ -571,23 +571,6 @@
 
             savetxt(stream, IJV, fmt=fmt)
 
-
-            ### Old method
-            ## line template
-            #template = '%i %i ' + template
-            #I,J,V = coo.row + 1, coo.col + 1, coo.data # change base 0 -> base 1
-            #if field in (self.FIELD_REAL, self.FIELD_INTEGER):
-            #    for ijv_tuple in izip(I,J,V):
-            #        stream.writelines(template % ijv_tuple)
-            #elif field == self.FIELD_COMPLEX:
-            #    for ijv_tuple in izip(I,J,V.real,V.imag):
-            #        stream.writelines(template % ijv_tuple)
-            #elif field == self.FIELD_PATTERN:
-            #    raise NotImplementedError,`field`
-            #else:
-            #    raise TypeError,'Unknown field type %s'% `field`
-
-
 #-------------------------------------------------------------------------------
 if __name__ == '__main__':
     import sys

Modified: branches/refactor_fft/scipy/io/netcdf.py
===================================================================
--- branches/refactor_fft/scipy/io/netcdf.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/io/netcdf.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -15,7 +15,6 @@
 __all__ = ['netcdf_file', 'netcdf_variable']
 
 import struct
-import itertools
 import mmap
 
 from numpy import ndarray, zeros, array

Deleted: branches/refactor_fft/scipy/io/tests/gen_unittests.m
===================================================================
--- branches/refactor_fft/scipy/io/tests/gen_unittests.m	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/io/tests/gen_unittests.m	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,92 +0,0 @@
-% Generates mat files for loadmat unit tests
-% This is the version for matlab 5 and higher
-% Uses save_test.m function
-
-% work out matlab version and file suffix for test files
-global FILEPREFIX FILESUFFIX
-FILEPREFIX = [fullfile(pwd, 'data') filesep];
-temp = ver('MATLAB');
-mlv = temp.Version;
-FILESUFFIX = ['_' mlv '_' computer '.mat'];
-
-% basic double array
-save_test('testdouble', 0:pi/4:2*pi);
-
-% string
-save_test('teststring', '"Do nine men interpret?" "Nine men," I nod.')
-
-% complex
-theta = 0:pi/4:2*pi;
-save_test('testcomplex', cos(theta) + 1j*sin(theta));
-
-% asymmetric array to check indexing
-a = zeros(3, 5);
-a(:,1) = [1:3]';
-a(1,:) = 1:5;
-
-% 2D matrix
-save_test('testmatrix', a);
-
-% minus number - tests signed int 
-save_test('testminus', -1);
-
-% single character
-save_test('testonechar', 'r');
-
-% string array
-save_test('teststringarray', ['one  '; 'two  '; 'three']);
-
-% sparse array
-save_test('testsparse', sparse(a));
-
-% sparse complex array
-b = sparse(a);
-b(1,1) = b(1,1) + j;
-save_test('testsparsecomplex', b);
-
-% Two variables in same file
-save([FILEPREFIX 'testmulti' FILESUFFIX], 'a', 'theta')
-
-
-% struct
-save_test('teststruct', ...
-	  struct('stringfield','Rats live on no evil star.',...
-		 'doublefield',[sqrt(2) exp(1) pi],...
-		 'complexfield',(1+1j)*[sqrt(2) exp(1) pi]));
-
-% cell
-save_test('testcell', ...
-	  {['This cell contains this string and 3 arrays of increasing' ...
-	    ' length'], 1., 1.:2., 1.:3.});
-
-% Empty cells in two cell matrices
-save_test('testemptycell', {1, 2, [], [], 3});
-
-% 3D matrix
-save_test('test3dmatrix', reshape(1:24,[2 3 4]))
-
-% nested cell array
-save_test('testcellnest', {1, {2, 3, {4, 5}}});
-
-% nested struct
-save_test('teststructnest', struct('one', 1, 'two', ...
-				   struct('three', 'number 3')));
-
-% array of struct
-save_test('teststructarr', [struct('one', 1, 'two', 2) ...
-		    struct('one', 'number 1', 'two', 'number 2')]);
-
-% matlab object
-save_test('testobject', inline('x'))
-
-% array of matlab objects
-%save_test('testobjarr', [inline('x') inline('y')])
-
-% unicode test
-if str2num(mlv) > 7  % function added 7.0.1
-  fid = fopen([FILEPREFIX 'japanese_utf8.txt']);
-  from_japan = fread(fid, 'uint8')';
-  fclose(fid);
-  save_test('testunicode', native2unicode(from_japan, 'utf-8'));
-end
-  
\ No newline at end of file

Deleted: branches/refactor_fft/scipy/io/tests/gen_unittests4.m
===================================================================
--- branches/refactor_fft/scipy/io/tests/gen_unittests4.m	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/io/tests/gen_unittests4.m	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,50 +0,0 @@
-% Generates mat files for loadmat unit tests
-% Uses save_test.m function
-% This is the version for matlab 4
-
-% work out matlab version and file suffix for test files
-global FILEPREFIX FILESUFFIX
-sepchar = '/';
-if strcmp(computer, 'PCWIN'), sepchar = '\'; end
-FILEPREFIX = [pwd sepchar 'data' sepchar];
-mlv = version;
-FILESUFFIX = ['_' mlv '_' computer '.mat'];
-
-% basic double array
-save_test('testdouble', 0:pi/4:2*pi);
-
-% string
-save_test('teststring', '"Do nine men interpret?" "Nine men," I nod.')
-
-% complex
-theta = 0:pi/4:2*pi;
-save_test('testcomplex', cos(theta) + 1j*sin(theta));
-
-% asymmetric array to check indexing
-a = zeros(3, 5);
-a(:,1) = [1:3]';
-a(1,:) = 1:5;
-
-% 2D matrix
-save_test('testmatrix', a);
-
-% minus number - tests signed int 
-save_test('testminus', -1);
-
-% single character
-save_test('testonechar', 'r');
-
-% string array
-save_test('teststringarray', ['one  '; 'two  '; 'three']);
-
-% sparse array
-save_test('testsparse', sparse(a));
-
-% sparse complex array
-b = sparse(a);
-b(1,1) = b(1,1) + j;
-save_test('testsparsecomplex', b);
-
-% Two variables in same file
-save([FILEPREFIX 'testmulti' FILESUFFIX], 'a', 'theta')
-

Deleted: branches/refactor_fft/scipy/io/tests/save_test.m
===================================================================
--- branches/refactor_fft/scipy/io/tests/save_test.m	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/io/tests/save_test.m	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,6 +0,0 @@
-function save_test(test_name, v)
-% saves variable passed in m with filename from prefix
-  
-global FILEPREFIX FILESUFFIX
-eval([test_name ' = v;']);
-save([FILEPREFIX test_name FILESUFFIX], test_name)
\ No newline at end of file

Modified: branches/refactor_fft/scipy/io/tests/test_mmio.py
===================================================================
--- branches/refactor_fft/scipy/io/tests/test_mmio.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/io/tests/test_mmio.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -4,7 +4,6 @@
 from numpy import array,transpose
 from numpy.testing import *
 
-import scipy
 import scipy.sparse
 from scipy.io.mmio import mminfo,mmread,mmwrite
 

Modified: branches/refactor_fft/scipy/lib/blas/tests/test_blas.py
===================================================================
--- branches/refactor_fft/scipy/lib/blas/tests/test_blas.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/lib/blas/tests/test_blas.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -12,10 +12,9 @@
   python tests/test_blas.py [<level>]
 """
 
-import sys
 import math
 
-from numpy import arange, add, array
+from numpy import array
 from numpy.testing import *
 from scipy.lib.blas import fblas
 from scipy.lib.blas import cblas

Modified: branches/refactor_fft/scipy/lib/blas/tests/test_fblas.py
===================================================================
--- branches/refactor_fft/scipy/lib/blas/tests/test_fblas.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/lib/blas/tests/test_fblas.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -6,10 +6,8 @@
 # !! Complex calculations really aren't checked that carefully.
 # !! Only real valued complex numbers are used in tests.
 
-import sys
-from numpy import zeros, transpose, newaxis, shape, float32, \
-     float64, complex64, complex128, arange, array, common_type, \
-     conjugate
+from numpy import zeros, transpose, newaxis, shape, float32, float64, \
+                  complex64, complex128, arange, array, common_type, conjugate
 from numpy.testing import *
 from scipy.lib.blas import fblas
 

Modified: branches/refactor_fft/scipy/lib/lapack/tests/test_lapack.py
===================================================================
--- branches/refactor_fft/scipy/lib/lapack/tests/test_lapack.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/lib/lapack/tests/test_lapack.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -14,10 +14,8 @@
 can be run (see the isrunnable method).
 '''
 
-import os
-import sys
 from numpy.testing import *
-from numpy import dot, ones, zeros
+from numpy import ones
 
 from scipy.lib.lapack import flapack, clapack
 

Modified: branches/refactor_fft/scipy/linalg/benchmarks/bench_basic.py
===================================================================
--- branches/refactor_fft/scipy/linalg/benchmarks/bench_basic.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/linalg/benchmarks/bench_basic.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,19 +1,13 @@
 import sys
-import numpy
-from numpy import arange, add, array, dot, zeros, identity, conjugate, transpose
-
 from numpy.testing import *
+import numpy.linalg as linalg
 
-from scipy.linalg import solve,inv,det,lstsq, toeplitz, hankel, tri, triu, \
-     tril, pinv, pinv2, solve_banded
-
 def random(size):
     return rand(*size)
 
 class TestSolve(TestCase):
 
     def bench_random(self):
-        import numpy.linalg as linalg
         basic_solve = linalg.solve
         print
         print '      Solving system of linear equations'
@@ -53,7 +47,6 @@
 class TestInv(TestCase):
 
     def bench_random(self):
-        import numpy.linalg as linalg
         basic_inv = linalg.inv
         print
         print '           Finding matrix inverse'
@@ -92,7 +85,6 @@
 class TestDet(TestCase):
 
     def bench_random(self):
-        import numpy.linalg as linalg
         basic_det = linalg.det
         print
         print '           Finding matrix determinant'

Modified: branches/refactor_fft/scipy/linalg/benchmarks/bench_decom.py
===================================================================
--- branches/refactor_fft/scipy/linalg/benchmarks/bench_decom.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/linalg/benchmarks/bench_decom.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -3,10 +3,7 @@
 """
 import sys
 
-import numpy
 from numpy import linalg
-from scipy.linalg import eigvals
-
 from numpy.testing import *
 
 def random(size):

Modified: branches/refactor_fft/scipy/linalg/matfuncs.py
===================================================================
--- branches/refactor_fft/scipy/linalg/matfuncs.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/linalg/matfuncs.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -9,15 +9,15 @@
 
 from numpy import asarray, Inf, dot, floor, eye, diag, exp, \
      product, logical_not, ravel, transpose, conjugate, \
-     cast, log, ogrid, isfinite, imag, real, absolute, amax, sign, \
+     cast, log, ogrid, imag, real, absolute, amax, sign, \
      isfinite, sqrt, identity, single
 from numpy import matrix as mat
-import numpy as sb
+import numpy as np
 from basic import solve, inv, norm, triu, all_mat
 from decomp import eig, schur, rsf2csf, orth, svd
 
-eps = sb.finfo(float).eps
-feps = sb.finfo(single).eps
+eps = np.finfo(float).eps
+feps = np.finfo(single).eps
 
 def expm(A,q=7):
     """Compute the matrix exponential using Pade approximation.
@@ -142,7 +142,7 @@
     if tol is None:
         tol = {0:feps*1e3, 1:eps*1e6}[_array_precision[arr.dtype.char]]
     if (arr.dtype.char in ['F', 'D','G']) and \
-       sb.allclose(arr.imag, 0.0, atol=tol):
+       np.allclose(arr.imag, 0.0, atol=tol):
         arr = arr.real
     return arr
 
@@ -455,11 +455,11 @@
     # Shifting to avoid zero eigenvalues. How to ensure that shifting does
     # not change the spectrum too much?
     vals = svd(a,compute_uv=0)
-    max_sv = sb.amax(vals)
+    max_sv = np.amax(vals)
     #min_nonzero_sv = vals[(vals>max_sv*errtol).tolist().count(1)-1]
     #c = 0.5/min_nonzero_sv
     c = 0.5/max_sv
-    S0 = a + c*sb.identity(a.shape[0])
+    S0 = a + c*np.identity(a.shape[0])
     prev_errest = errest
     for i in range(100):
         iS0 = inv(S0)
@@ -508,7 +508,7 @@
     T, Z = rsf2csf(T,Z)
     n,n = T.shape
 
-    R = sb.zeros((n,n),T.dtype.char)
+    R = np.zeros((n,n),T.dtype.char)
     for j in range(n):
         R[j,j] = sqrt(T[j,j])
         for i in range(j-1,-1,-1):
@@ -521,7 +521,7 @@
     X = (Z * R * Z.H)
 
     if disp:
-        nzeig = sb.any(sb.diag(T)==0)
+        nzeig = np.any(diag(T)==0)
         if nzeig:
             print "Matrix is singular and may not have a square root."
         return X.A

Modified: branches/refactor_fft/scipy/linalg/tests/test_atlas_version.py
===================================================================
--- branches/refactor_fft/scipy/linalg/tests/test_atlas_version.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/linalg/tests/test_atlas_version.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -3,7 +3,6 @@
 # Created by: Pearu Peterson, October 2003
 #
 
-import sys
 from numpy.testing import *
 
 import scipy.linalg.atlas_version

Modified: branches/refactor_fft/scipy/linalg/tests/test_basic.py
===================================================================
--- branches/refactor_fft/scipy/linalg/tests/test_basic.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/linalg/tests/test_basic.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -19,10 +19,9 @@
   python tests/test_basic.py
 """
 
-import numpy
 from numpy import arange, add, array, dot, zeros, identity, conjugate, transpose
+import numpy.linalg as linalg
 
-import sys
 from numpy.testing import *
 
 from scipy.linalg import solve,inv,det,lstsq, toeplitz, hankel, tri, triu, \
@@ -50,33 +49,33 @@
         for b in ([[1,0,0,0],[0,0,0,1],[0,1,0,0],[0,1,0,0]],
                   [[2,1],[-30,4],[2,3],[1,3]]):
             x = solve_banded((l,u),ab,b)
-            assert_array_almost_equal(numpy.dot(a,x),b)
+            assert_array_almost_equal(dot(a,x),b)
 
 class TestSolve(TestCase):
 
     def test_20Feb04_bug(self):
         a = [[1,1],[1.0,0]] # ok
         x0 = solve(a,[1,0j])
-        assert_array_almost_equal(numpy.dot(a,x0),[1,0])
+        assert_array_almost_equal(dot(a,x0),[1,0])
 
         a = [[1,1],[1.2,0]] # gives failure with clapack.zgesv(..,rowmajor=0)
         b = [1,0j]
         x0 = solve(a,b)
-        assert_array_almost_equal(numpy.dot(a,x0),[1,0])
+        assert_array_almost_equal(dot(a,x0),[1,0])
 
     def test_simple(self):
         a = [[1,20],[-30,4]]
         for b in ([[1,0],[0,1]],[1,0],
                   [[2,1],[-30,4]]):
             x = solve(a,b)
-            assert_array_almost_equal(numpy.dot(a,x),b)
+            assert_array_almost_equal(dot(a,x),b)
 
     def test_simple_sym(self):
         a = [[2,3],[3,5]]
         for lower in [0,1]:
             for b in ([[1,0],[0,1]],[1,0]):
                 x = solve(a,b,sym_pos=1,lower=lower)
-                assert_array_almost_equal(numpy.dot(a,x),b)
+                assert_array_almost_equal(dot(a,x),b)
 
     def test_simple_sym_complex(self):
         a = [[5,2],[2,4]]
@@ -85,7 +84,7 @@
                    [0,2]],
                   ]:
             x = solve(a,b,sym_pos=1)
-            assert_array_almost_equal(numpy.dot(a,x),b)
+            assert_array_almost_equal(dot(a,x),b)
 
     def test_simple_complex(self):
         a = array([[5,2],[2j,4]],'D')
@@ -96,7 +95,7 @@
                   array([1,0],'D'),
                   ]:
             x = solve(a,b)
-            assert_array_almost_equal(numpy.dot(a,x),b)
+            assert_array_almost_equal(dot(a,x),b)
 
     def test_nils_20Feb04(self):
         n = 2
@@ -117,7 +116,7 @@
         for i in range(4):
             b = random([n,3])
             x = solve(a,b)
-            assert_array_almost_equal(numpy.dot(a,x),b)
+            assert_array_almost_equal(dot(a,x),b)
 
     def test_random_complex(self):
         n = 20
@@ -126,7 +125,7 @@
         for i in range(2):
             b = random([n,3])
             x = solve(a,b)
-            assert_array_almost_equal(numpy.dot(a,x),b)
+            assert_array_almost_equal(dot(a,x),b)
 
     def test_random_sym(self):
         n = 20
@@ -138,7 +137,7 @@
         for i in range(4):
             b = random([n])
             x = solve(a,b,sym_pos=1)
-            assert_array_almost_equal(numpy.dot(a,x),b)
+            assert_array_almost_equal(dot(a,x),b)
 
     def test_random_sym_complex(self):
         n = 20
@@ -147,11 +146,11 @@
         for i in range(n):
             a[i,i] = abs(20*(.1+a[i,i]))
             for j in range(i):
-                a[i,j] = numpy.conjugate(a[j,i])
+                a[i,j] = conjugate(a[j,i])
         b = random([n])+2j*random([n])
         for i in range(2):
             x = solve(a,b,sym_pos=1)
-            assert_array_almost_equal(numpy.dot(a,x),b)
+            assert_array_almost_equal(dot(a,x),b)
 
 
 class TestInv(TestCase):
@@ -159,11 +158,11 @@
     def test_simple(self):
         a = [[1,2],[3,4]]
         a_inv = inv(a)
-        assert_array_almost_equal(numpy.dot(a,a_inv),
+        assert_array_almost_equal(dot(a,a_inv),
                                   [[1,0],[0,1]])
         a = [[1,2,3],[4,5,6],[7,8,10]]
         a_inv = inv(a)
-        assert_array_almost_equal(numpy.dot(a,a_inv),
+        assert_array_almost_equal(dot(a,a_inv),
                                   [[1,0,0],[0,1,0],[0,0,1]])
 
     def test_random(self):
@@ -172,12 +171,12 @@
             a = random([n,n])
             for i in range(n): a[i,i] = 20*(.1+a[i,i])
             a_inv = inv(a)
-            assert_array_almost_equal(numpy.dot(a,a_inv),
-                                      numpy.identity(n))
+            assert_array_almost_equal(dot(a,a_inv),
+                                      identity(n))
     def test_simple_complex(self):
         a = [[1,2],[3,4j]]
         a_inv = inv(a)
-        assert_array_almost_equal(numpy.dot(a,a_inv),
+        assert_array_almost_equal(dot(a,a_inv),
                                   [[1,0],[0,1]])
 
     def test_random_complex(self):
@@ -186,8 +185,8 @@
             a = random([n,n])+2j*random([n,n])
             for i in range(n): a[i,i] = 20*(.1+a[i,i])
             a_inv = inv(a)
-            assert_array_almost_equal(numpy.dot(a,a_inv),
-                                      numpy.identity(n))
+            assert_array_almost_equal(dot(a,a_inv),
+                                      identity(n))
 
 
 class TestDet(TestCase):
@@ -203,7 +202,6 @@
         assert_almost_equal(a_det,-6+4j)
 
     def test_random(self):
-        import numpy.linalg as linalg
         basic_det = linalg.det
         n = 20
         for i in range(4):
@@ -213,7 +211,6 @@
             assert_almost_equal(d1,d2)
 
     def test_random_complex(self):
-        import numpy.linalg as linalg
         basic_det = linalg.det
         n = 20
         for i in range(4):
@@ -246,7 +243,7 @@
         for b in ([[1,0],[0,1]],[1,0],
                   [[2,1],[-30,4]]):
             x = lstsq(a,b)[0]
-            assert_array_almost_equal(numpy.dot(a,x),b)
+            assert_array_almost_equal(dot(a,x),b)
 
     def test_simple_overdet(self):
         a = [[1,2],[4,5],[3,4]]
@@ -271,7 +268,7 @@
         for i in range(4):
             b = random([n,3])
             x = lstsq(a,b)[0]
-            assert_array_almost_equal(numpy.dot(a,x),b)
+            assert_array_almost_equal(dot(a,x),b)
 
     def test_random_complex_exact(self):
         n = 20
@@ -280,7 +277,7 @@
         for i in range(2):
             b = random([n,3])
             x = lstsq(a,b)[0]
-            assert_array_almost_equal(numpy.dot(a,x),b)
+            assert_array_almost_equal(dot(a,x),b)
 
     def test_random_overdet(self):
         n = 20

Modified: branches/refactor_fft/scipy/linalg/tests/test_blas.py
===================================================================
--- branches/refactor_fft/scipy/linalg/tests/test_blas.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/linalg/tests/test_blas.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -12,13 +12,9 @@
   python tests/test_blas.py [<level>]
 """
 
-import sys
 import math
 
-from numpy import arange, add, array
-
 from numpy.testing import *
-
 from scipy.linalg import fblas, cblas
 
 

Modified: branches/refactor_fft/scipy/linalg/tests/test_decomp.py
===================================================================
--- branches/refactor_fft/scipy/linalg/tests/test_decomp.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/linalg/tests/test_decomp.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -14,7 +14,6 @@
   python tests/test_decomp.py
 """
 
-import sys
 from numpy.testing import *
 
 from scipy.linalg import eig,eigvals,lu,svd,svdvals,cholesky,qr, \
@@ -25,10 +24,9 @@
 
 from numpy import array, transpose, sometrue, diag, ones, linalg, \
      argsort, zeros, arange, float32, complex64, dot, conj, identity, \
-     ravel, sqrt, iscomplex, shape, sort, sign, conjugate, sign, bmat, \
+     ravel, sqrt, iscomplex, shape, sort, conjugate, bmat, sign, \
      asarray, matrix, isfinite, all
 
-
 from numpy.random import rand
 
 def random(size):

Modified: branches/refactor_fft/scipy/linalg/tests/test_fblas.py
===================================================================
--- branches/refactor_fft/scipy/linalg/tests/test_fblas.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/linalg/tests/test_fblas.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -6,11 +6,8 @@
 # !! Complex calculations really aren't checked that carefully.
 # !! Only real valued complex numbers are used in tests.
 
-import sys
-
-from numpy import dot, float32, float64, complex64, complex128, \
-     arange, array, zeros, shape, transpose, newaxis, \
-     common_type, conjugate
+from numpy import float32, float64, complex64, complex128, arange, array, \
+                  zeros, shape, transpose, newaxis, common_type, conjugate
 from scipy.linalg import fblas
 
 from numpy.testing import *

Modified: branches/refactor_fft/scipy/linalg/tests/test_lapack.py
===================================================================
--- branches/refactor_fft/scipy/linalg/tests/test_lapack.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/linalg/tests/test_lapack.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -3,8 +3,6 @@
 # Created by: Pearu Peterson, September 2002
 #
 
-
-import sys
 from numpy.testing import *
 from numpy import ones
 

Modified: branches/refactor_fft/scipy/linalg/tests/test_matfuncs.py
===================================================================
--- branches/refactor_fft/scipy/linalg/tests/test_matfuncs.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/linalg/tests/test_matfuncs.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -6,15 +6,11 @@
 
 """
 
-import sys
-
-import numpy
 from numpy import array, identity, dot, sqrt
-
 from numpy.testing import *
 
 import scipy.linalg
-from scipy.linalg import signm,logm,funm, sqrtm, expm, expm2, expm3
+from scipy.linalg import signm, logm, sqrtm, expm, expm2, expm3
 
 
 class TestSignM(TestCase):

Modified: branches/refactor_fft/scipy/maxentropy/examples/bergerexample.py
===================================================================
--- branches/refactor_fft/scipy/maxentropy/examples/bergerexample.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/maxentropy/examples/bergerexample.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -20,8 +20,6 @@
 __author__ =  'Ed Schofield'
 __version__=  '2.1'
 
-
-import math
 from scipy import maxentropy
 
 a_grave = u'\u00e0'

Modified: branches/refactor_fft/scipy/maxentropy/examples/conditionalexample2.py
===================================================================
--- branches/refactor_fft/scipy/maxentropy/examples/conditionalexample2.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/maxentropy/examples/conditionalexample2.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -18,9 +18,7 @@
 
 __author__ =  'Ed Schofield'
 
-import math
 from scipy import maxentropy, sparse
-import numpy
 
 samplespace = ['dans', 'en', 'à', 'au cours de', 'pendant']
 # Occurrences of French words, and their 'next English word' contexts, in

Modified: branches/refactor_fft/scipy/maxentropy/maxentropy.py
===================================================================
--- branches/refactor_fft/scipy/maxentropy/maxentropy.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/maxentropy/maxentropy.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -70,8 +70,8 @@
 
 
 import math, types, cPickle
-import numpy
-from scipy import optimize, sparse
+import numpy as np
+from scipy import optimize
 from scipy.linalg import norm
 from scipy.maxentropy.maxentutils import *
 
@@ -194,7 +194,7 @@
                                       " using setfeaturesandsamplespace()"
 
         # First convert K to a numpy array if necessary
-        K = numpy.asarray(K, float)
+        K = np.asarray(K, float)
 
         # Store the desired feature expectations as a member variable
         self.K = K
@@ -212,7 +212,7 @@
         # self.gradevals = 0
 
         # Make a copy of the parameters
-        oldparams = numpy.array(self.params)
+        oldparams = np.array(self.params)
 
         callback = self.log
 
@@ -272,7 +272,7 @@
                     + "' is unsupported.  Options are 'CG', 'LBFGSB', " \
                     "'Nelder-Mead', 'Powell', and 'BFGS'"
 
-        if numpy.any(self.params != newparams):
+        if np.any(self.params != newparams):
             self.setparams(newparams)
         self.func_calls = func_calls
 
@@ -322,7 +322,7 @@
             self.setparams(params)
 
         # Subsumes both small and large cases:
-        L = self.lognormconst() - numpy.dot(self.params, self.K)
+        L = self.lognormconst() - np.dot(self.params, self.K)
 
         if self.verbose and self.external is None:
             print "  dual is ", L
@@ -332,7 +332,7 @@
         # Define 0 / 0 = 0 here; this allows a variance term of
         # sigma_i^2==0 to indicate that feature i should be ignored.
         if self.sigma2 is not None and ignorepenalty==False:
-            ratios = numpy.nan_to_num(self.params**2 / self.sigma2)
+            ratios = np.nan_to_num(self.params**2 / self.sigma2)
             # Why does the above convert inf to 1.79769e+308?
 
             L += 0.5 * ratios.sum()
@@ -396,7 +396,7 @@
                 self.test()
 
         if not self.callingback and self.external is None:
-            if self.mindual > -numpy.inf and self.dual() < self.mindual:
+            if self.mindual > -np.inf and self.dual() < self.mindual:
                 raise DivergenceError, "dual is below the threshold 'mindual'" \
                         " and may be diverging to -inf.  Fix the constraints" \
                         " or lower the threshold!"
@@ -428,7 +428,7 @@
         if self.sigma2 is not None and ignorepenalty==False:
             penalty = self.params / self.sigma2
             G += penalty
-            features_to_kill = numpy.where(numpy.isnan(penalty))[0]
+            features_to_kill = np.where(np.isnan(penalty))[0]
             G[features_to_kill] = 0.0
             if self.verbose and self.external is None:
                 normG = norm(G)
@@ -449,7 +449,7 @@
         return G
 
 
-    def crossentropy(self, fx, log_prior_x=None, base=numpy.e):
+    def crossentropy(self, fx, log_prior_x=None, base=np.e):
         """Returns the cross entropy H(q, p) of the empirical
         distribution q of the data (with the given feature matrix fx)
         with respect to the model p.  For discrete distributions this is
@@ -466,9 +466,9 @@
         For continuous distributions this makes no sense!
         """
         H = -self.logpdf(fx, log_prior_x).mean()
-        if base != numpy.e:
+        if base != np.e:
             # H' = H * log_{base} (e)
-            return H / numpy.log(base)
+            return H / np.log(base)
         else:
             return H
 
@@ -483,7 +483,7 @@
         Z = E_aux_dist [{exp (params.f(X))} / aux_dist(X)] using a sample
         from aux_dist.
         """
-        return numpy.exp(self.lognormconst())
+        return np.exp(self.lognormconst())
 
 
     def setsmooth(sigma):
@@ -507,7 +507,7 @@
         length as the model's feature vector f.
         """
 
-        self.params = numpy.array(params, float)        # make a copy
+        self.params = np.array(params, float)        # make a copy
 
         # Log the new params to disk
         self.logparams()
@@ -546,7 +546,7 @@
                 raise ValueError, "specify the number of features / parameters"
 
         # Set parameters, clearing cache variables
-        self.setparams(numpy.zeros(m, float))
+        self.setparams(np.zeros(m, float))
 
         # These bounds on the param values are only effective for the
         # L-BFGS-B optimizer:
@@ -595,7 +595,7 @@
             return
 
         # Check whether the params are NaN
-        if not numpy.all(self.params == self.params):
+        if not np.all(self.params == self.params):
             raise FloatingPointError, "some of the parameters are NaN"
 
         if self.verbose:
@@ -775,15 +775,15 @@
                 raise AttributeError, "prior probability mass function not set"
 
         def p(x):
-            f_x = numpy.array([f[i](x) for i in range(len(f))], float)
+            f_x = np.array([f[i](x) for i in range(len(f))], float)
 
             # Do we have a prior distribution p_0?
             if priorlogpmf is not None:
                 priorlogprob_x = priorlogpmf(x)
-                return math.exp(numpy.dot(self.params, f_x) + priorlogprob_x \
+                return math.exp(np.dot(self.params, f_x) + priorlogprob_x \
                                 - logZ)
             else:
-                return math.exp(numpy.dot(self.params, f_x) - logZ)
+                return math.exp(np.dot(self.params, f_x) - logZ)
         return p
 
 
@@ -893,7 +893,7 @@
         # As an optimization, p_tilde need not be copied or stored at all, since
         # it is only used by this function.
 
-        self.p_tilde_context = numpy.empty(numcontexts, float)
+        self.p_tilde_context = np.empty(numcontexts, float)
         for w in xrange(numcontexts):
             self.p_tilde_context[w] = self.p_tilde[0, w*S : (w+1)*S].sum()
 
@@ -932,7 +932,7 @@
         if self.priorlogprobs is not None:
             log_p_dot += self.priorlogprobs
 
-        self.logZ = numpy.zeros(numcontexts, float)
+        self.logZ = np.zeros(numcontexts, float)
         for w in xrange(numcontexts):
             self.logZ[w] = logsumexp(log_p_dot[w*S: (w+1)*S])
         return self.logZ
@@ -972,8 +972,7 @@
 
         logZs = self.lognormconst()
 
-        L = numpy.dot(self.p_tilde_context, logZs) - numpy.dot(self.params, \
-                                                               self.K)
+        L = np.dot(self.p_tilde_context, logZs) - np.dot(self.params, self.K)
 
         if self.verbose and self.external is None:
             print "  dual is ", L
@@ -1069,7 +1068,7 @@
             log_p_dot += self.priorlogprobs
         if not hasattr(self, 'logZ'):
             # Compute the norm constant (quickly!)
-            self.logZ = numpy.zeros(numcontexts, float)
+            self.logZ = np.zeros(numcontexts, float)
             for w in xrange(numcontexts):
                 self.logZ[w] = logsumexp(log_p_dot[w*S : (w+1)*S])
         # Renormalize
@@ -1366,8 +1365,8 @@
             #     -log(n-1) + logsumexp(2*log|Z_k - meanZ|)
 
             self.logZapprox = logsumexp(logZs) - math.log(ttrials)
-            stdevlogZ = numpy.array(logZs).std()
-            mus = numpy.array(mus)
+            stdevlogZ = np.array(logZs).std()
+            mus = np.array(mus)
             self.varE = columnvariances(mus)
             self.mu = columnmeans(mus)
             return
@@ -1459,7 +1458,7 @@
         log_Z_est = self.lognormconst()
 
         def p(fx):
-            return numpy.exp(innerprodtranspose(fx, self.params) - log_Z_est)
+            return np.exp(innerprodtranspose(fx, self.params) - log_Z_est)
         return p
 
 
@@ -1486,7 +1485,7 @@
         """
         log_Z_est = self.lognormconst()
         if len(fx.shape) == 1:
-            logpdf = numpy.dot(self.params, fx) - log_Z_est
+            logpdf = np.dot(self.params, fx) - log_Z_est
         else:
             logpdf = innerprodtranspose(fx, self.params) - log_Z_est
         if log_prior_x is not None:
@@ -1536,8 +1535,8 @@
                     # Use Kersten-Deylon accelerated SA, based on the rate of
                     # changes of sign of the gradient.  (If frequent swaps, the
                     # stepsize is too large.)
-                    #n += (numpy.dot(y_k, y_kminus1) < 0)   # an indicator fn
-                    if numpy.dot(y_k, y_kminus1) < 0:
+                    #n += (np.dot(y_k, y_kminus1) < 0)   # an indicator fn
+                    if np.dot(y_k, y_kminus1) < 0:
                         n += 1
                     else:
                         # Store iterations of sign switches (for plotting
@@ -1590,7 +1589,7 @@
             if self.verbose:
                 print "SA: after iteration " + str(k)
                 print "  approx dual fn is: " + str(self.logZapprox \
-                            - numpy.dot(self.params, K))
+                            - np.dot(self.params, K))
                 print "  norm(mu_est - k) = " + str(norm_y_k)
 
             # Update params (after the convergence tests too ... don't waste the
@@ -1682,7 +1681,7 @@
         self.external = None
         self.clearcache()
 
-        meandual = numpy.average(dualapprox,axis=0)
+        meandual = np.average(dualapprox,axis=0)
         self.external_duals[self.iters] = dualapprox
         self.external_gradnorms[self.iters] = gradnorms
 
@@ -1692,7 +1691,7 @@
                  (len(self.externalFs), meandual)
             print "** Mean mean square error of the (unregularized) feature" \
                     " expectation estimates from the external samples =" \
-                    " mean(|| \hat{\mu_e} - k ||,axis=0) =", numpy.average(gradnorms,axis=0)
+                    " mean(|| \hat{\mu_e} - k ||,axis=0) =", np.average(gradnorms,axis=0)
         # Track the parameter vector params with the lowest mean dual estimate
         # so far:
         if meandual < self.bestdual:

Modified: branches/refactor_fft/scipy/maxentropy/maxentutils.py
===================================================================
--- branches/refactor_fft/scipy/maxentropy/maxentutils.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/maxentropy/maxentutils.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -17,7 +17,9 @@
 __author__ = "Ed Schofield"
 __version__ = '2.0'
 
-import random, math, bisect, cmath
+import random
+import math
+import cmath
 import numpy
 from numpy import log, exp, asarray, ndarray
 from scipy import sparse

Modified: branches/refactor_fft/scipy/maxentropy/tests/test_maxentropy.py
===================================================================
--- branches/refactor_fft/scipy/maxentropy/tests/test_maxentropy.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/maxentropy/tests/test_maxentropy.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -6,9 +6,8 @@
 Copyright: Ed Schofield, 2003-2005
 """
 
-import sys
 from numpy.testing import *
-from numpy import arange, add, array, dot, zeros, identity, log, exp, ones
+from numpy import arange, log, exp, ones
 from scipy.maxentropy.maxentropy import *
 
 class TestMaxentropy(TestCase):

Modified: branches/refactor_fft/scipy/misc/common.py
===================================================================
--- branches/refactor_fft/scipy/misc/common.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/misc/common.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -3,16 +3,9 @@
 (special, linalg)
 """
 
-import sys
+from numpy import exp, asarray, arange, newaxis, hstack, product, array, \
+                  where, zeros, extract, place, pi, sqrt, eye, poly1d, dot, r_
 
-import numpy
-
-from numpy import exp, asarray, arange, \
-     newaxis, hstack, product, array, where, \
-     zeros, extract, place, pi, sqrt, eye, poly1d, dot, r_
-
-from numpy import who
-
 __all__ = ['factorial','factorial2','factorialk','comb',
            'central_diff_weights', 'derivative', 'pade', 'lena']
 

Modified: branches/refactor_fft/scipy/misc/pilutil.py
===================================================================
--- branches/refactor_fft/scipy/misc/pilutil.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/misc/pilutil.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,6 +1,5 @@
 # Functions which need the PIL
 
-import types
 import numpy
 import tempfile
 

Modified: branches/refactor_fft/scipy/misc/tests/test_pilutil.py
===================================================================
--- branches/refactor_fft/scipy/misc/tests/test_pilutil.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/misc/tests/test_pilutil.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,5 +1,4 @@
 import os.path
-import glob
 import numpy as np
 
 from numpy.testing import *

Modified: branches/refactor_fft/scipy/ndimage/SConscript
===================================================================
--- branches/refactor_fft/scipy/ndimage/SConscript	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/ndimage/SConscript	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,4 +1,4 @@
-# Last Change: Wed Mar 05 09:00 PM 2008 J
+# Last Change: Fri Oct 10 03:00 PM 2008 J
 from os.path import join
 
 from numscons import GetNumpyEnvironment
@@ -10,11 +10,3 @@
 ndimage_src = ["nd_image.c", "ni_filters.c", "ni_fourier.c", "ni_interpolation.c",
                "ni_measure.c", "ni_morphology.c", "ni_support.c"]
 env.NumpyPythonExtension('_nd_image', source = [join('src', i) for i in ndimage_src])
-
-segment_src = ['Segmenter_EXT.c', 'Segmenter_IMPL.c']
-env.NumpyPythonExtension('_segment', source = [join('src', 'segment', i) 
-                                               for i in segment_src])
-
-register_src = ['Register_EXT.c', 'Register_IMPL.c']
-env.NumpyPythonExtension('_register', source = [join('src', 'register', i) 
-                                                for i in register_src])

Modified: branches/refactor_fft/scipy/ndimage/fourier.py
===================================================================
--- branches/refactor_fft/scipy/ndimage/fourier.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/ndimage/fourier.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -29,7 +29,6 @@
 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import types
-import math
 import numpy
 import _ni_support
 import _nd_image

Modified: branches/refactor_fft/scipy/ndimage/interpolation.py
===================================================================
--- branches/refactor_fft/scipy/ndimage/interpolation.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/ndimage/interpolation.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -28,9 +28,7 @@
 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-import types
 import math
-import warnings
 import numpy
 import _ni_support
 import _nd_image

Modified: branches/refactor_fft/scipy/ndimage/morphology.py
===================================================================
--- branches/refactor_fft/scipy/ndimage/morphology.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/ndimage/morphology.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -32,7 +32,6 @@
 import _ni_support
 import _nd_image
 import filters
-import types
 
 
 def _center_is_true(structure, origin):

Modified: branches/refactor_fft/scipy/odr/tests/test_odr.py
===================================================================
--- branches/refactor_fft/scipy/odr/tests/test_odr.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/odr/tests/test_odr.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,6 +1,3 @@
-# Standard library imports.
-import cPickle
-
 # Scipy imports.
 import numpy as np
 from numpy import pi

Modified: branches/refactor_fft/scipy/optimize/SConscript
===================================================================
--- branches/refactor_fft/scipy/optimize/SConscript	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/optimize/SConscript	2008-10-23 12:30:20 UTC (rev 4828)
@@ -73,6 +73,10 @@
 src = [pjoin('minpack2', i) for i in ['dcsrch.f', 'dcstep.f', 'minpack2.pyf']]
 env.NumpyPythonExtension('minpack2', source = src)
 
+# _nnls pyextension
+src = [pjoin('nnls', i) for i in ['nnls.f', 'nnls.pyf']]
+env.NumpyPythonExtension('_nnls', source = src)
+
 # moduleTNC pyextension
 env.NumpyPythonExtension('moduleTNC', 
                          source = [pjoin('tnc', i) for i in \

Modified: branches/refactor_fft/scipy/optimize/linesearch.py
===================================================================
--- branches/refactor_fft/scipy/optimize/linesearch.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/optimize/linesearch.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -2,7 +2,6 @@
 
 from scipy.optimize import minpack2
 import numpy
-import sys
 
 import __builtin__
 pymin = __builtin__.min

Modified: branches/refactor_fft/scipy/optimize/minpack.py
===================================================================
--- branches/refactor_fft/scipy/optimize/minpack.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/optimize/minpack.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -2,7 +2,7 @@
 
 from numpy import atleast_1d, dot, take, triu, shape, eye, \
                   transpose, zeros, product, greater, array, \
-                  any, all, where, isscalar, asarray, ndarray
+                  all, where, isscalar, asarray
 
 error = _minpack.error
 

Copied: branches/refactor_fft/scipy/optimize/nnls (from rev 4827, trunk/scipy/optimize/nnls)

Deleted: branches/refactor_fft/scipy/optimize/nnls/nnls.f
===================================================================
--- trunk/scipy/optimize/nnls/nnls.f	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/optimize/nnls/nnls.f	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,477 +0,0 @@
-C     SUBROUTINE NNLS  (A,MDA,M,N,B,X,RNORM,W,ZZ,INDEX,MODE)
-C   
-C  Algorithm NNLS: NONNEGATIVE LEAST SQUARES
-C   
-c  The original version of this code was developed by
-c  Charles L. Lawson and Richard J. Hanson at Jet Propulsion Laboratory
-c  1973 JUN 15, and published in the book
-c  "SOLVING LEAST SQUARES PROBLEMS", Prentice-HalL, 1974.
-c  Revised FEB 1995 to accompany reprinting of the book by SIAM.
-c
-C     GIVEN AN M BY N MATRIX, A, AND AN M-VECTOR, B,  COMPUTE AN
-C     N-VECTOR, X, THAT SOLVES THE LEAST SQUARES PROBLEM   
-C   
-C                      A * X = B  SUBJECT TO X .GE. 0   
-C     ------------------------------------------------------------------
-c                     Subroutine Arguments
-c
-C     A(),MDA,M,N     MDA IS THE FIRST DIMENSIONING PARAMETER FOR THE   
-C                     ARRAY, A().   ON ENTRY A() CONTAINS THE M BY N    
-C                     MATRIX, A.           ON EXIT A() CONTAINS 
-C                     THE PRODUCT MATRIX, Q*A , WHERE Q IS AN   
-C                     M BY M ORTHOGONAL MATRIX GENERATED IMPLICITLY BY  
-C                     THIS SUBROUTINE.  
-C     B()     ON ENTRY B() CONTAINS THE M-VECTOR, B.   ON EXIT B() CON- 
-C             TAINS Q*B.
-C     X()     ON ENTRY X() NEED NOT BE INITIALIZED.  ON EXIT X() WILL   
-C             CONTAIN THE SOLUTION VECTOR.  
-C     RNORM   ON EXIT RNORM CONTAINS THE EUCLIDEAN NORM OF THE  
-C             RESIDUAL VECTOR.  
-C     W()     AN N-ARRAY OF WORKING SPACE.  ON EXIT W() WILL CONTAIN    
-C             THE DUAL SOLUTION VECTOR.   W WILL SATISFY W(I) = 0.  
-C             FOR ALL I IN SET P  AND W(I) .LE. 0. FOR ALL I IN SET Z   
-C     ZZ()     AN M-ARRAY OF WORKING SPACE.     
-C     INDEX()     AN INTEGER WORKING ARRAY OF LENGTH AT LEAST N.
-C                 ON EXIT THE CONTENTS OF THIS ARRAY DEFINE THE SETS    
-C                 P AND Z AS FOLLOWS..  
-C   
-C                 INDEX(1)   THRU INDEX(NSETP) = SET P.     
-C                 INDEX(IZ1) THRU INDEX(IZ2)   = SET Z.     
-C                 IZ1 = NSETP + 1 = NPP1
-C                 IZ2 = N   
-C     MODE    THIS IS A SUCCESS-FAILURE FLAG WITH THE FOLLOWING 
-C             MEANINGS. 
-C             1     THE SOLUTION HAS BEEN COMPUTED SUCCESSFULLY.
-C             2     THE DIMENSIONS OF THE PROBLEM ARE BAD.  
-C                   EITHER M .LE. 0 OR N .LE. 0.
-C             3    ITERATION COUNT EXCEEDED.  MORE THAN 3*N ITERATIONS. 
-C   
-C     ------------------------------------------------------------------
-      SUBROUTINE NNLS (A,MDA,M,N,B,X,RNORM,W,ZZ,INDEX,MODE) 
-C     ------------------------------------------------------------------
-      integer I, II, IP, ITER, ITMAX, IZ, IZ1, IZ2, IZMAX, J, JJ, JZ, L
-      integer M, MDA, MODE,N, NPP1, NSETP, RTNKEY
-c     integer INDEX(N)  
-c     double precision A(MDA,N), B(M), W(N), X(N), ZZ(M)   
-      integer INDEX(*)  
-      double precision A(MDA,*), B(*), W(*), X(*), ZZ(*)   
-      double precision ALPHA, ASAVE, CC, DIFF, DUMMY, FACTOR, RNORM
-      double precision SM, SS, T, TEMP, TWO, UNORM, UP, WMAX
-      double precision ZERO, ZTEST
-      parameter(FACTOR = 0.01d0)
-      parameter(TWO = 2.0d0, ZERO = 0.0d0)
-C     ------------------------------------------------------------------
-      MODE=1
-      IF (M .le. 0 .or. N .le. 0) then
-         MODE=2
-         RETURN
-      endif
-      ITER=0
-      ITMAX=3*N 
-C   
-C                    INITIALIZE THE ARRAYS INDEX() AND X(). 
-C   
-          DO 20 I=1,N   
-          X(I)=ZERO     
-   20     INDEX(I)=I    
-C   
-      IZ2=N 
-      IZ1=1 
-      NSETP=0   
-      NPP1=1
-C                             ******  MAIN LOOP BEGINS HERE  ******     
-   30 CONTINUE  
-C                  QUIT IF ALL COEFFICIENTS ARE ALREADY IN THE SOLUTION.
-C                        OR IF M COLS OF A HAVE BEEN TRIANGULARIZED.    
-C   
-      IF (IZ1 .GT.IZ2.OR.NSETP.GE.M) GO TO 350   
-C   
-C         COMPUTE COMPONENTS OF THE DUAL (NEGATIVE GRADIENT) VECTOR W().
-C   
-      DO 50 IZ=IZ1,IZ2  
-         J=INDEX(IZ)   
-         SM=ZERO   
-         DO 40 L=NPP1,M
-   40        SM=SM+A(L,J)*B(L)     
-         W(J)=SM   
-   50 continue
-C                                   FIND LARGEST POSITIVE W(J). 
-   60 continue
-      WMAX=ZERO 
-      DO 70 IZ=IZ1,IZ2  
-         J=INDEX(IZ)   
-         IF (W(J) .gt. WMAX) then
-            WMAX=W(J)     
-            IZMAX=IZ  
-         endif
-   70 CONTINUE  
-C   
-C             IF WMAX .LE. 0. GO TO TERMINATION.
-C             THIS INDICATES SATISFACTION OF THE KUHN-TUCKER CONDITIONS.
-C   
-      IF (WMAX .le. ZERO) go to 350
-      IZ=IZMAX  
-      J=INDEX(IZ)   
-C   
-C     THE SIGN OF W(J) IS OK FOR J TO BE MOVED TO SET P.    
-C     BEGIN THE TRANSFORMATION AND CHECK NEW DIAGONAL ELEMENT TO AVOID  
-C     NEAR LINEAR DEPENDENCE.   
-C   
-      ASAVE=A(NPP1,J)   
-      CALL H12 (1,NPP1,NPP1+1,M,A(1,J),1,UP,DUMMY,1,1,0)    
-      UNORM=ZERO
-      IF (NSETP .ne. 0) then
-          DO 90 L=1,NSETP   
-   90       UNORM=UNORM+A(L,J)**2     
-      endif
-      UNORM=sqrt(UNORM) 
-      IF (DIFF(UNORM+ABS(A(NPP1,J))*FACTOR,UNORM) .gt. ZERO) then
-C   
-C        COL J IS SUFFICIENTLY INDEPENDENT.  COPY B INTO ZZ, UPDATE ZZ
-C        AND SOLVE FOR ZTEST ( = PROPOSED NEW VALUE FOR X(J) ).    
-C   
-         DO 120 L=1,M  
-  120        ZZ(L)=B(L)    
-         CALL H12 (2,NPP1,NPP1+1,M,A(1,J),1,UP,ZZ,1,1,1)   
-         ZTEST=ZZ(NPP1)/A(NPP1,J)  
-C   
-C                                     SEE IF ZTEST IS POSITIVE  
-C   
-         IF (ZTEST .gt. ZERO) go to 140
-      endif
-C   
-C     REJECT J AS A CANDIDATE TO BE MOVED FROM SET Z TO SET P.  
-C     RESTORE A(NPP1,J), SET W(J)=0., AND LOOP BACK TO TEST DUAL
-C     COEFFS AGAIN.     
-C   
-      A(NPP1,J)=ASAVE   
-      W(J)=ZERO 
-      GO TO 60  
-C   
-C     THE INDEX  J=INDEX(IZ)  HAS BEEN SELECTED TO BE MOVED FROM
-C     SET Z TO SET P.    UPDATE B,  UPDATE INDICES,  APPLY HOUSEHOLDER  
-C     TRANSFORMATIONS TO COLS IN NEW SET Z,  ZERO SUBDIAGONAL ELTS IN   
-C     COL J,  SET W(J)=0.   
-C   
-  140 continue
-      DO 150 L=1,M  
-  150    B(L)=ZZ(L)    
-C   
-      INDEX(IZ)=INDEX(IZ1)  
-      INDEX(IZ1)=J  
-      IZ1=IZ1+1 
-      NSETP=NPP1
-      NPP1=NPP1+1   
-C   
-      IF (IZ1 .le. IZ2) then
-         DO 160 JZ=IZ1,IZ2 
-            JJ=INDEX(JZ)  
-            CALL H12 (2,NSETP,NPP1,M,A(1,J),1,UP,A(1,JJ),1,MDA,1)
-  160    continue
-      endif
-C   
-      IF (NSETP .ne. M) then
-         DO 180 L=NPP1,M   
-  180       A(L,J)=ZERO   
-      endif
-C   
-      W(J)=ZERO 
-C                                SOLVE THE TRIANGULAR SYSTEM.   
-C                                STORE THE SOLUTION TEMPORARILY IN ZZ().
-      RTNKEY = 1
-      GO TO 400 
-  200 CONTINUE  
-C   
-C                       ******  SECONDARY LOOP BEGINS HERE ******   
-C   
-C                          ITERATION COUNTER.   
-C 
-  210 continue  
-      ITER=ITER+1   
-      IF (ITER .gt. ITMAX) then
-         MODE=3
-         write (*,'(/a)') ' NNLS quitting on iteration count.'
-         GO TO 350 
-      endif
-C   
-C                    SEE IF ALL NEW CONSTRAINED COEFFS ARE FEASIBLE.    
-C                                  IF NOT COMPUTE ALPHA.    
-C   
-      ALPHA=TWO 
-      DO 240 IP=1,NSETP 
-         L=INDEX(IP)   
-         IF (ZZ(IP) .le. ZERO) then
-            T=-X(L)/(ZZ(IP)-X(L))     
-            IF (ALPHA .gt. T) then
-               ALPHA=T   
-               JJ=IP 
-            endif
-         endif
-  240 CONTINUE  
-C   
-C          IF ALL NEW CONSTRAINED COEFFS ARE FEASIBLE THEN ALPHA WILL   
-C          STILL = 2.    IF SO EXIT FROM SECONDARY LOOP TO MAIN LOOP.   
-C   
-      IF (ALPHA.EQ.TWO) GO TO 330   
-C   
-C          OTHERWISE USE ALPHA WHICH WILL BE BETWEEN 0. AND 1. TO   
-C          INTERPOLATE BETWEEN THE OLD X AND THE NEW ZZ.    
-C   
-      DO 250 IP=1,NSETP 
-         L=INDEX(IP)   
-         X(L)=X(L)+ALPHA*(ZZ(IP)-X(L)) 
-  250 continue
-C   
-C        MODIFY A AND B AND THE INDEX ARRAYS TO MOVE COEFFICIENT I  
-C        FROM SET P TO SET Z.   
-C   
-      I=INDEX(JJ)   
-  260 continue
-      X(I)=ZERO 
-C   
-      IF (JJ .ne. NSETP) then
-         JJ=JJ+1   
-         DO 280 J=JJ,NSETP 
-            II=INDEX(J)   
-            INDEX(J-1)=II 
-            CALL G1 (A(J-1,II),A(J,II),CC,SS,A(J-1,II))   
-            A(J,II)=ZERO  
-            DO 270 L=1,N  
-               IF (L.NE.II) then
-c
-c                 Apply procedure G2 (CC,SS,A(J-1,L),A(J,L))  
-c
-                  TEMP = A(J-1,L)
-                  A(J-1,L) = CC*TEMP + SS*A(J,L)
-                  A(J,L)   =-SS*TEMP + CC*A(J,L)
-               endif
-  270       CONTINUE  
-c
-c                 Apply procedure G2 (CC,SS,B(J-1),B(J))   
-c
-            TEMP = B(J-1)
-            B(J-1) = CC*TEMP + SS*B(J)    
-            B(J)   =-SS*TEMP + CC*B(J)    
-  280    continue
-      endif
-c
-      NPP1=NSETP
-      NSETP=NSETP-1     
-      IZ1=IZ1-1 
-      INDEX(IZ1)=I  
-C   
-C        SEE IF THE REMAINING COEFFS IN SET P ARE FEASIBLE.  THEY SHOULD
-C        BE BECAUSE OF THE WAY ALPHA WAS DETERMINED.
-C        IF ANY ARE INFEASIBLE IT IS DUE TO ROUND-OFF ERROR.  ANY   
-C        THAT ARE NONPOSITIVE WILL BE SET TO ZERO   
-C        AND MOVED FROM SET P TO SET Z. 
-C   
-      DO 300 JJ=1,NSETP 
-         I=INDEX(JJ)   
-         IF (X(I) .le. ZERO) go to 260
-  300 CONTINUE  
-C   
-C         COPY B( ) INTO ZZ( ).  THEN SOLVE AGAIN AND LOOP BACK.
-C   
-      DO 310 I=1,M  
-  310     ZZ(I)=B(I)    
-      RTNKEY = 2
-      GO TO 400 
-  320 CONTINUE  
-      GO TO 210 
-C                      ******  END OF SECONDARY LOOP  ******
-C   
-  330 continue
-      DO 340 IP=1,NSETP 
-          I=INDEX(IP)   
-  340     X(I)=ZZ(IP)   
-C        ALL NEW COEFFS ARE POSITIVE.  LOOP BACK TO BEGINNING.  
-      GO TO 30  
-C   
-C                        ******  END OF MAIN LOOP  ******   
-C   
-C                        COME TO HERE FOR TERMINATION.  
-C                     COMPUTE THE NORM OF THE FINAL RESIDUAL VECTOR.    
-C 
-  350 continue  
-      SM=ZERO   
-      IF (NPP1 .le. M) then
-         DO 360 I=NPP1,M   
-  360       SM=SM+B(I)**2 
-      else
-         DO 380 J=1,N  
-  380       W(J)=ZERO     
-      endif
-      RNORM=sqrt(SM)    
-      RETURN
-C   
-C     THE FOLLOWING BLOCK OF CODE IS USED AS AN INTERNAL SUBROUTINE     
-C     TO SOLVE THE TRIANGULAR SYSTEM, PUTTING THE SOLUTION IN ZZ().     
-C   
-  400 continue
-      DO 430 L=1,NSETP  
-         IP=NSETP+1-L  
-         IF (L .ne. 1) then
-            DO 410 II=1,IP
-               ZZ(II)=ZZ(II)-A(II,JJ)*ZZ(IP+1)   
-  410       continue
-         endif
-         JJ=INDEX(IP)  
-         ZZ(IP)=ZZ(IP)/A(IP,JJ)    
-  430 continue
-      go to (200, 320), RTNKEY
-      END   
-
-
-       double precision FUNCTION DIFF(X,Y)
-c
-c  Function used in tests that depend on machine precision.
-c
-c  The original version of this code was developed by
-c  Charles L. Lawson and Richard J. Hanson at Jet Propulsion Laboratory
-c  1973 JUN 7, and published in the book
-c  "SOLVING LEAST SQUARES PROBLEMS", Prentice-HalL, 1974.
-c  Revised FEB 1995 to accompany reprinting of the book by SIAM.
-C
-      double precision X, Y
-      DIFF=X-Y  
-      RETURN
-      END   
-
-
-C     SUBROUTINE H12 (MODE,LPIVOT,L1,M,U,IUE,UP,C,ICE,ICV,NCV)  
-C   
-C  CONSTRUCTION AND/OR APPLICATION OF A SINGLE   
-C  HOUSEHOLDER TRANSFORMATION..     Q = I + U*(U**T)/B   
-C   
-c  The original version of this code was developed by
-c  Charles L. Lawson and Richard J. Hanson at Jet Propulsion Laboratory
-c  1973 JUN 12, and published in the book
-c  "SOLVING LEAST SQUARES PROBLEMS", Prentice-HalL, 1974.
-c  Revised FEB 1995 to accompany reprinting of the book by SIAM.
-C     ------------------------------------------------------------------
-c                     Subroutine Arguments
-c
-C     MODE   = 1 OR 2   Selects Algorithm H1 to construct and apply a
-c            Householder transformation, or Algorithm H2 to apply a
-c            previously constructed transformation.
-C     LPIVOT IS THE INDEX OF THE PIVOT ELEMENT. 
-C     L1,M   IF L1 .LE. M   THE TRANSFORMATION WILL BE CONSTRUCTED TO   
-C            ZERO ELEMENTS INDEXED FROM L1 THROUGH M.   IF L1 GT. M     
-C            THE SUBROUTINE DOES AN IDENTITY TRANSFORMATION.
-C     U(),IUE,UP    On entry with MODE = 1, U() contains the pivot
-c            vector.  IUE is the storage increment between elements.  
-c            On exit when MODE = 1, U() and UP contain quantities
-c            defining the vector U of the Householder transformation.
-c            on entry with MODE = 2, U() and UP should contain
-c            quantities previously computed with MODE = 1.  These will
-c            not be modified during the entry with MODE = 2.   
-C     C()    ON ENTRY with MODE = 1 or 2, C() CONTAINS A MATRIX WHICH
-c            WILL BE REGARDED AS A SET OF VECTORS TO WHICH THE
-c            HOUSEHOLDER TRANSFORMATION IS TO BE APPLIED.
-c            ON EXIT C() CONTAINS THE SET OF TRANSFORMED VECTORS.
-C     ICE    STORAGE INCREMENT BETWEEN ELEMENTS OF VECTORS IN C().  
-C     ICV    STORAGE INCREMENT BETWEEN VECTORS IN C().  
-C     NCV    NUMBER OF VECTORS IN C() TO BE TRANSFORMED. IF NCV .LE. 0  
-C            NO OPERATIONS WILL BE DONE ON C(). 
-C     ------------------------------------------------------------------
-      SUBROUTINE H12 (MODE,LPIVOT,L1,M,U,IUE,UP,C,ICE,ICV,NCV)  
-C     ------------------------------------------------------------------
-      integer I, I2, I3, I4, ICE, ICV, INCR, IUE, J
-      integer L1, LPIVOT, M, MODE, NCV
-      double precision B, C(*), CL, CLINV, ONE, SM
-c     double precision U(IUE,M)
-      double precision U(IUE,*)
-      double precision UP
-      parameter(ONE = 1.0d0)
-C     ------------------------------------------------------------------
-      IF (0.GE.LPIVOT.OR.LPIVOT.GE.L1.OR.L1.GT.M) RETURN    
-      CL=abs(U(1,LPIVOT))   
-      IF (MODE.EQ.2) GO TO 60   
-C                            ****** CONSTRUCT THE TRANSFORMATION. ******
-          DO 10 J=L1,M  
-   10     CL=MAX(abs(U(1,J)),CL)  
-      IF (CL) 130,130,20
-   20 CLINV=ONE/CL  
-      SM=(U(1,LPIVOT)*CLINV)**2   
-          DO 30 J=L1,M  
-   30     SM=SM+(U(1,J)*CLINV)**2 
-      CL=CL*SQRT(SM)   
-      IF (U(1,LPIVOT)) 50,50,40     
-   40 CL=-CL
-   50 UP=U(1,LPIVOT)-CL 
-      U(1,LPIVOT)=CL    
-      GO TO 70  
-C            ****** APPLY THE TRANSFORMATION  I+U*(U**T)/B  TO C. ******
-C   
-   60 IF (CL) 130,130,70
-   70 IF (NCV.LE.0) RETURN  
-      B= UP*U(1,LPIVOT)
-C                       B  MUST BE NONPOSITIVE HERE.  IF B = 0., RETURN.
-C   
-      IF (B) 80,130,130 
-   80 B=ONE/B   
-      I2=1-ICV+ICE*(LPIVOT-1)   
-      INCR=ICE*(L1-LPIVOT)  
-          DO 120 J=1,NCV
-          I2=I2+ICV     
-          I3=I2+INCR    
-          I4=I3 
-          SM=C(I2)*UP
-              DO 90 I=L1,M  
-              SM=SM+C(I3)*U(1,I)
-   90         I3=I3+ICE 
-          IF (SM) 100,120,100   
-  100     SM=SM*B   
-          C(I2)=C(I2)+SM*UP
-              DO 110 I=L1,M 
-              C(I4)=C(I4)+SM*U(1,I)
-  110         I4=I4+ICE 
-  120     CONTINUE  
-  130 RETURN
-      END   
-
-
-
-      SUBROUTINE G1 (A,B,CTERM,STERM,SIG)   
-c
-C     COMPUTE ORTHOGONAL ROTATION MATRIX..  
-c
-c  The original version of this code was developed by
-c  Charles L. Lawson and Richard J. Hanson at Jet Propulsion Laboratory
-c  1973 JUN 12, and published in the book
-c  "SOLVING LEAST SQUARES PROBLEMS", Prentice-HalL, 1974.
-c  Revised FEB 1995 to accompany reprinting of the book by SIAM.
-C   
-C     COMPUTE.. MATRIX   (C, S) SO THAT (C, S)(A) = (SQRT(A**2+B**2))   
-C                        (-S,C)         (-S,C)(B)   (   0          )    
-C     COMPUTE SIG = SQRT(A**2+B**2) 
-C        SIG IS COMPUTED LAST TO ALLOW FOR THE POSSIBILITY THAT 
-C        SIG MAY BE IN THE SAME LOCATION AS A OR B .
-C     ------------------------------------------------------------------
-      double precision A, B, CTERM, ONE, SIG, STERM, XR, YR, ZERO
-      parameter(ONE = 1.0d0, ZERO = 0.0d0)
-C     ------------------------------------------------------------------
-      if (abs(A) .gt. abs(B)) then
-         XR=B/A
-         YR=sqrt(ONE+XR**2)
-         CTERM=sign(ONE/YR,A)
-         STERM=CTERM*XR
-         SIG=abs(A)*YR     
-         RETURN
-      endif
-
-      if (B .ne. ZERO) then
-         XR=A/B
-         YR=sqrt(ONE+XR**2)
-         STERM=sign(ONE/YR,B)
-         CTERM=STERM*XR
-         SIG=abs(B)*YR     
-         RETURN
-      endif
-
-      SIG=ZERO  
-      CTERM=ZERO  
-      STERM=ONE   
-      RETURN
-      END   

Copied: branches/refactor_fft/scipy/optimize/nnls/nnls.f (from rev 4827, trunk/scipy/optimize/nnls/nnls.f)

Deleted: branches/refactor_fft/scipy/optimize/nnls/nnls.pyf
===================================================================
--- trunk/scipy/optimize/nnls/nnls.pyf	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/optimize/nnls/nnls.pyf	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,22 +0,0 @@
-!    -*- f90 -*-
-! Note: the context of this file is case sensitive.
-
-python module _nnls ! in 
-    interface  ! in :_nnls
-        subroutine nnls(a,mda,m,n,b,x,rnorm,w,zz,index_bn,mode) ! in :nnls:NNLS.F
-            double precision dimension(mda,*), intent(copy) :: a
-            integer optional,check(shape(a,0)==mda),depend(a) :: mda=shape(a,0)
-            integer :: m
-            integer :: n
-            double precision dimension(*), intent(copy) :: b
-            double precision dimension(n), intent(out) :: x
-            double precision, intent(out) :: rnorm
-            double precision dimension(*) :: w
-            double precision dimension(*) :: zz
-            integer dimension(*) :: index_bn
-            integer , intent(out):: mode
-        end subroutine nnls
-end python module _nnls
-
-! This file was auto-generated with f2py (version:2_5878).
-! See http://cens.ioc.ee/projects/f2py2e/

Copied: branches/refactor_fft/scipy/optimize/nnls/nnls.pyf (from rev 4827, trunk/scipy/optimize/nnls/nnls.pyf)

Copied: branches/refactor_fft/scipy/optimize/nnls.py (from rev 4827, trunk/scipy/optimize/nnls.py)

Modified: branches/refactor_fft/scipy/optimize/optimize.py
===================================================================
--- branches/refactor_fft/scipy/optimize/optimize.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/optimize/optimize.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -24,7 +24,7 @@
 
 import numpy
 from numpy import atleast_1d, eye, mgrid, argmin, zeros, shape, empty, \
-     squeeze, isscalar, vectorize, asarray, absolute, sqrt, Inf, asfarray, isinf
+     squeeze, vectorize, asarray, absolute, sqrt, Inf, asfarray, isinf
 import linesearch
 
 # These have been copied from Numeric's MLab.py

Modified: branches/refactor_fft/scipy/optimize/setup.py
===================================================================
--- branches/refactor_fft/scipy/optimize/setup.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/optimize/setup.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -41,6 +41,9 @@
     sources = ['slsqp.pyf', 'slsqp_optmz.f']
     config.add_extension('_slsqp', sources=[join('slsqp', x) for x in sources])
 
+    config.add_extension('_nnls', sources=[join('nnls', x) \
+                                          for x in ["nnls.f","nnls.pyf"]])
+
     config.add_data_dir('tests')
     config.add_data_dir('benchmarks')
     return config

Modified: branches/refactor_fft/scipy/optimize/slsqp.py
===================================================================
--- branches/refactor_fft/scipy/optimize/slsqp.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/optimize/slsqp.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -8,8 +8,8 @@
 __all__ = ['approx_jacobian','fmin_slsqp']
 
 from _slsqp import slsqp
-from numpy import zeros, array, identity, linalg, rank, squeeze, append, \
-                  asfarray,product, concatenate, finfo, sqrt, vstack, transpose
+from numpy import zeros, array, linalg, append, asfarray, concatenate, finfo, \
+                  sqrt, vstack
 from optimize import approx_fprime, wrap_function
 
 __docformat__ = "restructuredtext en"

Copied: branches/refactor_fft/scipy/optimize/tests/test_nnls.py (from rev 4827, trunk/scipy/optimize/tests/test_nnls.py)

Modified: branches/refactor_fft/scipy/optimize/tests/test_optimize.py
===================================================================
--- branches/refactor_fft/scipy/optimize/tests/test_optimize.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/optimize/tests/test_optimize.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -13,8 +13,7 @@
 
 from scipy import optimize
 from scipy.optimize import leastsq
-from numpy import array, zeros, float64, dot, log, exp, inf, \
-     pi, sin, cos
+from numpy import array, zeros, float64, dot, log, exp, inf, sin, cos
 import numpy as np
 from scipy.optimize.tnc import RCSTRINGS, MSG_NONE
 import numpy.random
@@ -264,14 +263,14 @@
         return err
 
     def test_basic(self):
-        p0 = numpy.array([0,0,0])
+        p0 = array([0,0,0])
         params_fit, ier = leastsq(self.residuals, p0,
                                   args=(self.y_meas, self.x))
         assert ier in (1,2,3,4), 'solution not found (ier=%d)'%ier
         assert_array_almost_equal( params_fit, self.abc, decimal=2) # low precision due to random
 
     def test_full_output(self):
-        p0 = numpy.array([0,0,0])
+        p0 = array([0,0,0])
         full_output = leastsq(self.residuals, p0,
                               args=(self.y_meas, self.x),
                               full_output=True)
@@ -279,8 +278,8 @@
         assert ier in (1,2,3,4), 'solution not found: %s'%mesg
 
     def test_input_untouched(self):
-        p0 = numpy.array([0,0,0],dtype=numpy.float64)
-        p0_copy = numpy.array(p0, copy=True)
+        p0 = array([0,0,0],dtype=float64)
+        p0_copy = array(p0, copy=True)
         full_output = leastsq(self.residuals, p0,
                               args=(self.y_meas, self.x),
                               full_output=True)

Modified: branches/refactor_fft/scipy/optimize/tests/test_slsqp.py
===================================================================
--- branches/refactor_fft/scipy/optimize/tests/test_slsqp.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/optimize/tests/test_slsqp.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -2,7 +2,6 @@
 import numpy as np
 
 from scipy.optimize import  fmin_slsqp
-from numpy import matrix, diag
 
 
 class TestSLSQP(TestCase):

Modified: branches/refactor_fft/scipy/optimize/tests/test_zeros.py
===================================================================
--- branches/refactor_fft/scipy/optimize/tests/test_zeros.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/optimize/tests/test_zeros.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -7,8 +7,7 @@
 from scipy.optimize import zeros as cc
 
 # Import testing parameters
-from scipy.optimize._tstutils import methods, mstrings, functions, \
-     fstrings, description
+from scipy.optimize._tstutils import functions, fstrings
 
 class TestBasic(TestCase) :
     def run_check(self, method, name):

Modified: branches/refactor_fft/scipy/optimize/zeros.py
===================================================================
--- branches/refactor_fft/scipy/optimize/zeros.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/optimize/zeros.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,7 +1,7 @@
 ## Automatically adapted for scipy Oct 07, 2005 by convertcode.py
 
 import _zeros
-from numpy import sqrt, sign, finfo
+from numpy import finfo
 
 _iter = 100
 _xtol = 1e-12

Modified: branches/refactor_fft/scipy/signal/bsplines.py
===================================================================
--- branches/refactor_fft/scipy/signal/bsplines.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/signal/bsplines.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -3,7 +3,7 @@
 import scipy.special
 from numpy import logical_and, asarray, pi, zeros_like, \
      piecewise, array, arctan2, tan, zeros, arange, floor
-from numpy.core.umath import sqrt, exp, greater, less, equal, cos, add, sin, \
+from numpy.core.umath import sqrt, exp, greater, less, cos, add, sin, \
      less_equal, greater_equal
 from spline import *      # C-modules
 from scipy.misc import comb

Modified: branches/refactor_fft/scipy/signal/signaltools.py
===================================================================
--- branches/refactor_fft/scipy/signal/signaltools.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/signal/signaltools.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -4,17 +4,16 @@
 import types
 import sigtools
 from scipy import special, linalg
-from scipy.fftpack import fft, ifft, ifftshift, fft2, ifft2
+from scipy.fftpack import fft, ifft, ifftshift, fft2, ifft2, fftn, ifftn
 from numpy import polyadd, polymul, polydiv, polysub, \
      roots, poly, polyval, polyder, cast, asarray, isscalar, atleast_1d, \
      ones, sin, linspace, real, extract, real_if_close, zeros, array, arange, \
      where, sqrt, rank, newaxis, argmax, product, cos, pi, exp, \
      ravel, size, less_equal, sum, r_, iscomplexobj, take, \
-     argsort, allclose, expand_dims, unique, prod, sort, reshape, c_, \
-     transpose, dot, any, minimum, maximum, mean, cosh, arccosh, \
+     argsort, allclose, expand_dims, unique, prod, sort, reshape, \
+     transpose, dot, any, mean, cosh, arccosh, \
      arccos, concatenate
-import numpy
-from scipy.fftpack import fftn, ifftn, fft
+import numpy as np
 from scipy.misc import factorial
 
 _modedict = {'valid':0, 'same':1, 'full':2}
@@ -94,8 +93,8 @@
     """
     s1 = array(in1.shape)
     s2 = array(in2.shape)
-    complex_result = (numpy.issubdtype(in1.dtype, numpy.complex) or
-                      numpy.issubdtype(in2.dtype, numpy.complex))
+    complex_result = (np.issubdtype(in1.dtype, np.complex) or
+                      np.issubdtype(in2.dtype, np.complex))
     size = s1+s2-1
     IN1 = fftn(in1,size)
     IN1 *= fftn(in2,size)
@@ -864,7 +863,7 @@
     p = zeros(x.shape)
     p[x > 1] = cosh(order * arccosh(x[x > 1]))
     p[x < -1] = (1 - 2*(order%2)) * cosh(order * arccosh(-x[x < -1]))
-    p[numpy.abs(x) <=1 ] = cos(order * arccos(x[numpy.abs(x) <= 1]))
+    p[np.abs(x) <=1 ] = cos(order * arccos(x[np.abs(x) <= 1]))
 
     # Appropriate IDFT and filling up
     # depending on even/odd M
@@ -1004,11 +1003,11 @@
       mult -- The multiplicity of each root
     """
     if rtype in ['max','maximum']:
-        comproot = numpy.maximum
+        comproot = np.maximum
     elif rtype in ['min','minimum']:
-        comproot = numpy.minimum
+        comproot = np.minimum
     elif rtype in ['avg','mean']:
-        comproot = numpy.mean
+        comproot = np.mean
     p = asarray(p)*1.0
     tol = abs(tol)
     p, indx = cmplx_sort(p)
@@ -1381,7 +1380,7 @@
     sl = [slice(None)]*len(x.shape)
     newshape = list(x.shape)
     newshape[axis] = num
-    N = int(numpy.minimum(num,Nx))
+    N = int(np.minimum(num,Nx))
     Y = zeros(newshape,'D')
     sl[axis] = slice(0,(N+1)/2)
     Y[sl] = X[sl]

Modified: branches/refactor_fft/scipy/signal/wavelets.py
===================================================================
--- branches/refactor_fft/scipy/signal/wavelets.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/signal/wavelets.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,45 +1,45 @@
 __all__ = ['daub','qmf','cascade','morlet']
 
-import numpy as sb
+import numpy as np
 from numpy.dual import eig
 from scipy.misc import comb
-from scipy import linspace, pi, exp, zeros
+from scipy import linspace, pi, exp
 
 def daub(p):
     """The coefficients for the FIR low-pass filter producing Daubechies wavelets.
 
     p>=1 gives the order of the zero at f=1/2.  There are 2p filter coefficients.
     """
-    sqrt = sb.sqrt
+    sqrt = np.sqrt
     assert(p>=1)
     if p==1:
         c = 1/sqrt(2)
-        return sb.array([c,c])
+        return np.array([c,c])
     elif p==2:
         f = sqrt(2)/8
         c = sqrt(3)
-        return f*sb.array([1+c,3+c,3-c,1-c])
+        return f*np.array([1+c,3+c,3-c,1-c])
     elif p==3:
         tmp  = 12*sqrt(10)
         z1 = 1.5 + sqrt(15+tmp)/6 - 1j*(sqrt(15)+sqrt(tmp-15))/6
-        z1c = sb.conj(z1)
+        z1c = np.conj(z1)
         f = sqrt(2)/8
-        d0 = sb.real((1-z1)*(1-z1c))
-        a0 = sb.real(z1*z1c)
-        a1 = 2*sb.real(z1)
-        return f/d0*sb.array([a0, 3*a0-a1, 3*a0-3*a1+1, a0-3*a1+3, 3-a1, 1])
+        d0 = np.real((1-z1)*(1-z1c))
+        a0 = np.real(z1*z1c)
+        a1 = 2*np.real(z1)
+        return f/d0*np.array([a0, 3*a0-a1, 3*a0-3*a1+1, a0-3*a1+3, 3-a1, 1])
     elif p<35:
         # construct polynomial and factor it
         if p<35:
             P = [comb(p-1+k,k,exact=1) for k in range(p)][::-1]
-            yj = sb.roots(P)
+            yj = np.roots(P)
         else:  # try different polynomial --- needs work
             P = [comb(p-1+k,k,exact=1)/4.0**k for k in range(p)][::-1]
-            yj = sb.roots(P) / 4
+            yj = np.roots(P) / 4
         # for each root, compute two z roots, select the one with |z|>1
         # Build up final polynomial
-        c = sb.poly1d([1,1])**p
-        q = sb.poly1d([1])
+        c = np.poly1d([1,1])**p
+        q = np.poly1d([1])
         for k in range(p-1):
             yval = yj[k]
             part = 2*sqrt(yval*(yval-1))
@@ -49,9 +49,9 @@
                 z1 = const - part
             q = q * [1,-z1]
 
-        q = c * sb.real(q)
+        q = c * np.real(q)
         # Normalize result
-        q = q / sb.sum(q) * sqrt(2)
+        q = q / np.sum(q) * sqrt(2)
         return q.c[::-1]
     else:
         raise ValueError, "Polynomial factorization does not work "\
@@ -62,7 +62,7 @@
     """
     N = len(hk)-1
     asgn = [{0:1,1:-1}[k%2] for k in range(N+1)]
-    return hk[::-1]*sb.array(asgn)
+    return hk[::-1]*np.array(asgn)
 
 def wavedec(amn,hk):
     gk = qmf(hk)
@@ -96,55 +96,55 @@
 
     N = len(hk)-1
 
-    if (J > 30 - sb.log2(N+1)):
+    if (J > 30 - np.log2(N+1)):
         raise ValueError, "Too many levels."
     if (J < 1):
         raise ValueError, "Too few levels."
 
 
     # construct matrices needed
-    nn,kk = sb.ogrid[:N,:N]
-    s2 = sb.sqrt(2)
+    nn,kk = np.ogrid[:N,:N]
+    s2 = np.sqrt(2)
     # append a zero so that take works
-    thk = sb.r_[hk,0]
+    thk = np.r_[hk,0]
     gk = qmf(hk)
-    tgk = sb.r_[gk,0]
+    tgk = np.r_[gk,0]
 
-    indx1 = sb.clip(2*nn-kk,-1,N+1)
-    indx2 = sb.clip(2*nn-kk+1,-1,N+1)
-    m = sb.zeros((2,2,N,N),'d')
-    m[0,0] = sb.take(thk,indx1,0)
-    m[0,1] = sb.take(thk,indx2,0)
-    m[1,0] = sb.take(tgk,indx1,0)
-    m[1,1] = sb.take(tgk,indx2,0)
+    indx1 = np.clip(2*nn-kk,-1,N+1)
+    indx2 = np.clip(2*nn-kk+1,-1,N+1)
+    m = np.zeros((2,2,N,N),'d')
+    m[0,0] = np.take(thk,indx1,0)
+    m[0,1] = np.take(thk,indx2,0)
+    m[1,0] = np.take(tgk,indx1,0)
+    m[1,1] = np.take(tgk,indx2,0)
     m *= s2
 
     # construct the grid of points
-    x = sb.arange(0,N*(1<<J),dtype=sb.float) / (1<<J)
+    x = np.arange(0,N*(1<<J),dtype=np.float) / (1<<J)
     phi = 0*x
 
     psi = 0*x
 
     # find phi0, and phi1
     lam, v = eig(m[0,0])
-    ind = sb.argmin(sb.absolute(lam-1))
+    ind = np.argmin(np.absolute(lam-1))
     # a dictionary with a binary representation of the
     #   evaluation points x < 1 -- i.e. position is 0.xxxx
-    v = sb.real(v[:,ind])
+    v = np.real(v[:,ind])
     # need scaling function to integrate to 1 so find
     #  eigenvector normalized to sum(v,axis=0)=1
-    sm = sb.sum(v)
+    sm = np.sum(v)
     if sm < 0:  # need scaling function to integrate to 1
         v = -v
         sm = -sm
     bitdic = {}
     bitdic['0'] = v / sm
-    bitdic['1'] = sb.dot(m[0,1],bitdic['0'])
+    bitdic['1'] = np.dot(m[0,1],bitdic['0'])
     step = 1<<J
     phi[::step] = bitdic['0']
     phi[(1<<(J-1))::step] = bitdic['1']
-    psi[::step] = sb.dot(m[1,0],bitdic['0'])
-    psi[(1<<(J-1))::step] = sb.dot(m[1,1],bitdic['0'])
+    psi[::step] = np.dot(m[1,0],bitdic['0'])
+    psi[(1<<(J-1))::step] = np.dot(m[1,1],bitdic['0'])
     # descend down the levels inserting more and more values
     #  into bitdic -- store the values in the correct location once we
     #  have computed them -- stored in the dictionary
@@ -161,10 +161,10 @@
                     num += (1<<(level-1-pos))
             pastphi = bitdic[key[1:]]
             ii = int(key[0])
-            temp = sb.dot(m[0,ii],pastphi)
+            temp = np.dot(m[0,ii],pastphi)
             bitdic[key] = temp
             phi[num*fac::step] = temp
-            psi[num*fac::step] = sb.dot(m[1,ii],pastphi)
+            psi[num*fac::step] = np.dot(m[1,ii],pastphi)
         prevkeys = newkeys
 
     return x, phi, psi

Modified: branches/refactor_fft/scipy/sparse/benchmarks/bench_sparse.py
===================================================================
--- branches/refactor_fft/scipy/sparse/benchmarks/bench_sparse.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/benchmarks/bench_sparse.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -8,8 +8,8 @@
 from numpy.testing import *
 
 from scipy import sparse
-from scipy.sparse import csc_matrix, csr_matrix, dok_matrix, \
-        coo_matrix, lil_matrix, dia_matrix, spdiags
+from scipy.sparse import csr_matrix, coo_matrix, dia_matrix, lil_matrix, \
+        dok_matrix
 
 
 def random_sparse(m,n,nnz_per_row):

Modified: branches/refactor_fft/scipy/sparse/bsr.py
===================================================================
--- branches/refactor_fft/scipy/sparse/bsr.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/bsr.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -7,16 +7,15 @@
 from warnings import warn
 
 from numpy import zeros, intc, array, asarray, arange, diff, tile, rank, \
-        prod, ravel, empty, matrix, asmatrix, empty_like, hstack
+                  ravel, empty, empty_like
 
 from data import _data_matrix
 from compressed import _cs_matrix
 from base import isspmatrix, _formats
-from sputils import isshape, getdtype, to_native, isscalarlike, isdense, \
-        upcast
+from sputils import isshape, getdtype, to_native, upcast
 import sparsetools
-from sparsetools import bsr_matvec, bsr_matvecs, csr_matmat_pass1, csr_matmat_pass2, \
-        bsr_matmat_pass2, bsr_transpose, bsr_sort_indices
+from sparsetools import bsr_matvec, bsr_matvecs, csr_matmat_pass1, \
+                        bsr_matmat_pass2, bsr_transpose, bsr_sort_indices
 
 class bsr_matrix(_cs_matrix):
     """Block Sparse Row matrix

Modified: branches/refactor_fft/scipy/sparse/compressed.py
===================================================================
--- branches/refactor_fft/scipy/sparse/compressed.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/compressed.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -5,10 +5,8 @@
 
 from warnings import warn
 
-import numpy
-from numpy import array, matrix, asarray, asmatrix, zeros, rank, intc, \
-        empty, hstack, isscalar, ndarray, shape, searchsorted, empty_like, \
-        where, concatenate, transpose, deprecate
+from numpy import array, asarray, zeros, rank, intc, empty, isscalar, \
+                  empty_like, where, concatenate, deprecate, diff, multiply
 
 from base import spmatrix, isspmatrix, SparseEfficiencyWarning
 from data import _data_matrix
@@ -166,7 +164,7 @@
                 if self.indices.min() < 0:
                     raise ValueError, "%s index values must be >= 0" % \
                             minor_name
-                if numpy.diff(self.indptr).min() < 0:
+                if diff(self.indptr).min() < 0:
                     raise ValueError,'index pointer values must form a " \
                                         "non-decreasing sequence'
 
@@ -260,7 +258,7 @@
             raise ValueError('inconsistent shapes')
 
         if isdense(other):
-            return numpy.multiply(self.todense(),other)
+            return multiply(self.todense(),other)
         else:
             other = self.__class__(other)
             return self._binopt(other,'_elmul_')
@@ -541,7 +539,7 @@
 
         index  = self.indices[indices] - start
         data   = self.data[indices]
-        indptr = numpy.array([0, len(indices)])
+        indptr = array([0, len(indices)])
         return self.__class__((data, index, indptr), shape=shape, \
                               dtype=self.dtype)
 

Modified: branches/refactor_fft/scipy/sparse/construct.py
===================================================================
--- branches/refactor_fft/scipy/sparse/construct.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/construct.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -15,16 +15,13 @@
 
 from sputils import upcast
 
-from csr import csr_matrix, isspmatrix_csr
-from csc import csc_matrix, isspmatrix_csc
+from csr import csr_matrix
+from csc import csc_matrix
 from bsr import bsr_matrix
 from coo import coo_matrix
-from dok import dok_matrix
 from lil import lil_matrix
 from dia import dia_matrix
-from base import isspmatrix
 
-
 def spdiags(data, diags, m, n, format=None):
     """Return a sparse matrix from diagonals.
 

Modified: branches/refactor_fft/scipy/sparse/coo.py
===================================================================
--- branches/refactor_fft/scipy/sparse/coo.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/coo.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -7,14 +7,13 @@
 from itertools import izip
 from warnings import warn
 
-from numpy import array, asarray, empty, intc, zeros, \
-        unique, searchsorted, atleast_2d, rank, deprecate, hstack
+from numpy import array, asarray, empty, intc, zeros, unique, searchsorted,\
+                  atleast_2d, rank, deprecate, hstack
 
-from sparsetools import coo_tocsr, coo_tocsc, coo_todense, coo_matvec
+from sparsetools import coo_tocsr, coo_todense, coo_matvec
 from base import isspmatrix
 from data import _data_matrix
 from sputils import upcast, to_native, isshape, getdtype
-from spfuncs import estimate_blocksize
 
 class coo_matrix(_data_matrix):
     """A sparse matrix in COOrdinate format.

Modified: branches/refactor_fft/scipy/sparse/csc.py
===================================================================
--- branches/refactor_fft/scipy/sparse/csc.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/csc.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -6,15 +6,9 @@
 
 from warnings import warn
 
-import numpy
-from numpy import array, matrix, asarray, asmatrix, zeros, rank, intc, \
-        empty, hstack, isscalar, ndarray, shape, searchsorted, where, \
-        concatenate, deprecate, transpose, ravel
-
-from base import spmatrix, isspmatrix
+from numpy import asarray, intc, empty, searchsorted, deprecate
 from sparsetools import csc_tocsr
-from sputils import upcast, to_native, isdense, isshape, getdtype, \
-        isscalarlike, isintlike
+from sputils import upcast, isintlike
 
 from compressed import _cs_matrix
 

Modified: branches/refactor_fft/scipy/sparse/csr.py
===================================================================
--- branches/refactor_fft/scipy/sparse/csr.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/csr.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -7,16 +7,12 @@
 
 from warnings import warn
 
-import numpy
-from numpy import array, matrix, asarray, asmatrix, zeros, rank, intc, \
-        empty, hstack, isscalar, ndarray, shape, searchsorted, where, \
-        concatenate, deprecate, arange, ones, ravel
+from numpy import asarray, asmatrix, zeros, intc, empty, isscalar, array, \
+                  searchsorted, where, deprecate, arange, ones, ravel
 
-from base import spmatrix, isspmatrix
 from sparsetools import csr_tocsc, csr_tobsr, csr_count_blocks, \
         get_csr_submatrix
-from sputils import upcast, to_native, isdense, isshape, getdtype, \
-        isscalarlike, isintlike
+from sputils import upcast, isintlike
 
 
 from compressed import _cs_matrix
@@ -319,7 +315,7 @@
 
         index  = self.indices[indices] - start
         data   = self.data[indices]
-        indptr = numpy.array([0, len(indices)])
+        indptr = array([0, len(indices)])
         return csr_matrix( (data, index, indptr), shape=(1, stop-start) )
 
     def _get_submatrix( self, row_slice, col_slice ):
@@ -342,7 +338,7 @@
 
                 return i0, i1
 
-            elif isscalar( sl ):
+            elif isintlike( sl ):
                 if sl < 0:
                     sl += num
 

Modified: branches/refactor_fft/scipy/sparse/dia.py
===================================================================
--- branches/refactor_fft/scipy/sparse/dia.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/dia.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -4,14 +4,12 @@
 
 __all__ = ['dia_matrix','isspmatrix_dia']
 
-from numpy import asarray, asmatrix, matrix, zeros, arange, array, \
-        empty_like, intc, atleast_1d, atleast_2d, add, multiply, \
-        unique, hstack
+from numpy import asarray, zeros, arange, array, intc, atleast_1d, \
+                  atleast_2d, unique, hstack
 
 from base import isspmatrix, _formats
 from data import _data_matrix
-from sputils import isscalarlike, isshape, upcast, getdtype, isdense
-
+from sputils import isshape, upcast, getdtype
 from sparsetools import dia_matvec
 
 class dia_matrix(_data_matrix):
@@ -28,9 +26,9 @@
             to construct an empty matrix with shape (M, N),
             dtype is optional, defaulting to dtype='d'.
 
-        dia_matrix((data, diags), shape=(M, N))
+        dia_matrix((data, offsets), shape=(M, N))
             where the ``data[k,:]`` stores the diagonal entries for
-            diagonal ``diag[k]`` (See example below)
+            diagonal ``offsets[k]`` (See example below)
 
 
     Examples
@@ -44,8 +42,8 @@
             [0, 0, 0, 0]], dtype=int8)
 
     >>> data = array([[1,2,3,4]]).repeat(3,axis=0)
-    >>> diags = array([0,-1,2])
-    >>> dia_matrix( (data,diags), shape=(4,4)).todense()
+    >>> offsets = array([0,-1,2])
+    >>> dia_matrix( (data,offsets), shape=(4,4)).todense()
     matrix([[1, 0, 3, 0],
             [1, 2, 0, 4],
             [0, 2, 3, 0],
@@ -59,36 +57,36 @@
         if isspmatrix_dia(arg1):
             if copy:
                 arg1 = arg1.copy()
-            self.data  = arg1.data
-            self.diags = arg1.diags
-            self.shape = arg1.shape
+            self.data    = arg1.data
+            self.offsets = arg1.offsets
+            self.shape   = arg1.shape
         elif isspmatrix(arg1):
             if isspmatrix_dia(arg1) and copy:
                 A = arg1.copy()
             else:
                 A = arg1.todia()
-            self.data  = A.data
-            self.diags = A.diags
-            self.shape = A.shape
+            self.data    = A.data
+            self.offsets = A.offsets
+            self.shape   = A.shape
         elif isinstance(arg1, tuple):
             if isshape(arg1):
                 # It's a tuple of matrix dimensions (M, N)
                 # create empty matrix
                 self.shape = arg1   #spmatrix checks for errors here
                 self.data  = zeros( (0,0), getdtype(dtype, default=float))
-                self.diags = zeros( (0), dtype=intc)
+                self.offsets = zeros( (0), dtype=intc)
             else:
                 try:
-                    # Try interpreting it as (data, diags)
-                    data, diags = arg1
+                    # Try interpreting it as (data, offsets)
+                    data, offsets = arg1
                 except:
-                    raise ValueError, "unrecognized form for dia_matrix constructor"
+                    raise ValueError('unrecognized form for dia_matrix constructor')
                 else:
                     if shape is None:
-                        raise ValueError,'expected a shape argument'
-                    self.data  = atleast_2d(array(arg1[0],dtype=dtype,copy=copy))
-                    self.diags = atleast_1d(array(arg1[1],dtype='i',copy=copy))
-                    self.shape = shape
+                        raise ValueError('expected a shape argument')
+                    self.data    = atleast_2d(array(arg1[0],dtype=dtype,copy=copy))
+                    self.offsets = atleast_1d(array(arg1[1],dtype='i',copy=copy))
+                    self.shape   = shape
         else:
             #must be dense, convert to COO first, then to DIA
             try:
@@ -98,25 +96,25 @@
                         " %s_matrix constructor" % self.format
             from coo import coo_matrix
             A = coo_matrix(arg1).todia()
-            self.data  = A.data
-            self.diags = A.diags
-            self.shape = A.shape
+            self.data    = A.data
+            self.offsets = A.offsets
+            self.shape   = A.shape
 
 
         #check format
-        if self.diags.ndim != 1:
-            raise ValueError,'diags array must have rank 1'
+        if self.offsets.ndim != 1:
+            raise ValueError('offsets array must have rank 1')
 
         if self.data.ndim != 2:
-            raise ValueError,'data array must have rank 2'
+            raise ValueError('data array must have rank 2')
 
-        if self.data.shape[0] != len(self.diags):
-            raise ValueError,'number of diagonals (%d) ' \
-                    'does not match the number of diags (%d)' \
-                    % (self.data.shape[0], len(self.diags))
+        if self.data.shape[0] != len(self.offsets):
+            raise ValueError('number of diagonals (%d) ' \
+                    'does not match the number of offsets (%d)' \
+                    % (self.data.shape[0], len(self.offsets)))
 
-        if len(unique(self.diags)) != len(self.diags):
-            raise ValueError,'offset array contains duplicate values'
+        if len(unique(self.offsets)) != len(self.offsets):
+            raise ValueError('offset array contains duplicate values')
 
     def __repr__(self):
         nnz = self.getnnz()
@@ -133,7 +131,7 @@
         """
         M,N = self.shape
         nnz = 0
-        for k in self.diags:
+        for k in self.offsets:
             if k > 0:
                 nnz += min(M,N-k)
             else:
@@ -151,7 +149,7 @@
 
         M,N = self.shape
 
-        dia_matvec(M,N, len(self.diags), L, self.diags, self.data, x.ravel(), y.ravel())
+        dia_matvec(M,N, len(self.offsets), L, self.offsets, self.data, x.ravel(), y.ravel())
 
         return y
 
@@ -179,7 +177,7 @@
         row = arange(len_data).reshape(1,-1).repeat(num_data,axis=0)
         col = row.copy()
 
-        for i,k in enumerate(self.diags):
+        for i,k in enumerate(self.offsets):
             row[i,:] -= k
 
         row,col,data = row.ravel(),col.ravel(),self.data.ravel()
@@ -200,9 +198,9 @@
         but with different data.  By default the structure arrays are copied.
         """
         if copy:
-            return dia_matrix( (data,self.diags.copy()), shape=self.shape)
+            return dia_matrix( (data,self.offsets.copy()), shape=self.shape)
         else:
-            return dia_matrix( (data,self.diags), shape=self.shape)
+            return dia_matrix( (data,self.offsets), shape=self.shape)
 
 
 from sputils import _isinstance

Modified: branches/refactor_fft/scipy/sparse/dok.py
===================================================================
--- branches/refactor_fft/scipy/sparse/dok.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/dok.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -7,53 +7,73 @@
 import operator
 from itertools import izip
 
-from numpy import asarray, asmatrix, intc, isscalar, array, matrix
+from numpy import asarray, intc, isscalar
 
 from base import spmatrix,isspmatrix
 from sputils import isdense, getdtype, isshape, isintlike, isscalarlike
 
 class dok_matrix(spmatrix, dict):
     """Dictionary Of Keys based matrix.  This is an efficient
-    structure for constructing sparse matrices
+    structure for constructing sparse matrices incrementally.
+
+    This can be instatiated in several ways:
+        dok_matrix(D)
+            with a dense matrix, D
+
+        dok_matrix(S)
+            with a sparse matrix, S
+
+        dok_matrix((M,N), [dtype])
+            create the matrix with initial shape (M,N)
+            dtype is optional, defaulting to dtype='d'
+
+    Notes
+    -----
+    Allows for efficient O(1) access of individual elements.
+    Duplicates are not allowed.
+    Can be efficiently converted to a coo_matrix once constructed.
+
+    Examples
+    --------
+    >>> from scipy.sparse import *
+    >>> from scipy import *
+    >>> S = dok_matrix((5,5), dtype=float32)
+    >>> for i in range(5):
+    >>>     for j in range(5):
+    >>>         S[i,j] = i+j # Update element
+
     """
-    def __init__(self, A=None, shape=None, dtype=None, copy=False):
-        """ Create a new dictionary-of-keys sparse matrix.  An optional
-        argument A is accepted, which initializes the dok_matrix with it.
-        This can be a tuple of dimensions (M, N) or a (dense) array
-        to copy.
-        """
-        #TODO deprecate argument A in favor of arg1 style
 
+    def __init__(self, arg1, shape=None, dtype=None, copy=False):
         dict.__init__(self)
         spmatrix.__init__(self)
-        self.dtype = getdtype(dtype, A, default=float)
-        if A is not None:
-            if isinstance(A, tuple):
-                # Interpret as dimensions
-                if not isshape(A):
-                    raise TypeError, "dimensions must be a 2-tuple of positive"\
-                            " integers"
-                self.shape = A
-            elif isspmatrix(A):
-                if isspmatrix_dok(A) and copy:
-                    A = A.copy()
-                else:
-                    A = A.todok()
-                self.update( A )
-                self.shape = A.shape
-                self.dtype = A.dtype
+
+        self.dtype = getdtype(dtype, default=float)
+        if isinstance(arg1, tuple) and isshape(arg1): # (M,N)
+            M, N = arg1
+            self.shape = (M, N)
+        elif isspmatrix(arg1): # Sparse ctor
+            if isspmatrix_dok(arg1) and copy:
+                arg1 = arg1.copy()
             else:
-                #must be dense, convert to COO first, then to DOK
-                try:
-                    A = asarray(A)
-                except:
-                    raise ValueError, "unrecognized form for" \
-                            " %s_matrix constructor" % self.format
-                from coo import coo_matrix
-                self.update( coo_matrix(A).todok() )
-                self.shape = A.shape
-                self.dtype = A.dtype
+                arg1 = arg1.todok()
+            self.update(arg1)
+            self.shape = arg1.shape
+            self.dtype = arg1.dtype
+        else: # Dense ctor
+            try:
+                arg1 = asarray(arg1)
+            except:
+                raise TypeError('invalid input format')
 
+            if len(arg1.shape)!=2:
+                raise TypeError('expected rank <=2 dense array or matrix')
+
+            from coo import coo_matrix
+            self.update( coo_matrix(arg1).todok() )
+            self.shape = arg1.shape
+            self.dtype = arg1.dtype
+
     def getnnz(self):
         return dict.__len__(self)
     nnz = property(fget=getnnz)
@@ -177,13 +197,10 @@
 
     def __setitem__(self, key, value):
         try:
-            assert len(key) == 2
-        except (AssertionError, TypeError):
-            raise TypeError, "index must be a pair of integers, slices, or" \
-                    " sequences"
-        i, j = key
+            i, j = key
+        except (ValueError, TypeError):
+            raise TypeError, "index must be a pair of integers or slices"
 
-
         # First deal with the case where both i and j are integers
         if isintlike(i) and isintlike(j):
             if i < 0:
@@ -193,20 +210,14 @@
 
             if i < 0 or i >= self.shape[0] or j < 0 or j >= self.shape[1]:
                 raise IndexError, "index out of bounds"
-            if isintlike(value) and value == 0:
-                if key in self.keys():  # get rid of it something already there
-                    del self[key]
+
+            if isscalar(value):
+                if value==0:
+                    del self[(i,j)]
+                else:
+                    dict.__setitem__(self, (i,j), self.dtype.type(value))
             else:
-                # Ensure value is a single element, not a sequence
-                if isinstance(value, float) or isintlike(value) or \
-                        isinstance(value, complex):
-                    dict.__setitem__(self, (i,j), self.dtype.type(value))
-                    newrows = max(self.shape[0], int(key[0])+1)
-                    newcols = max(self.shape[1], int(key[1])+1)
-                    self.shape = (newrows, newcols)
-                else:
-                    raise TypeError, "cannot set matrix element to non-scalar"
-            return                 # done
+                raise TypeError, "cannot set matrix element to a non-scalar"
         else:
             # Either i or j is a slice, sequence, or invalid.  If i is a slice
             # or sequence, unfold it first and call __setitem__ recursively.

Modified: branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/cgsequ.c
===================================================================
--- branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/cgsequ.c	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/cgsequ.c	2008-10-23 12:30:20 UTC (rev 4828)
@@ -118,7 +118,7 @@
     for (j = 0; j < A->ncol; ++j)
 	for (i = Astore->colptr[j]; i < Astore->colptr[j+1]; ++i) {
 	    irow = Astore->rowind[i];
-	    r[irow] = SUPERLU_MAX( r[irow], c_abs1(&Aval[i]) );
+	    r[irow] = SUPERLU_MAX( r[irow], slu_c_abs1(&Aval[i]) );
 	}
 
     /* Find the maximum and minimum scale factors. */
@@ -153,7 +153,7 @@
     for (j = 0; j < A->ncol; ++j)
 	for (i = Astore->colptr[j]; i < Astore->colptr[j+1]; ++i) {
 	    irow = Astore->rowind[i];
-	    c[j] = SUPERLU_MAX( c[j], c_abs1(&Aval[i]) * r[irow] );
+	    c[j] = SUPERLU_MAX( c[j], slu_c_abs1(&Aval[i]) * r[irow] );
 	}
 
     /* Find the maximum and minimum scale factors. */

Modified: branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/cgsrfs.c
===================================================================
--- branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/cgsrfs.c	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/cgsrfs.c	2008-10-23 12:30:20 UTC (rev 4828)
@@ -276,21 +276,21 @@
 	       than SAFE2, then SAFE1 is added to the i-th component of the   
 	       numerator and denominator before dividing. */
 
-	    for (i = 0; i < A->nrow; ++i) rwork[i] = c_abs1( &Bptr[i] );
+	    for (i = 0; i < A->nrow; ++i) rwork[i] = slu_c_abs1( &Bptr[i] );
 	    
 	    /* Compute abs(op(A))*abs(X) + abs(B). */
 	    if (notran) {
 		for (k = 0; k < A->ncol; ++k) {
-		    xk = c_abs1( &Xptr[k] );
+		    xk = slu_c_abs1( &Xptr[k] );
 		    for (i = Astore->colptr[k]; i < Astore->colptr[k+1]; ++i)
-			rwork[Astore->rowind[i]] += c_abs1(&Aval[i]) * xk;
+			rwork[Astore->rowind[i]] += slu_c_abs1(&Aval[i]) * xk;
 		}
 	    } else {
 		for (k = 0; k < A->ncol; ++k) {
 		    s = 0.;
 		    for (i = Astore->colptr[k]; i < Astore->colptr[k+1]; ++i) {
 			irow = Astore->rowind[i];
-			s += c_abs1(&Aval[i]) * c_abs1(&Xptr[irow]);
+			s += slu_c_abs1(&Aval[i]) * slu_c_abs1(&Xptr[irow]);
 		    }
 		    rwork[k] += s;
 		}
@@ -298,9 +298,9 @@
 	    s = 0.;
 	    for (i = 0; i < A->nrow; ++i) {
 		if (rwork[i] > safe2)
-		    s = SUPERLU_MAX( s, c_abs1(&work[i]) / rwork[i] );
+		    s = SUPERLU_MAX( s, slu_c_abs1(&work[i]) / rwork[i] );
 		else
-		    s = SUPERLU_MAX( s, (c_abs1(&work[i]) + safe1) / 
+		    s = SUPERLU_MAX( s, (slu_c_abs1(&work[i]) + safe1) / 
 				(rwork[i] + safe1) );
 	    }
 	    berr[j] = s;
@@ -351,22 +351,22 @@
              inv(op(A)) * diag(W),   
           where W = abs(R) + NZ*EPS*( abs(op(A))*abs(X)+abs(B) ))) */
 	
-	for (i = 0; i < A->nrow; ++i) rwork[i] = c_abs1( &Bptr[i] );
+	for (i = 0; i < A->nrow; ++i) rwork[i] = slu_c_abs1( &Bptr[i] );
 	
 	/* Compute abs(op(A))*abs(X) + abs(B). */
 	if ( notran ) {
 	    for (k = 0; k < A->ncol; ++k) {
-		xk = c_abs1( &Xptr[k] );
+		xk = slu_c_abs1( &Xptr[k] );
 		for (i = Astore->colptr[k]; i < Astore->colptr[k+1]; ++i)
-		    rwork[Astore->rowind[i]] += c_abs1(&Aval[i]) * xk;
+		    rwork[Astore->rowind[i]] += slu_c_abs1(&Aval[i]) * xk;
 	    }
 	} else {
 	    for (k = 0; k < A->ncol; ++k) {
 		s = 0.;
 		for (i = Astore->colptr[k]; i < Astore->colptr[k+1]; ++i) {
 		    irow = Astore->rowind[i];
-		    xk = c_abs1( &Xptr[irow] );
-		    s += c_abs1(&Aval[i]) * xk;
+		    xk = slu_c_abs1( &Xptr[irow] );
+		    s += slu_c_abs1(&Aval[i]) * xk;
 		}
 		rwork[k] += s;
 	    }
@@ -374,9 +374,9 @@
 	
 	for (i = 0; i < A->nrow; ++i)
 	    if (rwork[i] > safe2)
-		rwork[i] = c_abs(&work[i]) + (iwork[i]+1)*eps*rwork[i];
+		rwork[i] = slu_c_abs(&work[i]) + (iwork[i]+1)*eps*rwork[i];
 	    else
-		rwork[i] = c_abs(&work[i])+(iwork[i]+1)*eps*rwork[i]+safe1;
+		rwork[i] = slu_c_abs(&work[i])+(iwork[i]+1)*eps*rwork[i]+safe1;
 	kase = 0;
 
 	do {
@@ -424,13 +424,13 @@
 	lstres = 0.;
  	if ( notran && colequ ) {
 	    for (i = 0; i < A->nrow; ++i)
-	    	lstres = SUPERLU_MAX( lstres, C[i] * c_abs1( &Xptr[i]) );
+	    	lstres = SUPERLU_MAX( lstres, C[i] * slu_c_abs1( &Xptr[i]) );
   	} else if ( !notran && rowequ ) {
 	    for (i = 0; i < A->nrow; ++i)
-	    	lstres = SUPERLU_MAX( lstres, R[i] * c_abs1( &Xptr[i]) );
+	    	lstres = SUPERLU_MAX( lstres, R[i] * slu_c_abs1( &Xptr[i]) );
 	} else {
 	    for (i = 0; i < A->nrow; ++i)
-	    	lstres = SUPERLU_MAX( lstres, c_abs1( &Xptr[i]) );
+	    	lstres = SUPERLU_MAX( lstres, slu_c_abs1( &Xptr[i]) );
 	}
 	if ( lstres != 0. )
 	    ferr[j] /= lstres;

Modified: branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/clacon.c
===================================================================
--- branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/clacon.c	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/clacon.c	2008-10-23 12:30:20 UTC (rev 4828)
@@ -106,14 +106,14 @@
   L20:
     if (*n == 1) {
 	v[0] = x[0];
-	*est = c_abs(&v[0]);
+	*est = slu_c_abs(&v[0]);
 	/*        ... QUIT */
 	goto L150;
     }
     *est = scsum1_(n, x, &c__1);
 
     for (i = 0; i < *n; ++i) {
-	d__1 = c_abs(&x[i]);
+	d__1 = slu_c_abs(&x[i]);
 	if (d__1 > safmin) {
 	    d__1 = 1 / d__1;
 	    x[i].r *= d__1;
@@ -158,7 +158,7 @@
     if (*est <= estold) goto L120;
 
     for (i = 0; i < *n; ++i) {
-	d__1 = c_abs(&x[i]);
+	d__1 = slu_c_abs(&x[i]);
 	if (d__1 > safmin) {
 	    d__1 = 1 / d__1;
 	    x[i].r *= d__1;

Modified: branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/clangs.c
===================================================================
--- branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/clangs.c	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/clangs.c	2008-10-23 12:30:20 UTC (rev 4828)
@@ -72,7 +72,7 @@
 	value = 0.;
 	for (j = 0; j < A->ncol; ++j)
 	    for (i = Astore->colptr[j]; i < Astore->colptr[j+1]; i++)
-		value = SUPERLU_MAX( value, c_abs( &Aval[i]) );
+		value = SUPERLU_MAX( value, slu_c_abs( &Aval[i]) );
 	
     } else if (lsame_(norm, "O") || *(unsigned char *)norm == '1') {
 	/* Find norm1(A). */
@@ -80,7 +80,7 @@
 	for (j = 0; j < A->ncol; ++j) {
 	    sum = 0.;
 	    for (i = Astore->colptr[j]; i < Astore->colptr[j+1]; i++) 
-		sum += c_abs( &Aval[i] );
+		sum += slu_c_abs( &Aval[i] );
 	    value = SUPERLU_MAX(value,sum);
 	}
 	
@@ -92,7 +92,7 @@
 	for (j = 0; j < A->ncol; ++j)
 	    for (i = Astore->colptr[j]; i < Astore->colptr[j+1]; i++) {
 		irow = Astore->rowind[i];
-		rwork[irow] += c_abs( &Aval[i] );
+		rwork[irow] += slu_c_abs( &Aval[i] );
 	    }
 	value = 0.;
 	for (i = 0; i < A->nrow; ++i)

Modified: branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/cpivotL.c
===================================================================
--- branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/cpivotL.c	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/cpivotL.c	2008-10-23 12:30:20 UTC (rev 4828)
@@ -106,7 +106,7 @@
     diag = EMPTY;
     old_pivptr = nsupc;
     for (isub = nsupc; isub < nsupr; ++isub) {
-        rtemp = c_abs1 (&lu_col_ptr[isub]);
+        rtemp = slu_c_abs1 (&lu_col_ptr[isub]);
 	if ( rtemp > pivmax ) {
 	    pivmax = rtemp;
 	    pivptr = isub;
@@ -127,7 +127,7 @@
     
     /* Choose appropriate pivotal element by our policy. */
     if ( *usepr ) {
-        rtemp = c_abs1 (&lu_col_ptr[old_pivptr]);
+        rtemp = slu_c_abs1 (&lu_col_ptr[old_pivptr]);
 	if ( rtemp != 0.0 && rtemp >= thresh )
 	    pivptr = old_pivptr;
 	else
@@ -136,7 +136,7 @@
     if ( *usepr == 0 ) {
 	/* Use diagonal pivot? */
 	if ( diag >= 0 ) { /* diagonal exists */
-            rtemp = c_abs1 (&lu_col_ptr[diag]);
+            rtemp = slu_c_abs1 (&lu_col_ptr[diag]);
 	    if ( rtemp != 0.0 && rtemp >= thresh ) pivptr = diag;
         }
 	*pivrow = lsub_ptr[pivptr];

Modified: branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/cpivotgrowth.c
===================================================================
--- branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/cpivotgrowth.c	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/cpivotgrowth.c	2008-10-23 12:30:20 UTC (rev 4828)
@@ -83,15 +83,15 @@
 	    maxaj = 0.;
             oldcol = inv_perm_c[j];
 	    for (i = Astore->colptr[oldcol]; i < Astore->colptr[oldcol+1]; ++i)
-		maxaj = SUPERLU_MAX( maxaj, c_abs1( &Aval[i]) );
+		maxaj = SUPERLU_MAX( maxaj, slu_c_abs1( &Aval[i]) );
 	
 	    maxuj = 0.;
 	    for (i = Ustore->colptr[j]; i < Ustore->colptr[j+1]; i++)
-		maxuj = SUPERLU_MAX( maxuj, c_abs1( &Uval[i]) );
+		maxuj = SUPERLU_MAX( maxuj, slu_c_abs1( &Uval[i]) );
 	    
 	    /* Supernode */
 	    for (i = 0; i < nz_in_U; ++i)
-		maxuj = SUPERLU_MAX( maxuj, c_abs1( &luval[i]) );
+		maxuj = SUPERLU_MAX( maxuj, slu_c_abs1( &luval[i]) );
 
 	    ++nz_in_U;
 	    luval += nsupr;

Modified: branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/cutil.c
===================================================================
--- branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/cutil.c	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/cutil.c	2008-10-23 12:30:20 UTC (rev 4828)
@@ -414,8 +414,8 @@
       err = xnorm = 0.0;
       for (i = 0; i < X->nrow; i++) {
         c_sub(&temp, &soln_work[i], &xtrue[i]);
-	err = SUPERLU_MAX(err, c_abs(&temp));
-	xnorm = SUPERLU_MAX(xnorm, c_abs(&soln_work[i]));
+	err = SUPERLU_MAX(err, slu_c_abs(&temp));
+	xnorm = SUPERLU_MAX(xnorm, slu_c_abs(&soln_work[i]));
       }
       err = err / xnorm;
       printf("||X - Xtrue||/||X|| = %e\n", err);

Modified: branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/scomplex.c
===================================================================
--- branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/scomplex.c	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/scomplex.c	2008-10-23 12:30:20 UTC (rev 4828)
@@ -45,7 +45,7 @@
 
 
 /* Returns sqrt(z.r^2 + z.i^2) */
-double c_abs(complex *z)
+double slu_c_abs(complex *z)
 {
     float temp;
     float real = z->r;
@@ -68,7 +68,7 @@
 
 /* Approximates the abs */
 /* Returns abs(z.r) + abs(z.i) */
-double c_abs1(complex *z)
+double slu_c_abs1(complex *z)
 {
     float real = z->r;
     float imag = z->i;

Modified: branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/scomplex.h
===================================================================
--- branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/scomplex.h	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/scomplex.h	2008-10-23 12:30:20 UTC (rev 4828)
@@ -57,8 +57,8 @@
 
 /* Prototypes for functions in scomplex.c */
 void c_div(complex *, complex *, complex *);
-double c_abs(complex *);     /* exact */
-double c_abs1(complex *);    /* approximate */
+double slu_c_abs(complex *);     /* exact */
+double slu_c_abs1(complex *);    /* approximate */
 void c_exp(complex *, complex *);
 void r_cnjg(complex *, complex *);
 double r_imag(complex *);

Modified: branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/scsum1.c
===================================================================
--- branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/scsum1.c	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/linalg/dsolve/SuperLU/SRC/scsum1.c	2008-10-23 12:30:20 UTC (rev 4828)
@@ -42,7 +42,7 @@
     int i__1, i__2;
     float ret_val;
     /* Builtin functions */
-    double c_abs(complex *);
+    double slu_c_abs(complex *);
     /* Local variables */
     static int i, nincx;
     static float stemp;
@@ -69,7 +69,7 @@
 
 /*        NEXT LINE MODIFIED. */
 
-	stemp += c_abs(&CX(i));
+	stemp += slu_c_abs(&CX(i));
 /* L10: */
     }
     ret_val = stemp;
@@ -83,7 +83,7 @@
 
 /*        NEXT LINE MODIFIED. */
 
-	stemp += c_abs(&CX(i));
+	stemp += slu_c_abs(&CX(i));
 /* L30: */
     }
     ret_val = stemp;

Modified: branches/refactor_fft/scipy/sparse/linalg/dsolve/tests/test_linsolve.py
===================================================================
--- branches/refactor_fft/scipy/sparse/linalg/dsolve/tests/test_linsolve.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/linalg/dsolve/tests/test_linsolve.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -4,7 +4,7 @@
 from numpy.testing import *
 
 from scipy.linalg import norm, inv
-from scipy.sparse import spdiags, csc_matrix, SparseEfficiencyWarning
+from scipy.sparse import spdiags, SparseEfficiencyWarning
 from scipy.sparse.linalg.dsolve import spsolve, use_solver
 
 warnings.simplefilter('ignore',SparseEfficiencyWarning)

Modified: branches/refactor_fft/scipy/sparse/linalg/dsolve/umfpack/tests/test_umfpack.py
===================================================================
--- branches/refactor_fft/scipy/sparse/linalg/dsolve/umfpack/tests/test_umfpack.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/linalg/dsolve/umfpack/tests/test_umfpack.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -6,19 +6,16 @@
 """
 
 import warnings
-
-from numpy import transpose, array, arange
-
 import random
 from numpy.testing import *
 
 from scipy import rand, matrix, diag, eye
-from scipy.sparse import csc_matrix, dok_matrix, spdiags, SparseEfficiencyWarning
+from scipy.sparse import csc_matrix, spdiags, SparseEfficiencyWarning
 from scipy.sparse.linalg import linsolve
 
 warnings.simplefilter('ignore',SparseEfficiencyWarning)
 
-import numpy as nm
+import numpy as np
 try:
     import scipy.sparse.linalg.dsolve.umfpack as um
 except (ImportError, AttributeError):
@@ -112,8 +109,8 @@
         self.a = spdiags([[1, 2, 3, 4, 5], [6, 5, 8, 9, 10]], [0, 1], 5, 5)
         #print "The sparse matrix (constructed from diagonals):"
         #print self.a
-        self.b = array([1, 2, 3, 4, 5])
-        self.b2 = array([5, 4, 3, 2, 1])
+        self.b = np.array([1, 2, 3, 4, 5])
+        self.b2 = np.array([5, 4, 3, 2, 1])
 
 
 
@@ -174,7 +171,7 @@
 
         self.real_matrices = [csc_matrix(x).astype('d') for x \
                 in self.real_matrices]
-        self.complex_matrices = [x.astype(nm.complex128)
+        self.complex_matrices = [x.astype(np.complex128)
                                  for x in self.real_matrices]
 
 # Skip methods if umfpack not present

Modified: branches/refactor_fft/scipy/sparse/linalg/dsolve/umfpack/umfpack.py
===================================================================
--- branches/refactor_fft/scipy/sparse/linalg/dsolve/umfpack/umfpack.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/linalg/dsolve/umfpack/umfpack.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -7,9 +7,9 @@
 
 
 #from base import Struct, pause
-import numpy as nm
+import numpy as np
 import scipy.sparse as sp
-import re, imp
+import re
 try: # Silence import error.
     import _umfpack as _um
 except:
@@ -275,8 +275,8 @@
             raise TypeError, 'wrong family: %s' % family
 
         self.family = family
-        self.control = nm.zeros( (UMFPACK_CONTROL, ), dtype = nm.double )
-        self.info = nm.zeros( (UMFPACK_INFO, ), dtype = nm.double )
+        self.control = np.zeros( (UMFPACK_CONTROL, ), dtype = np.double )
+        self.info = np.zeros( (UMFPACK_INFO, ), dtype = np.double )
         self._symbolic = None
         self._numeric = None
         self.mtx = None
@@ -328,19 +328,19 @@
         ##
         # Should check types of indices to correspond to familyTypes.
         if self.family[1] == 'i':
-            if (indx.dtype != nm.dtype('i')) \
-                   or mtx.indptr.dtype != nm.dtype('i'):
+            if (indx.dtype != np.dtype('i')) \
+                   or mtx.indptr.dtype != np.dtype('i'):
                 raise ValueError, 'matrix must have int indices'
         else:
-            if (indx.dtype != nm.dtype('l')) \
-                   or mtx.indptr.dtype != nm.dtype('l'):
+            if (indx.dtype != np.dtype('l')) \
+                   or mtx.indptr.dtype != np.dtype('l'):
                 raise ValueError, 'matrix must have long indices'
 
         if self.isReal:
-            if mtx.data.dtype != nm.dtype('<f8'):
+            if mtx.data.dtype != np.dtype('<f8'):
                 raise ValueError, 'matrix must have float64 values'
         else:
-            if mtx.data.dtype != nm.dtype('<c16'):
+            if mtx.data.dtype != np.dtype('<c16'):
                 raise ValueError, 'matrix must have complex128 values'
 
         return indx
@@ -523,13 +523,13 @@
         indx = self._getIndx( mtx )
 
         if self.isReal:
-            rhs = rhs.astype( nm.float64 )
-            sol = nm.zeros( (mtx.shape[1],), dtype = nm.float64 )
+            rhs = rhs.astype( np.float64 )
+            sol = np.zeros( (mtx.shape[1],), dtype = np.float64 )
             status = self.funs.solve( sys, mtx.indptr, indx, mtx.data, sol, rhs,
                                       self._numeric, self.control, self.info )
         else:
-            rhs = rhs.astype( nm.complex128 )
-            sol = nm.zeros( (mtx.shape[1],), dtype = nm.complex128 )
+            rhs = rhs.astype( np.complex128 )
+            sol = np.zeros( (mtx.shape[1],), dtype = np.complex128 )
             mreal, mimag = mtx.data.real.copy(), mtx.data.imag.copy()
             sreal, simag = sol.real.copy(), sol.imag.copy()
             rreal, rimag = rhs.real.copy(), rhs.imag.copy()
@@ -544,7 +544,7 @@
             if status == UMFPACK_WARNING_singular_matrix:
                 ## Change inf, nan to zeros.
                 print 'zeroing nan and inf entries...'
-                sol[~nm.isfinite( sol )] = 0.0
+                sol[~np.isfinite( sol )] = 0.0
             else:
                 raise RuntimeError, '%s failed with %s' % (self.funs.solve,
                                                            umfStatus[status])
@@ -647,20 +647,20 @@
         #allocate storage for decomposition data
         i_type = mtx.indptr.dtype
 
-        Lp = nm.zeros( (n_row+1,), dtype = i_type )
-        Lj = nm.zeros( (lnz,), dtype = i_type )
-        Lx = nm.zeros( (lnz,), dtype = nm.double )
+        Lp = np.zeros( (n_row+1,), dtype = i_type )
+        Lj = np.zeros( (lnz,), dtype = i_type )
+        Lx = np.zeros( (lnz,), dtype = np.double )
 
-        Up = nm.zeros( (n_col+1,), dtype = i_type )
-        Ui = nm.zeros( (unz,), dtype = i_type )
-        Ux = nm.zeros( (unz,), dtype = nm.double )
+        Up = np.zeros( (n_col+1,), dtype = i_type )
+        Ui = np.zeros( (unz,), dtype = i_type )
+        Ux = np.zeros( (unz,), dtype = np.double )
 
-        P  = nm.zeros( (n_row,), dtype = i_type )
-        Q  = nm.zeros( (n_col,), dtype = i_type )
+        P  = np.zeros( (n_row,), dtype = i_type )
+        Q  = np.zeros( (n_col,), dtype = i_type )
 
-        Dx = nm.zeros( (min(n_row,n_col),), dtype = nm.double )
+        Dx = np.zeros( (min(n_row,n_col),), dtype = np.double )
 
-        Rs = nm.zeros( (n_row,), dtype = nm.double )
+        Rs = np.zeros( (n_row,), dtype = np.double )
 
         if self.isReal:
             (status,do_recip) = self.funs.get_numeric( Lp,Lj,Lx,Up,Ui,Ux,
@@ -679,9 +679,9 @@
 
         else:
             #allocate additional storage for imaginary parts
-            Lz = nm.zeros( (lnz,), dtype = nm.double )
-            Uz = nm.zeros( (unz,), dtype = nm.double )
-            Dz = nm.zeros( (min(n_row,n_col),), dtype = nm.double )
+            Lz = np.zeros( (lnz,), dtype = np.double )
+            Uz = np.zeros( (unz,), dtype = np.double )
+            Dz = np.zeros( (min(n_row,n_col),), dtype = np.double )
 
             (status,do_recip) = self.funs.get_numeric(Lp,Lj,Lx,Lz,Up,Ui,Ux,Uz,
                                                       P,Q,Dx,Dz,Rs,
@@ -692,9 +692,9 @@
                       % (self.funs.get_numeric, umfStatus[status])
 
 
-            Lxz = nm.zeros( (lnz,), dtype = nm.complex128 )
-            Uxz = nm.zeros( (unz,), dtype = nm.complex128 )
-            Dxz = nm.zeros( (min(n_row,n_col),), dtype = nm.complex128 )
+            Lxz = np.zeros( (lnz,), dtype = np.complex128 )
+            Uxz = np.zeros( (unz,), dtype = np.complex128 )
+            Dxz = np.zeros( (min(n_row,n_col),), dtype = np.complex128 )
 
             Lxz.real,Lxz.imag = Lx,Lz
             Uxz.real,Uxz.imag = Ux,Uz

Modified: branches/refactor_fft/scipy/sparse/linalg/eigen/arpack/speigs.py
===================================================================
--- branches/refactor_fft/scipy/sparse/linalg/eigen/arpack/speigs.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/linalg/eigen/arpack/speigs.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,6 +1,5 @@
 import numpy as np
 import _arpack
-import warnings
 
 __all___=['ArpackException','ARPACK_eigs', 'ARPACK_gen_eigs']
 

Modified: branches/refactor_fft/scipy/sparse/linalg/eigen/arpack/tests/test_arpack.py
===================================================================
--- branches/refactor_fft/scipy/sparse/linalg/eigen/arpack/tests/test_arpack.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/linalg/eigen/arpack/tests/test_arpack.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -7,9 +7,8 @@
 
 from numpy.testing import *
 
-from numpy import array,real,imag,finfo,concatenate,\
-    column_stack,argsort,dot,round,conj,sort,random
-from scipy.sparse.linalg.eigen.arpack import eigen_symmetric,eigen
+from numpy import array, finfo, argsort, dot, round, conj, random
+from scipy.sparse.linalg.eigen.arpack import eigen_symmetric, eigen
 
 
 def assert_almost_equal_cc(actual,desired,decimal=7,err_msg='',verbose=True):

Modified: branches/refactor_fft/scipy/sparse/linalg/eigen/lobpcg/lobpcg.py
===================================================================
--- branches/refactor_fft/scipy/sparse/linalg/eigen/lobpcg/lobpcg.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/linalg/eigen/lobpcg/lobpcg.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -10,8 +10,6 @@
 Examples in tests directory contributed by Nils Wagner.
 """
 
-from warnings import warn
-
 import numpy as np
 import scipy as sp
 

Modified: branches/refactor_fft/scipy/sparse/linalg/eigen/lobpcg/tests/test_lobpcg.py
===================================================================
--- branches/refactor_fft/scipy/sparse/linalg/eigen/lobpcg/tests/test_lobpcg.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/linalg/eigen/lobpcg/tests/test_lobpcg.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -5,8 +5,7 @@
 import numpy
 from numpy.testing import *
 
-from scipy import array, arange, ones, sort, cos, pi, rand, \
-     set_printoptions, r_, diag, linalg
+from scipy import arange, ones, rand, set_printoptions, r_, diag, linalg
 from scipy.linalg import eig
 from scipy.sparse.linalg.eigen.lobpcg import lobpcg
 

Modified: branches/refactor_fft/scipy/sparse/linalg/isolve/iterative.py
===================================================================
--- branches/refactor_fft/scipy/sparse/linalg/isolve/iterative.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/linalg/isolve/iterative.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -12,8 +12,7 @@
 __all__ = ['bicg','bicgstab','cg','cgs','gmres','qmr']
 
 import _iterative
-import numpy as sb
-import copy
+import numpy as np
 
 from scipy.sparse.linalg.interface import LinearOperator
 from utils import make_system
@@ -70,7 +69,7 @@
     resid = tol
     ndx1 = 1
     ndx2 = -1
-    work = sb.zeros(6*n,dtype=x.dtype)
+    work = np.zeros(6*n,dtype=x.dtype)
     ijob = 1
     info = 0
     ftflag = True
@@ -158,7 +157,7 @@
     resid = tol
     ndx1 = 1
     ndx2 = -1
-    work = sb.zeros(7*n,dtype=x.dtype)
+    work = np.zeros(7*n,dtype=x.dtype)
     ijob = 1
     info = 0
     ftflag = True
@@ -248,7 +247,7 @@
     resid = tol
     ndx1 = 1
     ndx2 = -1
-    work = sb.zeros(4*n,dtype=x.dtype)
+    work = np.zeros(4*n,dtype=x.dtype)
     ijob = 1
     info = 0
     ftflag = True
@@ -332,7 +331,7 @@
     resid = tol
     ndx1 = 1
     ndx2 = -1
-    work = sb.zeros(7*n,dtype=x.dtype)
+    work = np.zeros(7*n,dtype=x.dtype)
     ijob = 1
     info = 0
     ftflag = True
@@ -420,8 +419,8 @@
     resid = tol
     ndx1 = 1
     ndx2 = -1
-    work  = sb.zeros((6+restrt)*n,dtype=x.dtype)
-    work2 = sb.zeros((restrt+1)*(2*restrt+2),dtype=x.dtype)
+    work  = np.zeros((6+restrt)*n,dtype=x.dtype)
+    work2 = np.zeros((restrt+1)*(2*restrt+2),dtype=x.dtype)
     ijob = 1
     info = 0
     ftflag = True
@@ -545,7 +544,7 @@
     resid = tol
     ndx1 = 1
     ndx2 = -1
-    work = sb.zeros(11*n,x.dtype)
+    work = np.zeros(11*n,x.dtype)
     ijob = 1
     info = 0
     ftflag = True

Modified: branches/refactor_fft/scipy/sparse/linalg/isolve/minres.py
===================================================================
--- branches/refactor_fft/scipy/sparse/linalg/isolve/minres.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/linalg/isolve/minres.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,4 +1,4 @@
-from numpy import ndarray, matrix, sqrt, inner, finfo, asarray, zeros
+from numpy import sqrt, inner, finfo, zeros
 from numpy.linalg import norm
 
 from utils import make_system
@@ -280,7 +280,6 @@
     from scipy import ones, arange
     from scipy.linalg import norm
     from scipy.sparse import spdiags
-    from scipy.sparse.linalg import cg
 
     n = 10
 

Modified: branches/refactor_fft/scipy/sparse/linalg/isolve/tests/test_iterative.py
===================================================================
--- branches/refactor_fft/scipy/sparse/linalg/isolve/tests/test_iterative.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/linalg/isolve/tests/test_iterative.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -4,8 +4,7 @@
 
 from numpy.testing import *
 
-from numpy import zeros, dot, diag, ones, arange, array, abs, max
-from numpy.random import rand
+from numpy import zeros, ones, arange, array, abs, max
 from scipy.linalg import norm
 from scipy.sparse import spdiags, csr_matrix
 

Modified: branches/refactor_fft/scipy/sparse/linalg/tests/test_interface.py
===================================================================
--- branches/refactor_fft/scipy/sparse/linalg/tests/test_interface.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/linalg/tests/test_interface.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -5,7 +5,7 @@
 from numpy.testing import *
 
 import numpy
-from numpy import array, matrix, ones, ravel
+from numpy import array, matrix, dtype
 from scipy.sparse import csr_matrix
 
 from scipy.sparse.linalg.interface import *
@@ -21,7 +21,7 @@
 
         class matlike:
             def __init__(self):
-                self.dtype = numpy.dtype('int')
+                self.dtype = dtype('int')
                 self.shape = (2,3)
             def matvec(self,x):
                 y = array([ 1*x[0] + 2*x[1] + 3*x[2],

Modified: branches/refactor_fft/scipy/sparse/sparsetools/coo.h
===================================================================
--- branches/refactor_fft/scipy/sparse/sparsetools/coo.h	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/sparsetools/coo.h	2008-10-23 12:30:20 UTC (rev 4828)
@@ -2,6 +2,7 @@
 #define __COO_H__
 
 #include <algorithm>
+#include <set>
 
 /*
  * Compute B = A for COO matrix A, CSR matrix B
@@ -149,4 +150,26 @@
     }
 }
 
+/*
+ * Count the number of occupied diagonals in COO matrix A
+ *
+ * Input Arguments:
+ *   I  nnz             - number of nonzeros in A
+ *   I  Ai[nnz(A)]      - row indices
+ *   I  Aj[nnz(A)]      - column indices
+ *
+ */
+template <class I>
+I coo_count_diagonals(const I nnz,
+                      const I Ai[],
+                      const I Aj[])
+{
+    std::set<I> diagonals;
+    for(I n = 0; n < nnz; n++){
+        diagonals.insert(Aj[n] - Ai[n]);
+    }
+    return diagonals.size();
+}
+
+
 #endif

Modified: branches/refactor_fft/scipy/sparse/sparsetools/coo.i
===================================================================
--- branches/refactor_fft/scipy/sparse/sparsetools/coo.i	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/sparsetools/coo.i	2008-10-23 12:30:20 UTC (rev 4828)
@@ -14,4 +14,6 @@
 
 INSTANTIATE_ALL(coo_matvec)
 
+INSTANTIATE_INDEX(coo_count_diagonals)
 
+

Modified: branches/refactor_fft/scipy/sparse/sparsetools/coo.py
===================================================================
--- branches/refactor_fft/scipy/sparse/sparsetools/coo.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/sparsetools/coo.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -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.
@@ -49,7 +49,11 @@
 
 
 
+def 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, 

Modified: branches/refactor_fft/scipy/sparse/sparsetools/coo_wrap.cxx
===================================================================
--- branches/refactor_fft/scipy/sparse/sparsetools/coo_wrap.cxx	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/sparsetools/coo_wrap.cxx	2008-10-23 12:30:20 UTC (rev 4828)
@@ -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    "_coo"
 
-#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) 
@@ -3089,6 +3097,16 @@
   return res;
 }
 
+
+  #define SWIG_From_long   PyInt_FromLong 
+
+
+SWIGINTERNINLINE PyObject *
+SWIG_From_int  (int value)
+{    
+  return SWIG_From_long  (value);
+}
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -12950,6 +12968,76 @@
 }
 
 
+SWIGINTERN PyObject *_wrap_coo_count_diagonals(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  int arg1 ;
+  int *arg2 ;
+  int *arg3 ;
+  int val1 ;
+  int ecode1 = 0 ;
+  PyArrayObject *array2 = NULL ;
+  int is_new_object2 ;
+  PyArrayObject *array3 = NULL ;
+  int is_new_object3 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  int result;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:coo_count_diagonals",&obj0,&obj1,&obj2)) SWIG_fail;
+  ecode1 = SWIG_AsVal_int(obj0, &val1);
+  if (!SWIG_IsOK(ecode1)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "coo_count_diagonals" "', argument " "1"" of type '" "int""'");
+  } 
+  arg1 = static_cast< int >(val1);
+  {
+    npy_intp size[1] = {
+      -1
+    };
+    array2 = obj_to_array_contiguous_allow_conversion(obj1, PyArray_INT, &is_new_object2);
+    if (!array2 || !require_dimensions(array2,1) || !require_size(array2,size,1)
+      || !require_contiguous(array2)   || !require_native(array2)) SWIG_fail;
+    
+    arg2 = (int*) array2->data;
+  }
+  {
+    npy_intp size[1] = {
+      -1
+    };
+    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
+    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
+      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
+    
+    arg3 = (int*) array3->data;
+  }
+  result = (int)coo_count_diagonals< int >(arg1,(int const (*))arg2,(int const (*))arg3);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  {
+    if (is_new_object2 && array2) {
+      Py_DECREF(array2); 
+    }
+  }
+  {
+    if (is_new_object3 && array3) {
+      Py_DECREF(array3); 
+    }
+  }
+  return resultobj;
+fail:
+  {
+    if (is_new_object2 && array2) {
+      Py_DECREF(array2); 
+    }
+  }
+  {
+    if (is_new_object3 && array3) {
+      Py_DECREF(array3); 
+    }
+  }
+  return NULL;
+}
+
+
 static PyMethodDef SwigMethods[] = {
 	 { (char *)"coo_tocsr", _wrap_coo_tocsr, METH_VARARGS, (char *)"\n"
 		"coo_tocsr(int n_row, int n_col, int nnz, int Ai, int Aj, signed char Ax, \n"
@@ -13067,6 +13155,7 @@
 		"coo_matvec(int nnz, int Ai, int Aj, npy_clongdouble_wrapper Ax, \n"
 		"    npy_clongdouble_wrapper Xx, npy_clongdouble_wrapper Yx)\n"
 		""},
+	 { (char *)"coo_count_diagonals", _wrap_coo_count_diagonals, METH_VARARGS, (char *)"coo_count_diagonals(int nnz, int Ai, int Aj) -> int"},
 	 { NULL, NULL, 0, NULL }
 };
 

Modified: branches/refactor_fft/scipy/sparse/sparsetools/csc.i
===================================================================
--- branches/refactor_fft/scipy/sparse/sparsetools/csc.i	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/sparsetools/csc.i	2008-10-23 12:30:20 UTC (rev 4828)
@@ -8,7 +8,7 @@
 
 %include "csc.h" 
 
-%template(csc_matmat_pass1)   csc_matmat_pass1<int>;
+INSTANTIATE_INDEX(csc_matmat_pass1);
 
 INSTANTIATE_ALL(csc_diagonal)
 INSTANTIATE_ALL(csc_tocsr)

Modified: branches/refactor_fft/scipy/sparse/sparsetools/csc.py
===================================================================
--- branches/refactor_fft/scipy/sparse/sparsetools/csc.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/sparsetools/csc.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -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.

Modified: branches/refactor_fft/scipy/sparse/sparsetools/csc_wrap.cxx
===================================================================
--- branches/refactor_fft/scipy/sparse/sparsetools/csc_wrap.cxx	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/sparsetools/csc_wrap.cxx	2008-10-23 12:30:20 UTC (rev 4828)
@@ -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    "_csc"
 
-#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: branches/refactor_fft/scipy/sparse/sparsetools/csr.h
===================================================================
--- branches/refactor_fft/scipy/sparse/sparsetools/csr.h	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/sparsetools/csr.h	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,6 +1,7 @@
 #ifndef __CSR_H__
 #define __CSR_H__
 
+#include <set>
 #include <vector>
 #include <algorithm>
 #include <functional>
@@ -39,8 +40,8 @@
     const I N = std::min(n_row, n_col);
 
     for(I i = 0; i < N; i++){
-        I row_start = Ap[i];
-        I row_end   = Ap[i+1];
+        const I row_start = Ap[i];
+        const I row_end   = Ap[i+1];
 
         T diag = 0;
         for(I jj = row_start; jj < row_end; jj++){
@@ -380,7 +381,55 @@
 
 
 
+/*
+ * Compute B = A for CSR matrix A, ELL matrix B
+ *
+ * Input Arguments:
+ *   I  n_row         - number of rows in A
+ *   I  n_col         - number of columns in A
+ *   I  Ap[n_row+1]   - row pointer
+ *   I  Aj[nnz(A)]    - column indices
+ *   T  Ax[nnz(A)]    - nonzeros
+ *   I  row_length    - maximum nnz in a row of A
+ *
+ * Output Arguments:
+ *   I  Bj[n_row * row_length]  - column indices
+ *   T  Bx[n_row * row_length]  - nonzeros
+ *
+ * Note:
+ *   Output arrays Bj, Bx must be preallocated
+ *   Duplicate entries in A are not merged.
+ *   Explicit zeros in A are carried over to B.
+ *   Rows with fewer than row_length columns are padded with zeros.
+ *
+ */
+template <class I, class T>
+void csr_toell(const I n_row,
+	           const I n_col, 
+	           const I Ap[], 
+	           const I Aj[], 
+	           const T Ax[],
+               const I row_length,
+	                 I Bj[],
+	                 T Bx[])
+{
+    const I ell_nnz = row_length * n_row;
+    std::fill(Bj, Bj + ell_nnz, 0);
+    std::fill(Bx, Bx + ell_nnz, 0);
 
+    for(I i = 0; i < n_row; i++){
+        I * Bj_row = Bj + row_length * i;
+        T * Bx_row = Bx + row_length * i;
+        for(I jj = Ap[i]; jj < Ap[i+1]; jj++){
+            *Bj_row = Aj[jj];            
+            *Bx_row = Ax[jj];            
+            Bj_row++;
+            Bx_row++;
+        }
+    }
+}
+
+
 /*
  * Compute C = A*B for CSR matrices A,B
  *
@@ -742,6 +791,7 @@
  *   
  * Note:
  *   The column indicies within each row must be in sorted order.
+ *   Explicit zeros are retained.
  *   Ap, Aj, and Ax will be modified *inplace*
  *
  */
@@ -951,7 +1001,29 @@
 }
 
 
+/*
+ * Count the number of occupied diagonals in CSR matrix A
+ *
+ * Input Arguments:
+ *   I  nnz             - number of nonzeros in A
+ *   I  Ai[nnz(A)]      - row indices
+ *   I  Aj[nnz(A)]      - column indices
+ *
+ */
+template <class I>
+I csr_count_diagonals(const I n_row,
+                      const I Ap[],
+                      const I Aj[])
+{
+    std::set<I> diagonals;
+    
+    for(I i = 0; i < n_row; i++){
+        for(I jj = Ap[i]; jj < Ap[i+1]; jj++){
+            diagonals.insert(Aj[jj] - i);
+        }
+    }
+    return diagonals.size();
+}
 
 
-
 #endif

Modified: branches/refactor_fft/scipy/sparse/sparsetools/csr.i
===================================================================
--- branches/refactor_fft/scipy/sparse/sparsetools/csr.i	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/sparsetools/csr.i	2008-10-23 12:30:20 UTC (rev 4828)
@@ -9,12 +9,11 @@
 %include "csr.h" 
 
 
-%template(expandptr)   expandptr<int>;
-%template(csr_count_blocks)   csr_count_blocks<int>;
-%template(csr_matmat_pass1)   csr_matmat_pass1<int>;
-%template(csr_has_sorted_indices)   csr_has_sorted_indices<int>;
+INSTANTIATE_INDEX(expandptr)
+INSTANTIATE_INDEX(csr_matmat_pass1)
+INSTANTIATE_INDEX(csr_count_blocks)
+INSTANTIATE_INDEX(csr_has_sorted_indices)
 
-
 INSTANTIATE_ALL(csr_diagonal)
 INSTANTIATE_ALL(csr_scale_rows)
 INSTANTIATE_ALL(csr_scale_columns)

Modified: branches/refactor_fft/scipy/sparse/sparsetools/csr.py
===================================================================
--- branches/refactor_fft/scipy/sparse/sparsetools/csr.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/sparsetools/csr.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -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.
@@ -53,10 +53,6 @@
   """expandptr(int n_row, int Ap, int Bi)"""
   return _csr.expandptr(*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)
-
 def csr_matmat_pass1(*args):
   """
     csr_matmat_pass1(int n_row, int n_col, int Ap, int Aj, int Bp, int Bj, 
@@ -64,6 +60,10 @@
     """
   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)
+
 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)

Modified: branches/refactor_fft/scipy/sparse/sparsetools/csr_wrap.cxx
===================================================================
--- branches/refactor_fft/scipy/sparse/sparsetools/csr_wrap.cxx	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/sparsetools/csr_wrap.cxx	2008-10-23 12:30:20 UTC (rev 4828)
@@ -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)
@@ -2530,7 +2536,7 @@
 
 #define SWIG_name    "_csr"
 
-#define SWIGVERSION 0x010334 
+#define SWIGVERSION 0x010336 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -2558,7 +2564,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) 
@@ -3176,59 +3184,71 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_csr_count_blocks(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csr_matmat_pass1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
-  int arg3 ;
-  int arg4 ;
+  int *arg3 ;
+  int *arg4 ;
   int *arg5 ;
   int *arg6 ;
-  int result;
+  int *arg7 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
   int ecode2 = 0 ;
-  int val3 ;
-  int ecode3 = 0 ;
-  int val4 ;
-  int ecode4 = 0 ;
+  PyArrayObject *array3 = NULL ;
+  int is_new_object3 ;
+  PyArrayObject *array4 = NULL ;
+  int is_new_object4 ;
   PyArrayObject *array5 = NULL ;
   int is_new_object5 ;
   PyArrayObject *array6 = NULL ;
   int is_new_object6 ;
+  PyArrayObject *temp7 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
   PyObject * obj4 = 0 ;
   PyObject * obj5 = 0 ;
+  PyObject * obj6 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csr_count_blocks",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csr_matmat_pass1",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_count_blocks" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_matmat_pass1" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_count_blocks" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_matmat_pass1" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
-  ecode3 = SWIG_AsVal_int(obj2, &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "csr_count_blocks" "', argument " "3"" of type '" "int""'");
-  } 
-  arg3 = static_cast< int >(val3);
-  ecode4 = SWIG_AsVal_int(obj3, &val4);
-  if (!SWIG_IsOK(ecode4)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "csr_count_blocks" "', argument " "4"" of type '" "int""'");
-  } 
-  arg4 = static_cast< int >(val4);
   {
     npy_intp size[1] = {
       -1
     };
+    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
+    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
+      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
+    
+    arg3 = (int*) array3->data;
+  }
+  {
+    npy_intp size[1] = {
+      -1
+    };
+    array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4);
+    if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1)
+      || !require_contiguous(array4)   || !require_native(array4)) SWIG_fail;
+    
+    arg4 = (int*) array4->data;
+  }
+  {
+    npy_intp size[1] = {
+      -1
+    };
     array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_INT, &is_new_object5);
     if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)
       || !require_contiguous(array5)   || !require_native(array5)) SWIG_fail;
@@ -3245,9 +3265,24 @@
     
     arg6 = (int*) array6->data;
   }
-  result = (int)csr_count_blocks< int >(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6);
-  resultobj = SWIG_From_int(static_cast< int >(result));
   {
+    temp7 = obj_to_array_no_conversion(obj6,PyArray_INT);
+    if (!temp7  || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail;
+    arg7 = (int*) array_data(temp7);
+  }
+  csr_matmat_pass1< int >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,arg7);
+  resultobj = SWIG_Py_Void();
+  {
+    if (is_new_object3 && array3) {
+      Py_DECREF(array3); 
+    }
+  }
+  {
+    if (is_new_object4 && array4) {
+      Py_DECREF(array4); 
+    }
+  }
+  {
     if (is_new_object5 && array5) {
       Py_DECREF(array5); 
     }
@@ -3260,6 +3295,16 @@
   return resultobj;
 fail:
   {
+    if (is_new_object3 && array3) {
+      Py_DECREF(array3); 
+    }
+  }
+  {
+    if (is_new_object4 && array4) {
+      Py_DECREF(array4); 
+    }
+  }
+  {
     if (is_new_object5 && array5) {
       Py_DECREF(array5); 
     }
@@ -3273,71 +3318,59 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_csr_matmat_pass1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_csr_count_blocks(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   int arg2 ;
-  int *arg3 ;
-  int *arg4 ;
+  int arg3 ;
+  int arg4 ;
   int *arg5 ;
   int *arg6 ;
-  int *arg7 ;
   int val1 ;
   int ecode1 = 0 ;
   int val2 ;
   int ecode2 = 0 ;
-  PyArrayObject *array3 = NULL ;
-  int is_new_object3 ;
-  PyArrayObject *array4 = NULL ;
-  int is_new_object4 ;
+  int val3 ;
+  int ecode3 = 0 ;
+  int val4 ;
+  int ecode4 = 0 ;
   PyArrayObject *array5 = NULL ;
   int is_new_object5 ;
   PyArrayObject *array6 = NULL ;
   int is_new_object6 ;
-  PyArrayObject *temp7 = NULL ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
   PyObject * obj4 = 0 ;
   PyObject * obj5 = 0 ;
-  PyObject * obj6 = 0 ;
+  int result;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:csr_matmat_pass1",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:csr_count_blocks",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
   if (!SWIG_IsOK(ecode1)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_matmat_pass1" "', argument " "1"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "csr_count_blocks" "', argument " "1"" of type '" "int""'");
   } 
   arg1 = static_cast< int >(val1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_matmat_pass1" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "csr_count_blocks" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
+  ecode3 = SWIG_AsVal_int(obj2, &val3);
+  if (!SWIG_IsOK(ecode3)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "csr_count_blocks" "', argument " "3"" of type '" "int""'");
+  } 
+  arg3 = static_cast< int >(val3);
+  ecode4 = SWIG_AsVal_int(obj3, &val4);
+  if (!SWIG_IsOK(ecode4)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "csr_count_blocks" "', argument " "4"" of type '" "int""'");
+  } 
+  arg4 = static_cast< int >(val4);
   {
     npy_intp size[1] = {
       -1
     };
-    array3 = obj_to_array_contiguous_allow_conversion(obj2, PyArray_INT, &is_new_object3);
-    if (!array3 || !require_dimensions(array3,1) || !require_size(array3,size,1)
-      || !require_contiguous(array3)   || !require_native(array3)) SWIG_fail;
-    
-    arg3 = (int*) array3->data;
-  }
-  {
-    npy_intp size[1] = {
-      -1
-    };
-    array4 = obj_to_array_contiguous_allow_conversion(obj3, PyArray_INT, &is_new_object4);
-    if (!array4 || !require_dimensions(array4,1) || !require_size(array4,size,1)
-      || !require_contiguous(array4)   || !require_native(array4)) SWIG_fail;
-    
-    arg4 = (int*) array4->data;
-  }
-  {
-    npy_intp size[1] = {
-      -1
-    };
     array5 = obj_to_array_contiguous_allow_conversion(obj4, PyArray_INT, &is_new_object5);
     if (!array5 || !require_dimensions(array5,1) || !require_size(array5,size,1)
       || !require_contiguous(array5)   || !require_native(array5)) SWIG_fail;
@@ -3354,24 +3387,9 @@
     
     arg6 = (int*) array6->data;
   }
+  result = (int)csr_count_blocks< int >(arg1,arg2,arg3,arg4,(int const (*))arg5,(int const (*))arg6);
+  resultobj = SWIG_From_int(static_cast< int >(result));
   {
-    temp7 = obj_to_array_no_conversion(obj6,PyArray_INT);
-    if (!temp7  || !require_contiguous(temp7) || !require_native(temp7)) SWIG_fail;
-    arg7 = (int*) array_data(temp7);
-  }
-  csr_matmat_pass1< int >(arg1,arg2,(int const (*))arg3,(int const (*))arg4,(int const (*))arg5,(int const (*))arg6,arg7);
-  resultobj = SWIG_Py_Void();
-  {
-    if (is_new_object3 && array3) {
-      Py_DECREF(array3); 
-    }
-  }
-  {
-    if (is_new_object4 && array4) {
-      Py_DECREF(array4); 
-    }
-  }
-  {
     if (is_new_object5 && array5) {
       Py_DECREF(array5); 
     }
@@ -3384,16 +3402,6 @@
   return resultobj;
 fail:
   {
-    if (is_new_object3 && array3) {
-      Py_DECREF(array3); 
-    }
-  }
-  {
-    if (is_new_object4 && array4) {
-      Py_DECREF(array4); 
-    }
-  }
-  {
     if (is_new_object5 && array5) {
       Py_DECREF(array5); 
     }
@@ -3412,7 +3420,6 @@
   int arg1 ;
   int *arg2 ;
   int *arg3 ;
-  bool result;
   int val1 ;
   int ecode1 = 0 ;
   PyArrayObject *array2 = NULL ;
@@ -3422,6 +3429,7 @@
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
+  bool result;
   
   if (!PyArg_ParseTuple(args,(char *)"OOO:csr_has_sorted_indices",&obj0,&obj1,&obj2)) SWIG_fail;
   ecode1 = SWIG_AsVal_int(obj0, &val1);
@@ -45431,11 +45439,11 @@
 
 static PyMethodDef SwigMethods[] = {
 	 { (char *)"expandptr", _wrap_expandptr, METH_VARARGS, (char *)"expandptr(int n_row, int Ap, int Bi)"},
-	 { (char *)"csr_count_blocks", _wrap_csr_count_blocks, METH_VARARGS, (char *)"csr_count_blocks(int n_row, int n_col, int R, int C, int Ap, int Aj) -> int"},
 	 { (char *)"csr_matmat_pass1", _wrap_csr_matmat_pass1, METH_VARARGS, (char *)"\n"
 		"csr_matmat_pass1(int n_row, int n_col, int Ap, int Aj, int Bp, int Bj, \n"
 		"    int Cp)\n"
 		""},
+	 { (char *)"csr_count_blocks", _wrap_csr_count_blocks, METH_VARARGS, (char *)"csr_count_blocks(int n_row, int n_col, int R, int C, int Ap, int Aj) -> int"},
 	 { (char *)"csr_has_sorted_indices", _wrap_csr_has_sorted_indices, METH_VARARGS, (char *)"csr_has_sorted_indices(int n_row, int Ap, int Aj) -> bool"},
 	 { (char *)"csr_diagonal", _wrap_csr_diagonal, METH_VARARGS, (char *)"\n"
 		"csr_diagonal(int n_row, int n_col, int Ap, int Aj, signed char Ax, \n"

Modified: branches/refactor_fft/scipy/sparse/sparsetools/dia.py
===================================================================
--- branches/refactor_fft/scipy/sparse/sparsetools/dia.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/sparsetools/dia.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -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.

Modified: branches/refactor_fft/scipy/sparse/sparsetools/dia_wrap.cxx
===================================================================
--- branches/refactor_fft/scipy/sparse/sparsetools/dia_wrap.cxx	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/sparsetools/dia_wrap.cxx	2008-10-23 12:30:20 UTC (rev 4828)
@@ -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    "_dia"
 
-#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: branches/refactor_fft/scipy/sparse/sparsetools/sparsetools.i
===================================================================
--- branches/refactor_fft/scipy/sparse/sparsetools/sparsetools.i	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/sparsetools/sparsetools.i	2008-10-23 12:30:20 UTC (rev 4828)
@@ -189,3 +189,9 @@
 %enddef
 
 
+%define INSTANTIATE_INDEX( f_name )
+/* 32-bit indices */
+%template(f_name)   f_name<int>;
+/* 64-bit indices would go here */
+%enddef
+

Modified: branches/refactor_fft/scipy/sparse/spfuncs.py
===================================================================
--- branches/refactor_fft/scipy/sparse/spfuncs.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/spfuncs.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -3,15 +3,8 @@
 
 __all__ = ['count_blocks','estimate_blocksize']
 
-from numpy import empty, ravel
-
-from base import isspmatrix
 from csr import isspmatrix_csr, csr_matrix
 from csc import isspmatrix_csc
-from bsr import isspmatrix_bsr
-from sputils import upcast
-
-import sparsetools
 from sparsetools import csr_count_blocks
 
 def extract_diagonal(A):

Modified: branches/refactor_fft/scipy/sparse/sputils.py
===================================================================
--- branches/refactor_fft/scipy/sparse/sputils.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/sputils.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -82,13 +82,16 @@
     """Is x appropriate as an index into a sparse matrix? Returns True
     if it can be cast safely to a machine int.
     """
-    try:
-        if int(x) == x:
-            return True
-        else:
+    if issequence(x):
+        return False
+    else:
+        try:
+            if int(x) == x:
+                return True
+            else:
+                return False
+        except TypeError:
             return False
-    except TypeError:
-        return False
 
 def isshape(x):
     """Is x a valid 2-tuple of dimensions?

Modified: branches/refactor_fft/scipy/sparse/tests/test_base.py
===================================================================
--- branches/refactor_fft/scipy/sparse/tests/test_base.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/tests/test_base.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -15,9 +15,10 @@
 
 import warnings
 
-import numpy
-from numpy import arange, zeros, array, dot, ones, matrix, asmatrix, \
-        asarray, vstack, ndarray, transpose, diag
+import numpy as np
+from numpy import arange, zeros, array, dot, matrix, asmatrix, asarray, \
+                  vstack, ndarray, transpose, diag, kron, inf, conjugate, \
+                  int8
 
 import random
 from numpy.testing import *
@@ -94,12 +95,12 @@
         mats.append( [[0,1],[0,2],[0,3]] )
         mats.append( [[0,0,1],[0,0,2],[0,3,0]] )
 
-        mats.append( numpy.kron(mats[0],[[1,2]]) )
-        mats.append( numpy.kron(mats[0],[[1],[2]]) )
-        mats.append( numpy.kron(mats[1],[[1,2],[3,4]]) )
-        mats.append( numpy.kron(mats[2],[[1,2],[3,4]]) )
-        mats.append( numpy.kron(mats[3],[[1,2],[3,4]]) )
-        mats.append( numpy.kron(mats[3],[[1,2,3,4]]) )
+        mats.append( kron(mats[0],[[1,2]]) )
+        mats.append( kron(mats[0],[[1],[2]]) )
+        mats.append( kron(mats[1],[[1,2],[3,4]]) )
+        mats.append( kron(mats[2],[[1,2],[3,4]]) )
+        mats.append( kron(mats[3],[[1,2],[3,4]]) )
+        mats.append( kron(mats[3],[[1,2,3,4]]) )
 
         for m in mats:
             assert_equal(self.spmatrix(m).diagonal(),diag(m))
@@ -257,7 +258,7 @@
         assert_array_equal((self.datsp / self.datsp).todense(),expected)
 
         denom = self.spmatrix(matrix([[1,0,0,4],[-1,0,0,0],[0,8,0,-5]],'d'))
-        res = matrix([[1,0,0,0.5],[-3,0,numpy.inf,0],[0,0.25,0,0]],'d')
+        res = matrix([[1,0,0,0.5],[-3,0,inf,0],[0,0.25,0,0]],'d')
         assert_array_equal((self.datsp / denom).todense(),res)
 
         # complex
@@ -421,7 +422,7 @@
     def test_tobsr(self):
         x = array([[1,0,2,0],[0,0,0,0],[0,0,4,5]])
         y = array([[0,1,2],[3,0,5]])
-        A = numpy.kron(x,y)
+        A = kron(x,y)
         Asp = self.spmatrix(A)
         for format in ['bsr']:
             fn = getattr(Asp, 'to' + format )
@@ -584,16 +585,16 @@
         Wagner for a 64-bit machine, 02 March 2005 (EJS)
         """
         n = 20
-        numpy.random.seed(0) #make tests repeatable
+        np.random.seed(0) #make tests repeatable
         A = zeros((n,n), dtype=complex)
-        x = numpy.random.rand(n)
-        y = numpy.random.rand(n-1)+1j*numpy.random.rand(n-1)
-        r = numpy.random.rand(n)
+        x = np.random.rand(n)
+        y = np.random.rand(n-1)+1j*np.random.rand(n-1)
+        r = np.random.rand(n)
         for i in range(len(x)):
             A[i,i] = x[i]
         for i in range(len(y)):
             A[i,i+1] = y[i]
-            A[i+1,i] = numpy.conjugate(y[i])
+            A[i+1,i] = conjugate(y[i])
         A = self.spmatrix(A)
         x = splu(A).solve(r)
         assert_almost_equal(A*x,r)
@@ -699,20 +700,28 @@
         assert_equal(A[2,3],  B[2,3])
         assert_equal(A[-1,8], B[-1,8])
         assert_equal(A[-1,-2],B[-1,-2])
+        assert_equal(A[array(-1),-2],B[-1,-2])
+        assert_equal(A[-1,array(-2)],B[-1,-2])
+        assert_equal(A[array(-1),array(-2)],B[-1,-2])
 
         # [i,1:2]
         assert_equal(A[2,:].todense(),   B[2,:])
         assert_equal(A[2,5:-2].todense(),B[2,5:-2])
+        assert_equal(A[array(2),5:-2].todense(),B[2,5:-2])
 
         # [i,[1,2]]
         assert_equal(A[3,[1,3]].todense(),  B[3,[1,3]])
         assert_equal(A[-1,[2,-5]].todense(),B[-1,[2,-5]])
+        assert_equal(A[array(-1),[2,-5]].todense(),B[-1,[2,-5]])
+        assert_equal(A[-1,array([2,-5])].todense(),B[-1,[2,-5]])
+        assert_equal(A[array(-1),array([2,-5])].todense(),B[-1,[2,-5]])
 
         # [1:2,j]
         assert_equal(A[:,2].todense(),   B[:,2])
         assert_equal(A[3:4,9].todense(), B[3:4,9])
         assert_equal(A[1:4,-5].todense(),B[1:4,-5])
         assert_equal(A[2:-1,3].todense(),B[2:-1,3])
+        assert_equal(A[2:-1,array(3)].todense(),B[2:-1,3])
 
         # [1:2,1:2]
         assert_equal(A[1:2,1:2].todense(),B[1:2,1:2])
@@ -724,26 +733,38 @@
         assert_equal(A[:,[2,8,3,-1]].todense(),B[:,[2,8,3,-1]])
         assert_equal(A[3:4,[9]].todense(),     B[3:4,[9]])
         assert_equal(A[1:4,[-1,-5]].todense(), B[1:4,[-1,-5]])
+        assert_equal(A[1:4,array([-1,-5])].todense(), B[1:4,[-1,-5]])
 
         # [[1,2],j]
         assert_equal(A[[1,3],3].todense(),   B[[1,3],3])
         assert_equal(A[[2,-5],-4].todense(), B[[2,-5],-4])
+        assert_equal(A[array([2,-5]),-4].todense(), B[[2,-5],-4])
+        assert_equal(A[[2,-5],array(-4)].todense(), B[[2,-5],-4])
+        assert_equal(A[array([2,-5]),array(-4)].todense(), B[[2,-5],-4])
 
         # [[1,2],1:2]
         assert_equal(A[[1,3],:].todense(),    B[[1,3],:])
         assert_equal(A[[2,-5],8:-1].todense(),B[[2,-5],8:-1])
+        assert_equal(A[array([2,-5]),8:-1].todense(),B[[2,-5],8:-1])
 
         # [[1,2],[1,2]]
         assert_equal(A[[1,3],[2,4]],   B[[1,3],[2,4]])
         assert_equal(A[[-1,-3],[2,-4]],B[[-1,-3],[2,-4]])
+        assert_equal(A[array([-1,-3]),[2,-4]],B[[-1,-3],[2,-4]])
+        assert_equal(A[[-1,-3],array([2,-4])],B[[-1,-3],[2,-4]])
+        assert_equal(A[array([-1,-3]),array([2,-4])],B[[-1,-3],[2,-4]])
 
         # [[[1],[2]],[1,2]]
         assert_equal(A[[[1],[3]],[2,4]].todense(),        B[[[1],[3]],[2,4]])
         assert_equal(A[[[-1],[-3],[-2]],[2,-4]].todense(),B[[[-1],[-3],[-2]],[2,-4]])
+        assert_equal(A[array([[-1],[-3],[-2]]),[2,-4]].todense(),B[[[-1],[-3],[-2]],[2,-4]])
+        assert_equal(A[[[-1],[-3],[-2]],array([2,-4])].todense(),B[[[-1],[-3],[-2]],[2,-4]])
+        assert_equal(A[array([[-1],[-3],[-2]]),array([2,-4])].todense(),B[[[-1],[-3],[-2]],[2,-4]])
 
         # [i]
         assert_equal(A[1,:].todense(), B[1,:])
         assert_equal(A[-2,:].todense(),B[-2,:])
+        assert_equal(A[array(-2),:].todense(),B[-2,:])
 
         # [1:2]
         assert_equal(A[1:4].todense(), B[1:4])
@@ -752,19 +773,22 @@
         # [[1,2]]
         assert_equal(A[[1,3]].todense(),  B[[1,3]])
         assert_equal(A[[-1,-3]].todense(),B[[-1,-3]])
+        assert_equal(A[array([-1,-3])].todense(),B[[-1,-3]])
 
         # [[1,2],:][:,[1,2]]
         assert_equal(A[[1,3],:][:,[2,4]].todense(),    B[[1,3],:][:,[2,4]]    )
         assert_equal(A[[-1,-3],:][:,[2,-4]].todense(), B[[-1,-3],:][:,[2,-4]] )
+        assert_equal(A[array([-1,-3]),:][:,array([2,-4])].todense(), B[[-1,-3],:][:,[2,-4]] )
 
         # [:,[1,2]][[1,2],:]
         assert_equal(A[:,[1,3]][[2,4],:].todense(),    B[:,[1,3]][[2,4],:]    )
         assert_equal(A[:,[-1,-3]][[2,-4],:].todense(), B[:,[-1,-3]][[2,-4],:] )
+        assert_equal(A[:,array([-1,-3])][array([2,-4]),:].todense(), B[:,[-1,-3]][[2,-4],:] )
 
 
         # Check bug reported by Robert Cimrman:
         # http://thread.gmane.org/gmane.comp.python.scientific.devel/7986
-        s = slice(numpy.int8(2),numpy.int8(4),None)
+        s = slice(int8(2),int8(4),None)
         assert_equal(A[s,:].todense(), B[2:4,:])
         assert_equal(A[:,s].todense(), B[:,2:4])
 
@@ -920,9 +944,9 @@
 
     def test_constructor4(self):
         """using (data, ij) format"""
-        row  = numpy.array([2, 3, 1, 3, 0, 1, 3, 0, 2, 1, 2])
-        col  = numpy.array([0, 1, 0, 0, 1, 1, 2, 2, 2, 2, 1])
-        data = numpy.array([  6.,  10.,   3.,   9.,   1.,   4.,
+        row  = array([2, 3, 1, 3, 0, 1, 3, 0, 2, 1, 2])
+        col  = array([0, 1, 0, 0, 1, 1, 2, 2, 2, 2, 1])
+        data = array([  6.,  10.,   3.,   9.,   1.,   4.,
                               11.,   2.,   8.,   5.,   7.])
 
         ij = vstack((row,col))
@@ -994,9 +1018,9 @@
 
     def test_constructor4(self):
         """using (data, ij) format"""
-        row  = numpy.array([2, 3, 1, 3, 0, 1, 3, 0, 2, 1, 2])
-        col  = numpy.array([0, 1, 0, 0, 1, 1, 2, 2, 2, 2, 1])
-        data = numpy.array([  6.,  10.,   3.,   9.,   1.,   4.,
+        row  = array([2, 3, 1, 3, 0, 1, 3, 0, 2, 1, 2])
+        col  = array([0, 1, 0, 0, 1, 1, 2, 2, 2, 2, 1])
+        data = array([  6.,  10.,   3.,   9.,   1.,   4.,
                               11.,   2.,   8.,   5.,   7.])
 
         ij = vstack((row,col))
@@ -1139,7 +1163,26 @@
             caught += 1
         assert_equal(caught,5)
 
+    def test_ctor(self):
+        caught = 0
+        # Empty ctor
+        try:
+            A = dok_matrix()
+        except TypeError, e:
+            caught+=1
+        assert_equal(caught, 1)
 
+        # Dense ctor
+        b = matrix([[1,0,0,0],[0,0,1,0],[0,2,0,3]],'d')
+        A = dok_matrix(b)
+        assert_equal(A.todense(), b)
+
+        # Sparse ctor
+        c = csr_matrix(b)
+        assert_equal(A.todense(), c.todense())
+
+
+
 class TestLIL( _TestCommon, _TestHorizSlicing, _TestVertSlicing,
         _TestBothSlicing, _TestGetSet, _TestSolve,
         _TestArithmetic, _TestInplaceArithmetic,
@@ -1295,9 +1338,9 @@
     spmatrix = coo_matrix
     def test_constructor1(self):
         """unsorted triplet format"""
-        row  = numpy.array([2, 3, 1, 3, 0, 1, 3, 0, 2, 1, 2])
-        col  = numpy.array([0, 1, 0, 0, 1, 1, 2, 2, 2, 2, 1])
-        data = numpy.array([  6.,  10.,   3.,   9.,   1.,   4.,
+        row  = array([2, 3, 1, 3, 0, 1, 3, 0, 2, 1, 2])
+        col  = array([0, 1, 0, 0, 1, 1, 2, 2, 2, 2, 1])
+        data = array([  6.,  10.,   3.,   9.,   1.,   4.,
                               11.,   2.,   8.,   5.,   7.])
 
         coo = coo_matrix((data,(row,col)),(4,3))
@@ -1306,9 +1349,9 @@
 
     def test_constructor2(self):
         """unsorted triplet format with duplicates (which are summed)"""
-        row  = numpy.array([0,1,2,2,2,2,0,0,2,2])
-        col  = numpy.array([0,2,0,2,1,1,1,0,0,2])
-        data = numpy.array([2,9,-4,5,7,0,-1,2,1,-5])
+        row  = array([0,1,2,2,2,2,0,0,2,2])
+        col  = array([0,2,0,2,1,1,1,0,0,2])
+        data = array([2,9,-4,5,7,0,-1,2,1,-5])
         coo = coo_matrix((data,(row,col)),(3,3))
 
         mat = matrix([[4,-1,0],[0,0,9],[-3,7,0]])
@@ -1327,14 +1370,14 @@
 
     def test_constructor4(self):
         """from dense matrix"""
-        mat = numpy.array([[0,1,0,0],
+        mat = array([[0,1,0,0],
                            [7,0,3,0],
                            [0,4,0,0]])
         coo = coo_matrix(mat)
         assert_array_equal(coo.todense(),mat)
 
         #upgrade rank 1 arrays to row matrix
-        mat = numpy.array([0,1,0,0])
+        mat = array([0,1,0,0])
         coo = coo_matrix(mat)
         assert_array_equal(coo.todense(),mat.reshape(1,-1))
 
@@ -1366,7 +1409,7 @@
         data[3] = array([[ 0,  5, 10],
                          [15,  0, 25]])
 
-        A = numpy.kron( [[1,0,2,0],[0,0,0,0],[0,0,4,5]], [[0,1,2],[3,0,5]] )
+        A = kron( [[1,0,2,0],[0,0,0,0],[0,0,4,5]], [[0,1,2],[3,0,5]] )
         Asp = bsr_matrix((data,indices,indptr),shape=(6,12))
         assert_equal(Asp.todense(),A)
 
@@ -1385,7 +1428,7 @@
         assert_equal(bsr_matrix(A,blocksize=(2,2)).todense(),A)
         assert_equal(bsr_matrix(A,blocksize=(2,3)).todense(),A)
 
-        A = numpy.kron( [[1,0,2,0],[0,0,0,0],[0,0,4,5]], [[0,1,2],[3,0,5]] )
+        A = kron( [[1,0,2,0],[0,0,0,0],[0,0,4,5]], [[0,1,2],[3,0,5]] )
         assert_equal(bsr_matrix(A).todense(),A)
         assert_equal(bsr_matrix(A,shape=(6,12)).todense(),A)
         assert_equal(bsr_matrix(A,blocksize=(1,1)).todense(),A)
@@ -1395,11 +1438,11 @@
         assert_equal(bsr_matrix(A,blocksize=(3,12)).todense(),A)
         assert_equal(bsr_matrix(A,blocksize=(6,12)).todense(),A)
 
-        A = numpy.kron( [[1,0,2,0],[0,1,0,0],[0,0,0,0]], [[0,1,2],[3,0,5]] )
+        A = kron( [[1,0,2,0],[0,1,0,0],[0,0,0,0]], [[0,1,2],[3,0,5]] )
         assert_equal(bsr_matrix(A,blocksize=(2,3)).todense(),A)
 
     def test_eliminate_zeros(self):
-        data = numpy.kron([1, 0, 0, 0, 2, 0, 3, 0], [[1,1],[1,1]]).T
+        data = kron([1, 0, 0, 0, 2, 0, 3, 0], [[1,1],[1,1]]).T
         data = data.reshape(-1,2,2)
         indices = array( [1, 2, 3, 4, 5, 6, 7, 8] )
         indptr  = array( [0, 3, 8] )

Modified: branches/refactor_fft/scipy/sparse/tests/test_extract.py
===================================================================
--- branches/refactor_fft/scipy/sparse/tests/test_extract.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/tests/test_extract.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,9 +1,6 @@
 """test sparse matrix construction functions"""
 
-import numpy
-from numpy import array, matrix
 from numpy.testing import *
-
 from scipy.sparse import csr_matrix
 
 import numpy as np

Modified: branches/refactor_fft/scipy/sparse/tests/test_sputils.py
===================================================================
--- branches/refactor_fft/scipy/sparse/tests/test_sputils.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/sparse/tests/test_sputils.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -36,7 +36,7 @@
         assert_equal(isintlike(3.0),True)
         assert_equal(isintlike(-4),True)
         assert_equal(isintlike(np.array(3)),True)
-        assert_equal(isintlike( np.array([3])), True)
+        assert_equal(isintlike(np.array([3])), False)
 
         assert_equal(isintlike(2.5),False)
         assert_equal(isintlike(1 + 3j),False)

Modified: branches/refactor_fft/scipy/special/cephes/jv.c
===================================================================
--- branches/refactor_fft/scipy/special/cephes/jv.c	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/special/cephes/jv.c	2008-10-23 12:30:20 UTC (rev 4828)
@@ -50,6 +50,10 @@
 #include "mconf.h"
 #define CEPHES_DEBUG 0
 
+#if CEPHES_DEBUG
+#include <stdio.h>
+#endif
+
 #ifdef DEC
 #define MAXGAM 34.84425627277176174
 #else
@@ -94,6 +98,15 @@
     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);

Modified: branches/refactor_fft/scipy/special/cephes_doc.h
===================================================================
--- branches/refactor_fft/scipy/special/cephes_doc.h	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/special/cephes_doc.h	2008-10-23 12:30:20 UTC (rev 4828)
@@ -80,20 +80,20 @@
 #define jn_doc "y=jn(n,x) returns the Bessel function of integer order n at  x."
 #define jv_doc "y=jv(v,z) returns the Bessel function of real order v at complex z."
 #define jve_doc "y=jve(v,z) returns the exponentially scaled Bessel function of real order\nv at complex z: jve(v,z) = jv(v,z) * exp(-abs(z.imag))"
-#define k0_doc "y=i0(x) returns the modified Bessel function of the third kind of\norder 0 at x."
-#define k0e_doc "y=k0e(x) returns the exponentially scaled modified Bessel function\nof the third kind of order 0 at x.  k0e(x) = exp(x) * k0(x)."
-#define k1_doc "y=i1(x) returns the modified Bessel function of the third kind of\norder 1 at x."
-#define k1e_doc "y=k1e(x) returns the exponentially scaled modified Bessel function\nof the third kind of order 1 at x.  k1e(x) = exp(x) * k1(x)"
+#define k0_doc "y=k0(x) returns the modified Bessel function of the second kind (sometimes called the third kind) of\norder 0 at x."
+#define k0e_doc "y=k0e(x) returns the exponentially scaled modified Bessel function\nof the second kind (sometimes called the third kind) of order 0 at x.  k0e(x) = exp(x) * k0(x)."
+#define k1_doc "y=i1(x) returns the modified Bessel function of the second kind (sometimes called the third kind) of\norder 1 at x."
+#define k1e_doc "y=k1e(x) returns the exponentially scaled modified Bessel function\nof the second kind (sometimes called the third kind) of order 1 at x.  k1e(x) = exp(x) * k1(x)"
 #define kei_doc "y=kei(x) returns the Kelvin function ker x"
 #define keip_doc "y=keip(x) returns the derivative of the Kelvin function kei x"
 #define kelvin_doc "(Be, Ke, Bep, Kep)=kelvin(x) returns the tuple (Be, Ke, Bep, Kep) which containes \ncomplex numbers representing the real and imaginary Kelvin functions \nand their derivatives evaluated at x.  For example, \nkelvin(x)[0].real = ber x and kelvin(x)[0].imag = bei x with similar \nrelationships for ker and kei."
 #define ker_doc "y=ker(x) returns the Kelvin function ker x"
 #define kerp_doc "y=kerp(x) returns the derivative of the Kelvin function ker x"
-#define kn_doc "y=kn(n,x) returns the modified Bessel function of the third kind for\ninteger order n at x."
+#define kn_doc "y=kn(n,x) returns the modified Bessel function of the second kind (sometimes called the third kind) for\ninteger order n at x."
 #define kolmogi_doc "y=kolmogi(p) returns y such that kolmogorov(y) = p"
 #define kolmogorov_doc "p=kolmogorov(y) returns the complementary cumulative distribution \nfunction of Kolmogorov's limiting distribution (Kn* for large n) \nof a two-sided test for equality between an empirical and a theoretical \ndistribution. It is equal to the (limit as n->infinity of the) probability \nthat sqrt(n) * max absolute deviation > y."
-#define kv_doc "y=kv(v,z) returns the modified Bessel function of the third kind for\nreal order v at complex z."
-#define kve_doc "y=kve(v,z) returns the exponentially scaled, modified Bessel function\nof the third kind for real order v at complex z: kve(v,z) = kv(v,z) * exp(z)"
+#define kv_doc "y=kv(v,z) returns the modified Bessel function of the second kind (sometimes called the third kind) for\nreal order v at complex z."
+#define kve_doc "y=kve(v,z) returns the exponentially scaled, modified Bessel function\nof the second kind (sometimes called the third kind) for real order v at complex z: kve(v,z) = kv(v,z) * exp(z)"
 #define log1p_doc "y=log1p(x) calculates log(1+x) for use when x is near zero."
 #define lpmv_doc "y=lpmv(m,v,x) returns the associated legendre function of integer order\nm and nonnegative degree v: |x|<=1."
 #define mathieu_a_doc "lmbda=mathieu_a(m,q) returns the characteristic value for the even solution, \nce_m(z,q), of Mathieu's equation"

Modified: branches/refactor_fft/scipy/special/info.py
===================================================================
--- branches/refactor_fft/scipy/special/info.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/special/info.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -25,9 +25,9 @@
 *  yn       -- Bessel function of second kind (integer order).
 *  yv       -- Bessel function of the second kind (real-valued order).
 *  yve      -- Exponentially scaled Bessel function of the second kind.
-*  kn       -- Modified Bessel function of the third kind (integer order).
-*  kv       -- Modified Bessel function of the third kind (real order).
-*  kve      -- Exponentially scaled modified Bessel function of the third kind.
+*  kn       -- Modified Bessel function of the second kind (integer order).
+*  kv       -- Modified Bessel function of the second kind (real order).
+*  kve      -- Exponentially scaled modified Bessel function of the second kind.
 *  iv       -- Modified Bessel function.
 *  ive      -- Exponentially scaled modified Bessel function.
 *  hankel1  -- Hankel function of the first kind.
@@ -60,10 +60,10 @@
 *  i0e      -- Exponentially scaled modified Bessel function of order 0.
 *  i1       -- Modified Bessel function of order 1.
 *  i1e      -- Exponentially scaled modified Bessel function of order 1.
-*  k0       -- Modified Bessel function of the third kind of order 0.
-*  k0e      -- Exponentially scaled modified Bessel function of the third kind of order 0.
-*  k1       -- Modified Bessel function of the third kind of order 1.
-*  k1e      -- Exponentially scaled modified Bessel function of the third kind of order 1.
+*  k0       -- Modified Bessel function of the second kind of order 0.
+*  k0e      -- Exponentially scaled modified Bessel function of the second kind of order 0.
+*  k1       -- Modified Bessel function of the second kind of order 1.
+*  k1e      -- Exponentially scaled modified Bessel function of the second kind of order 1.
 
 Integrals of Bessel Functions
 .............................

Modified: branches/refactor_fft/scipy/special/tests/test_basic.py
===================================================================
--- branches/refactor_fft/scipy/special/tests/test_basic.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/special/tests/test_basic.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -32,7 +32,7 @@
 #8   test_sh_jacobi
 #8   test_sh_legendre
 
-from numpy import dot, array
+from numpy import array
 
 from numpy.testing import *
 

Modified: branches/refactor_fft/scipy/stats/_support.py
===================================================================
--- branches/refactor_fft/scipy/stats/_support.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/stats/_support.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -48,7 +48,7 @@
                 except TypeError:
                     uniques = np.concatenate([uniques,np.array([item])])
     else:                                  # IT MUST BE A 2+D ARRAY
-        if inarray.typecode() != 'O':  # not an Object array
+        if inarray.dtype.char != 'O':  # not an Object array
             for item in inarray[1:]:
                 if not np.sum(np.alltrue(np.equal(uniques,item),1),axis=0):
                     try:

Modified: branches/refactor_fft/scipy/stats/continuous.lyx
===================================================================
--- branches/refactor_fft/scipy/stats/continuous.lyx	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/stats/continuous.lyx	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,18 +1,19 @@
-#LyX 1.3 created this file. For more info see http://www.lyx.org/
-\lyxformat 221
+#LyX 1.4.3 created this file. For more info see http://www.lyx.org/
+\lyxformat 245
+\begin_document
+\begin_header
 \textclass article
 \language english
 \inputencoding auto
 \fontscheme default
 \graphics default
 \paperfontsize default
-\spacing single 
-\papersize Default
-\paperpackage a4
-\use_geometry 1
-\use_amsmath 1
-\use_natbib 0
-\use_numerical_citations 0
+\spacing single
+\papersize default
+\use_geometry true
+\use_amsmath 2
+\cite_engine basic
+\use_bibtopic false
 \paperorientation portrait
 \leftmargin 1in
 \topmargin 1in
@@ -23,43 +24,49 @@
 \paragraph_separation indent
 \defskip medskip
 \quotes_language english
-\quotes_times 2
 \papercolumns 1
 \papersides 1
 \paperpagestyle default
+\tracking_changes false
+\output_changes true
+\end_header
 
-\layout Title
+\begin_body
 
+\begin_layout Title
 Continuous Statistical Distributions
-\layout Section
+\end_layout
 
+\begin_layout Section
 Overview
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 All distributions will have location (L) and Scale (S) parameters along
  with any shape parameters needed, the names for the shape parameters will
  vary.
  Standard form for the distributions will be given where 
 \begin_inset Formula $L=0.0$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $S=1.0.$
-\end_inset 
+\end_inset
 
  The nonstandard forms can be obtained for the various functions using (note
  
 \begin_inset Formula $U$
-\end_inset 
+\end_inset
 
  is a standard uniform random variate).
  
-\layout Standard
-\align center 
+\end_layout
 
-\size small 
+\begin_layout Standard
+\align center
 
-\begin_inset  Tabular
+\size small
+\begin_inset Tabular
 <lyxtabular version="3" rows="16" columns="3">
 <features>
 <column alignment="center" valignment="top" leftline="true" width="0pt">
@@ -69,591 +76,612 @@
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+Function Name
+\end_layout
 
-Function Name
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+Standard Function
+\end_layout
 
-Standard Function
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+Transformation
+\end_layout
 
-Transformation
-\end_inset 
+\end_inset
 </cell>
 </row>
 <row topline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+Cumulative Distribution Function (CDF)
+\end_layout
 
-Cumulative Distribution Function (CDF)
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $F\left(x\right)$
+\end_inset
 
 
-\begin_inset Formula $F\left(x\right)$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $F\left(x;L,S\right)=F\left(\frac{\left(x-L\right)}{S}\right)$
+\end_inset
 
 
-\begin_inset Formula $F\left(x;L,S\right)=F\left(\frac{\left(x-L\right)}{S}\right)$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 </row>
 <row topline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+Probability Density Function (PDF)
+\end_layout
 
-Probability Density Function (PDF)
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $f\left(x\right)=F^{\prime}\left(x\right)$
+\end_inset
 
 
-\begin_inset Formula $f\left(x\right)=F^{\prime}\left(x\right)$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $f\left(x;L,S\right)=\frac{1}{S}f\left(\frac{\left(x-L\right)}{S}\right)$
+\end_inset
 
 
-\begin_inset Formula $f\left(x;L,S\right)=\frac{1}{S}f\left(\frac{\left(x-L\right)}{S}\right)$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 </row>
 <row topline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+Percent Point Function (PPF)
+\end_layout
 
-Percent Point Function (PPF)
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $G\left(q\right)=F^{-1}\left(q\right)$
+\end_inset
 
 
-\begin_inset Formula $G\left(q\right)=F^{-1}\left(q\right)$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $G\left(q;L,S\right)=L+SG\left(q\right)$
+\end_inset
 
 
-\begin_inset Formula $G\left(q;L,S\right)=L+SG\left(q\right)$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 </row>
 <row topline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+Probability Sparsity Function (PSF)
+\end_layout
 
-Probability Sparsity Function (PSF)
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
-
-
+\begin_layout Standard
 \begin_inset Formula $g\left(q\right)=G^{\prime}\left(q\right)$
-\end_inset 
+\end_inset
 
  
-\end_inset 
+\end_layout
+
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $g\left(q;L,S\right)=Sg\left(q\right)$
+\end_inset
 
 
-\begin_inset Formula $g\left(q;L,S\right)=Sg\left(q\right)$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 </row>
 <row topline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+Hazard Function (HF)
+\end_layout
 
-Hazard Function (HF)
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $h_{a}\left(x\right)=\frac{f\left(x\right)}{1-F\left(x\right)}$
+\end_inset
 
 
-\begin_inset Formula $h_{a}\left(x\right)=\frac{f\left(x\right)}{1-F\left(x\right)}$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $h_{a}\left(x;L,S\right)=\frac{1}{S}h_{a}\left(\frac{\left(x-L\right)}{S}\right)$
+\end_inset
 
 
-\begin_inset Formula $h_{a}\left(x;L,S\right)=\frac{1}{S}h_{a}\left(\frac{\left(x-L\right)}{S}\right)$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 </row>
 <row topline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+Cumulative Hazard Functon (CHF)
+\end_layout
 
-Cumulative Hazard Functon (CHF)
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
-
-
+\begin_layout Standard
 \begin_inset Formula $H_{a}\left(x\right)=$
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula $\log\frac{1}{1-F\left(x\right)}$
-\end_inset 
+\end_inset
 
 
-\end_inset 
+\end_layout
+
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $H_{a}\left(x;L,S\right)=H_{a}\left(\frac{\left(x-L\right)}{S}\right)$
+\end_inset
 
 
-\begin_inset Formula $H_{a}\left(x;L,S\right)=H_{a}\left(\frac{\left(x-L\right)}{S}\right)$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 </row>
 <row topline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+Survival Function (SF)
+\end_layout
 
-Survival Function (SF)
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $S\left(x\right)=1-F\left(x\right)$
+\end_inset
 
 
-\begin_inset Formula $S\left(x\right)=1-F\left(x\right)$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $S\left(x;L,S\right)=S\left(\frac{\left(x-L\right)}{S}\right)$
+\end_inset
 
 
-\begin_inset Formula $S\left(x;L,S\right)=S\left(\frac{\left(x-L\right)}{S}\right)$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 </row>
 <row topline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+Inverse Survival Function (ISF)
+\end_layout
 
-Inverse Survival Function (ISF)
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $Z\left(\alpha\right)=S^{-1}\left(\alpha\right)=G\left(1-\alpha\right)$
+\end_inset
 
 
-\begin_inset Formula $Z\left(\alpha\right)=S^{-1}\left(\alpha\right)=G\left(1-\alpha\right)$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $Z\left(\alpha;L,S\right)=L+SZ\left(\alpha\right)$
+\end_inset
 
 
-\begin_inset Formula $Z\left(\alpha;L,S\right)=L+SZ\left(\alpha\right)$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 </row>
 <row topline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+Moment Generating Function (MGF) 
+\end_layout
 
-Moment Generating Function (MGF) 
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $M_{Y}\left(t\right)=E\left[e^{Yt}\right]$
+\end_inset
 
 
-\begin_inset Formula $M_{Y}\left(t\right)=E\left[e^{Yt}\right]$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $M_{X}\left(t\right)=e^{Lt}M_{Y}\left(St\right)$
+\end_inset
 
 
-\begin_inset Formula $M_{X}\left(t\right)=e^{Lt}M_{Y}\left(St\right)$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 </row>
 <row topline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+Random Variates
+\end_layout
 
-Random Variates
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $Y=G\left(U\right)$
+\end_inset
 
 
-\begin_inset Formula $Y=G\left(U\right)$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $X=L+SY$
+\end_inset
 
 
-\begin_inset Formula $X=L+SY$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 </row>
 <row topline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+(Differential) Entropy
+\end_layout
 
-(Differential) Entropy
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $h\left[Y\right]=-\int f\left(y\right)\log f\left(y\right)dy$
+\end_inset
 
 
-\begin_inset Formula $h\left[Y\right]=-\int f\left(y\right)\log f\left(y\right)dy$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $h\left[X\right]=h\left[Y\right]+\log S$
+\end_inset
 
 
-\begin_inset Formula $h\left[X\right]=h\left[Y\right]+\log S$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 </row>
 <row topline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+(Non-central) Moments
+\end_layout
 
-(Non-central) Moments
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $\mu_{n}^{\prime}=E\left[Y^{n}\right]$
+\end_inset
 
 
-\begin_inset Formula $\mu_{n}^{\prime}=E\left[Y^{n}\right]$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
-
-
+\begin_layout Standard
 \begin_inset Formula $E\left[X^{n}\right]=L^{n}\sum_{k=0}^{N}\left(\begin{array}{c}
 n\\
 k\end{array}\right)\left(\frac{S}{L}\right)^{k}\mu_{k}^{\prime}$
-\end_inset 
+\end_inset
 
 
-\end_inset 
+\end_layout
+
+\end_inset
 </cell>
 </row>
 <row topline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+Central Moments 
+\end_layout
 
-Central Moments 
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $\mu_{n}=E\left[\left(Y-\mu\right)^{n}\right]$
+\end_inset
 
 
-\begin_inset Formula $\mu_{n}=E\left[\left(Y-\mu\right)^{n}\right]$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $E\left[\left(X-\mu_{X}\right)^{n}\right]=S^{n}\mu_{n}$
+\end_inset
 
 
-\begin_inset Formula $E\left[\left(X-\mu_{X}\right)^{n}\right]=S^{n}\mu_{n}$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 </row>
 <row topline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+mean (mode, median), var
+\end_layout
 
-mean (mode, median), var
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $\mu,\,\mu_{2}$
+\end_inset
 
 
-\begin_inset Formula $\mu,\,\mu_{2}$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
-
-
+\begin_layout Standard
 \begin_inset Formula $L+S\mu,\, S^{2}\mu_{2}$
-\end_inset 
+\end_inset
 
   
-\end_inset 
+\end_layout
+
+\end_inset
 </cell>
 </row>
 <row topline="true" bottomline="true">
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+skewness, kurtosis
+\end_layout
 
-skewness, kurtosis
-\end_inset 
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
-
-
+\begin_layout Standard
 \begin_inset Formula $\gamma_{1}=\frac{\mu_{3}}{\left(\mu_{2}\right)^{3/2}},\,$
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula $\gamma_{2}=\frac{\mu_{4}}{\left(\mu_{2}\right)^{2}}-3$
-\end_inset 
+\end_inset
 
  
-\end_inset 
+\end_layout
+
+\end_inset
 </cell>
 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
 \begin_inset Text
 
-\layout Standard
+\begin_layout Standard
+\begin_inset Formula $\gamma_{1},\,\gamma_{2}$
+\end_inset
 
 
-\begin_inset Formula $\gamma_{1},\,\gamma_{2}$
-\end_inset 
+\end_layout
 
-
-\end_inset 
+\end_inset
 </cell>
 </row>
 </lyxtabular>
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-\SpecialChar ~
+\begin_layout Standard
+\InsetSpace ~
 
-\layout Subsection
+\end_layout
 
+\begin_layout Subsection
 Moments
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Non-central moments are defined using the PDF 
 \begin_inset Formula \[
 \mu_{n}^{\prime}=\int_{-\infty}^{\infty}x^{n}f\left(x\right)dx.\]
 
-\end_inset 
+\end_inset
 
  Note, that these can always be computed using the PPF.
  Substitute 
 \begin_inset Formula $x=G\left(q\right)$
-\end_inset 
+\end_inset
 
  in the above equation and get 
 \begin_inset Formula \[
 \mu_{n}^{\prime}=\int_{0}^{1}G^{n}\left(q\right)dq\]
 
-\end_inset 
+\end_inset
 
  which may be easier to compute numerically.
  Note that 
 \begin_inset Formula $q=F\left(x\right)$
-\end_inset 
+\end_inset
 
  so that 
 \begin_inset Formula $dq=f\left(x\right)dx.$
-\end_inset 
+\end_inset
 
  Central moments are computed similarly 
 \begin_inset Formula $\mu=\mu_{1}^{\prime}$
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \begin{eqnarray*}
@@ -663,7 +691,7 @@
 n\\
 k\end{array}\right)\left(-\mu\right)^{k}\mu_{n-k}^{\prime}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  In particular 
 \begin_inset Formula \begin{eqnarray*}
@@ -672,157 +700,162 @@
 \mu_{4} & = & \mu_{4}^{\prime}-4\mu\mu_{3}^{\prime}+6\mu^{2}\mu_{2}^{\prime}-3\mu^{4}\\
  & = & \mu_{4}^{\prime}-4\mu\mu_{3}-6\mu^{2}\mu_{2}-\mu^{4}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  Skewness is defined as 
 \begin_inset Formula \[
 \gamma_{1}=\sqrt{\beta_{1}}=\frac{\mu_{3}}{\mu_{2}^{3/2}}\]
 
-\end_inset 
+\end_inset
 
  while (Fisher) kurtosis is 
 \begin_inset Formula \[
 \gamma_{2}=\frac{\mu_{4}}{\mu_{2}^{2}}-3,\]
 
-\end_inset 
+\end_inset
 
  so that a normal distribution has a kurtosis of zero.
  
-\layout Subsection
+\end_layout
 
+\begin_layout Subsection
 Median and mode
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 The median, 
 \begin_inset Formula $m_{n}$
-\end_inset 
+\end_inset
 
  is defined as the point at which half of the density is on one side and
  half on the other.
  In other words, 
 \begin_inset Formula $F\left(m_{n}\right)=\frac{1}{2}$
-\end_inset 
+\end_inset
 
  so that 
 \begin_inset Formula \[
 m_{n}=G\left(\frac{1}{2}\right).\]
 
-\end_inset 
+\end_inset
 
  In addition, the mode, 
 \begin_inset Formula $m_{d}$
-\end_inset 
+\end_inset
 
 , is defined as the value for which the probability density function reaches
  it's peak 
 \begin_inset Formula \[
 m_{d}=\arg\max_{x}f\left(x\right).\]
 
-\end_inset 
+\end_inset
 
 
-\layout Subsection
+\end_layout
 
+\begin_layout Subsection
 Fitting data
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 To fit data to a distribution, maximizing the likelihood function is common.
  Alternatively, some distributions have well-known minimum variance unbiased
  estimators.
  These will be chosen by default, but the likelihood function will always
  be available for minimizing.
  
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 If 
 \begin_inset Formula $f\left(x;\boldsymbol{\theta}\right)$
-\end_inset 
+\end_inset
 
  is the PDF of a random-variable where 
 \begin_inset Formula $\boldsymbol{\theta}$
-\end_inset 
+\end_inset
 
  is a vector of parameters (
-\emph on 
+\emph on
 e.g.
  
 \begin_inset Formula $L$
-\end_inset 
+\end_inset
 
  
-\emph default 
+\emph default
 and 
 \begin_inset Formula $S$
-\end_inset 
+\end_inset
 
 ), then for a collection of 
 \begin_inset Formula $N$
-\end_inset 
+\end_inset
 
  independent samples from this distribution, the joint distribution the
  random vector 
 \begin_inset Formula $\mathbf{x}$
-\end_inset 
+\end_inset
 
  is 
 \begin_inset Formula \[
 f\left(\mathbf{x};\boldsymbol{\theta}\right)=\prod_{i=1}^{N}f\left(x_{i};\boldsymbol{\theta}\right).\]
 
-\end_inset 
+\end_inset
 
  The maximum likelihood estimate of the parameters 
 \begin_inset Formula $\boldsymbol{\theta}$
-\end_inset 
+\end_inset
 
  are the parameters which maximize this function with 
 \begin_inset Formula $\mathbf{x}$
-\end_inset 
+\end_inset
 
  fixed and given by the data: 
 \begin_inset Formula \begin{eqnarray*}
 \boldsymbol{\theta}_{es} & = & \arg\max_{\boldsymbol{\theta}}f\left(\mathbf{x};\boldsymbol{\theta}\right)\\
  & = & \arg\min_{\boldsymbol{\theta}}l_{\mathbf{x}}\left(\boldsymbol{\theta}\right).\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  Where 
 \begin_inset Formula \begin{eqnarray*}
 l_{\mathbf{x}}\left(\boldsymbol{\theta}\right) & = & -\sum_{i=1}^{N}\log f\left(x_{i};\boldsymbol{\theta}\right)\\
  & = & -N\overline{\log f\left(x_{i};\boldsymbol{\theta}\right)}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  Note that if 
 \begin_inset Formula $\boldsymbol{\theta}$
-\end_inset 
+\end_inset
 
  includes only shape parameters, the location and scale-parameters can be
  fit by replacing 
 \begin_inset Formula $x_{i}$
-\end_inset 
+\end_inset
 
  with 
 \begin_inset Formula $\left(x_{i}-L\right)/S$
-\end_inset 
+\end_inset
 
  in the log-likelihood function adding 
 \begin_inset Formula $N\log S$
-\end_inset 
+\end_inset
 
  and minimizing, thus 
 \begin_inset Formula \begin{eqnarray*}
 l_{\mathbf{x}}\left(L,S;\boldsymbol{\theta}\right) & = & N\log S-\sum_{i=1}^{N}\log f\left(\frac{x_{i}-L}{S};\boldsymbol{\theta}\right)\\
  & = & N\log S+l_{\frac{\mathbf{x}-S}{L}}\left(\boldsymbol{\theta}\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  If desired, sample estimates for 
 \begin_inset Formula $L$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $S$
-\end_inset 
+\end_inset
 
  (not necessarily maximum likelihood estimates) can be obtained from samples
  estimates of the mean and variance using 
@@ -830,185 +863,194 @@
 \hat{S} & = & \sqrt{\frac{\hat{\mu}_{2}}{\mu_{2}}}\\
 \hat{L} & = & \hat{\mu}-\hat{S}\mu\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  where 
 \begin_inset Formula $\mu$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $\mu_{2}$
-\end_inset 
+\end_inset
 
  are assumed known as the mean and variance of the
-\series bold 
+\series bold
  untransformed 
-\series default 
+\series default
 distribution (when 
 \begin_inset Formula $L=0$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $S=1$
-\end_inset 
+\end_inset
 
 ) and 
 \begin_inset Formula \begin{eqnarray*}
 \hat{\mu} & = & \frac{1}{N}\sum_{i=1}^{N}x_{i}=\bar{\mathbf{x}}\\
 \hat{\mu}_{2} & = & \frac{1}{N-1}\sum_{i=1}^{N}\left(x_{i}-\hat{\mu}\right)^{2}=\frac{N}{N-1}\overline{\left(\mathbf{x}-\bar{\mathbf{x}}\right)^{2}}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Subsection
+\end_layout
 
+\begin_layout Subsection
 Standard notation for mean
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 We will use 
 \begin_inset Formula \[
 \overline{y\left(\mathbf{x}\right)}=\frac{1}{N}\sum_{i=1}^{N}y\left(x_{i}\right)\]
 
-\end_inset 
+\end_inset
 
  where 
 \begin_inset Formula $N$
-\end_inset 
+\end_inset
 
  should be clear from context as the number of samples 
 \begin_inset Formula $x_{i}$
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Alpha 
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 One shape parameters 
 \begin_inset Formula $\alpha>0$
-\end_inset 
+\end_inset
 
  (paramter 
 \begin_inset Formula $\beta$
-\end_inset 
+\end_inset
 
  in DATAPLOT is a scale-parameter).
  Standard form is 
 \begin_inset Formula $x>0:$
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x;\alpha\right) & = & \frac{1}{x^{2}\Phi\left(\alpha\right)\sqrt{2\pi}}\exp\left(-\frac{1}{2}\left(\alpha-\frac{1}{x}\right)^{2}\right)\\
 F\left(x;\alpha\right) & = & \frac{\Phi\left(\alpha-\frac{1}{x}\right)}{\Phi\left(\alpha\right)}\\
 G\left(q;\alpha\right) & = & \left[\alpha-\Phi^{-1}\left(q\Phi\left(\alpha\right)\right)\right]^{-1}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 M\left(t\right)=\frac{1}{\Phi\left(a\right)\sqrt{2\pi}}\int_{0}^{\infty}\frac{e^{xt}}{x^{2}}\exp\left(-\frac{1}{2}\left(\alpha-\frac{1}{x}\right)^{2}\right)dx\]
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 No moments?
 \begin_inset Formula \[
 l_{\mathbf{x}}\left(\alpha\right)=N\log\left[\Phi\left(\alpha\right)\sqrt{2\pi}\right]+2N\overline{\log\mathbf{x}}+\frac{N}{2}\alpha^{2}-\alpha\overline{\mathbf{x}^{-1}}+\frac{1}{2}\overline{\mathbf{x}^{-2}}\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Anglit
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Defined over 
 \begin_inset Formula $x\in\left[-\frac{\pi}{4},\frac{\pi}{4}\right]$
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x\right) & = & \sin\left(2x+\frac{\pi}{2}\right)=\cos\left(2x\right)\\
 F\left(x\right) & = & \sin^{2}\left(x+\frac{\pi}{4}\right)\\
 G\left(q\right) & = & \arcsin\left(\sqrt{q}\right)-\frac{\pi}{4}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 \mu & = & 0\\
 \mu_{2} & = & \frac{\pi^{2}}{16}-\frac{1}{2}\\
 \gamma_{1} & = & 0\\
 \gamma_{2} & = & -2\frac{\pi^{4}-96}{\left(\pi^{2}-8\right)^{2}}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
 h\left[X\right] & = & 1-\log2\\
  & \approx & 0.30685281944005469058\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 M\left(t\right) & = & \int_{-\frac{\pi}{4}}^{\frac{\pi}{4}}\cos\left(2x\right)e^{xt}dx\\
  & = & \frac{4\cosh\left(\frac{\pi t}{4}\right)}{t^{2}+4}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 l_{\mathbf{x}}\left(\cdot\right)=-N\overline{\log\left[\cos\left(2\mathbf{x}\right)\right]}\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Arcsine 
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Defined over 
 \begin_inset Formula $x\in\left(0,1\right)$
-\end_inset 
+\end_inset
 
 .
  To get the JKB definition put 
 \begin_inset Formula $x=\frac{u+1}{2}.$
-\end_inset 
+\end_inset
 
  i.e.
  
 \begin_inset Formula $L=-1$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $S=2.$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -1016,20 +1058,20 @@
 F\left(x\right) & = & \frac{2}{\pi}\arcsin\left(\sqrt{x}\right)\\
 G\left(q\right) & = & \sin^{2}\left(\frac{\pi}{2}q\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \[
 M\left(t\right)=E^{t/2}I_{0}\left(\frac{t}{2}\right)\]
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \begin{eqnarray*}
 \mu_{n}^{\prime} & = & \frac{1}{\pi}\int_{0}^{1}dx\, x^{n-1/2}\left(1-x\right)^{-1/2}\\
  & = & \frac{1}{\pi}B\left(\frac{1}{2},n+\frac{1}{2}\right)=\frac{\left(2n-1\right)!!}{2^{n}n!}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -1038,45 +1080,47 @@
 \gamma_{1} & = & 0\\
 \gamma_{2} & = & -\frac{3}{2}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 h\left[X\right]\approx-0.24156447527049044468\]
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 l_{\mathbf{x}}\left(\cdot\right)=N\log\pi+\frac{N}{2}\overline{\log\mathbf{x}}+\frac{N}{2}\overline{\log\left(1-\mathbf{x}\right)}\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Beta 
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Two shape parameters
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 a,b>0\]
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x;a,b\right) & = & \frac{\Gamma\left(a+b\right)}{\Gamma\left(a\right)\Gamma\left(b\right)}x^{a-1}\left(1-x\right)^{b-1}I_{\left(0,1\right)}\left(x\right)\\
 F\left(x;a,b\right) & = & \int_{0}^{x}f\left(y;a,b\right)dy=I\left(x,a,b\right)\\
@@ -1088,66 +1132,68 @@
 \gamma_{2} & = & \frac{6\left(a^{3}+a^{2}\left(1-2b\right)+b^{2}\left(b+1\right)-2ab\left(b+2\right)\right)}{ab\left(a+b+2\right)\left(a+b+3\right)}\\
 m_{d} & = & \frac{\left(a-1\right)}{\left(a+b-2\right)}\, a+b\neq2\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula $f\left(x;a,1\right)$
-\end_inset 
+\end_inset
 
  is also called the Power-function distribution.
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 l_{\mathbf{x}}\left(a,b\right)=-N\log\Gamma\left(a+b\right)+N\log\Gamma\left(a\right)+N\log\Gamma\left(b\right)-N\left(a-1\right)\overline{\log\mathbf{x}}-N\left(b-1\right)\overline{\log\left(1-\mathbf{x}\right)}\]
 
-\end_inset 
+\end_inset
 
  All of the 
 \begin_inset Formula $x_{i}\in\left[0,1\right]$
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Beta Prime
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Defined over 
 \begin_inset Formula $0<x<\infty.$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula $\alpha,\beta>0.$
-\end_inset 
+\end_inset
 
  (Note the CDF evaluation uses Eq.
  3.194.1 on pg.
  313 of Gradshteyn & Ryzhik (sixth edition).
  
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x;\alpha,\beta\right) & = & \frac{\Gamma\left(\alpha+\beta\right)}{\Gamma\left(\alpha\right)\Gamma\left(\beta\right)}x^{\alpha-1}\left(1+x\right)^{-\alpha-\beta}\\
 F\left(x;\alpha,\beta\right) & = & \frac{\Gamma\left(\alpha+\beta\right)}{\alpha\Gamma\left(\alpha\right)\Gamma\left(\beta\right)}x^{\alpha}\,_{2}F_{1}\left(\alpha+\beta,\alpha;1+\alpha;-x\right)\\
 G\left(q;\alpha,\beta\right) & = & F^{-1}\left(x;\alpha,\beta\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 \mu_{n}^{\prime}=\left\{ \begin{array}{ccc}
 \frac{\Gamma\left(n+\alpha\right)\Gamma\left(\beta-n\right)}{\Gamma\left(\alpha\right)\Gamma\left(\beta\right)}=\frac{\left(\alpha\right)_{n}}{\left(\beta-n\right)_{n}} &  & \beta>n\\
 \infty &  & \textrm{otherwise}\end{array}\right.\]
 
-\end_inset 
+\end_inset
 
  Therefore, 
 \begin_inset Formula \begin{eqnarray*}
@@ -1157,20 +1203,21 @@
 \gamma_{2} & = & \frac{\mu_{4}}{\mu_{2}^{2}}-3\\
 \mu_{4} & = & \frac{\alpha\left(\alpha+1\right)\left(\alpha+2\right)\left(\alpha+3\right)}{\left(\beta-4\right)\left(\beta-3\right)\left(\beta-2\right)\left(\beta-1\right)}-4\mu\mu_{3}-6\mu^{2}\mu_{2}-\mu^{4}\quad\beta>4\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
-\layout Section
+\end_layout
 
+\begin_layout Section
 Bradford
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 c & > & 0\\
 k & = & \log\left(1+c\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -1185,37 +1232,38 @@
 m_{d} & = & 0\\
 m_{n} & = & \sqrt{1+c}-1\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  where 
 \begin_inset Formula $\textrm{Ei}\left(\textrm{z}\right)$
-\end_inset 
+\end_inset
 
  is the exponential integral function.
  Also 
 \begin_inset Formula \[
 h\left[X\right]=\frac{1}{2}\log\left(1+c\right)-\log\left(\frac{c}{\log\left(1+c\right)}\right)\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Burr
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 c & > & 0\\
 d & > & 0\\
 k & = & \Gamma\left(d\right)\Gamma\left(1-\frac{2}{c}\right)\Gamma\left(\frac{2}{c}+d\right)-\Gamma^{2}\left(1-\frac{1}{c}\right)\Gamma^{2}\left(\frac{1}{c}+d\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x;c,d\right) & = & \frac{cd}{x^{c+1}\left(1+x^{-c}\right)^{d+1}}I_{\left(0,\infty\right)}\left(x\right)\\
 F\left(x;c,d\right) & = & \left(1+x^{-c}\right)^{-d}\\
@@ -1230,15 +1278,16 @@
 m_{d} & = & \left(\frac{cd-1}{c+1}\right)^{1/c}\,\textrm{if }cd>1\,\textrm{otherwise }0\\
 m_{n} & = & \left(2^{1/d}-1\right)^{-1/c}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Cauchy
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x\right) & = & \frac{1}{\pi\left(1+x^{2}\right)}\\
 F\left(x\right) & = & \frac{1}{2}+\frac{1}{\pi}\tan^{-1}x\\
@@ -1246,7 +1295,7 @@
 m_{d} & = & 0\\
 m_{n} & = & 0\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 No finite moments.
  This is the t distribution with one degree of freedom.
@@ -1255,35 +1304,37 @@
 h\left[X\right] & = & \log\left(4\pi\right)\\
  & \approx & 2.5310242469692907930.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Chi
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Generated by taking the (positive) square-root of chi-squared variates.
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x;\nu\right) & = & \frac{x^{\nu-1}e^{-x^{2}/2}}{2^{\nu/2-1}\Gamma\left(\frac{\nu}{2}\right)}I_{\left(0,\infty\right)}\left(x\right)\\
 F\left(x;\nu\right) & = & \Gamma\left(\frac{\nu}{2},\frac{x^{2}}{2}\right)\\
 G\left(\alpha;\nu\right) & = & \sqrt{2\Gamma^{-1}\left(\frac{\nu}{2},\alpha\right)}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
 M\left(t\right)=\Gamma\left(\frac{v}{2}\right)\,_{1}F_{1}\left(\frac{v}{2};\frac{1}{2};\frac{t^{2}}{2}\right)+\frac{t}{\sqrt{2}}\Gamma\left(\frac{1+\nu}{2}\right)\,_{1}F_{1}\left(\frac{1+\nu}{2};\frac{3}{2};\frac{t^{2}}{2}\right)\]
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 \mu & = & \frac{\sqrt{2}\Gamma\left(\frac{\nu+1}{2}\right)}{\Gamma\left(\frac{\nu}{2}\right)}\\
 \mu_{2} & = & \nu-\mu^{2}\\
@@ -1292,50 +1343,53 @@
 m_{d} & = & \sqrt{\nu-1}\quad\nu\geq1\\
 m_{n} & = & \sqrt{2\Gamma^{-1}\left(\frac{\nu}{2},\frac{1}{2}\right)}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
-\layout Section
+\end_layout
 
+\begin_layout Section
 Chi-squared
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 This is the gamma distribution with 
 \begin_inset Formula $L=0.0$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $S=2.0$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $\alpha=\nu/2$
-\end_inset 
+\end_inset
 
  where 
 \begin_inset Formula $\nu$
-\end_inset 
+\end_inset
 
  is called the degrees of freedom.
  If 
 \begin_inset Formula $Z_{1}\ldots Z_{\nu}$
-\end_inset 
+\end_inset
 
  are all standard normal distributions, then 
 \begin_inset Formula $W=\sum_{k}Z_{k}^{2}$
-\end_inset 
+\end_inset
 
  has (standard) chi-square distribution with 
 \begin_inset Formula $\nu$
-\end_inset 
+\end_inset
 
  degrees of freedom.
  
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 The standard form (most often used in standard form only) is 
 \begin_inset Formula $x>0$
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \begin{eqnarray*}
@@ -1343,13 +1397,13 @@
 F\left(x;\alpha\right) & = & \Gamma\left(\frac{\nu}{2},\frac{x}{2}\right)\\
 G\left(q;\alpha\right) & = & 2\Gamma^{-1}\left(\frac{\nu}{2},q\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
 M\left(t\right)=\frac{\Gamma\left(\frac{\nu}{2}\right)}{\left(\frac{1}{2}-t\right)^{\nu/2}}\]
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -1359,19 +1413,21 @@
 \gamma_{2} & = & \frac{12}{\nu}\\
 m_{d} & = & \frac{\nu}{2}-1\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Cosine
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Approximation to the normal distribution.
  
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x\right) & = & \frac{1}{2\pi}\left[1+\cos x\right]I_{\left[-\pi,\pi\right]}\left(x\right)\\
 F\left(x\right) & = & \frac{1}{2\pi}\left[\pi+x+\sin x\right]I_{\left[-\pi,\pi\right]}\left(x\right)+I_{\left(\pi,\infty\right)}\left(x\right)\\
@@ -1382,33 +1438,35 @@
 \gamma_{1} & = & 0\\
 \gamma_{2} & = & \frac{-6\left(\pi^{4}-90\right)}{5\left(\pi^{2}-6\right)^{2}}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 h\left[X\right] & = & \log\left(4\pi\right)-1\\
  & \approx & 1.5310242469692907930.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Double Gamma
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 The double gamma is the signed version of the Gamma distribution.
  For 
 \begin_inset Formula $\alpha>0:$
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x;\alpha\right) & = & \frac{1}{2\Gamma\left(\alpha\right)}\left|x\right|^{\alpha-1}e^{-\left|x\right|}\\
 F\left(x;\alpha\right) & = & \left\{ \begin{array}{ccc}
@@ -1418,21 +1476,21 @@
 -\Gamma^{-1}\left(\alpha,\left|2q-1\right|\right) &  & q\leq\frac{1}{2}\\
 \Gamma^{-1}\left(\alpha,\left|2q-1\right|\right) &  & q>\frac{1}{2}\end{array}\right.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 M\left(t\right)=\frac{1}{2\left(1-t\right)^{a}}+\frac{1}{2\left(1+t\right)^{a}}\]
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 \mu=m_{n} & = & 0\\
 \mu_{2} & = & \alpha\left(\alpha+1\right)\\
@@ -1440,24 +1498,28 @@
 \gamma_{2} & = & \frac{\left(\alpha+2\right)\left(\alpha+3\right)}{\alpha\left(\alpha+1\right)}-3\\
 m_{d} & = & \textrm{NA}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Doubly Non-central F*
-\layout Section
+\end_layout
 
+\begin_layout Section
 Doubly Non-central t*
-\layout Section
+\end_layout
 
+\begin_layout Section
 Double Weibull
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 This is a signed form of the Weibull distribution.
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x;c\right) & = & \frac{c}{2}\left|x\right|^{c-1}\exp\left(-\left|x\right|^{c}\right)\\
 F\left(x;c\right) & = & \left\{ \begin{array}{ccc}
@@ -1467,7 +1529,7 @@
 -\log^{1/c}\left(\frac{1}{2q}\right) &  & q\leq\frac{1}{2}\\
 \log^{1/c}\left(\frac{1}{2q-1}\right) &  & q>\frac{1}{2}\end{array}\right.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
@@ -1475,7 +1537,7 @@
 \Gamma\left(1+\frac{n}{c}\right) & n\textrm{ even}\\
 0 & n\textrm{ odd}\end{cases}\]
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -1485,34 +1547,38 @@
 \gamma_{2} & = & \frac{\Gamma\left(1+\frac{4}{c}\right)}{\Gamma^{2}\left(1+\frac{2}{c}\right)}\\
 m_{d} & = & \textrm{NA bimodal}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Erlang
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 This is just the Gamma distribution with shape parameter 
 \begin_inset Formula $\alpha=n$
-\end_inset 
+\end_inset
 
  an integer.
  
-\layout Section
+\end_layout
 
+\begin_layout Section
 Exponential
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 This is a special case of the Gamma (and Erlang) distributions with shape
  parameter 
 \begin_inset Formula $\left(\alpha=1\right)$
-\end_inset 
+\end_inset
 
  and the same location and scale parameters.
  The standard form is therefore (
 \begin_inset Formula $x\geq0$
-\end_inset 
+\end_inset
 
 ) 
 \begin_inset Formula \begin{eqnarray*}
@@ -1520,25 +1586,25 @@
 F\left(x\right) & = & \Gamma\left(1,x\right)=1-e^{-x}\\
 G\left(q\right) & = & -\log\left(1-q\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 \mu_{n}^{\prime}=n!\]
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 M\left(t\right)=\frac{1}{1-t}\]
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \begin{eqnarray*}
@@ -1548,31 +1614,33 @@
 \gamma_{2} & = & 6\\
 m_{d} & = & 0\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \[
 h\left[X\right]=1.\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Exponentiated Weibull
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Two positive shape parameters 
 \begin_inset Formula $a$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $c$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $x\in\left(0,\infty\right)$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -1580,22 +1648,24 @@
 F\left(x;a,c\right) & = & \left[1-\exp\left(-x^{c}\right)\right]^{a}\\
 G\left(q;a,c\right) & = & \left[-\log\left(1-q^{1/a}\right)\right]^{1/c}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Exponential Power
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 One positive shape parameter 
 \begin_inset Formula $b$
-\end_inset 
+\end_inset
 
 .
  Defined for 
 \begin_inset Formula $x\geq0.$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -1603,84 +1673,88 @@
 F\left(x;b\right) & = & 1-\exp\left[1-e^{x^{b}}\right]\\
 G\left(q;b\right) & = & \log^{1/b}\left[1-\log\left(1-q\right)\right]\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Fatigue Life (Birnbaum-Sanders)
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 This distribution's pdf is the average of the inverse-Gaussian 
 \begin_inset Formula $\left(\mu=1\right)$
-\end_inset 
+\end_inset
 
  and reciprocal inverse-Gaussian pdf 
 \begin_inset Formula $\left(\mu=1\right)$
-\end_inset 
+\end_inset
 
 .
  We follow the notation of JKB here with 
 \begin_inset Formula $\beta=S.$
-\end_inset 
+\end_inset
 
  for 
 \begin_inset Formula $x>0$
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x;c\right) & = & \frac{x+1}{2c\sqrt{2\pi x^{3}}}\exp\left(-\frac{\left(x-1\right)^{2}}{2xc^{2}}\right)\\
 F\left(x;c\right) & = & \Phi\left(\frac{1}{c}\left(\sqrt{x}-\frac{1}{\sqrt{x}}\right)\right)\\
 G\left(q;c\right) & = & \frac{1}{4}\left[c\Phi^{-1}\left(q\right)+\sqrt{c^{2}\left(\Phi^{-1}\left(q\right)\right)^{2}+4}\right]^{2}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
 M\left(t\right)=c\sqrt{2\pi}\exp\left[\frac{1}{c^{2}}\left(1-\sqrt{1-2c^{2}t}\right)\right]\left(1+\frac{1}{\sqrt{1-2c^{2}t}}\right)\]
 
-\end_inset 
+\end_inset
 
  
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 \mu & = & \frac{c^{2}}{2}+1\\
 \mu_{2} & = & c^{2}\left(\frac{5}{4}c^{2}+1\right)\\
 \gamma_{1} & = & \frac{4c\sqrt{11c^{2}+6}}{\left(5c^{2}+4\right)^{3/2}}\\
 \gamma_{2} & = & \frac{6c^{2}\left(93c^{2}+41\right)}{\left(5c^{2}+4\right)^{2}}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Fisk (Log Logistic)
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Special case of the Burr distribution with 
 \begin_inset Formula $d=1$
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 c & > & 0\\
 k & = & \Gamma\left(1-\frac{2}{c}\right)\Gamma\left(\frac{2}{c}+1\right)-\Gamma^{2}\left(1-\frac{1}{c}\right)\Gamma^{2}\left(\frac{1}{c}+1\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x;c,d\right) & = & \frac{cx^{c-1}}{\left(1+x^{c}\right)^{2}}I_{\left(0,\infty\right)}\left(x\right)\\
 F\left(x;c,d\right) & = & \left(1+x^{-c}\right)^{-1}\\
@@ -1695,45 +1769,47 @@
 m_{d} & = & \left(\frac{c-1}{c+1}\right)^{1/c}\,\textrm{if }c>1\,\textrm{otherwise }0\\
 m_{n} & = & 1\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 h\left[X\right]=2-\log c.\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Folded Cauchy
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 This formula can be expressed in terms of the standard formulas for the
  Cauchy distribution (call the cdf 
 \begin_inset Formula $C\left(x\right)$
-\end_inset 
+\end_inset
 
  and the pdf 
 \begin_inset Formula $d\left(x\right)$
-\end_inset 
+\end_inset
 
 ).
  if 
 \begin_inset Formula $Y$
-\end_inset 
+\end_inset
 
  is cauchy then 
 \begin_inset Formula $\left|Y\right|$
-\end_inset 
+\end_inset
 
  is folded cauchy.
  Note that 
 \begin_inset Formula $x\geq0.$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -1741,54 +1817,57 @@
 F\left(x;c\right) & = & \frac{1}{\pi}\tan^{-1}\left(x-c\right)+\frac{1}{\pi}\tan^{-1}\left(x+c\right)\\
 G\left(q;c\right) & = & F^{-1}\left(x;c\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 No moments
-\layout Section
+\end_layout
 
+\begin_layout Section
 Folded Normal
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 If 
 \begin_inset Formula $Z$
-\end_inset 
+\end_inset
 
  is Normal with mean 
 \begin_inset Formula $L$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $\sigma=S$
-\end_inset 
+\end_inset
 
 , then 
 \begin_inset Formula $\left|Z\right|$
-\end_inset 
+\end_inset
 
  is a folded normal with shape parameter 
 \begin_inset Formula $c=\left|L\right|/S$
-\end_inset 
+\end_inset
 
 , location parameter 
 \begin_inset Formula $0$
-\end_inset 
+\end_inset
 
  and scale parameter 
 \begin_inset Formula $S$
-\end_inset 
+\end_inset
 
 .
  This is a special case of the non-central chi distribution with one-degree
  of freedom and non-centrality parameter 
 \begin_inset Formula $c^{2}.$
-\end_inset 
+\end_inset
 
  Note that 
 \begin_inset Formula $c\geq0$
-\end_inset 
+\end_inset
 
 .
  The standard form of the folded normal is 
@@ -1797,13 +1876,13 @@
 F\left(x;c\right) & = & \Phi\left(x-c\right)-\Phi\left(-x-c\right)=\Phi\left(x-c\right)+\Phi\left(x+c\right)-1\\
 G\left(\alpha;c\right) & = & F^{-1}\left(x;c\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \[
 M\left(t\right)=\exp\left[\frac{t}{2}\left(t-2c\right)\right]\left(1+e^{2ct}\right)\]
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \begin{eqnarray*}
@@ -1814,38 +1893,40 @@
 \gamma_{1} & = & \frac{\sqrt{\frac{2}{\pi}}p^{3}\left(4-\frac{\pi}{p^{2}}\left(2c^{2}+1\right)\right)+2ck\left(6p^{2}+3cpk\sqrt{2\pi}+\pi c\left(k^{2}-1\right)\right)}{\pi\mu_{2}^{3/2}}\\
 \gamma_{2} & = & \frac{c^{4}+6c^{2}+3+6\left(c^{2}+1\right)\mu^{2}-3\mu^{4}-4p\mu\left(\sqrt{\frac{2}{\pi}}\left(c^{2}+2\right)+\frac{ck}{p}\left(c^{2}+3\right)\right)}{\mu_{2}^{2}}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Fratio (or F)
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Defined for 
 \begin_inset Formula $x>0$
-\end_inset 
+\end_inset
 
 .
  The distribution of 
 \begin_inset Formula $\left(X_{1}/X_{2}\right)\left(\nu_{2}/\nu_{1}\right)$
-\end_inset 
+\end_inset
 
  if 
 \begin_inset Formula $X_{1}$
-\end_inset 
+\end_inset
 
  is chi-squared with 
 \begin_inset Formula $v_{1}$
-\end_inset 
+\end_inset
 
  degrees of freedom and 
 \begin_inset Formula $X_{2}$
-\end_inset 
+\end_inset
 
  is chi-squared with 
 \begin_inset Formula $v_{2}$
-\end_inset 
+\end_inset
 
  degrees of freedom.
  
@@ -1854,7 +1935,7 @@
 F\left(x;v_{1},v_{2}\right) & = & I\left(\frac{\nu_{1}}{2},\frac{\nu_{2}}{2},\frac{\nu_{2}x}{\nu_{2}+\nu_{1}x}\right)\\
 G\left(q;\nu_{1},\nu_{2}\right) & = & \left[\frac{\nu_{2}}{I^{-1}\left(\nu_{1}/2,\nu_{2}/2,q\right)}-\frac{\nu_{1}}{\nu_{2}}\right]^{-1}.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \begin{eqnarray*}
@@ -1863,22 +1944,24 @@
 \gamma_{1} & = & \frac{2\left(2\nu_{1}+\nu_{2}-2\right)}{\nu_{2}-6}\sqrt{\frac{2\left(\nu_{2}-4\right)}{\nu_{1}\left(\nu_{1}+\nu_{2}-2\right)}}\quad\nu_{2}>6\\
 \gamma_{2} & = & \frac{3\left[8+\left(\nu_{2}-6\right)\gamma_{1}^{2}\right]}{2\nu-16}\quad\nu_{2}>8\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
-\layout Section
+\end_layout
 
+\begin_layout Section
 Fréchet (ExtremeLB, Extreme Value II, Weibull minimum)
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 A type of extreme-value distribution with a lower bound.
  Defined for 
 \begin_inset Formula $x>0$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $c>0$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -1886,13 +1969,13 @@
 F\left(x;c\right) & = & 1-\exp\left(-x^{c}\right)\\
 G\left(q;c\right) & = & \left[-\log\left(1-q\right)\right]^{1/c}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \[
 \mu_{n}^{\prime}=\Gamma\left(1+\frac{n}{c}\right)\]
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \begin{eqnarray*}
@@ -1903,37 +1986,39 @@
 m_{d} & = & \left(\frac{c}{1+c}\right)^{1/c}\\
 m_{n} & = & G\left(\frac{1}{2};c\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \[
 h\left[X\right]=-\frac{\gamma}{c}-\log\left(c\right)+\gamma+1\]
 
-\end_inset 
+\end_inset
 
  where 
 \begin_inset Formula $\gamma$
-\end_inset 
+\end_inset
 
  is Euler's constant and equal to 
 \begin_inset Formula \[
 \gamma\approx0.57721566490153286061.\]
 
-\end_inset 
+\end_inset
 
  
-\layout Section
+\end_layout
 
+\begin_layout Section
 Fréchet (left-skewed, Extreme Value Type III, Weibull maximum)
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Defined for 
 \begin_inset Formula $x<0$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $c>0$
-\end_inset 
+\end_inset
 
 .
  
@@ -1942,53 +2027,56 @@
 F\left(x;c\right) & = & \exp\left(-\left(-x\right)^{c}\right)\\
 G\left(q;c\right) & = & -\left(-\log q\right)^{1/c}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 The mean is the negative of the right-skewed Frechet distribution given
  above, and the other statistical parameters can be computed from
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 \mu_{n}^{\prime}=\left(-1\right)^{n}\Gamma\left(1+\frac{n}{c}\right).\]
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 h\left[X\right]=-\frac{\gamma}{c}-\log\left(c\right)+\gamma+1\]
 
-\end_inset 
+\end_inset
 
  where 
 \begin_inset Formula $\gamma$
-\end_inset 
+\end_inset
 
  is Euler's constant and equal to 
 \begin_inset Formula \[
 \gamma\approx0.57721566490153286061.\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Gamma
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 The standard form for the gamma distribution is 
 \begin_inset Formula $\left(\alpha>0\right)$
-\end_inset 
+\end_inset
 
  valid for 
 \begin_inset Formula $x\geq0$
-\end_inset 
+\end_inset
 
 .
 \begin_inset Formula \begin{eqnarray*}
@@ -1996,13 +2084,13 @@
 F\left(x;\alpha\right) & = & \Gamma\left(\alpha,x\right)\\
 G\left(q;\alpha\right) & = & \Gamma^{-1}\left(\alpha,q\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
 M\left(t\right)=\frac{1}{\left(1-t\right)^{\alpha}}\]
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -2012,62 +2100,64 @@
 \gamma_{2} & = & \frac{6}{\alpha}\\
 m_{d} & = & \alpha-1\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 h\left[X\right]=\Psi\left(a\right)\left[1-a\right]+a+\log\Gamma\left(a\right)\]
 
-\end_inset 
+\end_inset
 
  where 
 \begin_inset Formula \[
 \Psi\left(a\right)=\frac{\Gamma^{\prime}\left(a\right)}{\Gamma\left(a\right)}.\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Generalized Logistic
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Has been used in the analysis of extreme values.
  Has one shape parameter 
 \begin_inset Formula $c>0.$
-\end_inset 
+\end_inset
 
  And 
 \begin_inset Formula $x>0$
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x;c\right) & = & \frac{c\exp\left(-x\right)}{\left[1+\exp\left(-x\right)\right]^{c+1}}\\
 F\left(x;c\right) & = & \frac{1}{\left[1+\exp\left(-x\right)\right]^{c}}\\
 G\left(q;c\right) & = & -\log\left(q^{-1/c}-1\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 M\left(t\right)=\frac{c}{1-t}\,_{2}F_{1}\left(1+c,\,1-t\,;\,2-t\,;-1\right)\]
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 \mu & = & \gamma+\psi_{0}\left(c\right)\\
 \mu_{2} & = & \frac{\pi^{2}}{6}+\psi_{1}\left(c\right)\\
@@ -2076,7 +2166,7 @@
 m_{d} & = & \log c\\
 m_{n} & = & -\log\left(2^{1/c}-1\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  Note that the polygamma function is 
 \begin_inset Formula \begin{eqnarray*}
@@ -2084,42 +2174,44 @@
  & = & \left(-1\right)^{n+1}n!\sum_{k=0}^{\infty}\frac{1}{\left(z+k\right)^{n+1}}\\
  & = & \left(-1\right)^{n+1}n!\zeta\left(n+1,z\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  where 
 \begin_inset Formula $\zeta\left(k,x\right)$
-\end_inset 
+\end_inset
 
  is a generalization of the Riemann zeta function called the Hurwitz zeta
  function Note that 
 \begin_inset Formula $\zeta\left(n\right)\equiv\zeta\left(n,1\right)$
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Generalized Pareto
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Shape parameter 
 \begin_inset Formula $c\neq0$
-\end_inset 
+\end_inset
 
  and defined for 
 \begin_inset Formula $x\geq0$
-\end_inset 
+\end_inset
 
  for all 
 \begin_inset Formula $c$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $x<\frac{1}{\left|c\right|}$
-\end_inset 
+\end_inset
 
  if 
 \begin_inset Formula $c$
-\end_inset 
+\end_inset
 
  is negative.
  
@@ -2128,29 +2220,29 @@
 F\left(x;c\right) & = & 1-\frac{1}{\left(1+cx\right)^{1/c}}\\
 G\left(q;c\right) & = & \frac{1}{c}\left[\left(\frac{1}{1-q}\right)^{c}-1\right]\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 M\left(t\right)=\left\{ \begin{array}{cc}
 \left(-\frac{t}{c}\right)^{\frac{1}{c}}e^{-\frac{t}{c}}\left[\Gamma\left(1-\frac{1}{c}\right)+\Gamma\left(-\frac{1}{c},-\frac{t}{c}\right)-\pi\csc\left(\frac{\pi}{c}\right)/\Gamma\left(\frac{1}{c}\right)\right] & c>0\\
 \left(\frac{\left|c\right|}{t}\right)^{1/\left|c\right|}\Gamma\left[\frac{1}{\left|c\right|},\frac{t}{\left|c\right|}\right] & c<0\end{array}\right.\]
 
-\end_inset 
+\end_inset
 
  
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 \mu_{n}^{\prime}=\frac{\left(-1\right)^{n}}{c^{n}}\sum_{k=0}^{n}\left(\begin{array}{c}
 n\\
 k\end{array}\right)\frac{\left(-1\right)^{k}}{1-ck}\quad cn<1\]
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -2159,7 +2251,7 @@
 \mu_{3}^{\prime} & = & \frac{6}{\left(1-c\right)\left(1-2c\right)\left(1-3c\right)}\quad c<\frac{1}{3}\\
 \mu_{4}^{\prime} & = & \frac{24}{\left(1-c\right)\left(1-2c\right)\left(1-3c\right)\left(1-4c\right)}\quad c<\frac{1}{4}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  Thus,
 \begin_inset Formula \begin{eqnarray*}
@@ -2168,38 +2260,40 @@
 \gamma_{1} & = & \frac{\mu_{3}^{\prime}-3\mu\mu_{2}-\mu^{3}}{\mu_{2}^{3/2}}\\
 \gamma_{2} & = & \frac{\mu_{4}^{\prime}-4\mu\mu_{3}-6\mu^{2}\mu_{2}-\mu^{4}}{\mu_{2}^{2}}-3\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 h\left[X\right]=1+c\quad c>0\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Generalized Exponential
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Three positive shape parameters for 
 \begin_inset Formula $x\geq0.$
-\end_inset 
+\end_inset
 
  Note that 
 \begin_inset Formula $a,b,$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $c$
-\end_inset 
+\end_inset
 
  are all 
 \begin_inset Formula $>0.$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -2207,29 +2301,32 @@
 F\left(x;a,b,c\right) & = & 1-\exp\left[ax-bx+\frac{b}{c}\left(1-e^{-cx}\right)\right]\\
 G\left(q;a,b,c\right) & = & F^{-1}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Generalized Extreme Value
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Extreme value distributions with shape parameter 
 \begin_inset Formula $c$
-\end_inset 
+\end_inset
 
 .
  
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 For 
 \begin_inset Formula $c>0$
-\end_inset 
+\end_inset
 
  defined on 
 \begin_inset Formula $-\infty<x\leq1/c.$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -2237,7 +2334,7 @@
 F\left(x;c\right) & = & \exp\left[-\left(1-cx\right)^{1/c}\right]\\
 G\left(q;c\right) & = & \frac{1}{c}\left[1-\left(-\log q\right)^{c}\right]\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
@@ -2245,7 +2342,7 @@
 n\\
 k\end{array}\right)\left(-1\right)^{k}\Gamma\left(ck+1\right)\quad cn>-1\]
 
-\end_inset 
+\end_inset
 
  So,
 \begin_inset Formula \begin{eqnarray*}
@@ -2254,19 +2351,19 @@
 \mu_{3}^{\prime} & = & \frac{1}{c^{3}}\left(1-3\Gamma\left(1+c\right)+3\Gamma\left(1+2c\right)-\Gamma\left(1+3c\right)\right)\quad c>-\frac{1}{3}\\
 \mu_{4}^{\prime} & = & \frac{1}{c^{4}}\left(1-4\Gamma\left(1+c\right)+6\Gamma\left(1+2c\right)-4\Gamma\left(1+3c\right)+\Gamma\left(1+4c\right)\right)\quad c>-\frac{1}{4}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  For 
 \begin_inset Formula $c<0$
-\end_inset 
+\end_inset
 
  defined on 
 \begin_inset Formula $\frac{1}{c}\leq x<\infty.$
-\end_inset 
+\end_inset
 
  For 
 \begin_inset Formula $c=0$
-\end_inset 
+\end_inset
 
  defined over all space 
 \begin_inset Formula \begin{eqnarray*}
@@ -2274,7 +2371,7 @@
 F\left(x;0\right) & = & \exp\left[-e^{-x}\right]\\
 G\left(q;0\right) & = & -\log\left(-\log q\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  This is just the (left-skewed) Gumbel distribution for c=0.
  
@@ -2284,30 +2381,32 @@
 \gamma_{1} & = & \frac{12\sqrt{6}}{\pi^{3}}\zeta\left(3\right)\\
 \gamma_{2} & = & \frac{12}{5}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Generalized Gamma
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 A general probability form that reduces to many common distributions: 
 \begin_inset Formula $x>0$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula $a>0$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $c\neq0.$
-\end_inset 
+\end_inset
 
  
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x;a,c\right) & = & \frac{\left|c\right|x^{ca-1}}{\Gamma\left(a\right)}\exp\left(-x^{c}\right)\\
 F\left(x;a,c\right) & = & \begin{array}{cc}
@@ -2316,13 +2415,13 @@
 G\left(q;a,c\right) & = & \left\{ \Gamma^{-1}\left[a,\Gamma\left(a\right)q\right]\right\} ^{1/c}\quad c>0\\
  &  & \left\{ \Gamma^{-1}\left[a,\Gamma\left(a\right)\left(1-q\right)\right]\right\} ^{1/c}\quad c<0\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \[
 \mu_{n}^{\prime}=\frac{\Gamma\left(a+\frac{n}{c}\right)}{\Gamma\left(a\right)}\]
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -2332,47 +2431,49 @@
 \gamma_{2} & = & \frac{\Gamma\left(a+\frac{4}{c}\right)/\Gamma\left(a\right)-4\mu\mu_{3}-6\mu^{2}\mu_{2}-\mu^{4}}{\mu_{2}^{2}}-3\\
 m_{d} & = & \left(\frac{ac-1}{c}\right)^{1/c}.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  Special cases are Weibull 
 \begin_inset Formula $\left(a=1\right)$
-\end_inset 
+\end_inset
 
 , half-normal 
 \begin_inset Formula $\left(a=1/2,c=2\right)$
-\end_inset 
+\end_inset
 
  and ordinary gamma distributions 
 \begin_inset Formula $c=1.$
-\end_inset 
+\end_inset
 
  If 
 \begin_inset Formula $c=-1$
-\end_inset 
+\end_inset
 
  then it is the inverted gamma distribution.
  
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 h\left[X\right]=a-a\Psi\left(a\right)+\frac{1}{c}\Psi\left(a\right)+\log\Gamma\left(a\right)-\log\left|c\right|.\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Generalized Half-Logistic
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 For 
 \begin_inset Formula $x\in\left[0,1/c\right]$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $c>0$
-\end_inset 
+\end_inset
 
  we have 
 \begin_inset Formula \begin{eqnarray*}
@@ -2380,34 +2481,36 @@
 F\left(x;c\right) & = & \frac{1-\left(1-cx\right)^{1/c}}{1+\left(1-cx\right)^{1/c}}\\
 G\left(q;c\right) & = & \frac{1}{c}\left[1-\left(\frac{1-q}{1+q}\right)^{c}\right]\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 h\left[X\right] & = & 2-\left(2c+1\right)\log2.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Gilbrat
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Special case of the log-normal with 
 \begin_inset Formula $\sigma=1$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $S=1.0$
-\end_inset 
+\end_inset
 
  (typically also 
 \begin_inset Formula $L=0.0$
-\end_inset 
+\end_inset
 
 ) 
 \begin_inset Formula \begin{eqnarray*}
@@ -2415,7 +2518,7 @@
 F\left(x;\sigma\right) & = & \Phi\left(\log x\right)=\frac{1}{2}\left[1+\textrm{erf}\left(\frac{\log x}{\sqrt{2}}\right)\right]\\
 G\left(q;\sigma\right) & = & \exp\left\{ \Phi^{-1}\left(q\right)\right\} \end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -2424,58 +2527,60 @@
 \gamma_{1} & = & \sqrt{e-1}\left(2+e\right)\\
 \gamma_{2} & = & e^{4}+2e^{3}+3e^{2}-6\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 h\left[X\right] & = & \log\left(\sqrt{2\pi e}\right)\\
  & \approx & 1.4189385332046727418\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Gompertz (Truncated Gumbel)
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 For 
 \begin_inset Formula $x\geq0$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $c>0$
-\end_inset 
+\end_inset
 
 .
  In JKB the two shape parameters 
 \begin_inset Formula $b,a$
-\end_inset 
+\end_inset
 
  are reduced to the single shape-parameter 
 \begin_inset Formula $c=b/a$
-\end_inset 
+\end_inset
 
 .
  As 
 \begin_inset Formula $a$
-\end_inset 
+\end_inset
 
  is just a scale parameter when 
 \begin_inset Formula $a\neq0$
-\end_inset 
+\end_inset
 
 .
  If 
 \begin_inset Formula $a=0,$
-\end_inset 
+\end_inset
 
  the distribution reduces to the exponential distribution scaled by 
 \begin_inset Formula $1/b.$
-\end_inset 
+\end_inset
 
  Thus, the standard form is given as 
 \begin_inset Formula \begin{eqnarray*}
@@ -2483,45 +2588,47 @@
 F\left(x;c\right) & = & 1-\exp\left[-c\left(e^{x}-1\right)\right]\\
 G\left(q;c\right) & = & \log\left[1-\frac{1}{c}\log\left(1-q\right)\right]\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 h\left[X\right]=1-\log\left(c\right)-e^{c}\textrm{Ei}\left(1,c\right),\]
 
-\end_inset 
+\end_inset
 
 where 
 \begin_inset Formula \[
 \textrm{Ei}\left(n,x\right)=\int_{1}^{\infty}t^{-n}\exp\left(-xt\right)dt\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Gumbel (LogWeibull, Fisher-Tippetts, Type I Extreme Value)
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 One of a clase of extreme value distributions (right-skewed).
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x\right) & = & \exp\left(-\left(x+e^{-x}\right)\right)\\
 F\left(x\right) & = & \exp\left(-e^{-x}\right)\\
 G\left(q\right) & = & -\log\left(-\log\left(q\right)\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
 M\left(t\right)=\Gamma\left(1-t\right)\]
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -2532,80 +2639,83 @@
 m_{d} & = & 0\\
 m_{n} & = & -\log\left(\log2\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 h\left[X\right]\approx1.0608407169541684911\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Gumbel Left-skewed (for minimum order statistic)
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x\right) & = & \exp\left(x-e^{x}\right)\\
 F\left(x\right) & = & 1-\exp\left(-e^{x}\right)\\
 G\left(q\right) & = & \log\left(-\log\left(1-q\right)\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
 M\left(t\right)=\Gamma\left(1+t\right)\]
 
-\end_inset 
+\end_inset
 
  Note, that 
 \begin_inset Formula $\mu$
-\end_inset 
+\end_inset
 
  is negative the mean for the right-skewed distribution.
  Similar for median and mode.
  All other moments are the same.
  
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 h\left[X\right]\approx1.0608407169541684911.\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 HalfCauchy
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 If 
 \begin_inset Formula $Z$
-\end_inset 
+\end_inset
 
  is Hyperbolic Secant distributed then 
 \begin_inset Formula $e^{Z}$
-\end_inset 
+\end_inset
 
  is Half-Cauchy distributed.
  Also, if 
 \begin_inset Formula $W$
-\end_inset 
+\end_inset
 
  is (standard) Cauchy distributed, then 
 \begin_inset Formula $\left|W\right|$
-\end_inset 
+\end_inset
 
  is Half-Cauchy distributed.
  Special case of the Folded Cauchy distribution with 
 \begin_inset Formula $c=0.$
-\end_inset 
+\end_inset
 
  The standard form is 
 \begin_inset Formula \begin{eqnarray*}
@@ -2613,68 +2723,70 @@
 F\left(x\right) & = & \frac{2}{\pi}\arctan\left(x\right)I_{\left[0,\infty\right]}\left(x\right)\\
 G\left(q\right) & = & \tan\left(\frac{\pi}{2}q\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
 M\left(t\right)=\cos t+\frac{2}{\pi}\left[\textrm{Si}\left(t\right)\cos t-\textrm{Ci}\left(\textrm{-}t\right)\sin t\right]\]
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 m_{d} & = & 0\\
 m_{n} & = & \tan\left(\frac{\pi}{4}\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  No moments, as the integrals diverge.
  
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 h\left[X\right] & = & \log\left(2\pi\right)\\
  & \approx & 1.8378770664093454836.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 HalfNormal
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 This is a special case of the chi distribution with 
 \begin_inset Formula $L=a$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $S=b$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $\nu=1.$
-\end_inset 
+\end_inset
 
  This is also a special case of the folded normal with shape parameter 
 \begin_inset Formula $c=0$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $S=S.$
-\end_inset 
+\end_inset
 
  If 
 \begin_inset Formula $Z$
-\end_inset 
+\end_inset
 
  is (standard) normally distributed then, 
 \begin_inset Formula $\left|Z\right|$
-\end_inset 
+\end_inset
 
  is half-normal.
  The standard form is 
@@ -2683,18 +2795,18 @@
 F\left(x\right) & = & 2\Phi\left(x\right)-1\\
 G\left(q\right) & = & \Phi^{-1}\left(\frac{1+q}{2}\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
 M\left(t\right)=\sqrt{2\pi}e^{t^{2}/2}\Phi\left(t\right)\]
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 \mu & = & \sqrt{\frac{2}{\pi}}\\
 \mu_{2} & = & 1-\frac{2}{\pi}\\
@@ -2703,40 +2815,42 @@
 m_{d} & = & 0\\
 m_{n} & = & \Phi^{-1}\left(\frac{3}{4}\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 h\left[X\right] & = & \log\left(\sqrt{\frac{\pi e}{2}}\right)\\
  & \approx & 0.72579135264472743239.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Half-Logistic 
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 In the limit as 
 \begin_inset Formula $c\rightarrow\infty$
-\end_inset 
+\end_inset
 
  for the generalized half-logistic we have the half-logistic defined over
  
 \begin_inset Formula $x\geq0.$
-\end_inset 
+\end_inset
 
  Also, the distribution of 
 \begin_inset Formula $\left|X\right|$
-\end_inset 
+\end_inset
 
  where 
 \begin_inset Formula $X$
-\end_inset 
+\end_inset
 
  has logistic distribtution.
  
@@ -2745,22 +2859,22 @@
 F\left(x\right) & = & \frac{1-e^{-x}}{1+e^{-x}}=\tanh\left(\frac{x}{2}\right)\\
 G\left(q\right) & = & \log\left(\frac{1+q}{1-q}\right)=2\textrm{arctanh}\left(q\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 M\left(t\right)=1-t\psi_{0}\left(\frac{1}{2}-\frac{t}{2}\right)+t\psi_{0}\left(1-\frac{t}{2}\right)\]
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
 \mu_{n}^{\prime}=2\left(1-2^{1-n}\right)n!\zeta\left(n\right)\quad n\neq1\]
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -2769,28 +2883,30 @@
 \mu_{3}^{\prime} & = & 9\zeta\left(3\right)\\
 \mu_{4}^{\prime} & = & 42\zeta\left(4\right)=\frac{7\pi^{4}}{15}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 h\left[X\right] & = & 2-\log\left(2\right)\\
  & \approx & 1.3068528194400546906.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Hyperbolic Secant
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Related to the logistic distribution and used in lifetime analysis.
  Standard form is (defined over all 
 \begin_inset Formula $x$
-\end_inset 
+\end_inset
 
 )
 \begin_inset Formula \begin{eqnarray*}
@@ -2798,13 +2914,13 @@
 F\left(x\right) & = & \frac{2}{\pi}\arctan\left(e^{x}\right)\\
 G\left(q\right) & = & \log\left(\tan\left(\frac{\pi}{2}q\right)\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \[
 M\left(t\right)=\sec\left(\frac{\pi}{2}t\right)\]
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \begin{eqnarray*}
@@ -2813,30 +2929,30 @@
 0 & n\textrm{ odd}\\
 C_{n/2}\frac{\pi^{n}}{2^{n}} & n\textrm{ even}\end{array}\right.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  where 
 \begin_inset Formula $C_{m}$
-\end_inset 
+\end_inset
 
  is an integer given by 
 \begin_inset Formula \begin{eqnarray*}
 C_{m} & = & \frac{\left(2m\right)!\left[\zeta\left(2m+1,\frac{1}{4}\right)-\zeta\left(2m+1,\frac{3}{4}\right)\right]}{\pi^{2m+1}2^{2m}}\\
  & = & 4\left(-1\right)^{m-1}\frac{16^{m}}{2m+1}B_{2m+1}\left(\frac{1}{4}\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 where 
 \begin_inset Formula $B_{2m+1}\left(\frac{1}{4}\right)$
-\end_inset 
+\end_inset
 
  is the Bernoulli polynomial of order 
 \begin_inset Formula $2m+1$
-\end_inset 
+\end_inset
 
  evaluated at 
 \begin_inset Formula $1/4.$
-\end_inset 
+\end_inset
 
  Thus 
 \begin_inset Formula \[
@@ -2844,90 +2960,93 @@
 0 & n\textrm{ odd}\\
 4\left(-1\right)^{n/2-1}\frac{\left(2\pi\right)^{n}}{n+1}B_{n+1}\left(\frac{1}{4}\right) & n\textrm{ even}\end{array}\right.\]
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 m_{d}=m_{n}=\mu & = & 0\\
 \mu_{2} & = & \frac{\pi^{2}}{4}\\
 \gamma_{1} & = & 0\\
 \gamma_{2} & = & 2\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 h\left[X\right]=\log\left(2\pi\right).\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Gauss Hypergeometric 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula $x\in\left[0,1\right]$
-\end_inset 
+\end_inset
 
 , 
 \begin_inset Formula $\alpha>0,\,\beta>0$
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
 C^{-1}=B\left(\alpha,\beta\right)\,_{2}F_{1}\left(\gamma,\alpha;\alpha+\beta;-z\right)\]
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \begin{eqnarray*}
 f\left(x;\alpha,\beta,\gamma,z\right) & = & Cx^{\alpha-1}\frac{\left(1-x\right)^{\beta-1}}{\left(1+zx\right)^{\gamma}}\\
 \mu_{n}^{\prime} & = & \frac{B\left(n+\alpha,\beta\right)}{B\left(\alpha,\beta\right)}\frac{\,_{2}F_{1}\left(\gamma,\alpha+n;\alpha+\beta+n;-z\right)}{\,_{2}F_{1}\left(\gamma,\alpha;\alpha+\beta;-z\right)}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Inverted Gamma
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Special case of the generalized Gamma distribution with 
 \begin_inset Formula $c=-1$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $a>0$
-\end_inset 
+\end_inset
 
 , 
 \begin_inset Formula $x>0$
-\end_inset 
+\end_inset
 
  
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x;a\right) & = & \frac{x^{-a-1}}{\Gamma\left(a\right)}\exp\left(-\frac{1}{x}\right)\\
 F\left(x;a\right) & = & \frac{\Gamma\left(a,\frac{1}{x}\right)}{\Gamma\left(a\right)}\\
 G\left(q;a\right) & = & \left\{ \Gamma^{-1}\left[a,\Gamma\left(a\right)q\right]\right\} ^{-1}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \[
 \mu_{n}^{\prime}=\frac{\Gamma\left(a-n\right)}{\Gamma\left(a\right)}\quad a>n\]
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -2936,54 +3055,56 @@
 \gamma_{1} & = & \frac{\frac{1}{\left(a-3\right)\left(a-2\right)\left(a-1\right)}-3\mu\mu_{2}-\mu^{3}}{\mu_{2}^{3/2}}\\
 \gamma_{2} & = & \frac{\frac{1}{\left(a-4\right)\left(a-3\right)\left(a-2\right)\left(a-1\right)}-4\mu\mu_{3}-6\mu^{2}\mu_{2}-\mu^{4}}{\mu_{2}^{2}}-3\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
 m_{d}=\frac{1}{a+1}\]
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 h\left[X\right]=a-\left(a+1\right)\Psi\left(a\right)+\log\Gamma\left(a\right).\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Inverse Normal (Inverse Gaussian)
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 The standard form involves the shape parameter 
 \begin_inset Formula $\mu$
-\end_inset 
+\end_inset
 
  (in most definitions, 
 \begin_inset Formula $L=0.0$
-\end_inset 
+\end_inset
 
  is used).
  (In terms of the regress documentation 
 \begin_inset Formula $\mu=A/B$
-\end_inset 
+\end_inset
 
 ) and 
 \begin_inset Formula $B=S$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $L$
-\end_inset 
+\end_inset
 
  is not a parameter in that distribution.
  A standard form is 
 \begin_inset Formula $x>0$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -2991,12 +3112,12 @@
 F\left(x;\mu\right) & = & \Phi\left(\frac{1}{\sqrt{x}}\frac{x-\mu}{\mu}\right)+\exp\left(\frac{2}{\mu}\right)\Phi\left(-\frac{1}{\sqrt{x}}\frac{x+\mu}{\mu}\right)\\
 G\left(q;\mu\right) & = & F^{-1}\left(q;\mu\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 \mu & = & \mu\\
 \mu_{2} & = & \mu^{3}\\
@@ -3004,80 +3125,83 @@
 \gamma_{2} & = & 15\mu\\
 m_{d} & = & \frac{\mu}{2}\left(\sqrt{9\mu^{2}+4}-3\mu\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 This is related to the canonical form or JKB 
 \begin_inset Quotes eld
-\end_inset 
+\end_inset
 
 two-parameter
 \begin_inset Quotes erd
-\end_inset 
+\end_inset
 
  inverse Gaussian when written in it's full form with scale parameter 
 \begin_inset Formula $S$
-\end_inset 
+\end_inset
 
  and location parameter 
 \begin_inset Formula $L$
-\end_inset 
+\end_inset
 
  by taking 
 \begin_inset Formula $L=0$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $S\equiv\lambda,$
-\end_inset 
+\end_inset
 
  then 
 \begin_inset Formula $\mu S$
-\end_inset 
+\end_inset
 
  is equal to 
 \begin_inset Formula $\mu_{2}$
-\end_inset 
+\end_inset
 
  where
-\bar under 
+\bar under
  
-\bar default 
+\bar default
 
 \begin_inset Formula $\mu_{2}$
-\end_inset 
+\end_inset
 
  is the parameter used by JKB.
  We prefer this form because of it's consistent use of the scale parameter.
  Notice that in JKB the skew 
 \begin_inset Formula $\left(\sqrt{\beta_{1}}\right)$
-\end_inset 
+\end_inset
 
  and the kurtosis (
 \begin_inset Formula $\beta_{2}-3$
-\end_inset 
+\end_inset
 
 ) are both functions only of 
 \begin_inset Formula $\mu_{2}/\lambda=\mu S/S=\mu$
-\end_inset 
+\end_inset
 
  as shown here, while the variance and mean of the standard form here are
  transformed appropriately.
  
-\layout Section
+\end_layout
 
+\begin_layout Section
 Inverted Weibull
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Shape parameter 
 \begin_inset Formula $c>0$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $x>0$
-\end_inset 
+\end_inset
 
 .
  Then 
@@ -3086,35 +3210,37 @@
 F\left(x;c\right) & = & \exp\left(-x^{-c}\right)\\
 G\left(q;c\right) & = & \left(-\log q\right)^{-1/c}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
 h\left[X\right]=1+\gamma+\frac{\gamma}{c}-\log\left(c\right)\]
 
-\end_inset 
+\end_inset
 
  where 
 \begin_inset Formula $\gamma$
-\end_inset 
+\end_inset
 
  is Euler's constant.
-\layout Section
+\end_layout
 
+\begin_layout Section
 Johnson SB
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Defined for 
 \begin_inset Formula $x\in\left(0,1\right)$
-\end_inset 
+\end_inset
 
  with two shape parameters 
 \begin_inset Formula $a$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $b>0.$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -3122,25 +3248,27 @@
 F\left(x;a,b\right) & = & \Phi\left(a+b\log\frac{x}{1-x}\right)\\
 G\left(q;a,b\right) & = & \frac{1}{1+\exp\left[-\frac{1}{b}\left(\Phi^{-1}\left(q\right)-a\right)\right]}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Johnson SU
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Defined for all 
 \begin_inset Formula $x$
-\end_inset 
+\end_inset
 
  with two shape parameters 
 \begin_inset Formula $a$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $b>0$
-\end_inset 
+\end_inset
 
 .
  
@@ -3149,21 +3277,24 @@
 F\left(x;a,b\right) & = & \Phi\left(a+b\log\left(x+\sqrt{x^{2}+1}\right)\right)\\
 G\left(q;a,b\right) & = & \sinh\left[\frac{\Phi^{-1}\left(q\right)-a}{b}\right]\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 KSone
-\layout Section
+\end_layout
 
+\begin_layout Section
 KStwo
-\layout Section
+\end_layout
 
+\begin_layout Section
 Laplace (Double Exponential, Bilateral Expoooonential)
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x\right) & = & \frac{1}{2}e^{-\left|x\right|}\\
 F\left(x\right) & = & \left\{ \begin{array}{ccc}
@@ -3173,7 +3304,7 @@
 \log\left(2q\right) &  & q\leq\frac{1}{2}\\
 -\log\left(2-2q\right) &  & q>\frac{1}{2}\end{array}\right.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -3182,95 +3313,98 @@
 \gamma_{1} & = & 0\\
 \gamma_{2} & = & 3\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 The ML estimator of the location parameter is 
 \begin_inset Formula \[
 \hat{L}=\textrm{median}\left(X_{i}\right)\]
 
-\end_inset 
+\end_inset
 
  where 
 \begin_inset Formula $X_{i}$
-\end_inset 
+\end_inset
 
  is a sequence of 
 \begin_inset Formula $N$
-\end_inset 
+\end_inset
 
  mutually independent Laplace RV's and the median is some number between
  the 
 \begin_inset Formula $\frac{1}{2}N\textrm{th}$
-\end_inset 
+\end_inset
 
  and the 
 \begin_inset Formula $(N/2+1)\textrm{th}$
-\end_inset 
+\end_inset
 
  order statistic (
-\emph on 
+\emph on
 e.g.
 
-\emph default 
+\emph default
  take the average of these two) when 
 \begin_inset Formula $N$
-\end_inset 
+\end_inset
 
  is even.
  Also, 
 \begin_inset Formula \[
 \hat{S}=\frac{1}{N}\sum_{j=1}^{N}\left|X_{j}-\hat{L}\right|.\]
 
-\end_inset 
+\end_inset
 
  Replace 
 \begin_inset Formula $\hat{L}$
-\end_inset 
+\end_inset
 
  with 
 \begin_inset Formula $L$
-\end_inset 
+\end_inset
 
  if it is known.
  If 
 \begin_inset Formula $L$
-\end_inset 
+\end_inset
 
  is known then this estimator is distributed as 
 \begin_inset Formula $\left(2N\right)^{-1}S\cdot\chi_{2N}^{2}$
-\end_inset 
+\end_inset
 
 .
  
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 h\left[X\right] & = & \log\left(2e\right)\\
  & \approx & 1.6931471805599453094.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Left-skewed Lévy
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Special case of Lévy-stable distribution with 
 \begin_inset Formula $\alpha=\frac{1}{2}$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $\beta=-1$
-\end_inset 
+\end_inset
 
  the support is 
 \begin_inset Formula $x<0$
-\end_inset 
+\end_inset
 
 .
  In standard form
@@ -3279,26 +3413,28 @@
 F\left(x\right) & = & 2\Phi\left(\frac{1}{\sqrt{\left|x\right|}}\right)-1\\
 G\left(q\right) & = & -\left[\Phi^{-1}\left(\frac{q+1}{2}\right)\right]^{-2}.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 No moments.
-\layout Section
+\end_layout
 
+\begin_layout Section
 Lévy
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 A special case of Lévy-stable distributions with 
 \begin_inset Formula $\alpha=\frac{1}{2}$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $\beta=1$
-\end_inset 
+\end_inset
 
 .
  In standard form it is defined for 
 \begin_inset Formula $x>0$
-\end_inset 
+\end_inset
 
  as 
 \begin_inset Formula \begin{eqnarray*}
@@ -3306,37 +3442,39 @@
 F\left(x\right) & = & 2\left[1-\Phi\left(\frac{1}{\sqrt{x}}\right)\right]\\
 G\left(q\right) & = & \left[\Phi^{-1}\left(1-\frac{q}{2}\right)\right]^{-2}.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  It has no finite moments.
-\layout Section
+\end_layout
 
+\begin_layout Section
 Logistic (Sech-squared)
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 A special case of the Generalized Logistic distribution with 
 \begin_inset Formula $c=1.$
-\end_inset 
+\end_inset
 
  Defined for 
 \begin_inset Formula $x>0$
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x\right) & = & \frac{\exp\left(-x\right)}{\left[1+\exp\left(-x\right)\right]^{2}}\\
 F\left(x\right) & = & \frac{1}{1+\exp\left(-x\right)}\\
 G\left(q\right) & = & -\log\left(1/q-1\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 \mu & = & \gamma+\psi_{0}\left(1\right)=0\\
 \mu_{2} & = & \frac{\pi^{2}}{6}+\psi_{1}\left(1\right)=\frac{\pi^{2}}{3}\\
@@ -3345,30 +3483,32 @@
 m_{d} & = & \log1=0\\
 m_{n} & = & -\log\left(2-1\right)=0\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 h\left[X\right]=1.\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Log Double Exponential (Log-Laplace)
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Defined over 
 \begin_inset Formula $x>0$
-\end_inset 
+\end_inset
 
  with 
 \begin_inset Formula $c>0$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -3382,30 +3522,32 @@
 \left(2q\right)^{1/c} &  & 0\leq q<\frac{1}{2}\\
 \left(2-2q\right)^{-1/c} &  & \frac{1}{2}\leq q\leq1\end{array}\right.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 h\left[X\right]=\log\left(\frac{2e}{c}\right)\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Log Gamma
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 A single shape parameter 
 \begin_inset Formula $c>0$
-\end_inset 
+\end_inset
 
  (Defined for all 
 \begin_inset Formula $x$
-\end_inset 
+\end_inset
 
 ) 
 \begin_inset Formula \begin{eqnarray*}
@@ -3413,13 +3555,13 @@
 F\left(x;c\right) & = & \frac{\Gamma\left(c,e^{x}\right)}{\Gamma\left(c\right)}\\
 G\left(q;c\right) & = & \log\left[\Gamma^{-1}\left[c,q\Gamma\left(c\right)\right]\right]\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \[
 \mu_{n}^{\prime}=\int_{0}^{\infty}\left[\log y\right]^{n}y^{c-1}\exp\left(-y\right)dy.\]
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \begin{eqnarray*}
@@ -3428,43 +3570,45 @@
 \gamma_{1} & = & \frac{\mu_{3}^{\prime}-3\mu\mu_{2}-\mu^{3}}{\mu_{2}^{3/2}}\\
 \gamma_{2} & = & \frac{\mu_{4}^{\prime}-4\mu\mu_{3}-6\mu^{2}\mu_{2}-\mu^{4}}{\mu_{2}^{2}}-3\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Log Normal (Cobb-Douglass)
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Has one shape parameter 
 \begin_inset Formula $\sigma$
-\end_inset 
+\end_inset
 
 >0.
  (Notice that the 
 \begin_inset Quotes eld
-\end_inset 
+\end_inset
 
 Regress
 \begin_inset Quotes erd
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula $A=\log S$
-\end_inset 
+\end_inset
 
  where 
 \begin_inset Formula $S$
-\end_inset 
+\end_inset
 
  is the scale parameter and 
 \begin_inset Formula $A$
-\end_inset 
+\end_inset
 
  is the mean of the underlying normal distribution).
  The standard form is 
 \begin_inset Formula $x>0$
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \begin{eqnarray*}
@@ -3472,7 +3616,7 @@
 F\left(x;\sigma\right) & = & \Phi\left(\frac{\log x}{\sigma}\right)\\
 G\left(q;\sigma\right) & = & \exp\left\{ \sigma\Phi^{-1}\left(q\right)\right\} \end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -3481,45 +3625,80 @@
 \gamma_{1} & = & \sqrt{p-1}\left(2+p\right)\\
 \gamma_{2} & = & p^{4}+2p^{3}+3p^{2}-6\quad\quad p=e^{\sigma^{2}}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
   
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Notice that using JKB notation we have 
 \begin_inset Formula $\theta=L,$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula $\zeta=\log S$
-\end_inset 
+\end_inset
 
  and we have given the so-called antilognormal form of the distribution.
  This is more consistent with the location, scale parameter description
  of general probability distributions.
  
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 h\left[X\right]=\frac{1}{2}\left[1+\log\left(2\pi\right)+2\log\left(\sigma\right)\right].\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Standard
+Also, note that if 
+\begin_inset Formula $X$
+\end_inset
+
+ is a log-normally distributed random-variable with 
+\begin_inset Formula $L=0$
+\end_inset
+
+ and 
+\begin_inset Formula $S$
+\end_inset
+
+ and shape parameter 
+\begin_inset Formula $\sigma.$
+\end_inset
+
+ Then, 
+\begin_inset Formula $\log X$
+\end_inset
+
+ is normally distributed with variance 
+\begin_inset Formula $\sigma^{2}$
+\end_inset
+
+ and mean 
+\begin_inset Formula $\log S.$
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
 Nakagami
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Generalization of the chi distribution.
  Shape parameter is 
 \begin_inset Formula $\nu>0.$
-\end_inset 
+\end_inset
 
  Defined for 
 \begin_inset Formula $x>0.$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -3527,7 +3706,7 @@
 F\left(x;\nu\right) & = & \Gamma\left(\nu,\nu x^{2}\right)\\
 G\left(q;\nu\right) & = & \sqrt{\frac{1}{\nu}\Gamma^{-1}\left(v,q\right)}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -3536,70 +3715,75 @@
 \gamma_{1} & = & \frac{\mu\left(1-4v\mu_{2}\right)}{2\nu\mu_{2}^{3/2}}\\
 \gamma_{2} & = & \frac{-6\mu^{4}\nu+\left(8\nu-2\right)\mu^{2}-2\nu+1}{\nu\mu_{2}^{2}}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Noncentral beta*
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Defined over 
 \begin_inset Formula $x\in\left[0,1\right]$
-\end_inset 
+\end_inset
 
  with 
 \begin_inset Formula $a>0$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $b>0$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $c\geq0$
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 F\left(x;a,b,c\right)=\sum_{j=0}^{\infty}\frac{e^{-c/2}\left(\frac{c}{2}\right)^{j}}{j!}I_{B}\left(a+j,b;0\right)\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Noncentral chi*
-\layout Section
+\end_layout
 
+\begin_layout Section
 Noncentral chi-squared
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 The distribution of 
 \begin_inset Formula $\sum_{i=1}^{\nu}\left(Z_{i}+\delta_{i}\right)^{2}$
-\end_inset 
+\end_inset
 
  where 
 \begin_inset Formula $Z_{i}$
-\end_inset 
+\end_inset
 
  are independent standard normal variables and 
 \begin_inset Formula $\delta_{i}$
-\end_inset 
+\end_inset
 
  are constants.
  
 \begin_inset Formula $\lambda=\sum_{i=1}^{\nu}\delta_{i}^{2}>0.$
-\end_inset 
+\end_inset
 
  (In communications it is called the Marcum-Q function).
  Can be thought of as a Generalized Rayleigh-Rice distribution.
  For 
 \begin_inset Formula $x>0$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -3607,7 +3791,7 @@
 F\left(x;\nu,\lambda\right) & = & \sum_{j=0}^{\infty}\left\{ \frac{\left(\lambda/2\right)^{j}}{j!}e^{-\lambda/2}\right\} \textrm{Pr}\left[\chi_{\nu+2j}^{2}\leq x\right]\\
 G\left(q;\nu,\lambda\right) & = & F^{-1}\left(x;\nu,\lambda\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \begin{eqnarray*}
@@ -3616,68 +3800,72 @@
 \gamma_{1} & = & \frac{\sqrt{8}\left(\nu+3\lambda\right)}{\left(\nu+2\lambda\right)^{3/2}}\\
 \gamma_{2} & = & \frac{12\left(\nu+4\lambda\right)}{\left(\nu+2\lambda\right)^{2}}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Noncentral F
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Let 
 \begin_inset Formula $\lambda>0$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $\nu_{1}>0$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $\nu_{2}>0.$
-\end_inset 
+\end_inset
 
  
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x;\lambda,\nu_{1},\nu_{2}\right) & = & \exp\left[\frac{\lambda}{2}+\frac{\left(\lambda\nu_{1}x\right)}{2\left(\nu_{1}x+\nu_{2}\right)}\right]\nu_{1}^{\nu_{1}/2}\nu_{2}^{\nu_{2}/2}x^{\nu_{1}/2-1}\\
  &  & \times\left(\nu_{2}+\nu_{1}x\right)^{-\left(\nu_{1}+\nu_{2}\right)/2}\frac{\Gamma\left(\frac{\nu_{1}}{2}\right)\Gamma\left(1+\frac{\nu_{2}}{2}\right)L_{\nu_{2}/2}^{\nu_{1}/2-1}\left(-\frac{\lambda\nu_{1}x}{2\left(\nu_{1}x+\nu_{2}\right)}\right)}{B\left(\frac{\nu_{1}}{2},\frac{\nu_{2}}{2}\right)\Gamma\left(\frac{\nu_{1}+\nu_{2}}{2}\right)}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Noncentral t
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 The distribution of the ratio 
 \begin_inset Formula \[
 \frac{U+\lambda}{\chi_{\nu}/\sqrt{\nu}}\]
 
-\end_inset 
+\end_inset
 
  where 
 \begin_inset Formula $U$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $\chi_{\nu}$
-\end_inset 
+\end_inset
 
  are independent and distributed as a standard normal and chi with 
 \begin_inset Formula $\nu$
-\end_inset 
+\end_inset
 
  degrees of freedom.
  Note 
 \begin_inset Formula $\lambda>0$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $\nu>0$
-\end_inset 
+\end_inset
 
 .
  
@@ -3689,77 +3877,81 @@
  &  & \times\left(\frac{\nu}{\nu+x^{2}}\right)^{\left(\nu-1\right)/2}Hh_{\nu}\left(-\frac{\lambda x}{\sqrt{\nu+x^{2}}}\right)\\
 F\left(x;\lambda,\nu\right) & =\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Normal
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x\right) & = & \frac{e^{-x^{2}/2}}{\sqrt{2\pi}}\\
 F\left(x\right) & = & \Phi\left(x\right)=\frac{1}{2}+\frac{1}{2}\textrm{erf}\left(\frac{\textrm{x}}{\sqrt{2}}\right)\\
 G\left(q\right) & = & \Phi^{-1}\left(q\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
-\align center 
+\end_layout
 
+\begin_layout Standard
+\align center
 \begin_inset Formula \begin{eqnarray*}
 m_{d}=m_{n}=\mu & = & 0\\
 \mu_{2} & = & 1\\
 \gamma_{1} & = & 0\\
 \gamma_{2} & = & 0\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 h\left[X\right] & = & \log\left(\sqrt{2\pi e}\right)\\
  & \approx & 1.4189385332046727418\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Maxwell
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 This is a special case of the Chi distribution with 
 \begin_inset Formula $L=0$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $S=S=\frac{1}{\sqrt{a}}$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $\nu=3.$
-\end_inset 
+\end_inset
 
  
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x\right) & = & \sqrt{\frac{2}{\pi}}x^{2}e^{-x^{2}/2}I_{\left(0,\infty\right)}\left(x\right)\\
 F\left(x\right) & = & \Gamma\left(\frac{3}{2},\frac{x^{2}}{2}\right)\\
 G\left(\alpha\right) & = & \sqrt{2\Gamma^{-1}\left(\frac{3}{2},\alpha\right)}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 \mu & = & 2\sqrt{\frac{2}{\pi}}\\
 \mu_{2} & = & 3-\frac{8}{\pi}\\
@@ -3768,37 +3960,39 @@
 m_{d} & = & \sqrt{2}\\
 m_{n} & = & \sqrt{2\Gamma^{-1}\left(\frac{3}{2},\frac{1}{2}\right)}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
 h\left[X\right]=\log\left(\sqrt{\frac{2\pi}{e}}\right)+\gamma.\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Mielke's Beta-Kappa
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 A generalized F distribution.
  Two shape parameters 
 \begin_inset Formula $\kappa$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $\theta$
-\end_inset 
+\end_inset
 
 , and 
 \begin_inset Formula $x>0$
-\end_inset 
+\end_inset
 
 .
  The 
 \begin_inset Formula $\beta$
-\end_inset 
+\end_inset
 
  in the DATAPLOT reference is a scale parameter.
 \begin_inset Formula \begin{eqnarray*}
@@ -3806,107 +4000,112 @@
 F\left(x;\kappa,\theta\right) & = & \frac{x^{\kappa}}{\left(1+x^{\theta}\right)^{\kappa/\theta}}\\
 G\left(q;\kappa,\theta\right) & = & \left(\frac{q^{\theta/\kappa}}{1-q^{\theta/\kappa}}\right)^{1/\theta}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Pareto
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 For 
 \begin_inset Formula $x\geq1$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $b>0$
-\end_inset 
+\end_inset
 
 .
  Standard form is 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x;b\right) & = & \frac{b}{x^{b+1}}\\
 F\left(x;b\right) & = & 1-\frac{1}{x^{b}}\\
 G\left(q;b\right) & = & \left(1-q\right)^{-1/b}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 \mu & = & \frac{b}{b-1}\quad b>1\\
 \mu_{2} & = & \frac{b}{\left(b-2\right)\left(b-1\right)^{2}}\quad b>2\\
 \gamma_{1} & = & \frac{2\left(b+1\right)\sqrt{b-2}}{\left(b-3\right)\sqrt{b}}\quad b>3\\
 \gamma_{2} & = & \frac{6\left(b^{3}+b^{2}-6b-2\right)}{b\left(b^{2}-7b+12\right)}\quad b>4\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 h\left(X\right)=\frac{1}{c}+1-\log\left(c\right)\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Pareto Second Kind (Lomax)
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula $c>0.$
-\end_inset 
+\end_inset
 
  This is Pareto of the first kind with 
 \begin_inset Formula $L=-1.0$
-\end_inset 
+\end_inset
 
  so 
 \begin_inset Formula $x\geq0$
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x;c\right) & = & \frac{c}{\left(1+x\right)^{c+1}}\\
 F\left(x;c\right) & = & 1-\frac{1}{\left(1+x\right)^{c}}\\
 G\left(q;c\right) & = & \left(1-q\right)^{-1/c}-1\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
 h\left[X\right]=\frac{1}{c}+1-\log\left(c\right).\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Power Log Normal
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 A generalization of the log-normal distribution 
 \begin_inset Formula $\sigma>0$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $c>0$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $x>0$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -3914,13 +4113,13 @@
 F\left(x;\sigma,c\right) & = & 1-\left(\Phi\left(-\frac{\log x}{\sigma}\right)\right)^{c}\\
 G\left(q;\sigma,c\right) & = & \exp\left[-\sigma\Phi^{-1}\left[\left(1-q\right)^{1/c}\right]\right]\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \[
 \mu_{n}^{\prime}=\int_{0}^{1}\exp\left[-n\sigma\Phi^{-1}\left(y^{1/c}\right)\right]dy\]
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \begin{eqnarray*}
@@ -3929,21 +4128,23 @@
 \gamma_{1} & = & \frac{\mu_{3}^{\prime}-3\mu\mu_{2}-\mu^{3}}{\mu_{2}^{3/2}}\\
 \gamma_{2} & = & \frac{\mu_{4}^{\prime}-4\mu\mu_{3}-6\mu^{2}\mu_{2}-\mu^{4}}{\mu_{2}^{2}}-3\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  This distribution reduces to the log-normal distribution when 
 \begin_inset Formula $c=1.$
-\end_inset 
+\end_inset
 
  
-\layout Section
+\end_layout
 
+\begin_layout Section
 Power Normal
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 A generalization of the normal distribution, 
 \begin_inset Formula $c>0$
-\end_inset 
+\end_inset
 
  for 
 \begin_inset Formula \begin{eqnarray*}
@@ -3951,13 +4152,13 @@
 F\left(x;c\right) & = & 1-\left(\Phi\left(-x\right)\right)^{c}\\
 G\left(q;c\right) & = & -\Phi^{-1}\left[\left(1-q\right)^{1/c}\right]\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \[
 \mu_{n}^{\prime}=\left(-1\right)^{n}\int_{0}^{1}\left[\Phi^{-1}\left(y^{1/c}\right)\right]^{n}dy\]
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -3966,40 +4167,42 @@
 \gamma_{1} & = & \frac{\mu_{3}^{\prime}-3\mu\mu_{2}-\mu^{3}}{\mu_{2}^{3/2}}\\
 \gamma_{2} & = & \frac{\mu_{4}^{\prime}-4\mu\mu_{3}-6\mu^{2}\mu_{2}-\mu^{4}}{\mu_{2}^{2}}-3\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 For 
 \begin_inset Formula $c=1$
-\end_inset 
+\end_inset
 
  this reduces to the normal distribution.
  
-\layout Section
+\end_layout
 
+\begin_layout Section
 Power-function 
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 A special case of the beta distribution with 
 \begin_inset Formula $b=1$
-\end_inset 
+\end_inset
 
 : defined for 
 \begin_inset Formula $x\in\left[0,1\right]$
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 a>0\]
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x;a\right) & = & ax^{a-1}\\
 F\left(x;a\right) & = & x^{a}\\
@@ -4010,63 +4213,67 @@
 \gamma_{2} & = & \frac{6\left(a^{3}-a^{2}-6a+2\right)}{a\left(a+3\right)\left(a+4\right)}\\
 m_{d} & = & 1\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
 h\left[X\right]=1-\frac{1}{a}-\log\left(a\right)\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 R-distribution
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 A general-purpose distribution with a variety of shapes controlled by 
 \begin_inset Formula $c>0.$
-\end_inset 
+\end_inset
 
  Range of standard distribution is 
 \begin_inset Formula $x\in\left[-1,1\right]$
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \begin{eqnarray*}
 f\left(x;c\right) & = & \frac{\left(1-x^{2}\right)^{c/2-1}}{B\left(\frac{1}{2},\frac{c}{2}\right)}\\
 F\left(x;c\right) & = & \frac{1}{2}+\frac{x}{B\left(\frac{1}{2},\frac{c}{2}\right)}\,_{2}F_{1}\left(\frac{1}{2},1-\frac{c}{2};\frac{3}{2};x^{2}\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
 \mu_{n}^{\prime}=\frac{\left(1+\left(-1\right)^{n}\right)}{2}B\left(\frac{n+1}{2},\frac{c}{2}\right)\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Rayleigh 
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 This is Chi distribution with 
 \begin_inset Formula $L=0.0$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $\nu=2$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $S=S$
-\end_inset 
+\end_inset
 
  (no location parameter is generally used), the mode of the distribution
  is 
 \begin_inset Formula $S.$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -4074,7 +4281,7 @@
 F\left(r\right) & = & 1-e^{-r^{2}/2}I_{[0,\infty)}\left(x\right)\\
 G\left(q\right) & = & \sqrt{-2\log\left(1-q\right)}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -4085,69 +4292,73 @@
 m_{d} & = & 1\\
 m_{n} & = & \sqrt{2\log\left(2\right)}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \[
 h\left[X\right]=\frac{\gamma}{2}+\log\left(\frac{e}{\sqrt{2}}\right).\]
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 \mu_{n}^{\prime}=\sqrt{2^{n}}\Gamma\left(\frac{n}{2}+1\right)\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Rice*
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Defined for 
 \begin_inset Formula $x>0$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $b>0$
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x;b\right) & = & x\exp\left(-\frac{x^{2}+b^{2}}{2}\right)I_{0}\left(xb\right)\\
 F\left(x;b\right) & = & \int_{0}^{x}\alpha\exp\left(-\frac{\alpha^{2}+b^{2}}{2}\right)I_{0}\left(\alpha b\right)d\alpha\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 \mu_{n}^{\prime}=\sqrt{2^{n}}\Gamma\left(1+\frac{n}{2}\right)\,_{1}F_{1}\left(-\frac{n}{2};1;-\frac{b^{2}}{2}\right)\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Reciprocal
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Shape parameters 
 \begin_inset Formula $a,b>0$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula $x\in\left[a,b\right]$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -4155,7 +4366,7 @@
 F\left(x;a,b\right) & = & \frac{\log\left(x/a\right)}{\log\left(b/a\right)}\\
 G\left(q;a,b\right) & = & a\exp\left(q\log\left(b/a\right)\right)=a\left(\frac{b}{a}\right)^{q}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -4167,58 +4378,62 @@
 m_{d} & = & a\\
 m_{n} & = & \sqrt{ab}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
 h\left[X\right]=\frac{1}{2}\log\left(ab\right)+\log\left[\log\left(\frac{b}{a}\right)\right].\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Reciprocal Inverse Gaussian 
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 The pdf is found from the inverse gaussian (IG), 
 \begin_inset Formula $f_{RIG}\left(x;\mu\right)=\frac{1}{x^{2}}f_{IG}\left(\frac{1}{x};\mu\right)$
-\end_inset 
+\end_inset
 
  defined for 
 \begin_inset Formula $x\geq0$
-\end_inset 
+\end_inset
 
  as 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f_{IG}\left(x;\mu\right) & = & \frac{1}{\sqrt{2\pi x^{3}}}\exp\left(-\frac{\left(x-\mu\right)^{2}}{2x\mu^{2}}\right).\\
 F_{IG}\left(x;\mu\right) & = & \Phi\left(\frac{1}{\sqrt{x}}\frac{x-\mu}{\mu}\right)+\exp\left(\frac{2}{\mu}\right)\Phi\left(-\frac{1}{\sqrt{x}}\frac{x+\mu}{\mu}\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f_{RIG}\left(x;\mu\right) & = & \frac{1}{\sqrt{2\pi x}}\exp\left(-\frac{\left(1-\mu x\right)^{2}}{2x\mu^{2}}\right)\\
 F_{RIG}\left(x;\mu\right) & = & 1-F_{IG}\left(\frac{1}{x},\mu\right)\\
  & = & 1-\Phi\left(\frac{1}{\sqrt{x}}\frac{1-\mu x}{\mu}\right)-\exp\left(\frac{2}{\mu}\right)\Phi\left(-\frac{1}{\sqrt{x}}\frac{1+\mu x}{\mu}\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Semicircular
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Defined on 
 \begin_inset Formula $x\in\left[-1,1\right]$
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \begin{eqnarray*}
@@ -4226,7 +4441,7 @@
 F\left(x\right) & = & \frac{1}{2}+\frac{1}{\pi}\left[x\sqrt{1-x^{2}}+\arcsin x\right]\\
 G\left(q\right) & = & F^{-1}\left(q\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -4235,39 +4450,42 @@
 \gamma_{1} & = & 0\\
 \gamma_{2} & = & -1\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
 h\left[X\right]=0.64472988584940017414.\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Studentized Range*
-\layout Section
+\end_layout
 
+\begin_layout Section
 Student t
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Shape parameter 
 \begin_inset Formula $\nu>0.$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula $I\left(a,b,x\right)$
-\end_inset 
+\end_inset
 
  is the incomplete beta integral and 
 \begin_inset Formula $I^{-1}\left(a,b,I\left(a,b,x\right)\right)=x$
-\end_inset 
+\end_inset
 
  
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x;\nu\right) & = & \frac{\Gamma\left(\frac{\nu+1}{2}\right)}{\sqrt{\pi\nu}\Gamma\left(\frac{\nu}{2}\right)\left[1+\frac{x^{2}}{\nu}\right]^{\frac{\nu+1}{2}}}\\
 F\left(x;\nu\right) & = & \left\{ \begin{array}{ccc}
@@ -4277,50 +4495,52 @@
 -\sqrt{\frac{\nu}{I^{-1}\left(\frac{\nu}{2},\frac{1}{2},2q\right)}-\nu} &  & q\leq\frac{1}{2}\\
 \sqrt{\frac{\nu}{I^{-1}\left(\frac{\nu}{2},\frac{1}{2},2-2q\right)}-\nu} &  & q\geq\frac{1}{2}\end{array}\right.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 m_{n}=m_{d}=\mu & = & 0\\
 \mu_{2} & = & \frac{\nu}{\nu-2}\quad\nu>2\\
 \gamma_{1} & = & 0\quad\nu>3\\
 \gamma_{2} & = & \frac{6}{\nu-4}\quad\nu>4\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  As 
 \begin_inset Formula $\nu\rightarrow\infty,$
-\end_inset 
+\end_inset
 
  this distribution approaches the standard normal distribution.
  
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 h\left[X\right]=\frac{1}{4}\log\left(\frac{\pi c\Gamma^{2}\left(\frac{c}{2}\right)}{\Gamma^{2}\left(\frac{c+1}{2}\right)}\right)-\frac{\left(c+1\right)}{4}\left[\Psi\left(\frac{c}{2}\right)-cZ\left(c\right)+\pi\tan\left(\frac{\pi c}{2}\right)+\gamma+2\log2\right]\]
 
-\end_inset 
+\end_inset
 
 where 
 \begin_inset Formula \[
 Z\left(c\right)=\,_{3}F_{2}\left(1,1,1+\frac{c}{2};\frac{3}{2},2;1\right)=\sum_{k=0}^{\infty}\frac{k!}{k+1}\frac{\Gamma\left(\frac{c}{2}+1+k\right)}{\Gamma\left(\frac{c}{2}+1\right)}\frac{\Gamma\left(\frac{3}{2}\right)}{\Gamma\left(\frac{3}{2}+k\right)}\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Student Z
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 The student Z distriubtion is defined over all space with one shape parameter
  
 \begin_inset Formula $\nu>0$
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \begin{eqnarray*}
@@ -4330,7 +4550,7 @@
 1-Q\left(x;\nu\right) &  & x\geq0\end{array}\right.\\
 Q\left(x;\nu\right) & = & \frac{\left|x\right|^{1-n}\Gamma\left(\frac{n}{2}\right)\,_{2}F_{1}\left(\frac{n-1}{2},\frac{n}{2};\frac{n+1}{2};-\frac{1}{x^{2}}\right)}{2\sqrt{\pi}\Gamma\left(\frac{n+1}{2}\right)}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 Interesting moments are 
 \begin_inset Formula \begin{eqnarray*}
@@ -4339,26 +4559,29 @@
 \gamma_{1} & = & 0\\
 \gamma_{2} & = & \frac{6}{\nu-5}.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  The moment generating function is 
 \begin_inset Formula \[
 \theta\left(t\right)=2\sqrt{\left|\frac{t}{2}\right|^{\nu-1}}\frac{K_{\left(n-1\right)/2}\left(\left|t\right|\right)}{\Gamma\left(\frac{\nu-1}{2}\right)}.\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Symmetric Power*
-\layout Section
+\end_layout
 
+\begin_layout Section
 Triangular
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 One shape parameter 
 \begin_inset Formula $c\in[0,1]$
-\end_inset 
+\end_inset
 
  giving the distance to the peak as a percentage of the total extent of
  the non-zero portion.
@@ -4366,7 +4589,7 @@
 meter is the width of the non-zero portion.
  In standard form we have 
 \begin_inset Formula $x\in\left[0,1\right].$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -4380,7 +4603,7 @@
 \sqrt{cq} &  & q<c\\
 1-\sqrt{\left(1-c\right)\left(1-q\right)} &  & q\geq c\end{array}\right.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \begin{eqnarray*}
@@ -4389,24 +4612,26 @@
 \gamma_{1} & = & \frac{\sqrt{2}\left(2c-1\right)\left(c+1\right)\left(c-2\right)}{5\left(1-c+c^{2}\right)^{3/2}}\\
 \gamma_{2} & = & -\frac{3}{5}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
 h\left(X\right) & = & \log\left(\frac{1}{2}\sqrt{e}\right)\\
  & \approx & -0.19314718055994530942.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Truncated Exponential
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 This is an exponential distribution defined only over a certain region 
 \begin_inset Formula $0<x<B$
-\end_inset 
+\end_inset
 
 .
  In standard form this is 
@@ -4415,55 +4640,57 @@
 F\left(x;B\right) & = & \frac{1-e^{-x}}{1-e^{-B}}\\
 G\left(q;B\right) & = & -\log\left(1-q+qe^{-B}\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
 \mu_{n}^{\prime}=\Gamma\left(1+n\right)-\Gamma\left(1+n,B\right)\]
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \[
 h\left[X\right]=\log\left(e^{B}-1\right)+\frac{1+e^{B}\left(B-1\right)}{1-e^{B}}.\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Truncated Normal
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 A normal distribution restricted to lie within a certain range given by
  two parameters 
 \begin_inset Formula $A$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $B$
-\end_inset 
+\end_inset
 
 .
  Notice that this 
 \begin_inset Formula $A$
-\end_inset 
+\end_inset
 
  and 
 \begin_inset Formula $B$
-\end_inset 
+\end_inset
 
  correspond to the bounds on 
 \begin_inset Formula $x$
-\end_inset 
+\end_inset
 
  in standard form.
  For 
 \begin_inset Formula $x\in\left[A,B\right]$
-\end_inset 
+\end_inset
 
  we get 
 \begin_inset Formula \begin{eqnarray*}
@@ -4471,35 +4698,36 @@
 F\left(x;A,B\right) & = & \frac{\Phi\left(x\right)-\Phi\left(A\right)}{\Phi\left(B\right)-\Phi\left(A\right)}\\
 G\left(q;A,B\right) & = & \Phi^{-1}\left[q\Phi\left(B\right)+\Phi\left(A\right)\left(1-q\right)\right]\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  where 
 \begin_inset Formula \begin{eqnarray*}
 \phi\left(x\right) & = & \frac{1}{\sqrt{2\pi}}e^{-x^{2}/2}\\
 \Phi\left(x\right) & = & \int_{-\infty}^{x}\phi\left(u\right)du.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
 \mu & = & \frac{\phi\left(A\right)-\phi\left(B\right)}{\Phi\left(B\right)-\Phi\left(A\right)}\\
 \mu_{2} & = & 1+\frac{A\phi\left(A\right)-B\phi\left(B\right)}{\Phi\left(B\right)-\Phi\left(A\right)}-\left(\frac{\phi\left(A\right)-\phi\left(B\right)}{\Phi\left(B\right)-\Phi\left(A\right)}\right)^{2}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Tukey-Lambda
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x;\lambda\right) & = & F^{\prime}\left(x;\lambda\right)=\frac{1}{G^{\prime}\left(F\left(x;\lambda\right);\lambda\right)}=\frac{1}{F^{\lambda-1}\left(x;\lambda\right)+\left[1-F\left(x;\lambda\right)\right]^{\lambda-1}}\\
 F\left(x;\lambda\right) & = & G^{-1}\left(x;\lambda\right)\\
 G\left(p;\lambda\right) & = & \frac{p^{\lambda}-\left(1-p\right)^{\lambda}}{\lambda}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -4511,50 +4739,52 @@
 \mu_{4} & = & \frac{3\Gamma\left(\lambda\right)\Gamma\left(\lambda+\frac{1}{2}\right)2^{-2\lambda}}{\lambda^{3}\Gamma\left(2\lambda+\frac{3}{2}\right)}+\frac{2}{\lambda^{4}\left(1+4\lambda\right)}\\
  &  & -\frac{2\sqrt{3}\Gamma\left(\lambda\right)2^{-6\lambda}3^{3\lambda}\Gamma\left(\lambda+\frac{1}{3}\right)\Gamma\left(\lambda+\frac{2}{3}\right)}{\lambda^{3}\Gamma\left(2\lambda+\frac{3}{2}\right)\Gamma\left(\lambda+\frac{1}{2}\right)}.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  Notice that the 
 \begin_inset Formula $\lim_{\lambda\rightarrow0}G\left(p;\lambda\right)=\log\left(p/\left(1-p\right)\right)$
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 h\left[X\right] & = & \int_{0}^{1}\log\left[G^{\prime}\left(p\right)\right]dp\\
  & = & \int_{0}^{1}\log\left[p^{\lambda-1}+\left(1-p\right)^{\lambda-1}\right]dp.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Uniform
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Standard form 
 \begin_inset Formula $x\in\left(0,1\right).$
-\end_inset 
+\end_inset
 
  In general form, the lower limit is 
 \begin_inset Formula $L,$
-\end_inset 
+\end_inset
 
  the upper limit is 
 \begin_inset Formula $S+L.$
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x\right) & = & 1\\
 F\left(x\right) & = & x\\
 G\left(q\right) & = & q\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \begin{eqnarray*}
@@ -4563,45 +4793,47 @@
 \gamma_{1} & = & 0\\
 \gamma_{2} & = & -\frac{6}{5}\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
 h\left[X\right]=0\]
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Von Mises
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Defined for 
 \begin_inset Formula $x\in\left[-\pi,\pi\right]$
-\end_inset 
+\end_inset
 
  with shape parameter 
 \begin_inset Formula $b>0$
-\end_inset 
+\end_inset
 
 .
  Note, the PDF and CDF functions are periodic and are always defined over
  
 \begin_inset Formula $x\in\left[-\pi,\pi\right]$
-\end_inset 
+\end_inset
 
  regardless of the location parameter.
  Thus, if an input beyond this range is given, it is converted to the equivalent
  angle in this range.
  For values of 
 \begin_inset Formula $b<100$
-\end_inset 
+\end_inset
 
  the PDF and CDF formulas below are used.
  Otherwise, a normal approximation with variance 
 \begin_inset Formula $1/b$
-\end_inset 
+\end_inset
 
  is used.
  
@@ -4610,51 +4842,53 @@
 F\left(x;b\right) & = & \frac{1}{2}+\frac{x}{2\pi}+\sum_{k=1}^{\infty}\frac{I_{k}\left(b\right)\sin\left(kx\right)}{I_{0}\left(b\right)\pi k}\\
 G\left(q;b\right) & = & F^{-1}\left(x;b\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 \mu & = & 0\\
 \mu_{2} & = & \int_{-\pi}^{\pi}x^{2}f\left(x;b\right)dx\\
 \gamma_{1} & = & 0\\
 \gamma_{2} & = & \frac{\int_{-\pi}^{\pi}x^{4}f\left(x;b\right)dx}{\mu_{2}^{2}}-3\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
  This can be used for defining circular variance.
  
-\layout Section
+\end_layout
 
+\begin_layout Section
 Wald 
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 Special case of the Inverse Normal with shape parameter set to 
 \begin_inset Formula $1.0$
-\end_inset 
+\end_inset
 
 .
  Defined for 
 \begin_inset Formula $x>0$
-\end_inset 
+\end_inset
 
 .
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 f\left(x\right) & = & \frac{1}{\sqrt{2\pi x^{3}}}\exp\left(-\frac{\left(x-1\right)^{2}}{2x}\right).\\
 F\left(x\right) & = & \Phi\left(\frac{x-1}{\sqrt{x}}\right)+\exp\left(2\right)\Phi\left(-\frac{x+1}{\sqrt{x}}\right)\\
 G\left(q;\mu\right) & = & F^{-1}\left(q;\mu\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Standard
+\end_layout
 
-
+\begin_layout Standard
 \begin_inset Formula \begin{eqnarray*}
 \mu & = & 1\\
 \mu_{2} & = & 1\\
@@ -4662,24 +4896,27 @@
 \gamma_{2} & = & 15\\
 m_{d} & = & \frac{1}{2}\left(\sqrt{13}-3\right)\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
-\layout Section
+\end_layout
 
+\begin_layout Section
 Wishart*
-\layout Section
+\end_layout
 
+\begin_layout Section
 Wrapped Cauchy
-\layout Standard
+\end_layout
 
+\begin_layout Standard
 For 
 \begin_inset Formula $x\in\left[0,2\pi\right]$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula $c\in\left(0,1\right)$
-\end_inset 
+\end_inset
 
  
 \begin_inset Formula \begin{eqnarray*}
@@ -4693,19 +4930,22 @@
 r_{c}\left(q\right) &  & 0\leq q<\frac{1}{2}\\
 2\pi-r_{c}\left(1-q\right) &  & \frac{1}{2}\leq q\leq1\end{array}\right.\end{eqnarray*}
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
 \]
 
-\end_inset 
+\end_inset
 
 
 \begin_inset Formula \[
 h\left[X\right]=\log\left(2\pi\left(1-c^{2}\right)\right).\]
 
-\end_inset 
+\end_inset
 
  
-\the_end
+\end_layout
+
+\end_body
+\end_document

Modified: branches/refactor_fft/scipy/stats/distributions.py
===================================================================
--- branches/refactor_fft/scipy/stats/distributions.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/stats/distributions.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -21,6 +21,7 @@
 from numpy import flatnonzero as nonzero
 from scipy.special import gammaln as gamln
 from copy import copy
+import vonmises_cython
 
 __all__ = [
            'rv_continuous',
@@ -478,6 +479,8 @@
         goodargs = argsreduce(cond, *((x,)+args+(scale,)))
         scale, goodargs = goodargs[-1], goodargs[:-1]
         place(output,cond,self._pdf(*goodargs) / scale)
+        if output.ndim == 0:
+            return output[()]
         return output
 
     def cdf(self,x,*args,**kwds):
@@ -507,6 +510,8 @@
         place(output,cond2,1.0)
         goodargs = argsreduce(cond, *((x,)+args))
         place(output,cond,self._cdf(*goodargs))
+        if output.ndim == 0:
+            return output[()]
         return output
 
     def sf(self,x,*args,**kwds):
@@ -536,6 +541,8 @@
         place(output,cond2,1.0)
         goodargs = argsreduce(cond, *((x,)+args))
         place(output,cond,self._sf(*goodargs))
+        if output.ndim == 0:
+            return output[()]        
         return output
 
     def ppf(self,q,*args,**kwds):
@@ -565,6 +572,8 @@
         goodargs = argsreduce(cond, *((q,)+args+(scale,loc)))
         scale, loc, goodargs = goodargs[-2], goodargs[-1], goodargs[:-2]
         place(output,cond,self._ppf(*goodargs)*scale + loc)
+        if output.ndim == 0:
+            return output[()]        
         return output
 
     def isf(self,q,*args,**kwds):
@@ -594,6 +603,8 @@
         goodargs = argsreduce(cond, *((1.0-q,)+args+(scale,loc)))
         scale, loc, goodargs = goodargs[-2], goodargs[-1], goodargs[:-2]
         place(output,cond,self._ppf(*goodargs)*scale + loc)
+        if output.ndim == 0:
+            return output[()]
         return output
 
     def stats(self,*args,**kwds):
@@ -768,7 +779,7 @@
         return optimize.fmin(self.nnlf,x0,args=(ravel(data),),disp=0)
 
     def est_loc_scale(self, data, *args):
-        mu, mu2, g1, g2 = self.stats(*args,**{'moments':'mv'})
+        mu, mu2 = self.stats(*args,**{'moments':'mv'})
         muhat = st.nanmean(data)
         mu2hat = st.nanstd(data)
         Shat = sqrt(mu2hat / mu2)
@@ -2270,7 +2281,6 @@
 
 ## Log-Laplace  (Log Double Exponential)
 ##
-
 class loglaplace_gen(rv_continuous):
     def _pdf(self, x, c):
         cd2 = c/2.0
@@ -2326,6 +2336,10 @@
 
 lognorm.pdf(x,s) = 1/(s*x*sqrt(2*pi)) * exp(-1/2*(log(x)/s)**2)
 for x > 0, s > 0.
+
+If log x is normally distributed with mean mu and variance sigma**2,
+then x is log-normally distributed with shape paramter sigma and scale
+parameter exp(mu).
 """
                       )
 
@@ -3066,48 +3080,14 @@
 
 eps = numpy.finfo(float).eps
 
+
 class vonmises_gen(rv_continuous):
     def _rvs(self, b):
         return mtrand.vonmises(0.0, b, size=self._size)
     def _pdf(self, x, b):
-        x = arr(angle(exp(1j*x)))
-        Px = where(b < 100, exp(b*cos(x)) / (2*pi*special.i0(b)),
-                   norm.pdf(x, 0.0, sqrt(1.0/b)))
-        return Px
+        return exp(b*cos(x)) / (2*pi*special.i0(b))
     def _cdf(self, x, b):
-        x = arr(angle(exp(1j*x)))
-        eps2 = sqrt(eps)
-
-        c_xsimple = atleast_1d((b==0)&(x==x))
-        c_xiter = atleast_1d((b<100)&(b > 0)&(x==x))
-        c_xnormal = atleast_1d((b>=100)&(x==x))
-        c_bad = atleast_1d((b<=0) | (x != x))
-
-        indxiter = nonzero(c_xiter)
-        xiter = take(x, indxiter, 0)
-
-        vals = ones(len(c_xsimple),float)
-        putmask(vals, c_bad, nan)
-        putmask(vals, c_xsimple, x / 2.0/pi)
-        st = sqrt(b-0.5)
-        st = where(isnan(st),0.0,st)
-        putmask(vals, c_xnormal, norm.cdf(x, scale=st))
-
-        biter = take(atleast_1d(b)*(x==x), indxiter, 0)
-        if len(xiter) > 0:
-            fac = special.i0(biter)
-            x2 = xiter
-            val = x2 / 2.0/ pi
-            for j in range(1,501):
-                trm1 = special.iv(j,biter)/j/fac
-                trm2 = sin(j*x2)/pi
-                val += trm1*trm2
-                if all(trm1 < eps2):
-                    break
-            if (j == 500):
-                print "Warning: did not converge..."
-            put(vals, indxiter, val)
-        return vals + 0.5
+        return vonmises_cython.von_mises_cdf(b,x)
     def _stats(self, b):
         return 0, None, 0, None
 vonmises = vonmises_gen(name='vonmises', longname="A Von Mises",
@@ -3536,6 +3516,8 @@
         place(output,(1-cond0)*(cond1==cond1),self.badvalue)
         goodargs = argsreduce(cond, *((k,)+args))
         place(output,cond,self._pmf(*goodargs))
+        if output.ndim == 0:
+            return output[()]        
         return output
 
     def cdf(self, k, *args, **kwds):
@@ -3564,6 +3546,8 @@
         place(output,cond2*(cond0==cond0), 1.0)
         goodargs = argsreduce(cond, *((k,)+args))
         place(output,cond,self._cdf(*goodargs))
+        if output.ndim == 0:
+            return output[()]        
         return output
 
     def sf(self,k,*args,**kwds):
@@ -3592,6 +3576,8 @@
         place(output,cond2,1.0)
         goodargs = argsreduce(cond, *((k,)+args))
         place(output,cond,self._sf(*goodargs))
+        if output.ndim == 0:
+            return output[()]        
         return output
 
     def ppf(self,q,*args,**kwds):
@@ -3620,6 +3606,8 @@
         goodargs = argsreduce(cond, *((q,)+args+(loc,)))
         loc, goodargs = goodargs[-1], goodargs[:-1]
         place(output,cond,self._ppf(*goodargs) + loc)
+        if output.ndim == 0:
+            return output[()]        
         return output
 
     def isf(self,q,*args,**kwds):
@@ -3649,6 +3637,8 @@
         goodargs = argsreduce(cond, *((q,)+args+(loc,)))
         loc, goodargs = goodargs[-1], goodargs[:-1]
         place(output,cond,self._ppf(*goodargs) + loc)
+        if output.ndim == 0:
+            return output[()]        
         return output
 
     def stats(self, *args, **kwds):

Modified: branches/refactor_fft/scipy/stats/mmorestats.py
===================================================================
--- branches/refactor_fft/scipy/stats/mmorestats.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/stats/mmorestats.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -18,20 +18,16 @@
            'trimmed_mean_ci',]
 
 import numpy as np
-from numpy import bool_, float_, int_, ndarray, array as narray
+from numpy import float_, int_, ndarray
 
 import numpy.ma as ma
-from numpy.ma import masked, nomask, MaskedArray
-#from numpy.ma.extras import apply_along_axis, dot, median
+from numpy.ma import MaskedArray
 
 import scipy.stats.mstats as mstats
-#from numpy.ma.mstats import trim_both, trimmed_stde, mquantiles, stde_median
 
 from scipy.stats.distributions import norm, beta, t, binom
-from scipy.stats.morestats import find_repeats
 
 
-
 #####--------------------------------------------------------------------------
 #---- --- Quantiles ---
 #####--------------------------------------------------------------------------

Modified: branches/refactor_fft/scipy/stats/morestats.py
===================================================================
--- branches/refactor_fft/scipy/stats/morestats.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/stats/morestats.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -5,13 +5,12 @@
 import statlib
 import stats
 import distributions
-import inspect
 from numpy import isscalar, r_, log, sum, around, unique, asarray
 from numpy import zeros, arange, sort, amin, amax, any, where, \
-     array, atleast_1d, sqrt, ceil, floor, array, poly1d, compress, not_equal, \
+     atleast_1d, sqrt, ceil, floor, array, poly1d, compress, not_equal, \
      pi, exp, ravel, angle
 import scipy
-import numpy
+import numpy as np
 import types
 import scipy.optimize as optimize
 import scipy.special as special
@@ -785,7 +784,7 @@
     Returns pval -- Probability that null test is rejected for this set
                     of x and n even though it is true.
     """
-    x = atleast_1d(x).astype(numpy.integer)
+    x = atleast_1d(x).astype(np.integer)
     if len(x) == 2:
         n = x[1]+x[0]
         x = x[0]
@@ -793,7 +792,7 @@
         x = x[0]
         if n is None or n < x:
             raise ValueError, "n must be >= x"
-        n = numpy.int_(n)
+        n = np.int_(n)
     else:
         raise ValueError, "Incorrect length for x."
 

Modified: branches/refactor_fft/scipy/stats/mstats.py
===================================================================
--- branches/refactor_fft/scipy/stats/mstats.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/stats/mstats.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -256,15 +256,24 @@
     def _mode1D(a):
         (rep,cnt) = find_repeats(a)
         if not cnt.ndim:
-            return (0,0)
+            return (0, 0)
         elif cnt.size:
             return (rep[cnt.argmax()], cnt.max())
         return (a[0], 1)
     #
     if axis is None:
         output = _mode1D(ma.ravel(a))
+        output = (ma.array(output[0]), ma.array(output[1]))
     else:
         output = ma.apply_along_axis(_mode1D, axis, a)
+        newshape = list(a.shape)
+        newshape[axis] = 1
+        slices = [slice(None)] * output.ndim
+        slices[axis] = 0
+        modes = output[tuple(slices)].reshape(newshape)
+        slices[axis] = 1
+        counts = output[tuple(slices)].reshape(newshape)
+        output = (modes, counts)
     return output
 mode.__doc__ = stats.mode.__doc__
 

Modified: branches/refactor_fft/scipy/stats/setup.py
===================================================================
--- branches/refactor_fft/scipy/stats/setup.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/stats/setup.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -2,6 +2,7 @@
 
 from os.path import join
 
+
 def configuration(parent_package='',top_path=None):
     from numpy.distutils.misc_util import Configuration
     config = Configuration('stats', parent_package, top_path)
@@ -18,6 +19,11 @@
         libraries=['statlib'],
     )
 
+    # add vonmises_cython module
+    config.add_extension('vonmises_cython',
+        sources=['vonmises_cython.c'], # FIXME: use cython source
+    )
+
     # add futil module
     config.add_extension('futil',
         sources=['futil.f'],

Modified: branches/refactor_fft/scipy/stats/stats.py
===================================================================
--- branches/refactor_fft/scipy/stats/stats.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/stats/stats.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -404,6 +404,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("""\
+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)
 
@@ -475,6 +482,13 @@
     The median of each remaining axis, or of all of the values in the array
     if axis is None.
     """
+    warnings.warn("""\
+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)
     a, axis = _chk_asarray(a, axis)
     if axis != 0:
         a = np.rollaxis(a, axis, 0)
@@ -1185,13 +1199,19 @@
     sd = samplestd(instack,axis)
     return np.where(sd == 0, 0, m/sd)
 
-
 def var(a, axis=0, bias=False):
     """
 Returns the estimated population variance of the values in 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("""\
+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=1).""", DeprecationWarning)
     a, axis = _chk_asarray(a, axis)
     mn = np.expand_dims(mean(a,axis),axis)
     deviations = a - mn
@@ -1208,6 +1228,13 @@
 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("""\
+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
+    - 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)
     return np.sqrt(var(a,axis,bias))
 
 
@@ -1360,6 +1387,12 @@
     If rowvar is False, then each row is a variable with
     observations in the columns.
     """
+    warnings.warn("""\
+scipy.stats.cov is deprecated; please update your code to use numpy.cov.
+Please note that:
+    - numpy.cov rowvar argument defaults to true, not false
+    - numpy.cov bias argument defaults to false, not true
+""", DeprecationWarning)
     m = asarray(m)
     if y is None:
         y = m
@@ -1390,6 +1423,12 @@
     If rowvar is True, then each row is a variables with
     observations in the columns.
     """
+    warnings.warn("""\
+scipy.stats.corrcoef is deprecated; please update your code to use numpy.corrcoef.
+Please note that:
+    - numpy.corrcoef rowvar argument defaults to true, not false
+    - numpy.corrcoef bias argument defaults to false, not true
+""", DeprecationWarning)
     if y is not None:
         x = np.transpose([x,y])
         y = None

Modified: branches/refactor_fft/scipy/stats/tests/test_distributions.py
===================================================================
--- branches/refactor_fft/scipy/stats/tests/test_distributions.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/stats/tests/test_distributions.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -33,7 +33,8 @@
          'halflogistic','fatiguelife','foldnorm','ncx2','t','nct',
          'weibull_min','weibull_max','dweibull','maxwell','rayleigh',
          'genlogistic', 'logistic','gumbel_l','gumbel_r','gompertz',
-         'hypsecant', 'laplace', 'reciprocal','triang','tukeylambda']
+         'hypsecant', 'laplace', 'reciprocal','triang','tukeylambda',
+         'vonmises']
 
 # check function for test generator
 def check_distribution(dist, args, alpha):
@@ -63,6 +64,9 @@
             vals = rand(nargs)
             vals[1] = vals[0] + 1.0
             args = tuple(vals)
+        elif dist == 'vonmises':
+            yield check_distribution, dist, (100,), alpha
+            args = tuple(1.0+rand(nargs))
         else:
             args = tuple(1.0+rand(nargs))
         yield check_distribution, dist, args, alpha

Modified: branches/refactor_fft/scipy/stats/tests/test_mmorestats.py
===================================================================
--- branches/refactor_fft/scipy/stats/tests/test_mmorestats.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/stats/tests/test_mmorestats.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -9,7 +9,6 @@
 import numpy as np
 
 import numpy.ma as ma
-from numpy.ma import masked
 
 import scipy.stats.mstats as ms
 import scipy.stats.mmorestats as mms

Modified: branches/refactor_fft/scipy/stats/tests/test_mstats.py
===================================================================
--- branches/refactor_fft/scipy/stats/tests/test_mstats.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/stats/tests/test_mstats.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -348,10 +348,10 @@
         assert_equal(mstats.mode(ma1, axis=None), (0,3))
         assert_equal(mstats.mode(a2, axis=None), (3,4))
         assert_equal(mstats.mode(ma2, axis=None), (0,3))
-        assert_equal(mstats.mode(a2, axis=0), [[0,0,0,1,1],[1,1,1,1,1]])
-        assert_equal(mstats.mode(ma2, axis=0), [[0,0,0,1,1],[1,1,1,1,1]])
-        assert_equal(mstats.mode(a2, axis=-1), [[0,3],[3,3],[3,1]])
-        assert_equal(mstats.mode(ma2, axis=-1), [[0,3],[1,1],[0,0]])
+        assert_equal(mstats.mode(a2, axis=0), ([[0,0,0,1,1]],[[1,1,1,1,1]]))
+        assert_equal(mstats.mode(ma2, axis=0), ([[0,0,0,1,1]],[[1,1,1,1,1]]))
+        assert_equal(mstats.mode(a2, axis=-1), ([[0],[3],[3]], [[3],[3],[1]]))
+        assert_equal(mstats.mode(ma2, axis=-1), ([[0],[1],[0]], [[3],[1],[0]]))
 
 
 class TestPercentile(TestCase):

Modified: branches/refactor_fft/scipy/stats/tests/test_stats.py
===================================================================
--- branches/refactor_fft/scipy/stats/tests/test_stats.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/stats/tests/test_stats.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -6,10 +6,9 @@
 
 """
 
-import sys
 from numpy.testing import *
 from numpy import array, arange, zeros, ravel, float32, float64, power
-import numpy
+import numpy as np
 
 import scipy.stats as stats
 
@@ -88,12 +87,12 @@
 
     def test_rounding2(self):
         """ W.II.A.2. Y = 2-INT(EXP(LOG(SQR(2)*SQR(2))))   (Y should be 0)"""
-        y=2-int(numpy.exp(numpy.log(numpy.sqrt(2.)*numpy.sqrt(2.))))
+        y=2-int(np.exp(np.log(np.sqrt(2.)*np.sqrt(2.))))
         assert_equal(y,0)
 
     def test_rounding3(self):
         """ W.II.A.3. Y = INT(3-EXP(LOG(SQR(2)*SQR(2))))    (Y should be 1)"""
-        y=(int(round((3-numpy.exp(numpy.log(numpy.sqrt(2.0)*numpy.sqrt(2.0)))))))
+        y=(int(round((3-np.exp(np.log(np.sqrt(2.0)*np.sqrt(2.0)))))))
         assert_equal(y,1)
 
 class TestBasicStats(TestCase):
@@ -144,6 +143,7 @@
 
     def test_meanBIG(self):
         y = stats.mean(BIG)
+
         assert_almost_equal(y, 99999995.00)
 
     def test_stdBIG(self):
@@ -188,11 +188,11 @@
         self.X = X.copy()
 
         self.Xall = X.copy()
-        self.Xall[:] = numpy.nan
+        self.Xall[:] = np.nan
 
         self.Xsome = X.copy()
         self.Xsomet = X.copy()
-        self.Xsome[0] = numpy.nan
+        self.Xsome[0] = np.nan
         self.Xsomet = self.Xsomet[1:]
 
     def test_nanmean_none(self):
@@ -208,7 +208,7 @@
     def test_nanmean_all(self):
         """Check nanmean when all values are nan."""
         m = stats.nanmean(self.Xall)
-        assert numpy.isnan(m)
+        assert np.isnan(m)
 
     def test_nanstd_none(self):
         """Check nanstd when no values are nan."""
@@ -223,7 +223,7 @@
     def test_nanstd_all(self):
         """Check nanstd when all values are nan."""
         s = stats.nanstd(self.Xall)
-        assert numpy.isnan(s)
+        assert np.isnan(s)
 
     def test_nanmedian_none(self):
         """Check nanmedian when no values are nan."""
@@ -238,7 +238,7 @@
     def test_nanmedian_all(self):
         """Check nanmedian when all values are nan."""
         m = stats.nanmedian(self.Xall)
-        assert numpy.isnan(m)
+        assert np.isnan(m)
 
 class TestCorr(TestCase):
     """ W.II.D. Compute a correlation matrix on all the variables.
@@ -484,9 +484,9 @@
 
     def test_regress_simple(self):
         """Regress a line with sinusoidal noise."""
-        x = numpy.linspace(0, 100, 100)
-        y = 0.2 * numpy.linspace(0, 100, 100) + 10
-        y += numpy.sin(numpy.linspace(0, 20, 100))
+        x = np.linspace(0, 100, 100)
+        y = 0.2 * np.linspace(0, 100, 100) + 10
+        y += np.sin(np.linspace(0, 20, 100))
 
         res = stats.linregress(x, y)
         assert_almost_equal(res[4], 4.3609875083149268e-3)

Copied: branches/refactor_fft/scipy/stats/vonmises.py (from rev 4827, trunk/scipy/stats/vonmises.py)

Copied: branches/refactor_fft/scipy/stats/vonmises_cython.c (from rev 4827, trunk/scipy/stats/vonmises_cython.c)

Copied: branches/refactor_fft/scipy/stats/vonmises_cython.pyx (from rev 4827, trunk/scipy/stats/vonmises_cython.pyx)

Modified: branches/refactor_fft/scipy/stsci/convolve/lib/Convolve.py
===================================================================
--- branches/refactor_fft/scipy/stsci/convolve/lib/Convolve.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/stsci/convolve/lib/Convolve.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,4 +1,4 @@
-import numpy as num
+import numpy as np
 import _correlate
 import numpy.fft as dft
 import iraf_frame
@@ -16,12 +16,12 @@
     }
 
 def _condition_inputs(data, kernel):
-    data, kernel = num.asarray(data), num.asarray(kernel)
-    if num.rank(data) == 0:
+    data, kernel = np.asarray(data), np.asarray(kernel)
+    if np.rank(data) == 0:
         data.shape = (1,)
-    if num.rank(kernel) == 0:
+    if np.rank(kernel) == 0:
         kernel.shape = (1,)
-    if num.rank(data) > 1 or num.rank(kernel) > 1:
+    if np.rank(data) > 1 or np.rank(kernel) > 1:
         raise ValueError("arrays must be 1D")
     if len(data) < len(kernel):
         data, kernel = kernel, data
@@ -30,25 +30,25 @@
 def correlate(data, kernel, mode=FULL):
     """correlate(data, kernel, mode=FULL)
 
-    >>> correlate(num.arange(8), [1, 2], mode=VALID)
+    >>> correlate(np.arange(8), [1, 2], mode=VALID)
     array([ 2,  5,  8, 11, 14, 17, 20])
-    >>> correlate(num.arange(8), [1, 2], mode=SAME)
+    >>> correlate(np.arange(8), [1, 2], mode=SAME)
     array([ 0,  2,  5,  8, 11, 14, 17, 20])
-    >>> correlate(num.arange(8), [1, 2], mode=FULL)
+    >>> correlate(np.arange(8), [1, 2], mode=FULL)
     array([ 0,  2,  5,  8, 11, 14, 17, 20,  7])
-    >>> correlate(num.arange(8), [1, 2, 3], mode=VALID)
+    >>> correlate(np.arange(8), [1, 2, 3], mode=VALID)
     array([ 8, 14, 20, 26, 32, 38])
-    >>> correlate(num.arange(8), [1, 2, 3], mode=SAME)
+    >>> correlate(np.arange(8), [1, 2, 3], mode=SAME)
     array([ 3,  8, 14, 20, 26, 32, 38, 20])
-    >>> correlate(num.arange(8), [1, 2, 3], mode=FULL)
+    >>> correlate(np.arange(8), [1, 2, 3], mode=FULL)
     array([ 0,  3,  8, 14, 20, 26, 32, 38, 20,  7])
-    >>> correlate(num.arange(8), [1, 2, 3, 4, 5, 6], mode=VALID)
+    >>> correlate(np.arange(8), [1, 2, 3, 4, 5, 6], mode=VALID)
     array([ 70,  91, 112])
-    >>> correlate(num.arange(8), [1, 2, 3, 4, 5, 6], mode=SAME)
+    >>> correlate(np.arange(8), [1, 2, 3, 4, 5, 6], mode=SAME)
     array([ 17,  32,  50,  70,  91, 112,  85,  60])
-    >>> correlate(num.arange(8), [1, 2, 3, 4, 5, 6], mode=FULL)
+    >>> correlate(np.arange(8), [1, 2, 3, 4, 5, 6], mode=FULL)
     array([  0,   6,  17,  32,  50,  70,  91, 112,  85,  60,  38,  20,   7])
-    >>> correlate(num.arange(8), 1+1j)
+    >>> correlate(np.arange(8), 1+1j)
     Traceback (most recent call last):
     ...
     TypeError: array cannot be safely cast to required type
@@ -66,17 +66,17 @@
     result_type = max(kernel.dtype.name, data.dtype.name)
 
     if mode == VALID:
-        wdata = num.concatenate((kdata, data, kdata))
+        wdata = np.concatenate((kdata, data, kdata))
         result = wdata.astype(result_type)
         _correlate.Correlate1d(kernel, wdata, result)
         return result[lenk+halfk:-lenk-halfk+even]
     elif mode == SAME:
-        wdata = num.concatenate((kdata, data, kdata))
+        wdata = np.concatenate((kdata, data, kdata))
         result = wdata.astype(result_type)
         _correlate.Correlate1d(kernel, wdata, result)
         return result[lenk:-lenk]
     elif mode == FULL:
-        wdata = num.concatenate((kdata, data, kdata))
+        wdata = np.concatenate((kdata, data, kdata))
         result = wdata.astype(result_type)
         _correlate.Correlate1d(kernel, wdata, result)
         return result[halfk+1:-halfk-1+even]
@@ -102,25 +102,25 @@
     sequences a and v; mode can be 0 (VALID), 1 (SAME), or 2 (FULL)
     to specify size of the resulting sequence.
 
-    >>> convolve(num.arange(8), [1, 2], mode=VALID)
+    >>> convolve(np.arange(8), [1, 2], mode=VALID)
     array([ 1,  4,  7, 10, 13, 16, 19])
-    >>> convolve(num.arange(8), [1, 2], mode=SAME)
+    >>> convolve(np.arange(8), [1, 2], mode=SAME)
     array([ 0,  1,  4,  7, 10, 13, 16, 19])
-    >>> convolve(num.arange(8), [1, 2], mode=FULL)
+    >>> convolve(np.arange(8), [1, 2], mode=FULL)
     array([ 0,  1,  4,  7, 10, 13, 16, 19, 14])
-    >>> convolve(num.arange(8), [1, 2, 3], mode=VALID)
+    >>> convolve(np.arange(8), [1, 2, 3], mode=VALID)
     array([ 4, 10, 16, 22, 28, 34])
-    >>> convolve(num.arange(8), [1, 2, 3], mode=SAME)
+    >>> convolve(np.arange(8), [1, 2, 3], mode=SAME)
     array([ 1,  4, 10, 16, 22, 28, 34, 32])
-    >>> convolve(num.arange(8), [1, 2, 3], mode=FULL)
+    >>> convolve(np.arange(8), [1, 2, 3], mode=FULL)
     array([ 0,  1,  4, 10, 16, 22, 28, 34, 32, 21])
-    >>> convolve(num.arange(8), [1, 2, 3, 4, 5, 6], mode=VALID)
+    >>> convolve(np.arange(8), [1, 2, 3, 4, 5, 6], mode=VALID)
     array([35, 56, 77])
-    >>> convolve(num.arange(8), [1, 2, 3, 4, 5, 6], mode=SAME)
+    >>> convolve(np.arange(8), [1, 2, 3, 4, 5, 6], mode=SAME)
     array([ 4, 10, 20, 35, 56, 77, 90, 94])
-    >>> convolve(num.arange(8), [1, 2, 3, 4, 5, 6], mode=FULL)
+    >>> convolve(np.arange(8), [1, 2, 3, 4, 5, 6], mode=FULL)
     array([ 0,  1,  4, 10, 20, 35, 56, 77, 90, 94, 88, 71, 42])
-    >>> convolve([1.,2.], num.arange(10.))
+    >>> convolve([1.,2.], np.arange(10.))
     array([  0.,   1.,   4.,   7.,  10.,  13.,  16.,  19.,  22.,  25.,  18.])
     """
     data, kernel = _condition_inputs(data, kernel)
@@ -131,15 +131,15 @@
 
 
 def _gaussian(sigma, mew, npoints, sigmas):
-    ox = num.arange(mew-sigmas*sigma,
-                         mew+sigmas*sigma,
-                         2*sigmas*sigma/npoints, type=num.float64)
+    ox = np.arange(mew-sigmas*sigma,
+                   mew+sigmas*sigma,
+                   2*sigmas*sigma/npoints, type=np.float64)
     x = ox-mew
     x /= sigma
     x = x * x
     x *= -1/2
-    x = num.exp(x)
-    return ox, 1/(sigma * num.sqrt(2*num.pi)) * x
+    x = np.exp(x)
+    return ox, 1/(sigma * np.sqrt(2*np.pi)) * x
 
 def _correlate2d_fft(data0, kernel0, output=None, mode="nearest", cval=0.0):
     """_correlate2d_fft does 2d correlation of 'data' with 'kernel', storing
@@ -153,17 +153,17 @@
     """
     shape = data0.shape
     kshape = kernel0.shape
-    oversized = (num.array(shape) + num.array(kshape))
+    oversized = (np.array(shape) + np.array(kshape))
 
     dy = kshape[0] // 2
     dx = kshape[1] // 2
 
-    kernel = num.zeros(oversized, dtype=num.float64)
+    kernel = np.zeros(oversized, dtype=np.float64)
     kernel[:kshape[0], :kshape[1]] = kernel0[::-1,::-1]   # convolution <-> correlation
     data = iraf_frame.frame(data0, oversized, mode=mode, cval=cval)
 
-    complex_result = (isinstance(data, num.complexfloating) or
-                      isinstance(kernel, num.complexfloating))
+    complex_result = (isinstance(data, np.complexfloating) or
+                      isinstance(kernel, np.complexfloating))
 
     Fdata = dft.fft2(data)
     del data
@@ -171,7 +171,7 @@
     Fkernel = dft.fft2(kernel)
     del kernel
 
-    num.multiply(Fdata, Fkernel, Fdata)
+    np.multiply(Fdata, Fkernel, Fdata)
     del Fkernel
 
     if complex_result:
@@ -196,14 +196,14 @@
     commutative, _fix_data_kernel reverses kernel and data if necessary
     and panics if there's no good order.
     """
-    data, kernel = map(num.asarray, [data, kernel])
-    if num.rank(data) == 0:
+    data, kernel = map(np.asarray, [data, kernel])
+    if np.rank(data) == 0:
         data.shape = (1,1)
-    elif num.rank(data) == 1:
+    elif np.rank(data) == 1:
         data.shape = (1,) + data.shape
-    if num.rank(kernel) == 0:
+    if np.rank(kernel) == 0:
         kernel.shape = (1,1)
-    elif num.rank(kernel) == 1:
+    elif np.rank(kernel) == 1:
         kernel.shape = (1,) + kernel.shape
     if (kernel.shape[0] > data.shape[0] and
         kernel.shape[1] > data.shape[1]):
@@ -226,12 +226,12 @@
     If fft is True,  the correlation is performed using the FFT, else the
     correlation is performed using the naive approach.
 
-    >>> a = num.arange(20*20)
+    >>> a = np.arange(20*20)
     >>> a = a.reshape((20,20))
-    >>> b = num.ones((5,5), dtype=num.float64)
+    >>> b = np.ones((5,5), dtype=np.float64)
     >>> rn = correlate2d(a, b, fft=0)
     >>> rf = correlate2d(a, b, fft=1)
-    >>> num.alltrue(num.ravel(rn-rf<1e-10))
+    >>> np.alltrue(np.ravel(rn-rf<1e-10))
     True
     """
     data, kernel = _fix_data_kernel(data, kernel)
@@ -252,12 +252,12 @@
         'reflect'   elements beyond boundary come from reflection on same array edge.
         'constant'  elements beyond boundary are set to 'cval'
 
-    >>> a = num.arange(20*20)
+    >>> a = np.arange(20*20)
     >>> a = a.reshape((20,20))
-    >>> b = num.ones((5,5), dtype=num.float64)
+    >>> b = np.ones((5,5), dtype=np.float64)
     >>> rn = convolve2d(a, b, fft=0)
     >>> rf = convolve2d(a, b, fft=1)
-    >>> num.alltrue(num.ravel(rn-rf<1e-10))
+    >>> np.alltrue(np.ravel(rn-rf<1e-10))
     True
     """
     data, kernel = _fix_data_kernel(data, kernel)
@@ -269,8 +269,8 @@
 
 def _boxcar(data, output, boxshape, mode, cval):
     if len(boxshape) == 1:
-        _correlate.Boxcar2d(data[num.newaxis,...], 1, boxshape[0],
-                            output[num.newaxis,...], mode, cval)
+        _correlate.Boxcar2d(data[np.newaxis,...], 1, boxshape[0],
+                            output[np.newaxis,...], mode, cval)
     elif len(boxshape) == 2:
         _correlate.Boxcar2d(data, boxshape[0], boxshape[1], output, mode, cval)
     else:
@@ -290,19 +290,19 @@
         'reflect'   elements beyond boundary come from reflection on same array edge.
         'constant'  elements beyond boundary are set to 'cval'
 
-    >>> boxcar(num.array([10, 0, 0, 0, 0, 0, 1000]), (3,), mode="nearest").astype(num.longlong)
+    >>> boxcar(np.array([10, 0, 0, 0, 0, 0, 1000]), (3,), mode="nearest").astype(np.longlong)
     array([  6,   3,   0,   0,   0, 333, 666], dtype=int64)
-    >>> boxcar(num.array([10, 0, 0, 0, 0, 0, 1000]), (3,), mode="wrap").astype(num.longlong)
+    >>> boxcar(np.array([10, 0, 0, 0, 0, 0, 1000]), (3,), mode="wrap").astype(np.longlong)
     array([336,   3,   0,   0,   0, 333, 336], dtype=int64)
-    >>> boxcar(num.array([10, 0, 0, 0, 0, 0, 1000]), (3,), mode="reflect").astype(num.longlong)
+    >>> boxcar(np.array([10, 0, 0, 0, 0, 0, 1000]), (3,), mode="reflect").astype(np.longlong)
     array([  6,   3,   0,   0,   0, 333, 666], dtype=int64)
-    >>> boxcar(num.array([10, 0, 0, 0, 0, 0, 1000]), (3,), mode="constant").astype(num.longlong)
+    >>> boxcar(np.array([10, 0, 0, 0, 0, 0, 1000]), (3,), mode="constant").astype(np.longlong)
     array([  3,   3,   0,   0,   0, 333, 333], dtype=int64)
-    >>> a = num.zeros((10,10))
+    >>> a = np.zeros((10,10))
     >>> a[0,0] = 100
     >>> a[5,5] = 1000
     >>> a[9,9] = 10000
-    >>> boxcar(a, (3,3)).astype(num.longlong)
+    >>> boxcar(a, (3,3)).astype(np.longlong)
     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],
@@ -313,7 +313,7 @@
            [   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=int64)
-    >>> boxcar(a, (3,3), mode="wrap").astype(num.longlong)
+    >>> boxcar(a, (3,3), mode="wrap").astype(np.longlong)
     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],
@@ -324,7 +324,7 @@
            [   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=int64)
-    >>> boxcar(a, (3,3), mode="reflect").astype(num.longlong)
+    >>> boxcar(a, (3,3), mode="reflect").astype(np.longlong)
     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],
@@ -335,7 +335,7 @@
            [   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=int64)
-   >>> boxcar(a, (3,3), mode="constant").astype(num.longlong)
+   >>> boxcar(a, (3,3), mode="constant").astype(np.longlong)
    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],
@@ -347,9 +347,9 @@
           [   0,    0,    0,    0,    0,    0,    0,    0, 1111, 1111],
           [   0,    0,    0,    0,    0,    0,    0,    0, 1111, 1111]], dtype=int64)
 
-    >>> a = num.zeros((10,10))
+    >>> a = np.zeros((10,10))
     >>> a[3:6,3:6] = 111
-    >>> boxcar(a, (3,3)).astype(num.longlong)
+    >>> boxcar(a, (3,3)).astype(np.longlong)
     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],
@@ -363,11 +363,11 @@
     """
     mode = pix_modes[ mode ]
     if output is None:
-        woutput = data.astype(num.float64)
+        woutput = data.astype(np.float64)
     else:
         woutput = output
     _fbroadcast(_boxcar, len(boxshape), data.shape,
-                      (data, woutput), (boxshape, mode, cval))
+                (data, woutput), (boxshape, mode, cval))
     if output is None:
         return woutput
 

Modified: branches/refactor_fft/scipy/stsci/convolve/lib/iraf_frame.py
===================================================================
--- branches/refactor_fft/scipy/stsci/convolve/lib/iraf_frame.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/stsci/convolve/lib/iraf_frame.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,4 +1,4 @@
-import numpy as num
+import numpy as np
 
 """This module defines the function frame() which creates
 a framed copy of an input array with the boundary pixels
@@ -12,7 +12,7 @@
     and the contents of 'a' in the center.  The boundary pixels are
     copied from the nearest edge pixel in 'a'.
 
-    >>> a = num.arange(16)
+    >>> a = np.arange(16)
     >>> a.shape=(4,4)
     >>> frame_nearest(a, (8,8))
     array([[ 0,  0,  0,  1,  2,  3,  3,  3],
@@ -26,8 +26,8 @@
 
     """
 
-    b = num.zeros(shape, dtype=a.dtype)
-    delta = (num.array(b.shape) - num.array(a.shape))
+    b = np.zeros(shape, dtype=a.dtype)
+    delta = (np.array(b.shape) - np.array(a.shape))
     dy = delta[0] // 2
     dx = delta[1] // 2
     my = a.shape[0] + dy
@@ -51,7 +51,7 @@
     and the contents of 'a' in the center.  The boundary pixels are
     reflected from the nearest edge pixels in 'a'.
 
-    >>> a = num.arange(16)
+    >>> a = np.arange(16)
     >>> a.shape = (4,4)
     >>> frame_reflect(a, (8,8))
     array([[ 5,  4,  4,  5,  6,  7,  7,  6],
@@ -64,8 +64,8 @@
            [ 9,  8,  8,  9, 10, 11, 11, 10]])
     """
 
-    b = num.zeros(shape, dtype=a.dtype)
-    delta = (num.array(b.shape) - num.array(a.shape))
+    b = np.zeros(shape, dtype=a.dtype)
+    delta = (np.array(b.shape) - np.array(a.shape))
     dy = delta[0] // 2
     dx = delta[1] // 2
     my = a.shape[0] + dy
@@ -89,7 +89,7 @@
     and the contents of 'a' in the center.  The boundary pixels are
     wrapped around to the opposite edge pixels in 'a'.
 
-    >>> a = num.arange(16)
+    >>> a = np.arange(16)
     >>> a.shape=(4,4)
     >>> frame_wrap(a, (8,8))
     array([[10, 11,  8,  9, 10, 11,  8,  9],
@@ -103,8 +103,8 @@
 
     """
 
-    b = num.zeros(shape, dtype=a.dtype)
-    delta = (num.array(b.shape) - num.array(a.shape))
+    b = np.zeros(shape, dtype=a.dtype)
+    delta = (np.array(b.shape) - np.array(a.shape))
     dy = delta[0] // 2
     dx = delta[1] // 2
     my = a.shape[0] + dy
@@ -128,7 +128,7 @@
     and the contents of 'a' in the center.  The boundary pixels are
     copied from the nearest edge pixel in 'a'.
 
-    >>> a = num.arange(16)
+    >>> a = np.arange(16)
     >>> a.shape=(4,4)
     >>> frame_constant(a, (8,8), cval=42)
     array([[42, 42, 42, 42, 42, 42, 42, 42],
@@ -142,8 +142,8 @@
 
     """
 
-    b = num.zeros(shape, dtype=a.dtype)
-    delta = (num.array(b.shape) - num.array(a.shape))
+    b = np.zeros(shape, dtype=a.dtype)
+    delta = (np.array(b.shape) - np.array(a.shape))
     dy = delta[0] // 2
     dx = delta[1] // 2
     my = a.shape[0] + dy
@@ -183,7 +183,7 @@
     """unframe extracts the center slice of framed array 'a' which had
     'shape' prior to framing."""
 
-    delta = num.array(a.shape) - num.array(shape)
+    delta = np.array(a.shape) - np.array(shape)
     dy = delta[0]//2
     dx = delta[1]//2
     my = shape[0] + dy

Modified: branches/refactor_fft/scipy/stsci/convolve/lib/lineshape.py
===================================================================
--- branches/refactor_fft/scipy/stsci/convolve/lib/lineshape.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/stsci/convolve/lib/lineshape.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -40,11 +40,8 @@
 __date__    = "$Date: 2007/03/14 16:35:57 $"[7:-11]
 __version__ = "$Revision: 1.1 $"[11:-2]
 
-
-import numpy as num
 from convolve._lineshape import *
 
-
 class Profile(object):
     """An base object to provide a convolution kernel."""
 

Modified: branches/refactor_fft/scipy/stsci/image/lib/_image.py
===================================================================
--- branches/refactor_fft/scipy/stsci/image/lib/_image.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/stsci/image/lib/_image.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,7 +1,6 @@
-import numpy as num
+import numpy as np
 import scipy.stsci.convolve
 import scipy.stsci.convolve._correlate as _correlate
-MLab=num
 
 def _translate(a, dx, dy, output=None, mode="nearest", cval=0.0):
     """_translate does positive sub-pixel shifts using bilinear interpolation."""
@@ -14,10 +13,8 @@
     y = (1-dx) * dy
     z = dx * dy
 
-    kernel = num.array([
-        [ z, y ],
-        [ x, w ],
-        ])
+    kernel = np.array([[ z, y ],
+                       [ x, w ]])
 
     return convolve.correlate2d(a, kernel, output, mode, cval)
 
@@ -33,7 +30,7 @@
         'reflect'   elements beyond boundary come from reflection on same array edge.
         'constant'  elements beyond boundary are set to 'cval'
     """
-    a = num.asarray(a)
+    a = np.asarray(a)
 
     sdx, sdy = -sdx, -sdy     # Flip sign to match IRAF sign convention
 
@@ -51,11 +48,11 @@
         rotation = 0
         dx, dy = abs(sdx), abs(sdy)
 
-    b = MLab.rot90(a, rotation)
+    b = np.rot90(a, rotation)
     c = _correlate.Shift2d(b, int(dx), int(dy),
                            mode=convolve.pix_modes[mode])
     d = _translate(c, dx % 1, dy % 1, output, mode, cval)
     if output is not None:
-        output._copyFrom(MLab.rot90(output, -rotation%4))
+        output._copyFrom(np.rot90(output, -rotation%4))
     else:
-        return MLab.rot90(d, -rotation % 4).astype(a.type())
+        return np.rot90(d, -rotation % 4).astype(a.type())

Modified: branches/refactor_fft/scipy/stsci/image/lib/combine.py
===================================================================
--- branches/refactor_fft/scipy/stsci/image/lib/combine.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/stsci/image/lib/combine.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,10 +1,8 @@
-import numpy as num
+import numpy as np
 from _combine import combine as _comb
-import operator as _operator
 
-
 def _combine_f(funcstr, arrays, output=None, outtype=None, nlow=0, nhigh=0, badmasks=None):
-    arrays = [ num.asarray(a) for a in arrays ]
+    arrays = [ np.asarray(a) for a in arrays ]
     shape = arrays[0].shape
     if output is None:
         if outtype is not None:
@@ -44,7 +42,7 @@
                indicates that a particular pixel is not to be included in the
                median calculation.
 
-    >>> a = num.arange(4)
+    >>> a = np.arange(4)
     >>> a = a.reshape((2,2))
     >>> arrays = [a*16, a*4, a*2, a*8]
     >>> median(arrays)
@@ -56,10 +54,10 @@
     >>> median(arrays, nlow=1)
     array([[ 0,  8],
            [16, 24]])
-    >>> median(arrays, outtype=num.float32)
+    >>> median(arrays, outtype=np.float32)
     array([[  0.,   6.],
            [ 12.,  18.]], dtype=float32)
-    >>> bm = num.zeros((4,2,2), dtype=num.bool8)
+    >>> bm = np.zeros((4,2,2), dtype=np.bool8)
     >>> bm[2,...] = 1
     >>> median(arrays, badmasks=bm)
     array([[ 0,  8],
@@ -94,7 +92,7 @@
                indicates that a particular pixel is not to be included in the
                average calculation.
 
-    >>> a = num.arange(4)
+    >>> a = np.arange(4)
     >>> a = a.reshape((2,2))
     >>> arrays = [a*16, a*4, a*2, a*8]
     >>> average(arrays)
@@ -106,10 +104,10 @@
     >>> average(arrays, nlow=1)
     array([[ 0,  9],
            [18, 28]])
-    >>> average(arrays, outtype=num.float32)
+    >>> average(arrays, outtype=np.float32)
     array([[  0. ,   7.5],
            [ 15. ,  22.5]], dtype=float32)
-    >>> bm = num.zeros((4,2,2), dtype=num.bool8)
+    >>> bm = np.zeros((4,2,2), dtype=np.bool8)
     >>> bm[2,...] = 1
     >>> average(arrays, badmasks=bm)
     array([[ 0,  9],
@@ -145,7 +143,7 @@
                indicates that a particular pixel is not to be included in the
                minimum calculation.
 
-    >>> a = num.arange(4)
+    >>> a = np.arange(4)
     >>> a = a.reshape((2,2))
     >>> arrays = [a*16, a*4, a*2, a*8]
     >>> minimum(arrays)
@@ -157,10 +155,10 @@
     >>> minimum(arrays, nlow=1)
     array([[ 0,  4],
            [ 8, 12]])
-    >>> minimum(arrays, outtype=num.float32)
+    >>> minimum(arrays, outtype=np.float32)
     array([[ 0.,  2.],
            [ 4.,  6.]], dtype=float32)
-    >>> bm = num.zeros((4,2,2), dtype=num.bool8)
+    >>> bm = np.zeros((4,2,2), dtype=np.bool8)
     >>> bm[2,...] = 1
     >>> minimum(arrays, badmasks=bm)
     array([[ 0,  4],
@@ -178,9 +176,9 @@
     boolean value is true where each of the arrays values
     is < the low or >= the high threshholds.
 
-    >>> a=num.arange(100)
+    >>> a=np.arange(100)
     >>> a=a.reshape((10,10))
-    >>> (threshhold(a, 1, 50)).astype(num.int8)
+    >>> (threshhold(a, 1, 50)).astype(np.int8)
     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],
@@ -191,7 +189,7 @@
            [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=int8)
-    >>> (threshhold([ range(10)]*10, 3, 7)).astype(num.int8)
+    >>> (threshhold([ range(10)]*10, 3, 7)).astype(np.int8)
     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],
@@ -202,7 +200,7 @@
            [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=int8)
-    >>> (threshhold(a, high=50)).astype(num.int8)
+    >>> (threshhold(a, high=50)).astype(np.int8)
     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],
@@ -213,7 +211,7 @@
            [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=int8)
-    >>> (threshhold(a, low=50)).astype(num.int8)
+    >>> (threshhold(a, low=50)).astype(np.int8)
     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],
@@ -227,12 +225,12 @@
 
     """
 
-    if not isinstance(arrays[0],  num.ndarray):
-        return threshhold( num.asarray(arrays), low, high, outputs)
+    if not isinstance(arrays[0],  np.ndarray):
+        return threshhold( np.asarray(arrays), low, high, outputs)
 
     if outputs is None:
-        outs = num.zeros(shape=(len(arrays),)+arrays[0].shape,
-                         dtype=num.bool8)
+        outs = np.zeros(shape=(len(arrays),)+arrays[0].shape,
+                         dtype=np.bool8)
     else:
         outs = outputs
 
@@ -241,12 +239,12 @@
         out[:] = 0
 
         if high is not None:
-            num.greater_equal(a, high, out)
+            np.greater_equal(a, high, out)
             if low is not None:
-                num.logical_or(out, a < low, out)
+                np.logical_or(out, a < low, out)
         else:
             if low is not None:
-                num.less(a, low, out)
+                np.less(a, low, out)
 
     if outputs is None:
         return outs
@@ -254,16 +252,16 @@
 def _bench():
     """time a 10**6 element median"""
     import time
-    a = num.arange(10**6)
+    a = np.arange(10**6)
     a = a.reshape((1000, 1000))
     arrays = [a*2, a*64, a*16, a*8]
     t0 = time.clock()
     median(arrays)
     print "maskless:", time.clock()-t0
 
-    a = num.arange(10**6)
+    a = np.arange(10**6)
     a = a.reshape((1000, 1000))
     arrays = [a*2, a*64, a*16, a*8]
     t0 = time.clock()
-    median(arrays, badmasks=num.zeros((1000,1000), dtype=num.bool8))
+    median(arrays, badmasks=np.zeros((1000,1000), dtype=np.bool8))
     print "masked:", time.clock()-t0

Modified: branches/refactor_fft/scipy/weave/accelerate_tools.py
===================================================================
--- branches/refactor_fft/scipy/weave/accelerate_tools.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/weave/accelerate_tools.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -109,7 +109,7 @@
 Double = Double()
 String = String()
 
-import numpy as nx
+import numpy as np
 
 class Vector(Type_Descriptor):
     cxxtype = 'PyArrayObject*'
@@ -214,12 +214,12 @@
     int : Integer,
     float : Double,
     str: String,
-    (nx.ndarray,1,int): IntegerVector,
-    (nx.ndarray,2,int): Integermatrix,
-    (nx.ndarray,1,nx.long): LongVector,
-    (nx.ndarray,2,nx.long): Longmatrix,
-    (nx.ndarray,1,float): DoubleVector,
-    (nx.ndarray,2,float): Doublematrix,
+    (np.ndarray,1,int): IntegerVector,
+    (np.ndarray,2,int): Integermatrix,
+    (np.ndarray,1,np.long): LongVector,
+    (np.ndarray,2,np.long): Longmatrix,
+    (np.ndarray,1,float): DoubleVector,
+    (np.ndarray,2,float): Doublematrix,
     XRangeType : XRange,
     }
 
@@ -260,7 +260,7 @@
     try:
         return typedefs[T]
     except:
-        if isinstance(T,nx.ndarray):
+        if isinstance(T,np.ndarray):
             return typedefs[(T,len(x.shape),x.dtype.char)]
         elif issubclass(T, InstanceType):
             return Instance(x)

Modified: branches/refactor_fft/scipy/weave/examples/vq.py
===================================================================
--- branches/refactor_fft/scipy/weave/examples/vq.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/weave/examples/vq.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -14,7 +14,6 @@
 # [25 29] [ 2.49147272  3.83021021]
 #  speed up: 32.56
 
-import numpy
 from numpy import *
 import sys
 sys.path.insert(0,'..')

Modified: branches/refactor_fft/scipy/weave/tests/test_blitz_tools.py
===================================================================
--- branches/refactor_fft/scipy/weave/tests/test_blitz_tools.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/weave/tests/test_blitz_tools.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,7 +1,7 @@
 import os
 import time
 
-from numpy import dot, float32, float64, complex64, complex128, \
+from numpy import float32, float64, complex64, complex128, \
      zeros, random, array, sum, abs, allclose
 
 from numpy.testing import *

Modified: branches/refactor_fft/scipy/weave/tests/test_c_spec.py
===================================================================
--- branches/refactor_fft/scipy/weave/tests/test_c_spec.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/weave/tests/test_c_spec.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,4 +1,3 @@
-import time
 import os
 import sys
 

Modified: branches/refactor_fft/scipy/weave/tests/test_ext_tools.py
===================================================================
--- branches/refactor_fft/scipy/weave/tests/test_ext_tools.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/weave/tests/test_ext_tools.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,5 +1,3 @@
-import time
-
 from numpy.testing import *
 
 from scipy.weave import ext_tools, c_spec

Modified: branches/refactor_fft/scipy/weave/tests/test_inline_tools.py
===================================================================
--- branches/refactor_fft/scipy/weave/tests/test_inline_tools.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/weave/tests/test_inline_tools.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -2,7 +2,6 @@
 from numpy.testing import *
 
 from scipy.weave import inline_tools
-from test_scxx import *
 
 class TestInline(TestCase):
     """ These are long running tests...

Modified: branches/refactor_fft/scipy/weave/tests/test_numpy_scalar_spec.py
===================================================================
--- branches/refactor_fft/scipy/weave/tests/test_numpy_scalar_spec.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/weave/tests/test_numpy_scalar_spec.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,4 +1,3 @@
-import time
 import os
 import sys
 

Deleted: branches/refactor_fft/scipy/weave/tests/test_scxx.py
===================================================================
--- branches/refactor_fft/scipy/weave/tests/test_scxx.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/weave/tests/test_scxx.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,14 +0,0 @@
-""" Test refcounting and behavior of SCXX.
-"""
-import unittest
-import time
-import os,sys
-
-from numpy.testing import *
-from test_scxx_object import *
-from test_scxx_sequence import *
-from test_scxx_dict import *
-
-
-if __name__ == "__main__":
-    nose.run(argv=['', __file__])

Modified: branches/refactor_fft/scipy/weave/tests/test_scxx_dict.py
===================================================================
--- branches/refactor_fft/scipy/weave/tests/test_scxx_dict.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/weave/tests/test_scxx_dict.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,7 +1,6 @@
 """ Test refcounting and behavior of SCXX.
 """
-import time
-import os
+
 import sys
 
 from numpy.testing import *

Modified: branches/refactor_fft/scipy/weave/tests/test_scxx_object.py
===================================================================
--- branches/refactor_fft/scipy/weave/tests/test_scxx_object.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/weave/tests/test_scxx_object.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,7 +1,6 @@
 """ Test refcounting and behavior of SCXX.
 """
-import time
-import os
+
 import sys
 
 from numpy.testing import *

Modified: branches/refactor_fft/scipy/weave/tests/test_scxx_sequence.py
===================================================================
--- branches/refactor_fft/scipy/weave/tests/test_scxx_sequence.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/weave/tests/test_scxx_sequence.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -2,7 +2,7 @@
 """
 
 import time
-import os,sys
+import sys
 
 from numpy.testing import *
 
@@ -18,8 +18,6 @@
 #     operator[] (get)
 #     operator[] (set)  DONE
 
-from UserList import UserList
-
 class _TestSequenceBase(TestCase):
     seq_type = None
 

Modified: branches/refactor_fft/scipy/weave/tests/test_size_check.py
===================================================================
--- branches/refactor_fft/scipy/weave/tests/test_size_check.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/weave/tests/test_size_check.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,4 +1,3 @@
-import os
 import numpy as np
 from numpy.testing import *
 

Modified: branches/refactor_fft/scipy/weave/tests/weave_test_utils.py
===================================================================
--- branches/refactor_fft/scipy/weave/tests/weave_test_utils.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/scipy/weave/tests/weave_test_utils.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,7 +1,4 @@
 import os
-import sys
-import string
-import pprint
 
 def remove_whitespace(in_str):
     out = in_str.replace(" ","")

Copied: branches/refactor_fft/tools (from rev 4827, trunk/tools)

Copied: branches/refactor_fft/tools/win32 (from rev 4827, trunk/tools/win32)

Copied: branches/refactor_fft/tools/win32/build_scripts (from rev 4827, trunk/tools/win32/build_scripts)

Copied: branches/refactor_fft/tools/win32/build_scripts/nsis_scripts (from rev 4827, trunk/tools/win32/build_scripts/nsis_scripts)

Deleted: branches/refactor_fft/tools/win32/build_scripts/nsis_scripts/scipy-superinstaller.nsi.in
===================================================================
--- trunk/tools/win32/build_scripts/nsis_scripts/scipy-superinstaller.nsi.in	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/tools/win32/build_scripts/nsis_scripts/scipy-superinstaller.nsi.in	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,121 +0,0 @@
-;--------------------------------
-;Include Modern UI
-
-!include "MUI2.nsh"
-
-SetCompress off ; Useful to disable compression under development
-;SetCompressor /Solid LZMA ; Useful to disable compression under development
-
-;--------------------------------
-;General
-
-;Name and file
-Name "Scipy super installer"
-OutFile "@SCIPY_INSTALLER_NAME@"
-
-;Default installation folder
-InstallDir "$TEMP"
-
-;--------------------------------
-;Interface Settings
-
-!define MUI_ABORTWARNING
-
-;--------------------------------
-;Pages
-
-;!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
-;!insertmacro MUI_PAGE_COMPONENTS
-;!insertmacro MUI_PAGE_DIRECTORY
-;!insertmacro MUI_PAGE_INSTFILES
-
-;!insertmacro MUI_UNPAGE_CONFIRM
-;!insertmacro MUI_UNPAGE_INSTFILES
-
-;--------------------------------
-;Languages
-
-!insertmacro MUI_LANGUAGE "English"
-
-;--------------------------------
-;Component Sections
-
-!include 'Sections.nsh'
-!include LogicLib.nsh
-
-Var HasSSE2
-Var HasSSE3
-Var CPUSSE
-
-Section "Core" SecCore
-
-        ;SectionIn RO
-        SetOutPath "$INSTDIR"
-
-        ;Create uninstaller
-        ;WriteUninstaller "$INSTDIR\Uninstall.exe"
-
-        DetailPrint "Install dir for actual installers is $INSTDIR"
-
-        StrCpy $CPUSSE "0"
-        CpuCaps::hasSSE2
-        Pop $0
-        StrCpy $HasSSE2 $0
-
-        CpuCaps::hasSSE3
-        Pop $0
-        StrCpy $HasSSE3 $0
-
-        ; Debug
-        StrCmp $HasSSE2 "Y" include_sse2 no_include_sse2
-        include_sse2:
-                DetailPrint '"Target CPU handles SSE2"'
-                StrCpy $CPUSSE "2"
-                goto done_sse2
-        no_include_sse2:
-                DetailPrint '"Target CPU does NOT handle SSE2"'
-                goto done_sse2
-        done_sse2:
-
-        StrCmp $HasSSE3 "Y" include_sse3 no_include_sse3
-        include_sse3:
-                DetailPrint '"Target CPU handles SSE3"'
-                StrCpy $CPUSSE "3"
-                goto done_sse3
-        no_include_sse3:
-                DetailPrint '"Target CPU does NOT handle SSE3"'
-                goto done_sse3
-        done_sse3:
-
-        ClearErrors
-
-        ; Install files conditionaly on detected cpu
-        ${Switch} $CPUSSE
-                ${Case} "3"
-                DetailPrint '"Install SSE 3"'
-                File "binaries\@SSE3_BINARY@"
-                ExecWait '"$INSTDIR\@SSE3_BINARY@"'
-                ${Break}
-        ${Case} "2"
-                DetailPrint '"Install SSE 2"'
-                File "binaries\@SSE2_BINARY@"
-                ExecWait '"$INSTDIR\@SSE2_BINARY@"'
-                ${Break}
-        ${Default}
-                DetailPrint '"Install NO SSE"'
-                File "binaries\@NOSSE_BINARY@"
-                ExecWait '"$INSTDIR\@NOSSE_BINARY@"'
-                ${Break}
-        ${EndSwitch}
-
-        ; Handle errors when executing installers
-        IfErrors error no_error
-
-        error:
-                messageBox MB_OK "Executing scipy installer failed"
-                goto done
-        no_error:
-                goto done
-        done:
-
-SectionEnd

Copied: branches/refactor_fft/tools/win32/build_scripts/nsis_scripts/scipy-superinstaller.nsi.in (from rev 4827, trunk/tools/win32/build_scripts/nsis_scripts/scipy-superinstaller.nsi.in)

Deleted: branches/refactor_fft/tools/win32/build_scripts/pavement.py
===================================================================
--- trunk/tools/win32/build_scripts/pavement.py	2008-10-22 13:52:41 UTC (rev 4827)
+++ branches/refactor_fft/tools/win32/build_scripts/pavement.py	2008-10-23 12:30:20 UTC (rev 4828)
@@ -1,327 +0,0 @@
-import os
-from os.path import join as pjoin, normpath, exists as pexists, dirname
-import subprocess
-from shutil import rmtree, move as shmove
-import re
-from zipfile import ZipFile
-
-BUILD_MSI = False
-SRC_ROOT = normpath(pjoin(os.getcwd(), os.pardir, os.pardir, os.pardir))
-BUILD_ROOT = os.getcwd()
-
-PYVER = '2.5'
-ARCH = 'nosse'
-
-PYEXECS = {"2.5" : "C:\python25\python.exe",
-        "2.4" : "C:\python24\python24.exe",
-        "2.3" : "C:\python23\python23.exe"}
-
-_SSE3_CFG = r"""[atlas]
-library_dirs = C:\local\lib\yop\sse3"""
-_SSE2_CFG = r"""[atlas]
-library_dirs = C:\local\lib\yop\sse2"""
-_NOSSE_CFG = r"""[atlas]
-library_dirs = fakedirectorywhichhopefullydoesnotexist
-[DEFAULT]
-library_dirs = C:\local\lib\yop\nosse"""
-
-SITECFG = {"sse2" : _SSE2_CFG, "sse3" : _SSE3_CFG, "nosse" : _NOSSE_CFG}
-
-options(
-    clean=Bunch(
-        src_dir = SRC_ROOT,
-        pyver = PYVER
-    ),
-    clean_bootstrap=Bunch(
-        src_dir = SRC_ROOT,
-        pyver = PYVER
-    ),
-    build_sdist=Bunch(
-        src_dir = SRC_ROOT
-    ),
-    build_binary=Bunch(
-        pyver = PYVER,
-        arch = ARCH,
-        src_root = SRC_ROOT
-    ),
-    bootstrap=Bunch(
-        pyver = PYVER,
-        src_root = SRC_ROOT
-    ),
-    bootstrap_arch=Bunch(
-        pyver = PYVER,
-        arch = ARCH
-    ),
-    bootstrap_nsis=Bunch(
-        pyver = PYVER,
-        src_root = SRC_ROOT
-    )
-)
-
-# Clean everything, including bootstrap source tree
- at task
-def clean():
-    raw_clean(options.src_dir, options.pyver)
-
-# Clean the bootstrap source tree for a clean build from scratch
- at task
-def clean_bootstrap():
-    raw_clean_bootstrap(options.pyver)
-
- at task
-def build_sdist():
-    raw_build_sdist(options.src_dir)
-
- at task
- at needs('build_sdist')
-def bootstrap():
-    raw_bootstrap(options.pyver, options.src_dir)
-
- at task
-def bootstrap_arch():
-    pyver = options.pyver
-    arch = options.arch
-    set_bootstrap_sources(arch, pyver)
-
- at task
-def bootstrap_nsis():
-    pyver = options.pyver
-    bdir = bootstrap_dir(options.pyver)
-    prepare_nsis_script(bdir, pyver, get_scipy_version(options.src_root))
-
- at task
-def build_binary():
-    pyver = options.pyver
-    arch = options.arch
-    raw_build_arch(pyver, arch, options.src_root)
-
- at task
- at needs('bootstrap')
- at needs('clean')
-def build_nsis():
-    scipy_verstr = get_scipy_version(options.src_root)
-    bdir = bootstrap_dir(options.pyver)
-
-    prepare_nsis_script(bdir, options.pyver, scipy_verstr)
-    for arch in ['nosse', 'sse2', 'sse3']:
-        raw_clean_bootstrap(options.pyver)
-        set_bootstrap_sources(arch, options.pyver)
-        raw_build_arch(options.pyver, arch, options.src_root)
-
-    raw_build_nsis(options.pyver)
-
-# Helpers
-def set_bootstrap_sources(arch, pyver):
-    bdir = bootstrap_dir(pyver)
-    write_site_cfg(arch, cwd=bdir)
-
-def get_sdist_tarball(src_root):
-    """Return the name of the installer built by sdist command."""
-    # Yeah, the name logic is harcoded in distutils. We have to reproduce it
-    # here
-    name = "scipy-%s.zip" % get_scipy_version(src_root)
-    return name
-
-def prepare_scipy_sources(src_root, bootstrap):
-    zid = ZipFile(pjoin(src_root, 'dist', get_sdist_tarball(src_root)))
-    root = 'scipy-%s' % get_scipy_version(src_root)
-
-    # From the sdist-built tarball, extract all files into bootstrap directory,
-    # but removing the scipy-VERSION head path
-    for name in zid.namelist():
-        cnt = zid.read(name)
-        if name.startswith(root):
-            # XXX: even on windows, the path sep in zip is '/' ?
-            name = name.split('/', 1)[1]
-        newname = pjoin(bootstrap, name)
-
-        if not pexists(dirname(newname)):
-            os.makedirs(dirname(newname))
-        fid = open(newname, 'wb')
-        fid.write(cnt)
-
-def prepare_nsis_script(bdir, pyver, numver):
-    tpl = pjoin('nsis_scripts', 'scipy-superinstaller.nsi.in')
-    source = open(tpl, 'r')
-    target = open(pjoin(bdir, 'scipy-superinstaller.nsi'), 'w')
-
-    installer_name = 'scipy-%s-win32-superpack-python%s.exe' % (numver, pyver)
-    cnt = "".join(source.readlines())
-    cnt = cnt.replace('@SCIPY_INSTALLER_NAME@', installer_name)
-    for arch in ['nosse', 'sse2', 'sse3']:
-        cnt = cnt.replace('@%s_BINARY@' % arch.upper(),
-                          get_binary_name(arch, numver))
-
-    target.write(cnt)
-
-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
-    try:
-        return PYEXECS[ver]
-    except KeyError:
-        raise ValueError("Version %s not supported/recognized" % ver)
-
-def write_site_cfg(arch, cwd=None):
-    if not cwd:
-        cwd = os.getcwd()
-
-    scfg = pjoin(cwd, "site.cfg")
-    if pexists(scfg):
-        os.remove(scfg)
-    f = open(scfg, 'w')
-    f.writelines(SITECFG[arch])
-    f.close()
-
-def move_binary(arch, pyver, cwd, scipy_verstr):
-    if not pexists(pjoin(cwd, "binaries")):
-        os.makedirs(pjoin(cwd, "binaries"))
-
-    shmove(pjoin(cwd, 'dist', get_windist_exec(pyver, scipy_verstr)),
-           pjoin(cwd, 'binaries', get_binary_name(arch, scipy_verstr)))
-
-def get_binary_name(arch, scipy_verstr):
-    if BUILD_MSI:
-        ext = '.msi'
-    else:
-        ext = '.exe'
-    return "scipy-%s-%s%s" % (scipy_verstr, arch, ext)
-
-def get_windist_exec(pyver, scipy_verstr):
-    """Return the name of the installer built by wininst command."""
-    # Yeah, the name logic is harcoded in distutils. We have to reproduce it
-    # here
-    if BUILD_MSI:
-        ext = '.msi'
-    else:
-        ext = '.exe'
-    name = "scipy-%s.win32-py%s%s" % (scipy_verstr, pyver, ext)
-    return name
-
-def raw_clean(src_dir, pyver):
-    # Clean sdist
-    sdir = pjoin(src_dir, "dist")
-    if pexists(sdir):
-        rmtree(sdir)
-    mani = pjoin(src_dir, "MANIFEST")
-    if pexists(mani):
-        os.remove(mani)
-
-    # Clean bootstrap directory
-    bdir = bootstrap_dir(pyver)
-    if pexists(bdir):
-        rmtree(bdir)
-
-def raw_clean_bootstrap(pyver):
-    bdir = bootstrap_dir(pyver)
-    for d in ["build", "dist"]:
-        if pexists(pjoin(bdir, d)):
-            rmtree(pjoin(bdir, d))
-
-    if pexists(pjoin(bdir, "site.cfg")):
-        os.remove(pjoin(bdir, "site.cfg"))
-
-def raw_build_sdist(cwd):
-    cmd = ["python", "setup.py", "sdist", "--format=zip"]
-    st = subprocess.call(cmd, cwd=cwd)
-
-def raw_bootstrap(pyver, src_dir):
-    bdir = bootstrap_dir(pyver)
-    prepare_scipy_sources(src_dir, bdir)
-
-def raw_build_arch(pyver, arch, src_root):
-    scipy_verstr = get_scipy_version(src_root)
-    bdir = bootstrap_dir(pyver)
-
-    print "Building scipy (version %s) binary for python %s, arch is %s" % \
-          (scipy_verstr, get_python_exec(pyver), arch)
-
-    if BUILD_MSI:
-        cmd = [get_python_exec(pyver), "setup.py", "build", "-c", "mingw32",
-               "bdist_msi"]
-    else:
-        cmd = [get_python_exec(pyver), "setup.py", "build", "-c", "mingw32",
-               "bdist_wininst"]
-    build_log = "build-%s-%s.log" % (arch, pyver)
-    f = open(build_log, 'w')
-
-    try:
-        try:
-            st = subprocess.call(cmd, #shell = True,
-                            stderr = subprocess.STDOUT, stdout = f,
-                            cwd=bdir)
-            if st:
-                raise RuntimeError("The cmd failed with status %d" % st)
-        finally:
-            f.close()
-    except (subprocess.CalledProcessError, RuntimeError), e:
-        print e
-        msg = """
-There was an error while executing the following command:
-
-    %s
-
-Error was : %s
-
-Look at the build log (%s).""" % (cmd, str(e), build_log)
-        raise Exception(msg)
-
-    move_binary(arch, pyver, bdir, scipy_verstr)
-
-def raw_build_nsis(pyver):
-    bdir = bootstrap_dir(options.pyver)
-    st = subprocess.call(['makensis', 'scipy-superinstaller.nsi'], 
-                         cwd=bdir)
-    if st:
-        raise RuntimeError("Error while executing makensis command")

Copied: branches/refactor_fft/tools/win32/build_scripts/pavement.py (from rev 4827, trunk/tools/win32/build_scripts/pavement.py)




More information about the Scipy-svn mailing list