File: common.py

package info (click to toggle)
python-scipy 0.7.2%2Bdfsg1-1%2Bdeb6u1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze-lts
  • size: 28,572 kB
  • ctags: 36,183
  • sloc: cpp: 216,880; fortran: 76,016; python: 71,833; ansic: 62,118; makefile: 243; sh: 17
file content (52 lines) | stat: -rw-r--r-- 1,358 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import numpy as np

from scipy.lib.lapack import flapack, clapack

FUNCS_TP = {'ssygv' : np.float32,
         'dsygv': np.float,
         'ssygvd' : np.float32,
         'dsygvd' : np.float,
         'ssyev' : np.float32,
         'dsyev': np.float,
         'ssyevr' : np.float32,
         'dsyevr' : np.float,
         'ssyevr' : np.float32,
         'dsyevr' : np.float,
         'sgehrd' : np.float32,
         'dgehrd' : np.float,
         'sgebal' : np.float32,
         'dgebal': np.float}

# Test FLAPACK if not empty
if hasattr(flapack, 'empty_module'):
    FLAPACK_IS_EMPTY = True
else:
    FLAPACK_IS_EMPTY = False

# Test CLAPACK if not empty and not the same as clapack
if hasattr(clapack, 'empty_module') or (clapack == flapack):
    CLAPACK_IS_EMPTY = True
else:
    CLAPACK_IS_EMPTY = False

funcs = ['ssygv', 'dsygv', 'ssygvd', 'dsygvd', 'ssyev', 'dsyev', 'ssyevr',
         'dsyevr', 'sgehrd', 'dgehrd', 'sgebal', 'dgebal']

if not FLAPACK_IS_EMPTY:
    FUNCS_FLAPACK = {}
    for f in funcs:
        FUNCS_FLAPACK[f] = getattr(flapack, f)
else:
    FUNCS_FLAPACK = None

if not CLAPACK_IS_EMPTY:
    FUNCS_CLAPACK = {}
    for f in funcs:
        try:
            FUNCS_CLAPACK[f] = getattr(clapack, f)
        except AttributeError:
            FUNCS_CLAPACK[f] = None
else:
    FUNCS_CLAPACK = None

PREC = {np.float32: 5, np.float: 12}