How can I create sparse symmetric positive definite linear system?

Dear All :) I'm looking for sparse symmetric positive definite linear system Ax=b. Is it possible to generate it in Matlab? I need matrix A about 50x50 (maximum 100x100 - minimum 20x20) and vector b. It might be floating point numbers... I prefer not compressed format ;)
Thank you in advance.
D.

 採用された回答

Richard Brown
Richard Brown 2013 年 8 月 6 日
編集済み: Richard Brown 2013 年 8 月 6 日

1 投票

sprandsym is what you want.
m = 50;
density = 2/m; % for example
rc = 0.1; % Reciprocal condition number
A = sprandsym(m, density, rc, 1);
If you don't want it in compressed column format
A = full(A);
Verify positive definiteness
chol(A);

4 件のコメント

D
D 2013 年 8 月 6 日
Thank you. And is it possible to generate sparse SPD but integer?
Richard Brown
Richard Brown 2013 年 8 月 7 日
Not directly, but you might try scaling and rounding results from sprandsym, or something like that
sai chand
sai chand 2019 年 7 月 17 日
How to generate the matrix b.
Can it be a random one independent of the way A is generated?
sai chand
sai chand 2019 年 7 月 17 日
I needed to generate a symmetric sparse positive definite matrix. can you help me in that?

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSparse Matrices についてさらに検索

質問済み:

D
D
2013 年 8 月 6 日

コメント済み:

2019 年 7 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by