How to solve a linear system A * X = B when B and X are matrices instead as vectors?

2 ビュー (過去 30 日間)
Hanna Liu
Hanna Liu 2021 年 4 月 22 日
コメント済み: Star Strider 2021 年 4 月 22 日
Sovling a linear system A * X = B when X and B are matrices. If I use lsqr,then B is required to be a vector.
I could also iterate for each column of the B matrix, but that is not very computationally efficient.
Matrix A is very big, so I could not save it explicitly. I could only use a function handle to compute A * X.

回答 (2 件)

Stephan
Stephan 2021 年 4 月 22 日
編集済み: Stephan 2021 年 4 月 22 日
linsolve can handle this. From documentation (Input Arguments): "...If B is a matrix, then each column in the matrix represents a different vector for the right-hand side."
  1 件のコメント
Hanna Liu
Hanna Liu 2021 年 4 月 22 日
Thanks for the answer! My matrix A is very big. If I use linsolve, qr factorization is going to be slow and memory demanding. Is there a way to use an iterative solver similarly as lsqr?

サインインしてコメントする。


Star Strider
Star Strider 2021 年 4 月 22 日
The lsqr function is primarily used for sparse systems. There are a number of other options for iterative solutions summarised in Iterative Methods for Linear Systems. I am not certain which (if any) of these would be appropriate to your problem.
  2 件のコメント
Hanna Liu
Hanna Liu 2021 年 4 月 22 日
Thank you! I will have a look!
Star Strider
Star Strider 2021 年 4 月 22 日
My pleasure!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by