Extract diagonal of sparse quadratic form - MATLAB Cody - MATLAB Central

Problem 60754. Extract diagonal of sparse quadratic form

Difficulty:Rate
Consider the matrix A and vector v given by,
A=round(sprand(5e3,1e4,1/1e4*100)*100);
v=randi(10,width(A),1);
Write a routine that will return the diagonal of the quadratic form A*diag(v)*A', and which executes on the above inputs in less than 0.03 seconds.

Solution Stats

50.0% Correct | 50.0% Incorrect
Last Solution submitted on Nov 01, 2024

Problem Comments

Solution Comments

Show comments
Why should you share code?
In a discussion on LInkedin about my recent blog post, Do these...
1
2

Problem Recent Solvers4

Suggested Problems

More from this Author4

Problem Tags

Community Treasure Hunt

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

Start Hunting!