Skip to content

Commit fd71779

Browse files
committed
Using numpy svd instead of scipy
1 parent d9580da commit fd71779

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

mne/source_estimate.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3382,12 +3382,16 @@ def _pca_flip(flip, data):
33823382
if data.shape[0] < 2:
33833383
result = data.mean(axis=0) # Trivial accumulator
33843384
else:
3385-
U, s, V = _safe_svd(data, full_matrices=False)
33863385
# determine sign-flip.
33873386
# if flip is a mere int, multiply U and sum
33883387
if isinstance(flip, int):
3388+
# We assume here that flip is thus denoting a volumetric.
3389+
# It means LAPACK is likely to overflow on big matrices => We use numpy
3390+
U, s, V = np.linalg.svd(data, full_matrices=False)
3391+
33893392
sign = np.sign((flip * U[:, 0]).sum())
33903393
else:
3394+
U, s, V = _safe_svd(data, full_matrices=False)
33913395
sign = np.sign(np.dot(U[:, 0], flip))
33923396
# use average power in label for scaling
33933397
scale = np.linalg.norm(s) / np.sqrt(len(data))

0 commit comments

Comments
 (0)