Does Matlab use a QR or LU decomposition when solving a matrix equation?

3 ビュー (過去 30 日間)
David
David 2012 年 7 月 13 日
When Matlab computes A\B or A\b does it first compute the LU decomposition of A or the QR decomposition? I'm having accuracy issues and trying to compare my answers to those I get in C using LAPACK.
Thanks very much.
David

採用された回答

Honglei Chen
Honglei Chen 2012 年 7 月 16 日
There are actually some information regarding you question in the documentation
  1 件のコメント
David
David 2012 年 7 月 16 日
Thanks a whole lot. I feel a bit silly that I missed that when I scanned it.

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

その他の回答 (1 件)

Paul Metcalf
Paul Metcalf 2012 年 7 月 16 日
編集済み: Paul Metcalf 2012 年 7 月 16 日
I don't know the answer to your question, but you will need to provide more details to get a proper response to your question. For example:
  1. Is your matrix A square?
  2. What is the size/order of A?
  3. When using C/LAPACK, what data types have you cast for A?
  4. Are your results only slightly different or dramatically different?
MATLAB using DOUBLE arithmetic for all internal operations. If you are not using real64 types in C, then you might be accumulating quantisation errors...
  2 件のコメント
David
David 2012 年 7 月 16 日
編集済み: David 2012 年 7 月 16 日
1/ The matrix is square, so there's no least-squares solution or anything of that sort
2/ It's order 484
3/ A is double precision in C. On my architecture there's not much gain from single precision and it's not so big that I run into memory issues.
4/ The answers were pretty dramatically different, but it's that the LU decomposition I was using was screwing up. The QR was the right one. Sometimes slower is better!
Looks like the documentation said QR, so that's it. Thanks!
Paul Metcalf
Paul Metcalf 2012 年 7 月 18 日
Glad you got it sorted. Out of curiosity, how long does your solution take?

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

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by