Cody

Solution 1932843

Submitted on 12 Sep 2019 by 3-2
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(:,:,1) = [1 2 3;4 5 6;7 8 9]; x(:,:,2) = [1 4 7;2 5 8;3 6 9]; x(:,:,3) = [1 2 3;1 2 3;1 2 3]; y_correct(:,:,1) = [1 0 0;4 5 0;7 8 9]; y_correct(:,:,2) = [1 0 0;2 5 0;3 6 9]; y_correct(:,:,3) = [1 0 0;1 2 0;1 2 3]; assert(isequal(tril3(x),y_correct))

y = 1 0 0 4 5 0 7 8 9 y(:,:,1) = 1 0 0 4 5 0 7 8 9 y(:,:,2) = 1 0 0 2 5 0 3 6 9 y(:,:,1) = 1 0 0 4 5 0 7 8 9 y(:,:,2) = 1 0 0 2 5 0 3 6 9 y(:,:,3) = 1 0 0 1 2 0 1 2 3

2   Pass
x = cumsum(ones(3,3,50)); y_correct = repmat([1 0 0;2 2 0; 3 3 3],[1,1,50]); assert(isequal(tril3(x),y_correct))

y = 1 0 0 2 2 0 3 3 3 y(:,:,1) = 1 0 0 2 2 0 3 3 3 y(:,:,2) = 1 0 0 2 2 0 3 3 3 y(:,:,1) = 1 0 0 2 2 0 3 3 3 y(:,:,2) = 1 0 0 2 2 0 3 3 3 y(:,:,3) = 1 0 0 2 2 0 3 3 3 y(:,:,1) = 1 0 0 2 2 0 3 3 3 y(:,:,2) = 1 0 0 2 2 0 3 3 3 y(:,:,3) = 1 0 0 2 2 0 3 3 3 y(:,:,4) = 1 0 0 2 2 0 3 3 3 y(:,:,1) = 1 0 0 2 2 0 3 3 3 y(:,:,2) = 1 0 0 2 2 0 3 3 3 y(:,:,3) = 1 0 0 2 2 0 3 3 3 y(:,:,4) = 1 0 0 2 2 0 3 3 3 y(:,:,5) = 1 0 0 2 2 0 3 3 3 y(:,:,1) = 1 0 0 2 2 0 3 3 3 y(:,:,2) = 1 0 0 2 2 0 3 3 3 y(:,:,3) = 1 0 0 2 2 0 3 3 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:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,7) = 0.9697 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,7) = 0.9697 y(:,:,8) = 0.8403 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,7) = 0.9697 y(:,:,8) = 0.8403 y(:,:,9) = 0.8377 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,7) = 0.9697 y(:,:,8) = 0.8403 y(:,:,9) = 0.8377 y(:,:,10) = 0.8763 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,7) = 0.9697 y(:,:,8) = 0.8403 y(:,:,9) = 0.8377 y(:,:,10) = 0.8763 y(:,:,11) = 0.5190 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,7) = 0.9697 y(:,:,8) = 0.8403 y(:,:,9) = 0.8377 y(:,:,10) = 0.8763 y(:,:,11) = 0.5190 y(:,:,12) = 0.9188 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,7) = 0.9697 y(:,:,8) = 0.8403 y(:,:,9) = 0.8377 y(:,:,10) = 0.8763 y(:,:,11) = 0.5190 y(:,:,12) = 0.9188 y(:,:,13) = 0.0057 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,7) = 0.9697 y(:,:,8) = 0.8403 y(:,:,9) = 0.8377 y(:,:,10) = 0.8763 y(:,:,11) = 0.5190 y(:,:,12) = 0.9188 y(:,:,13) = 0.0057 y(:,:,14) = 0.8345 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,7) = 0.9697 y(:,:,8) = 0.8403 y(:,:,9) = 0.8377 y(:,:,10) = 0.8763 y(:,:,11) = 0.5190 y(:,:,12) = 0.9188 y(:,:,13) = 0.0057 y(:,:,14) = 0.8345 y(:,:,15) = 0.6100 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,7) = 0.9697 y(:,:,8) = 0.8403 y(:,:,9) = 0.8377 y(:,:,10) = 0.8763 y(:,:,11) = 0.5190 y(:,:,12) = 0.9188 y(:,:,13) = 0.0057 y(:,:,14) = 0.8345 y(:,:,15) = 0.6100 y(:,:,16) = 0.1414 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,7) = 0.9697 y(:,:,8) = 0.8403 y(:,:,9) = 0.8377 y(:,:,10) = 0.8763 y(:,:,11) = 0.5190 y(:,:,12) = 0.9188 y(:,:,13) = 0.0057 y(:,:,14) = 0.8345 y(:,:,15) = 0.6100 y(:,:,16) = 0.1414 y(:,:,17) = 0.1034 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,7) = 0.9697 y(:,:,8) = 0.8403 y(:,:,9) = 0.8377 y(:,:,10) = 0.8763 y(:,:,11) = 0.5190 y(:,:,12) = 0.9188 y(:,:,13) = 0.0057 y(:,:,14) = 0.8345 y(:,:,15) = 0.6100 y(:,:,16) = 0.1414 y(:,:,17) = 0.1034 y(:,:,18) = 0.0720 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,7) = 0.9697 y(:,:,8) = 0.8403 y(:,:,9) = 0.8377 y(:,:,10) = 0.8763 y(:,:,11) = 0.5190 y(:,:,12) = 0.9188 y(:,:,13) = 0.0057 y(:,:,14) = 0.8345 y(:,:,15) = 0.6100 y(:,:,16) = 0.1414 y(:,:,17) = 0.1034 y(:,:,18) = 0.0720 y(:,:,19) = 0.1843 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,7) = 0.9697 y(:,:,8) = 0.8403 y(:,:,9) = 0.8377 y(:,:,10) = 0.8763 y(:,:,11) = 0.5190 y(:,:,12) = 0.9188 y(:,:,13) = 0.0057 y(:,:,14) = 0.8345 y(:,:,15) = 0.6100 y(:,:,16) = 0.1414 y(:,:,17) = 0.1034 y(:,:,18) = 0.0720 y(:,:,19) = 0.1843 y(:,:,20) = 0.6295 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,7) = 0.9697 y(:,:,8) = 0.8403 y(:,:,9) = 0.8377 y(:,:,10) = 0.8763 y(:,:,11) = 0.5190 y(:,:,12) = 0.9188 y(:,:,13) = 0.0057 y(:,:,14) = 0.8345 y(:,:,15) = 0.6100 y(:,:,16) = 0.1414 y(:,:,17) = 0.1034 y(:,:,18) = 0.0720 y(:,:,19) = 0.1843 y(:,:,20) = 0.6295 y(:,:,21) = 0.5277 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,7) = 0.9697 y(:,:,8) = 0.8403 y(:,:,9) = 0.8377 y(:,:,10) = 0.8763 y(:,:,11) = 0.5190 y(:,:,12) = 0.9188 y(:,:,13) = 0.0057 y(:,:,14) = 0.8345 y(:,:,15) = 0.6100 y(:,:,16) = 0.1414 y(:,:,17) = 0.1034 y(:,:,18) = 0.0720 y(:,:,19) = 0.1843 y(:,:,20) = 0.6295 y(:,:,21) = 0.5277 y(:,:,22) = 0.3761 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,7) = 0.9697 y(:,:,8) = 0.8403 y(:,:,9) = 0.8377 y(:,:,10) = 0.8763 y(:,:,11) = 0.5190 y(:,:,12) = 0.9188 y(:,:,13) = 0.0057 y(:,:,14) = 0.8345 y(:,:,15) = 0.6100 y(:,:,16) = 0.1414 y(:,:,17) = 0.1034 y(:,:,18) = 0.0720 y(:,:,19) = 0.1843 y(:,:,20) = 0.6295 y(:,:,21) = 0.5277 y(:,:,22) = 0.3761 y(:,:,23) = 0.0382 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,7) = 0.9697 y(:,:,8) = 0.8403 y(:,:,9) = 0.8377 y(:,:,10) = 0.8763 y(:,:,11) = 0.5190 y(:,:,12) = 0.9188 y(:,:,13) = 0.0057 y(:,:,14) = 0.8345 y(:,:,15) = 0.6100 y(:,:,16) = 0.1414 y(:,:,17) = 0.1034 y(:,:,18) = 0.0720 y(:,:,19) = 0.1843 y(:,:,20) = 0.6295 y(:,:,21) = 0.5277 y(:,:,22) = 0.3761 y(:,:,23) = 0.0382 y(:,:,24) = 0.0066 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,7) = 0.9697 y(:,:,8) = 0.8403 y(:,:,9) = 0.8377 y(:,:,10) = 0.8763 y(:,:,11) = 0.5190 y(:,:,12) = 0.9188 y(:,:,13) = 0.0057 y(:,:,14) = 0.8345 y(:,:,15) = 0.6100 y(:,:,16) = 0.1414 y(:,:,17) = 0.1034 y(:,:,18) = 0.0720 y(:,:,19) = 0.1843 y(:,:,20) = 0.6295 y(:,:,21) = 0.5277 y(:,:,22) = 0.3761 y(:,:,23) = 0.0382 y(:,:,24) = 0.0066 y(:,:,25) = 0.5022 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,7) = 0.9697 y(:,:,8) = 0.8403 y(:,:,9) = 0.8377 y(:,:,10) = 0.8763 y(:,:,11) = 0.5190 y(:,:,12) = 0.9188 y(:,:,13) = 0.0057 y(:,:,14) = 0.8345 y(:,:,15) = 0.6100 y(:,:,16) = 0.1414 y(:,:,17) = 0.1034 y(:,:,18) = 0.0720 y(:,:,19) = 0.1843 y(:,:,20) = 0.6295 y(:,:,21) = 0.5277 y(:,:,22) = 0.3761 y(:,:,23) = 0.0382 y(:,:,24) = 0.0066 y(:,:,25) = 0.5022 y(:,:,26) = 0.4826 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,7) = 0.9697 y(:,:,8) = 0.8403 y(:,:,9) = 0.8377 y(:,:,10) = 0.8763 y(:,:,11) = 0.5190 y(:,:,12) = 0.9188 y(:,:,13) = 0.0057 y(:,:,14) = 0.8345 y(:,:,15) = 0.6100 y(:,:,16) = 0.1414 y(:,:,17) = 0.1034 y(:,:,18) = 0.0720 y(:,:,19) = 0.1843 y(:,:,20) = 0.6295 y(:,:,21) = 0.5277 y(:,:,22) = 0.3761 y(:,:,23) = 0.0382 y(:,:,24) = 0.0066 y(:,:,25) = 0.5022 y(:,:,26) = 0.4826 y(:,:,27) = 0.3728 y(:,:,1) = 0.1298 y(:,:,2) = 0.6923 y(:,:,3) = 0.9173 y(:,:,4) = 0.8455 y(:,:,5) = 0.5426 y(:,:,6) = 0.9694 y(:,:,7) = 0.9697 y(:,:,8) = 0.8403 y(:,:,9) = 0.8377 y(:,:,10) = 0.8763 y(:,:,11) = 0.5190 y(:,:,12) = 0.9188 y(:,:,13) = 0.0057 y(:,:,14) = 0.8345 y(:,:,15) = 0.6100 y(:,:...

5   Pass
x = reshape(1:40,[2,2,10]); y_correct(:,:,1) = [1 0;2 4]; y_correct(:,:,2) = [5 0;6 8]; y_correct(:,:,3) = [9 0;10 12]; y_correct(:,:,4) = [13 0;14 16]; y_correct(:,:,5) = [17 0;18 20]; y_correct(:,:,6) = [21 0;22 24]; y_correct(:,:,7) = [25 0;26 28]; y_correct(:,:,8) = [29 0;30 32]; y_correct(:,:,9) = [33 0;34 36]; y_correct(:,:,10) = [37 0;38 40]; assert(isequal(tril3(x),y_correct))

y = 1 0 2 4 y(:,:,1) = 1 0 2 4 y(:,:,2) = 5 0 6 8 y(:,:,1) = 1 0 2 4 y(:,:,2) = 5 0 6 8 y(:,:,3) = 9 0 10 12 y(:,:,1) = 1 0 2 4 y(:,:,2) = 5 0 6 8 y(:,:,3) = 9 0 10 12 y(:,:,4) = 13 0 14 16 y(:,:,1) = 1 0 2 4 y(:,:,2) = 5 0 6 8 y(:,:,3) = 9 0 10 12 y(:,:,4) = 13 0 14 16 y(:,:,5) = 17 0 18 20 y(:,:,1) = 1 0 2 4 y(:,:,2) = 5 0 6 8 y(:,:,3) = 9 0 10 12 y(:,:,4) = 13 0 14 16 y(:,:,5) = 17 0 18 20 y(:,:,6) = 21 0 22 24 y(:,:,1) = 1 0 2 4 y(:,:,2) = 5 0 6 8 y(:,:,3) = 9 0 10 12 y(:,:,4) = 13 0 14 16 y(:,:,5) = 17 0 18 20 y(:,:,6) = 21 0 22 24 y(:,:,7) = 25 0 26 28 y(:,:,1) = 1 0 2 4 y(:,:,2) = 5 0 6 8 y(:,:,3) = 9 0 10 12 y(:,:,4) = 13 0 14 16 y(:,:,5) = 17 0 18 20 y(:,:,6) = 21 0 22 24 y(:,:,7) = 25 0 26 28 y(:,:,8) = 29 0 30 32 y(:,:,1) = 1 0 2 4 y(:,:,2) = 5 0 6 8 y(:,:,3) = 9 0 10 12 y(:,:,4) = 13 0 14 16 y(:,:,5) = 17 0 18 20 y(:,:,6) = 21 0 22 24 y(:,:,7) = 25 0 26 28 y(:,:,8) = 29 0 30 32 y(:,:,9) = 33 0 34 36 y(:,:,1) = 1 0 2 4 y(:,:,2) = 5 0 6 8 y(:,:,3) = 9 0 10 12 y(:,:,4) = 13 0 14 16 y(:,:,5) = 17 0 18 20 y(:,:,6) = 21 0 22 24 y(:,:,7) = 25 0 26 28 y(:,:,8) = 29 0 30 32 y(:,:,9) = 33 0 34 36 y(:,:,10) = 37 0 38 40

6   Pass
x = randi([0 1],[4,4,5]); y_correct(:,:,1) = tril(x(:,:,1)); y_correct(:,:,2) = tril(x(:,:,2)); y_correct(:,:,3) = tril(x(:,:,3)); y_correct(:,:,4) = tril(x(:,:,4)); y_correct(:,:,5) = tril(x(:,:,5)); assert(isequal(tril3(x),y_correct))

y = 0 0 0 0 0 1 0 0 1 0 0 0 1 0 1 1 y(:,:,1) = 0 0 0 0 0 1 0 0 1 0 0 0 1 0 1 1 y(:,:,2) = 0 0 0 0 1 0 0 0 1 0 0 0 1 0 1 1 y(:,:,1) = 0 0 0 0 0 1 0 0 1 0 0 0 1 0 1 1 y(:,:,2) = 0 0 0 0 1 0 0 0 1 0 0 0 1 0 1 1 y(:,:,3) = 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 y(:,:,1) = 0 0 0 0 0 1 0 0 1 0 0 0 1 0 1 1 y(:,:,2) = 0 0 0 0 1 0 0 0 1 0 0 0 1 0 1 1 y(:,:,3) = 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 y(:,:,4) = 1 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 y(:,:,1) = 0 0 0 0 0 1 0 0 1 0 0 0 1 0 1 1 y(:,:,2) = 0 0 0 0 1 0 0 0 1 0 0 0 1 0 1 1 y(:,:,3) = 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 y(:,:,4) = 1 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 y(:,:,5) = 1 0 0 0 1 1 0 0 0 0 1 0 1 1 1 0