Problem 2585. How to reverse spdiags?
The spdiags function extracts all nonzero diagonals from the m-by-n matrix A.
So if
A = [1 2 3;4 5 6;7 8 9]
then
spdiags(A) = [7 4 1 0 0;
0 8 5 2 0;
0 0 9 6 3]
But if I give you spdiags(A), can you give me A ?
Solution Stats
Problem Comments
-
1 Comment
Paul Berglund
on 5 Oct 2014
% this problem is not guaranteed solvable
isequal(spdiags([eye(5) zeros(5)]),spdiags(eye(5)))
Solution Comments
Show commentsProblem Recent Solvers38
Suggested Problems
-
3381 Solvers
-
Project Euler: Problem 1, Multiples of 3 and 5
3384 Solvers
-
middleAsColumn: Return all but first and last element as a column vector
613 Solvers
-
Longest run of consecutive numbers
5840 Solvers
-
Arrange vector in ascending order
785 Solvers
More from this Author43
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!