suppose solving sequential generalized eigenvalue problems$$A_i x= \lambda Bx, i=1,2,3,\ldots $$In general setting, we always need to perform LU for matrix B(preconditioned) before to apply the rest iterative algorithm. Is there anumerical library(I have programming experiences with PETSc+SLEPc) or a toolkit that can allow me to separate those two parts, thus to perform LU only once? By default, LU factorization of $B$ is by direct solver, whose costs may be somewhat comparable, I suppose.Update: thanks to Arnold, but I want to modify my problem a little, where $B$ has a null vector s.t.$B\mathbf{1}=\mathbf{0},\quad \mathrm{rank}(B) = n-1$where $A_i,B$ are both $n\times n$ sparse symmetric matrix
solving generalized eigenvalue problems with the same precondition
software;eigensystem
Factor $PB=LU$ yourself and write a routine for evaluating $L^{-1}PAU^{-1}x$ given $x$ (using two backsolves). Then you can solve the problem $(L^{-1}PAU^{-1}-\lambda I)z=0$ with a standard iterative solver for the ordinary eigenvalue problem.If $B$ is singular, compute a left null space basis consisting of the rows of $M$, and a right null space basis consisting of the columns of $N$, so that $MB=0$ and $BN=0$. Then you can replace the eigenvalue problem by the modified problem with the matrices $A'=\pmatrix{A & sAN\\MA & sC}$ and $B'=\pmatrix{B & AN\\MA & C}$, with $C$ and $s$ arbitrary. If $x$ solves the original eigenvalue problem then $x'=\pmatrix{x\\0}$ is an eigenvector of the new problem with the same eigenvalue. Now the kernel of the matrix $\pmatrix{B\\MA}$ is trivial since otherwise the eigenvalue problem is ill-posed. This implies that $B'$ is a nonsingular matrix. Thus one can apply the preceding to the modified problem.The new eigenvalue problem also has the eigenvalue $s$, attained for all vectors of the form $x'=\pmatrix{0\\z}$. Therefore one should choose $s$ such that it lies somewhere in the middle of the  expected spectrum.