Cody

Solution 1940582

Submitted on 17 Sep 2019
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   Fail
x = spdiags([1 2 3;4 5 6;7 8 9]); assert(isequal(spdiags(inv_spdiags(x)),x))

m = 0 0 0 0 0 0 0 0 0 start = 3 1 caselle = 2×0 empty double matrix m = 0 0 0 0 0 0 0 0 0 start = 1 3 caselle = 2×0 empty double matrix m = 0 0 0 0 0 0 0 0 0 start = 2 1 caselle = 3 2

Unable to perform assignment because the left and right sides have a different number of elements. Error in inv_spdiags (line 9) m(sub2ind([r,c],caselle(1,:),caselle(2,:))) = x(1:i,i) Error in Test1 (line 2) assert(isequal(spdiags(inv_spdiags(x)),x))

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

m = 0×10 empty double matrix start = -8 1 caselle = 2×0 empty double matrix m = 0×10 empty double matrix start = 1 10 caselle = 2×0 empty double matrix m = 0×10 empty double matrix start = -9 1 caselle = -8 2

Index in position 2 exceeds array bounds (must not exceed 1). Error in inv_spdiags (line 9) m(sub2ind([r,c],caselle(1,:),caselle(2,:))) = x(1:i,i) Error in Test2 (line 2) assert(isequal(spdiags(inv_spdiags(b)),b))

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

m = 0 0 0 0 0 0 start = 3 1 caselle = 2×0 empty double matrix m = 0 0 0 0 0 0 start = 1 2 caselle = 2×0 empty double matrix m = 0 0 0 0 0 0 start = 2 1 caselle = 3 2

Unable to perform assignment because the left and right sides have a different number of elements. Error in inv_spdiags (line 9) m(sub2ind([r,c],caselle(1,:),caselle(2,:))) = x(1:i,i) Error in Test3 (line 2) assert(isequal(spdiags(inv_spdiags(x)),x))

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

m = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 start = 9 1 caselle = 2×0 empty double matrix m = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 start = 1 9 caselle = 2×0 empty double matrix m = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 start = 8 1 caselle = 9 2

Unable to perform assignment because the left and right sides have a different number of elements. Error in inv_spdiags (line 9) m(sub2ind([r,c],caselle(1,:),caselle(2,:))) = x(1:i,i) Error in Test4 (line 2) assert(isequal(spdiags(inv_spdiags(y)),y))

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

m = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 start = 5 1 caselle = 2×0 empty double matrix m = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 start = 1 5 caselle = 2×0 empty double matrix m = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 start = 4 1 caselle = 5 2

Unable to perform assignment because the left and right sides have a different number of elements. Error in inv_spdiags (line 9) m(sub2ind([r,c],caselle(1,:),caselle(2,:))) = x(1:i,i) Error in Test5 (line 2) assert(isequal(spdiags(inv_spdiags(x)),x))

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

m = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 start = 10 1 caselle = 2×0 empty double matrix m = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 start = 1 10 caselle = 2×0 empty double matrix m = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 start = 9 1 caselle = 10 2

Unable to perform assignment because the left and right sides have a different number of elements. Error in inv_spdiags (line 9) m(sub2ind([r,c],caselle(1,:),caselle(2,:))) = x(1:i,i) Error in Test6 (line 2) assert(isequal(spdiags(inv_spdiags(z)),z))

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

m = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 start = 5 1 caselle = 2×0 empty double matrix m = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 start = 1 5 caselle = 2×0 empty double matrix m = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 start = 4 1 caselle = 5 2

Unable to perform assignment because the left and right sides have a different number of elements. Error in inv_spdiags (line 9) m(sub2ind([r,c],caselle(1,:),caselle(2,:))) = x(1:i,i) Error in Test7 (line 2) assert(isequal(spdiags(inv_spdiags(x)),x))

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

m = 0 0 0 0 0 0 start = 3 1 caselle = 2×0 empty double matrix m = 0 0 0 0 0 0 start = 1 2 caselle = 2×0 empty double matrix m = 0 0 0 0 0 0 start = 2 1 caselle = 3 2

Unable to perform assignment because the left and right sides have a different number of elements. Error in inv_spdiags (line 9) m(sub2ind([r,c],caselle(1,:),caselle(2,:))) = x(1:i,i) Error in Test8 (line 2) assert(isequal(spdiags(inv_spdiags(x)),x))

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

m = 0×5 empty double matrix start = -4 1 caselle = 2×0 empty double matrix

Index in position 2 exceeds array bounds. Error in inv_spdiags (line 9) m(sub2ind([r,c],caselle(1,:),caselle(2,:))) = x(1:i,i) Error in Test9 (line 2) assert(isequal(spdiags(inv_spdiags(a)),a))