Effacer les filtres
Effacer les filtres

faster leftdivide given prior information

1 vue (au cours des 30 derniers jours)
REDI PONI
REDI PONI le 16 Déc 2019
Commenté : Christine Tobler le 17 Déc 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

Réponse acceptée

Steven Lord
Steven Lord le 16 Déc 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 commentaire
Christine Tobler
Christine Tobler le 17 Déc 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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Operating on Diagonal Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by