Filter löschen
Filter löschen

faster leftdivide given prior information

1 Ansicht (letzte 30 Tage)
REDI PONI
REDI PONI am 16 Dez. 2019
Kommentiert: Christine Tobler am 17 Dez. 2019
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

Akzeptierte Antwort

Steven Lord
Steven Lord am 16 Dez. 2019
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 Kommentar
Christine Tobler
Christine Tobler am 17 Dez. 2019
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Operating on Diagonal Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by