Cody

Problem 2585. How to reverse spdiags ?

Solution 1761856

Submitted on 26 Mar 2019 by Abdelfatah Teamah
• Size: 7
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x = spdiags([1 2 3;4 5 6;7 8 9]); assert(isequal(spdiags(inv_spdiags(x)),x))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In inv_spdiags (line 2) In ScoringEngineTestPoint1 (line 2) In solutionTest (line 3)]

2   Pass
b = spdiags(eye(10)); assert(isequal(spdiags(inv_spdiags(b)),b))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In inv_spdiags (line 2) In ScoringEngineTestPoint2 (line 2) In solutionTest (line 5)]

3   Pass
x = spdiags([1 2 3;4 5 6]); assert(isequal(spdiags(inv_spdiags(x)),x))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In inv_spdiags (line 2) In ScoringEngineTestPoint3 (line 2) In solutionTest (line 7)]

4   Pass
y = spdiags(magic(9)); assert(isequal(spdiags(inv_spdiags(y)),y))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In inv_spdiags (line 2) In ScoringEngineTestPoint4 (line 2) In solutionTest (line 9)]

5   Pass
x = spdiags(magic(5)); assert(isequal(spdiags(inv_spdiags(x)),x))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In inv_spdiags (line 2) In ScoringEngineTestPoint5 (line 2) In solutionTest (line 11)]

6   Pass
z = spdiags(ones(10)); assert(isequal(spdiags(inv_spdiags(z)),z))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In inv_spdiags (line 2) In ScoringEngineTestPoint6 (line 2) In solutionTest (line 13)]

7   Pass
x = spdiags(randi(10,5)); assert(isequal(spdiags(inv_spdiags(x)),x))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In inv_spdiags (line 2) In ScoringEngineTestPoint7 (line 2) In solutionTest (line 15)]

8   Pass
x = spdiags(randi(5,[3 2])); assert(isequal(spdiags(inv_spdiags(x)),x))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In inv_spdiags (line 2) In ScoringEngineTestPoint8 (line 2) In solutionTest (line 17)]

9   Pass
a = spdiags(zeros(5)); assert(isequal(spdiags(inv_spdiags(a)),a))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In inv_spdiags (line 2) In ScoringEngineTestPoint9 (line 2) In solutionTest (line 19)]