Skip to content

Commit 91cac26

Browse files
authored
Merge pull request #237 from mohamed82008/fix_223
Fix #223 - lobpcg matrix size too small
2 parents 610c3f8 + 06269bd commit 91cac26

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/lobpcg.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,7 @@ function lobpcg(A, B, largest, X0;
831831
n = size(X, 1)
832832
sizeX = size(X, 2)
833833
sizeX > n && throw("X column dimension exceeds the row dimension")
834+
3*sizeX > n && throw("The LOBPCG algorithms is not stable to use when the matrix size is less than 3 times the block size. Please use a dense solver instead.")
834835

835836
iterator = LOBPCGIterator(A, B, largest, X, P, C)
836837

@@ -930,6 +931,7 @@ function lobpcg(A, B, largest::Bool, X0, nev::Int;
930931
n = size(X0, 1)
931932
sizeX = size(X0, 2)
932933
nev > n && throw("Number of eigenvectors desired exceeds the row dimension.")
934+
3*sizeX > n && throw("The LOBPCG algorithms is not stable to use when the matrix size is less than 3 times the block size. Please use a dense solver instead.")
933935

934936
sizeX = min(nev, sizeX)
935937
X = X0[:, 1:sizeX]

0 commit comments

Comments
 (0)