Multiplication of a Sparse Matrix With Diagonal Matrices

4 vues (au cours des 30 derniers jours)
Kamal Premaratne
Kamal Premaratne le 12 Juin 2020
I have a sparse m x m square matrix L (which is actually a Laplacian matrix of a large graph) and an m x1 vector d. I want to create a diaognal matrix D whose diagonal is populated with the entries in d and then generate
normL = D * L * D
Currently, I am creating a sparse diaognal matrix as
D = spdiags(d, 0, m, m)
and then I use D * L * D.
I wonder whether there is a more efficient way to do this given that the (i, j)-th elements of normL and L are related by
normL(i, j) = D(i) * D(j) * L(i, j).
Thank you very much.

Réponses (0)

Catégories

En savoir plus sur Sparse 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