annotate DEPENDENCIES/mingw32/Python27/Lib/site-packages/numpy/dual.py @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2a2c65a20a8b
children
rev   line source
Chris@87 1 """
Chris@87 2 Aliases for functions which may be accelerated by Scipy.
Chris@87 3
Chris@87 4 Scipy_ can be built to use accelerated or otherwise improved libraries
Chris@87 5 for FFTs, linear algebra, and special functions. This module allows
Chris@87 6 developers to transparently support these accelerated functions when
Chris@87 7 scipy is available but still support users who have only installed
Chris@87 8 Numpy.
Chris@87 9
Chris@87 10 .. _Scipy : http://www.scipy.org
Chris@87 11
Chris@87 12 """
Chris@87 13 from __future__ import division, absolute_import, print_function
Chris@87 14
Chris@87 15 # This module should be used for functions both in numpy and scipy if
Chris@87 16 # you want to use the numpy version if available but the scipy version
Chris@87 17 # otherwise.
Chris@87 18 # Usage --- from numpy.dual import fft, inv
Chris@87 19
Chris@87 20 __all__ = ['fft', 'ifft', 'fftn', 'ifftn', 'fft2', 'ifft2',
Chris@87 21 'norm', 'inv', 'svd', 'solve', 'det', 'eig', 'eigvals',
Chris@87 22 'eigh', 'eigvalsh', 'lstsq', 'pinv', 'cholesky', 'i0']
Chris@87 23
Chris@87 24 import numpy.linalg as linpkg
Chris@87 25 import numpy.fft as fftpkg
Chris@87 26 from numpy.lib import i0
Chris@87 27 import sys
Chris@87 28
Chris@87 29
Chris@87 30 fft = fftpkg.fft
Chris@87 31 ifft = fftpkg.ifft
Chris@87 32 fftn = fftpkg.fftn
Chris@87 33 ifftn = fftpkg.ifftn
Chris@87 34 fft2 = fftpkg.fft2
Chris@87 35 ifft2 = fftpkg.ifft2
Chris@87 36
Chris@87 37 norm = linpkg.norm
Chris@87 38 inv = linpkg.inv
Chris@87 39 svd = linpkg.svd
Chris@87 40 solve = linpkg.solve
Chris@87 41 det = linpkg.det
Chris@87 42 eig = linpkg.eig
Chris@87 43 eigvals = linpkg.eigvals
Chris@87 44 eigh = linpkg.eigh
Chris@87 45 eigvalsh = linpkg.eigvalsh
Chris@87 46 lstsq = linpkg.lstsq
Chris@87 47 pinv = linpkg.pinv
Chris@87 48 cholesky = linpkg.cholesky
Chris@87 49
Chris@87 50 _restore_dict = {}
Chris@87 51
Chris@87 52 def register_func(name, func):
Chris@87 53 if name not in __all__:
Chris@87 54 raise ValueError("%s not a dual function." % name)
Chris@87 55 f = sys._getframe(0).f_globals
Chris@87 56 _restore_dict[name] = f[name]
Chris@87 57 f[name] = func
Chris@87 58
Chris@87 59 def restore_func(name):
Chris@87 60 if name not in __all__:
Chris@87 61 raise ValueError("%s not a dual function." % name)
Chris@87 62 try:
Chris@87 63 val = _restore_dict[name]
Chris@87 64 except KeyError:
Chris@87 65 return
Chris@87 66 else:
Chris@87 67 sys._getframe(0).f_globals[name] = val
Chris@87 68
Chris@87 69 def restore_all():
Chris@87 70 for name in _restore_dict.keys():
Chris@87 71 restore_func(name)