Saving memory by reusing a variable name?

1 回表示 (過去 30 日間)
Uri Shalit
Uri Shalit 2011 年 2 月 22 日
I have a code that uses pretty large files which causes some memory problems.
In my code I have a very large sparse matrix X, which I then multiply by a small dense matrix A. My question is, does the code:
Y=AX; clear X;
use less space when compared with:
X=AX;
  1 件のコメント
Oliver Woodford
Oliver Woodford 2011 年 2 月 22 日
I think you mean A*X (in MATLAB syntax).

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

回答 (1 件)

Matt Tearle
Matt Tearle 2011 年 2 月 22 日
I'd guess they'd be the same. Matrix multiply requires having to make an intermediate variable anyway (behind the scenes, if not explicitly).

カテゴリ

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