Cody

Solution 1992520

Submitted on 27 Oct 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
assert(isempty(maxdiag([])))

k = 0

Output argument "y" (and maybe others) not assigned during call to "maxdiag". Error in Test1 (line 1) assert(isempty(maxdiag([])))

2   Fail
x = randi(100); assert(isequal(maxdiag(x),x))

k = 0.5000

Output argument "y" (and maybe others) not assigned during call to "maxdiag". Error in Test2 (line 2) assert(isequal(maxdiag(x),x))

3   Fail
x = randi(100,100,1); assert(isequal(maxdiag(x),x(end:-1:1)'))

k = 0.5000

Output argument "y" (and maybe others) not assigned during call to "maxdiag". Error in Test3 (line 2) assert(isequal(maxdiag(x),x(end:-1:1)'))

4   Fail
x = randi(100,1,100); assert(isequal(maxdiag(x),x))

k = 50

Output argument "y" (and maybe others) not assigned during call to "maxdiag". Error in Test4 (line 2) assert(isequal(maxdiag(x),x))

5   Fail
x = eye(2); assert(isequal(maxdiag(x),[0 1 0]))

k = 1

Output argument "y" (and maybe others) not assigned during call to "maxdiag". Error in Test5 (line 2) assert(isequal(maxdiag(x),[0 1 0]))

6   Fail
x = magic(3); assert(isequal(maxdiag(x),[4 9 8 7 6]))

k = 1.5000

Output argument "y" (and maybe others) not assigned during call to "maxdiag". Error in Test6 (line 2) assert(isequal(maxdiag(x),[4 9 8 7 6]))

7   Fail
x = flipud(hankel(1:1000)); assert(isequal(maxdiag(x),[1:1000,zeros(1,1000-1)]))

k = 500

Output argument "y" (and maybe others) not assigned during call to "maxdiag". Error in Test7 (line 2) assert(isequal(maxdiag(x),[1:1000,zeros(1,1000-1)]))

8   Fail
x = toeplitz(1:1000); assert(isequal(maxdiag(x),[1000:-1:1,2:1000]))

k = 500

Output argument "y" (and maybe others) not assigned during call to "maxdiag". Error in Test8 (line 2) assert(isequal(maxdiag(x),[1000:-1:1,2:1000]))

9   Fail
N = randi(1000); x = fliplr(toeplitz(1:N)); assert(isequal(maxdiag(x),[1:N,N-1:-1:1]))

k = 351

Output argument "y" (and maybe others) not assigned during call to "maxdiag". Error in Test9 (line 3) assert(isequal(maxdiag(x),[1:N,N-1:-1:1]))

10   Fail
x = magic(10); x = x(:,1:3); assert(isequal(maxdiag(x),[11 18 100 94 17 86 93 87 98 92 99 1]))

k = 1.5000

Output argument "y" (and maybe others) not assigned during call to "maxdiag". Error in Test10 (line 3) assert(isequal(maxdiag(x),[11 18 100 94 17 86 93 87 98 92 99 1]))

11   Fail
x = hankel(-4:0,0:-2:-16); assert(isequal(maxdiag(x),[0 -1 0 -1 0 -1 0 -1 0 -2 -4 -6 -8]))

k = 4.5000

Output argument "y" (and maybe others) not assigned during call to "maxdiag". Error in Test11 (line 2) assert(isequal(maxdiag(x),[0 -1 0 -1 0 -1 0 -1 0 -2 -4 -6 -8]))