Cody

Solution 2581147

Submitted on 18 Jun 2020 by Jerry Wright
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 = []; y_correct = []; assert(isequal(common_by_row(x),y_correct))

u = 0×1 empty double column vector

2   Pass
x = [1e100; 1e100]; y_correct = [1e100]; assert(isequal(common_by_row(x),y_correct))

u = 1.0000e+100 z = 1.0000e+100 a = 2×1 logical array 1 1 s = 2 y = 1.0000e+100

3   Pass
x = [1; 2]; y_correct = []; assert(isequal(common_by_row(x),y_correct))

u = 1 2 z = 1 a = 2×1 logical array 1 0 s = 1 z = 2 a = 2×1 logical array 0 1 s = 1

4   Pass
x = ones(10); y_correct = [1]; assert(isequal(common_by_row(x),y_correct))

u = 1 z = 1 a = 10×1 logical array 1 1 1 1 1 1 1 1 1 1 s = 10 y = 1

5   Pass
x = magic(10); y_correct = []; assert(isequal(common_by_row(x),y_correct))

u = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 z = 1 a = 10×1 logical array 1 0 0 0 0 0 0 0 0 0 s = 1 z = 2 a = 10×1 logical array 0 0 0 0 1 0 0 0 0 0 s = 1 z = 3 a = 10×1 logical array 0 0 0 1 0 0 0 0 0 0 s = 1 z = 4 a = 10×1 logical array 0 0 1 0 0 0 0 0 0 0 s = 1 z = 5 a = 10×1 logical array 0 0 0 0 0 0 1 0 0 0 s = 1 z = 6 a = 10×1 logical array 0 0 0 0 0 0 0 1 0 0 s = 1 z = 7 a = 10×1 logical array 0 1 0 0 0 0 0 0 0 0 s = 1 z = 8 a = 10×1 logical array 1 0 0 0 0 0 0 0 0 0 s = 1 z = 9 a = 10×1 logical array 0 0 0 0 1 0 0 0 0 0 s = 1 z = 10 a = 10×1 logical array 0 0 0 0 0 0 0 0 1 0 s = 1 z = 11 a = 10×1 logical array 0 0 0 0 0 0 0 0 0 1 s = 1 z = 12 a = 10×1 logical array 0 0 0 0 0 0 0 0 1 0 s = 1 z = 13 a = 10×1 logical array 0 0 0 0 0 0 0 1 0 0 s = 1 z = 14 a = 10×1 logical array 0 1 0 0 0 0 0 0 0 0 s = 1 z = 15 a = 10×1 logical array 1 0 0 0 0 0 0 0 0 0 s = 1 z = 16 a = 10×1 logical array 0 1 0 0 0 0 0 0 0 0 s = 1 z = 17 a = 10×1 logical array 0 0 0 0 0 1 0 0 0 0 s = 1 z = 18 a = 10×1 logical array 0 0 0 0 0 0 0 0 0 1 s = 1 z = 19 a = 10×1 logical array 0 0 0 1 0 0 0 0 0 0 s = 1 z = 20 a = 10×1 logical array 0 0 1 0 0 0 0 0 0 0 s = 1 z = 21 a = 10×1 logical array 0 0 0 1 0 0 0 0 0 0 s = 1 z = 22 a = 10×1 logical array 0 0 1 0 0 0 0 0 0 0 s = 1 z = 23 a = 10×1 logical array 0 0 0 0 0 0 1 0 0 0 s = 1 z = 24 a = 10×1 logical array 0 0 0 0 0 1 0 0 0 0 s = 1 z = 25 a = 10×1 logical array 0 0 0 0 1 0 0 0 0 0 s = 1 z = 26 a = 10×1 logical array 0 0 0 0 0 1 0 0 0 0 s = 1 z = 27 a = 10×1 logical array 0 0 0 0 0 0 0 0 0 1 s = 1 z = 28 a = 10×1 logical array 0 0 0 1 0 0 0 0 0 0 s = 1 z = 29 a = 10×1 logical array 0 0 0 0 0 0 0 1 0 0 s = 1 z = 30 a = 10×1 logical array 0 0 0 0 0 0 1 0 0 0 s = 1 z = 31 a = 10×1 logical array 0 0 0 0 0 0 0 1 0 0 s = 1 z = 32 a = 10×1 logical array 0 0 0 0 0 0 1 0 0 0 s = 1 z = 33 a = 10×1 logical array 0 0 0 0 0 1 0 0 0 0 s = 1 z = 34 a = 10×1 logical array 0 0 0 0 1 0 0 0 0 0 s = 1 z = 35 a = 10×1 logical array 0 0 0 0 0 0 0 0 1 0 s = 1 z = 36 a = 10×1 logical array 0 0 0 0 0 0 0 0 0 1 s = 1 z = 37 a = 10×1 logical array 0 0 0 0 0 0 0 0 1 0 s = 1 z = 38 a = 10×1 logical array 0 0 0 0 0 0 0 1 0 0 s = 1 z = 39 a = 10×1 logical array 0 0 0 0 0 0 1 0 0 0 s = 1 z = 40 a = 10×1 logical array 1 0 0 0 0 0 0 0 0 0 s = 1 z = 41 a = 10×1 logical array 0 1 0 0 0 0 0 0 0 0 s = 1 z = 42 a = 10×1 logical array 0 0 0 0 0 1 0 0 0 0 s = 1 z = 43 a = 10×1 logical array 0 0 0 0 0 0 0 0 0 1 s = 1 z = 44 a = 10×1 logical array 0 0 0 0 0 0 0 0 1 0 s = 1 z = 45 a = 10×1 logical array 0 0 0 0 0 0 0 1 0 0 s = 1 z = 46 a = 10×1 logical array 0 0 0 0 0 0 0 0 1 0 s = 1 z = 47 a = 10×1 logical array 0 0 1 0 0 0 0 0 0 0 s = 1 z = 48 a = 10×1 logical array 0 0 0 0 0 0 1 0 0 0 s = 1 z = 49 a = 10×1 logical array 0 0 0 0 0 1 0 0 0 0 s = 1 z = 50 a = 10×1 logical array 0 0 0 0 0 0 0 0 0 1 s = 1 z = 51 a = 10×1 logical array 1 0 0 0 0 0 0 0 0 0 s = 1 z = 52 a = 10×1 logical array 0 0 0 0 1 0 0 0 0 0 s = 1 z = 53 a = 10×1 logical array 0 0 0 0 0 0 0 0 1 0 s = 1 z = 54 a = 10×1 logical array 0 0 1 0 0 0 0 0 0 0 s = 1 z = 55 a = 10×1 logical array 0 1 0 0 0 0 0 0 0 0 s = 1 z = 56 a = 10×1 logical array 0 0 1 0 0 0 0 0 0 0 s = 1 z = 57 a = 10×1 logical array 0 1 0 0 0 0 0 0 0 0 s = 1 z = 58 a = 10×1 logical array 1 0 0 0 0 0 0 0 0 0 s = 1 z = 59 a = 10×1 logical array 0 0 0 0 0 0 0 0 0 1 s = 1 z = 60 a = 10×1 logical array 0 0 0 1 0 0 0 0 0 0 s = 1 z = 61 a = 10×1 logical array 0 0 0 0 1 0 0 0 0 0 s = 1 z = 62 a = 10×1 logical array 0 0 0 1 0 0 0 0 0 0 s = 1 z = 63 a = 10×1 logical array 0 0 1 0 0 0 0 0 0 0 s = 1 z = 64 a = 10×1 logical array 0 1 0 0 0 0 0 0 0 0 s = 1 z = 65 a = 10×1 logical array 0 0 0 0 0 1 0 0 0 0 s = 1 z = 66 a = 10×1 logical array 0 0 0 0 0 0 1 0 0 0 s = 1 z = 67 a = 10×1 logical array 1 0 0 0 0 0 0 0 0 0 s = 1 z = 68 a = 10×1 logical array 0 0 0 0 1 0 0 0 0 0 s = 1 z = 69 a = 10×1 logical array 0 0 0 1 0 0 0 0 0 0 s = 1 z = 70 a = 10×1 logical array 0 0 1 0 0 0 0 0 0 0 s = 1 z = 71 a = 10×1 logical array 0 0 0 1 0 0 0 0 0 0 s = 1 z = 72 a = 10×1 logical array 0 0 0 0 0 0 0 1 0 0 s = 1 z = 73 a = 10×1 logical array 0 1 0 0 0 0 0 0 0 0 s = 1 z = 74 a = 10×1 logical array 1 0 0 0 0 0 0 0 0 0 s = 1 z = 75 a = 10×1 logical array 0 0 0 0 1 0 0 0 0 0 s = 1 z = 76 a = 10×1 logical array 0 0 0 0 0 1 0 0 0 0 s = 1 z = 77 a = 10×1 logical array 0 0 0 0 0 0 0 0 0 1 s = 1 z = 78 a = 10×1 logical array 0 0 0 0 0 0 0 0 1 0 s = 1 z = 79 a = 10×1 logical array 0 0 0 0 0 0 0 1 0 0 s = 1 z = 80 a = 10×1 logical array 0 1 0 0 0 0 0 0 0 0 s = 1 z = 81 a = 10×1 logical array 0 0 1 0 0 0 0 0 0 0 s = 1 z = 82 a = 10×1 logical array 0 0 0 0 0 0 1 0 0 0 s = 1 z = 83 a = 10×1 logical array 0 0 0 0 0 1 0 0 0 0 s = 1 z = 84 a = 10×1 logical array 0 0 0 0 0 0 0 0 0 1 s = 1 z = 85 a = 10×1 logical array 0 0 0 1 0 0 0 0 0 0 s = 1 z = 86 a = 10×1 logical array 0 0 0 0 1 0 0 0 0 0 s = 1 z = 87 a = 10×1 logical array 0 0 0 1 0 0 0 0 0 0 ...

6   Pass
x = wilkinson(9); y_correct = [0 1]; assert(isequal(common_by_row(x),y_correct))

u = 0 1 2 3 4 z = 0 a = 9×1 logical array 1 1 1 1 1 1 1 1 1 s = 9 y = 0 z = 1 a = 9×1 logical array 1 1 1 1 1 1 1 1 1 s = 9 y = 0 1 z = 2 a = 9×1 logical array 0 0 1 0 0 0 1 0 0 s = 2 z = 3 a = 9×1 logical array 0 1 0 0 0 0 0 1 0 s = 2 z = 4 a = 9×1 logical array 1 0 0 0 0 0 0 0 1 s = 2

7   Pass
x = [3 -2 1 NaN; NaN 0 -2 3]; y_correct = [-2 3]; assert(isequal(common_by_row(x),y_correct))

u = -2 0 1 3 NaN NaN z = -2 a = 2×1 logical array 1 1 s = 2 y = -2 z = 0 a = 2×1 logical array 0 1 s = 1 z = 1 a = 2×1 logical array 1 0 s = 1 z = 3 a = 2×1 logical array 1 1 s = 2 y = -2 3 z = NaN a = 2×1 logical array 0 0 s = 0 z = NaN a = 2×1 logical array 0 0 s = 0