Skip to content

Commit 7c36b55

Browse files
author
Ralf Gommers
committed
Merge pull request scipy#2768 from argriffing/lax-fractional-matrix-power-singularity
TST: mark a fractional_matrix_power test as knownfail
2 parents ba8eec1 + b1d4749 commit 7c36b55

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

scipy/linalg/_matfuncs_inv_ssq.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,9 +627,12 @@ def _remainder_matrix_power(A, t):
627627
32 (3). pp. 1056-1078. ISSN 0895-4798
628628
629629
"""
630+
# This code block is copied from numpy.matrix_power().
630631
A = np.asarray(A)
631632
if len(A.shape) != 2 or A.shape[0] != A.shape[1]:
632-
raise ValueError('expected a square matrix')
633+
raise ValueError('input must be a square array')
634+
635+
# Get the number of rows and columns.
633636
n, n = A.shape
634637

635638
# Triangularize the matrix if necessary,

scipy/linalg/tests/test_matfuncs.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -509,21 +509,16 @@ def test_type_conversion_mixed_sign_or_complex_spectrum(self):
509509
A_power = fractional_matrix_power(A, p)
510510
assert_(A_power.dtype.char in complex_dtype_chars)
511511

512+
@decorators.knownfailureif(True, 'Too unstable across LAPACKs.')
512513
def test_singular(self):
513514
# Negative fractional powers do not work with singular matrices.
514-
# Neither do non-integer fractional powers,
515-
# because the scaling and squaring cannot deal with it.
516515
for matrix_as_list in (
517516
[[0, 0], [0, 0]],
518517
[[1, 1], [1, 1]],
519518
[[1, 2], [3, 6]],
520519
[[0, 0, 0], [0, 1, 1], [0, -1, 1]]):
521520

522-
# check that the spectrum has the expected properties
523-
W = scipy.linalg.eigvals(matrix_as_list)
524-
assert_(np.sum(W != 0) < len(W))
525-
526-
# check fractional powers both for float and for complex types
521+
# Check fractional powers both for float and for complex types.
527522
for newtype in (float, complex):
528523
A = np.array(matrix_as_list, dtype=newtype)
529524
for p in (-0.7, -0.9, -2.4, -1.3):

0 commit comments

Comments
 (0)