Multiplication of a Sparse Matrix With Diagonal Matrices

4 visualizaciones (últimos 30 días)
Kamal Premaratne
Kamal Premaratne el 12 de Jun. de 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.

Respuestas (0)

Categorías

Más información sobre Sparse Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by