Permalink
Browse files

BUG: linalg: define some lapack aliases necessary for decomp_qr

  • Loading branch information...
1 parent 53728e6 commit 91ac56dfad47067fd3b3cdf1592747e02d87d971 @pv committed Nov 17, 2012
Showing with 11 additions and 13 deletions.
  1. +5 −12 scipy/linalg/decomp_qr.py
  2. +6 −1 scipy/linalg/lapack.py
@@ -4,7 +4,7 @@
# Local imports
from blas import get_blas_funcs
-from lapack import get_lapack_funcs, find_best_lapack_type
+from lapack import get_lapack_funcs
from misc import _datacopied
# XXX: what is qr_old, should it be kept?
@@ -154,10 +154,7 @@ def qr(a, overwrite_a=False, lwork=None, mode='full', pivoting=False,
elif mode == 'raw':
return ((qr, tau),) + Rj
- if find_best_lapack_type((a1,))[0] in ('s', 'd'):
- gor_un_gqr, = get_lapack_funcs(('orgqr',), (qr,))
- else:
- gor_un_gqr, = get_lapack_funcs(('ungqr',), (qr,))
+ gor_un_gqr, = get_lapack_funcs(('orgqr',), (qr,))
if M < N:
Q, = safecall(gor_un_gqr, "gorgqr/gungqr", qr[:, :M], tau,
@@ -249,11 +246,10 @@ def qr_multiply(a, c, mode='right', pivoting=False, conjugate=False,
raw = qr(a, overwrite_a, None, "raw", pivoting)
Q, tau = raw[0]
- if find_best_lapack_type((Q,))[0] in ('s', 'd'):
- gor_un_mqr, = get_lapack_funcs(('ormqr',), (Q,))
+ gor_un_mqr, = get_lapack_funcs(('ormqr',), (Q,))
+ if gor_un_mqr.typecode in ('s', 'd'):
trans = "T"
else:
- gor_un_mqr, = get_lapack_funcs(('unmqr',), (Q,))
trans = "C"
Q = Q[:, :min(M, N)]
@@ -435,10 +431,7 @@ def rq(a, overwrite_a=False, lwork=None, mode='full', check_finite=True):
if mode == 'r':
return R
- if find_best_lapack_type((a1,))[0] in ('s', 'd'):
- gor_un_grq, = get_lapack_funcs(('orgrq',), (rq,))
- else:
- gor_un_grq, = get_lapack_funcs(('ungrq',), (rq,))
+ gor_un_grq, = get_lapack_funcs(('orgrq',), (rq,))
if N < M:
# get optimal work array
@@ -22,7 +22,12 @@
elif hasattr(flapack,'empty_module'):
flapack = clapack
-_lapack_alias = {}
+# some convenience alias for complex functions
+_lapack_alias = {
+ 'corgqr': 'cungqr', 'zorgqr': 'zungqr',
+ 'cormqr': 'cunmqr', 'zormqr': 'zunmqr',
+ 'corgrq': 'cungrq', 'zorgrq': 'zungrq',
+}
def get_lapack_funcs(names, arrays=(), dtype=None):
"""Return available LAPACK function objects from names.

0 comments on commit 91ac56d

Please sign in to comment.