diff --git a/pyamg/multilevel.py b/pyamg/multilevel.py index bb5636f7..79d0ed75 100644 --- a/pyamg/multilevel.py +++ b/pyamg/multilevel.py @@ -3,6 +3,7 @@ from warnings import warn import scipy as sp +from scipy.linalg import pinv import scipy.sparse.linalg as sla from scipy.sparse.linalg import LinearOperator import numpy as np @@ -13,14 +14,6 @@ from .relaxation import smoothing from .util import upcast -# hack to compare the version of scipy -# int(''.join('1.7'.split('.')[:2])) = 17 -spversion = sp.__version__ -if int(''.join(spversion.split('.')[:2])) >= 17: - from scipy.linalg import pinv # pylint: disable=ungrouped-imports -else: - from scipy.linalg import pinv2 as pinv # pylint: disable=no-name-in-module - class MultilevelSolver: """Stores multigrid hierarchy and implements the multigrid cycle. diff --git a/pyamg/util/linalg.py b/pyamg/util/linalg.py index 6be4cadf..0f1da681 100644 --- a/pyamg/util/linalg.py +++ b/pyamg/util/linalg.py @@ -526,11 +526,11 @@ def ishermitian(A, fast_check=True, tol=1e-6, verbose=False): A = np.asarray(A) if fast_check: - x = np.random.rand(A.shape[0], 1) - y = np.random.rand(A.shape[0], 1) + x = np.random.rand(A.shape[0]) + y = np.random.rand(A.shape[0]) if A.dtype == complex: - x = x + 1.0j*np.random.rand(A.shape[0], 1) - y = y + 1.0j*np.random.rand(A.shape[0], 1) + x = x + 1.0j*np.random.rand(A.shape[0]) + y = y + 1.0j*np.random.rand(A.shape[0]) xAy = np.dot((A.dot(x)).conjugate().T, y) xAty = np.dot(x.conjugate().T, A.dot(y)) diff = float(np.abs(xAy - xAty) / np.sqrt(np.abs(xAy*xAty)))