Euler_Salter
Euler_Salter

Reputation: 3571

R solving multiple linear systems where each RHS is a column of a matrix

I know I can solve the system Lx = b where L is upper-triangular using backsolve in R. However, now I have a matrix B where each column of B is a right hand side of Lx = b. Basically I want to solve Lx = b where b is every column of the matrix B. Is there a way of doing this more efficiently than just a loop?

I'm not posting a MWE because I'm pretty sure there should be a function to do this.

Upvotes: 0

Views: 94

Answers (1)

ThomasIsCoding
ThomasIsCoding

Reputation: 102730

Maybe you can try the following approach

x <- ginv(L)%*%b

Upvotes: 1

Related Questions