How to divide a large sparse matrix

4 ビュー (過去 30 日間)
ektor
ektor 2017 年 4 月 15 日
回答済み: John D'Errico 2017 年 4 月 15 日
Dear all
I have
NN = speye(T) + sparse(2:T,1:(T-1),2*ones(1,T-1),T,T);
and I want to calculate
zz=(NN\( eye(T)))'.*(NN\( eye(T))) ;
for T=2000. But zz is inside a while loop and takes some time. Is there a faster approach to calculate zz?
Thanks

採用された回答

John D'Errico
John D'Errico 2017 年 4 月 15 日
You don't think it a bit silly to compute the subexpression:
NN\( eye(T))
twice instead of doing it once? Do you pay extra if you use two lines of code? I thought there was no charge for that. You must have a different license agreement.
u = NN\eye(T);
zz = u'.*u;
You also save on the extraneous use of parens, which they also don't charge you for. But that makes it a bit easier to read and follow what was done there.

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by