Cody

Solution 2195221

Submitted on 6 Apr 2020
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
a=reshape(1:36,6,[]); b=[sum(a(:,1:3),2) sum(a(:,4:6),2)]; m=matrix_crunch(a); assert(max(max(abs(m-b)))<1e-10)

ans = 1 7 13 2 8 14 3 9 15 4 10 16 5 11 17 6 12 18 ans = 19 25 31 20 26 32 21 27 33 22 28 34 23 29 35 24 30 36

Output argument "y" (and maybe others) not assigned during call to "matrix_crunch". Error in Test1 (line 3) m=matrix_crunch(a);

2   Fail
a=magic(9)-30; b=[sum(a(:,1:3),2) sum(a(:,4:6),2) sum(a(:,7:9),2)]; m=matrix_crunch(a); assert(max(max(abs(m-b)))<1e-10)

ans = 17 28 39 27 38 49 37 48 -22 47 -23 -12 -24 -13 -11 -14 -3 -1 -4 -2 9 6 8 19 7 18 29 ans = 50 -29 -18 -21 -19 -8 -20 -9 2 -10 1 12 0 11 22 10 21 32 20 31 42 30 41 43 40 51 -28 ans = -7 4 15 3 14 16 13 24 26 23 25 36 33 35 46 34 45 -25 44 -26 -15 -27 -16 -5 -17 -6 5

Output argument "y" (and maybe others) not assigned during call to "matrix_crunch". Error in Test2 (line 3) m=matrix_crunch(a);

3   Fail
a=rand(12); b=[sum(a(:,1:3),2) sum(a(:,4:6),2) sum(a(:,7:9),2) sum(a(:,10:12),2)]; m=matrix_crunch(a); assert(max(max(abs(m-b)))<1e-10)

ans = 0.0787 0.8419 0.5824 0.4859 0.7960 0.4219 0.5348 0.0747 0.6377 0.3333 0.5562 0.8479 0.8085 0.1178 0.8222 0.6597 0.3657 0.0344 0.2180 0.5126 0.4110 0.4822 0.1302 0.7093 0.8081 0.4083 0.5056 0.3467 0.3102 0.6605 0.1295 0.7097 0.5798 0.5744 0.6244 0.5379 ans = 0.4321 0.8815 0.6033 0.8097 0.8395 0.7128 0.5910 0.6289 0.3308 0.6961 0.0576 0.0257 0.7862 0.5933 0.8246 0.0671 0.2788 0.4076 0.6532 0.8355 0.5189 0.7506 0.8498 0.6141 0.8878 0.2890 0.2536 0.0323 0.0597 0.6835 0.7607 0.0101 0.9716 0.3585 0.1402 0.9502 ans = 0.3289 0.1274 0.2134 0.5980 0.1922 0.2768 0.1170 0.1624 0.8930 0.1591 0.9602 0.9169 0.8579 0.3286 0.8510 0.4057 0.0461 0.8131 0.9153 0.4494 0.1403 0.3943 0.5388 0.5106 0.4192 0.1861 0.5670 0.3480 0.8481 0.8916 0.0200 0.7971 0.7685 0.0566 0.4068 0.0878 ans = 0.6665 0.2161 0.2194 0.9749 0.5886 0.3126 0.7810 0.8151 0.7048 0.5153 0.5117 0.7238 0.0853 0.5642 0.1021 0.9054 0.7310 0.4824 0.2012 0.5122 0.9469 0.3277 0.1880 0.2173 0.4669 0.9702 0.8487 0.7066 0.2433 0.8186 0.6810 0.1910 0.4142 0.1041 0.1888 0.8679

Output argument "y" (and maybe others) not assigned during call to "matrix_crunch". Error in Test3 (line 3) m=matrix_crunch(a);

4   Fail
a=ones(18); b=3*ones(18,6); m=matrix_crunch(a); assert(max(max(abs(m-b)))<1e-10)

ans = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ans = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ans = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ans = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ans = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ans = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Output argument "y" (and maybe others) not assigned during call to "matrix_crunch". Error in Test4 (line 3) m=matrix_crunch(a);

5   Fail
a=magic(15)+j.*flipud(magic(15)); a=a(1:10,:)-rand(10,15); b=[sum(a(:,1:3),2) sum(a(:,4:6),2) sum(a(:,7:9),2) sum(a(:,10:12),2) sum(a(:,13:15),2)]; m=matrix_crunch(a); assert(max(max(abs(m-b)))<1e-10)

ans = 1.0e+02 * 1.2148 + 1.0600i 1.3891 + 1.2300i 1.5510 + 1.4000i 1.3797 + 1.0500i 1.5414 + 1.0700i 1.7185 + 1.2400i 1.5302 + 0.8900i 1.7013 + 0.9100i 1.8742 + 1.0800i 1.6906 + 0.7300i 1.8649 + 0.9000i 2.0355 + 0.9200i 1.8531 + 0.5700i 2.0290 + 0.7400i 2.1961 + 0.7600i 2.0111 + 0.4100i 2.1866 + 0.5800i 0.1040 + 0.7500i 2.1754 + 0.2500i 0.0976 + 0.4200i 0.2618 + 0.5900i 0.0827 + 0.0900i 0.2545 + 0.2600i 0.4234 + 0.4300i 0.2469 + 2.1800i 0.4182 + 0.1000i 0.5872 + 0.2700i 0.4066 + 2.0200i 0.5750 + 2.1900i 0.7494 + 0.1100i ans = 1.0e+02 * 1.7228 + 1.5700i 1.8905 + 1.7400i 2.0625 + 1.9100i 1.8879 + 1.4100i 2.0516 + 1.5800i 2.2283 + 1.7500i 2.0473 + 1.2500i 2.2144 + 1.4200i 0.1314 + 1.5900i 2.2012 + 1.0900i 0.1298 + 1.2600i 0.2917 + 1.4300i 0.1150 + 0.9300i 0.2889 + 1.1000i 0.3070 + 1.2700i 0.2770 + 0.7700i 0.4414 + 0.9400i 0.4650 + 1.1100i 0.4330 + 0.6100i 0.4542 + 0.7800i 0.6225 + 0.9500i 0.5995 + 0.6000i 0.6104 + 0.6200i 0.7819 + 0.7900i 0.6006 + 0.4400i 0.7776 + 0.4600i 0.9478 + 0.6300i 0.7626 + 0.2800i 0.9328 + 0.4500i 1.1027 + 0.4700i ans = 1.0e+02 * 2.2328 + 2.0800i 0.0097 + 2.2500i 0.1780 + 0.0200i 0.1438 + 1.9200i 0.1687 + 2.0900i 0.3341 + 2.1100i 0.1565 + 1.7600i 0.3293 + 1.9300i 0.4930 + 2.1000i 0.3191 + 1.6000i 0.4865 + 1.7700i 0.6564 + 1.9400i 0.4740 + 1.4400i 0.6439 + 1.6100i 0.8175 + 1.7800i 0.6332 + 1.2800i 0.8098 + 1.4500i 0.9738 + 1.6200i 0.7927 + 1.1200i 0.9685 + 1.2900i 1.1365 + 1.4600i 0.9522 + 0.9600i 1.1296 + 1.1300i 1.2941 + 1.3000i 1.1161 + 0.8000i 1.2884 + 0.9700i 1.4562 + 1.1400i 1.2752 + 0.6400i 1.4475 + 0.8100i 1.6183 + 0.9800i ans = 1.0e+02 * 0.3410 + 0.1900i 0.5157 + 0.3600i 0.6887 + 0.5300i 0.5065 + 0.0300i 0.6786 + 0.2000i 0.8482 + 0.3700i 0.6604 + 2.1200i 0.8330 + 0.0400i 1.0060 + 0.2100i 0.8265 + 1.9600i 0.9947 + 2.1300i 1.1691 + 0.0500i 0.9847 + 1.9500i 1.1521 + 1.9700i 1.3272 + 2.1400i 1.1402 + 1.7900i 1.3159 + 1.8100i 1.4832 + 1.9800i 1.3093 + 1.6300i 1.4787 + 1.8000i 1.6480 + 1.8200i 1.4605 + 1.4700i 1.6372 + 1.6400i 1.6565 + 1.6600i 1.6250 + 1.3100i 1.7953 + 1.4800i 1.8121 + 1.6500i 1.7832 + 1.1500i 1.8081 + 1.3200i 1.9707 + 1.4900i ans = 1.0e+02 * 0.8592 + 0.7000i 1.0204 + 0.8700i 1.1970 + 1.0400i 1.0112 + 0.5400i 1.1822 + 0.7100i 1.2055 + 0.8800i 1.1706 + 0.3800i 1.3461 + 0.5500i 1.3611 + 0.7200i 1.3400 + 0.2200i 1.3532 + 0.3900i 1.5235 + 0.5600i 1.4974 + 0.0600i 1.5106 + 0.2300i 1.6856 + 0.4000i 1.5021 + 2.1500i 1.6759 + 0.0700i 1.8484 + 0.2400i 1.6665 + 1.9900i 1.8307 + 2.1600i 2.0014 + 0.0800i 1.8263 + 1.8300i 1.9989 + 2.0000i 2.1690 + 2.1700i 1.9815 + 1.6700i 2.1579 + 1.8400i 0.0747 + 2.0100i 2.1474 + 1.5100i 0.0654 + 1.6800i 0.2383 + 1.8500i

Output argument "y" (and maybe others) not assigned during call to "matrix_crunch". Error in Test5 (line 4) m=matrix_crunch(a);