フィルターのクリア

faster leftdivide given prior information

1 回表示 (過去 30 日間)
REDI PONI
REDI PONI 2019 年 12 月 16 日
コメント済み: Christine Tobler 2019 年 12 月 17 日
Hi,
Among other calculation in my code there is a part where i use :
c=A\b;
Where A is sparse diagonal matrix (~100k x 100k) .
I am not sure whether checking of the matrix A properties takes considerable time or not.
Given that i already know that A is diagonal, is it possible to speed up the computation and avoid checkups for choosing solver?
thanks in advance,
redi

採用された回答

Steven Lord
Steven Lord 2019 年 12 月 16 日
The linsolve or decomposition functions may be of interest to you. decomposition may be particularly beneficial if you're solving multiple systems with the same A matrix.
Though if you're certain A is a diagonal matrix, I'd probably try calling diag then using element-wise division between b and that diagonal (or if possible skipping creating A altogether and just create its diagonal as a vector instead.)
  1 件のコメント
Christine Tobler
Christine Tobler 2019 年 12 月 17 日
Note linsolve only supports dense matrices, so wouldn't be ideal here. In general, decomposition can be used to skip some input checking in A\b. But I agree for a diagonal matrix, the cheapest will be to just compute the diagonal vector d (as a column vector, e.g. by call d = diag(A)) and call d.\b instead.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOperating on Diagonal Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by