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 a numerical 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