matlab - Solve Matrix with Multiple RHS -
i have problem need solve linear equations. matrix same, rhs changes (during iterative procedure). way see without repeating matrix factorization like:
[l,u] = lu(a); x = u\(l\b);
this seems clunky. there better way? can use lu factors stored in single array? tia
given system
lu*x = b
where l
lower triangular matrix , u
upper triangular matrix.
from question understand vector b
changing , keep lu
factorization constant possible vectors b
.
in other words, if have n
different b
's n
different solutions same lu
decomposition of a
.
i use forward substitution solve system
l*m = b
and backwards substitution with
u*x = m
more here.
this way keep factorization constant every vector b
.
and concerning other question, yes, possible store l
, u
matrices in single matrix. recognize diagonal of l
matrix not relevant because 1
.
Comments
Post a Comment