Incomplete LU factorization in SymPy

181 views Asked by At

I'm trying to to find a way to perform an incomplete LU factorization of a symbolic matrix in SymPy and cannot find anything helpful on my own. It's an option for solvers to use ilu as a preconditioner, but it seems there's no way to have it on its own.

Am I missing it? Is it even possible/feasible for symbolic matrices of size 20x20 and larger?

The reason I need this is because I need to approximate O(1) terms in the inverse of that symbolic matrix. I had luck with ilu and non-symbolic matrices, so I thought this may be the way. If this is relevant, the symbols are all binary variables and linear in the terms.

Update 1:

I tried to use the LU solver, but the number of variables in the matrix is much lower than the matrix dimension, so it's no option (unless there is an efficient way to compute just the very first component of the solution vector?). I also tried full LU decomposition with the additional simplification function

def simpfunc(E):
    E = E.replace(lambda e: e.is_Pow, lambda e: e.args[0])
    return E

which I do hope is correctly formulated this way, since there seems to be no example in the documentation. The idea came from the answer to a previous question here. I could additionally provide an iszerofunc because terms with more than n factors would be zero automatically, but I don't know how to check the degree of terms (example: 0.5x_0x_1x_2x_4 would be zero, while 0.8x_0x_2x_4 would not).

0

There are 0 answers