Cody

Solution 2195216

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)

x = 1 7 13 19 25 31 2 8 14 20 26 32 3 9 15 21 27 33 4 10 16 22 28 34 5 11 17 23 29 35 6 12 18 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)

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

x = 0.5760 0.6335 0.8570 0.9019 0.8599 0.7392 0.5273 0.3289 0.6532 0.8533 0.7264 0.4741 0.2180 0.6822 0.8805 0.6694 0.9923 0.4130 0.3990 0.6007 0.6129 0.6260 0.4852 0.7609 0.7352 0.1580 0.6886 0.3925 0.0440 0.4579 0.7435 0.4279 0.1665 0.7281 0.1289 0.7770 0.0249 0.8521 0.6665 0.8702 0.2849 0.6588 0.3256 0.0576 0.5752 0.7240 0.2162 0.5603 0.7760 0.3102 0.1362 0.1925 0.8585 0.7672 0.3162 0.7391 0.8457 0.2575 0.3300 0.7330 0.5452 0.9929 0.7841 0.7425 0.5424 0.4381 0.0748 0.2997 0.1188 0.3578 0.5037 0.2190 0.2984 0.7683 0.5595 0.2206 0.0028 0.2527 0.9876 0.7078 0.9481 0.8716 0.8559 0.6938 0.3669 0.3719 0.3467 0.4582 0.6163 0.4686 0.5778 0.8472 0.7697 0.4479 0.8187 0.4241 0.2930 0.5728 0.6788 0.8720 0.1824 0.8890 0.0381 0.6106 0.0983 0.3841 0.8974 0.8290 0.8428 0.3577 0.5687 0.1531 0.8256 0.3320 0.6292 0.3096 0.2617 0.3708 0.6135 0.4302 0.0566 0.0135 0.5855 0.5895 0.1546 0.6429 0.7265 0.1190 0.6060 0.2911 0.3290 0.0549 0.2751 0.2885 0.1611 0.3442 0.2450 0.8835 0.8092 0.1614 0.2411 0.0203 0.9295 0.3604

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)

x = 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 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 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 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 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 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)

x = 1.0e+02 * Columns 1 through 9 1.2187 + 1.0600i 1.3817 + 1.2300i 1.5549 + 1.4000i 1.7203 + 1.5700i 1.8939 + 1.7400i 2.0677 + 1.9100i 2.2387 + 2.0800i 0.0011 + 2.2500i 0.1778 + 0.0200i 1.3702 + 1.0500i 1.5428 + 1.0700i 1.7156 + 1.2400i 1.8817 + 1.4100i 2.0503 + 1.5800i 2.2271 + 1.7500i 0.1457 + 1.9200i 0.1647 + 2.0900i 0.3357 + 2.1100i 1.5372 + 0.8900i 1.7093 + 0.9100i 1.8785 + 1.0800i 2.0492 + 1.2500i 2.2198 + 1.4200i 0.1318 + 1.5900i 0.1578 + 1.7600i 0.3298 + 1.9300i 0.4920 + 2.1000i 1.6909 + 0.7300i 1.8676 + 0.9000i 2.0373 + 0.9200i 2.2067 + 1.0900i 0.1263 + 1.2600i 0.2955 + 1.4300i 0.3190 + 1.6000i 0.4844 + 1.7700i 0.6568 + 1.9400i 1.8571 + 0.5700i 2.0260 + 0.7400i 2.1979 + 0.7600i 0.1150 + 0.9300i 0.2880 + 1.1000i 0.3002 + 1.2700i 0.4795 + 1.4400i 0.6454 + 1.6100i 0.8130 + 1.7800i 2.0141 + 0.4100i 2.1869 + 0.5800i 0.1074 + 0.7500i 0.2797 + 0.7700i 0.4492 + 0.9400i 0.4671 + 1.1100i 0.6352 + 1.2800i 0.8038 + 1.4500i 0.9780 + 1.6200i 2.1785 + 0.2500i 0.0958 + 0.4200i 0.2608 + 0.5900i 0.4307 + 0.6100i 0.4538 + 0.7800i 0.6229 + 0.9500i 0.7997 + 1.1200i 0.9614 + 1.2900i 1.1377 + 1.4600i 0.0890 + 0.0900i 0.2512 + 0.2600i 0.4295 + 0.4300i 0.5987 + 0.6000i 0.6107 + 0.6200i 0.7813 + 0.7900i 0.9551 + 0.9600i 1.1277 + 1.1300i 1.2951 + 1.3000i 0.2429 + 2.1800i 0.4191 + 0.1000i 0.5830 + 0.2700i 0.6083 + 0.4400i 0.7775 + 0.4600i 0.9496 + 0.6300i 1.1196 + 0.8000i 1.2805 + 0.9700i 1.4533 + 1.1400i 0.4012 + 2.0200i 0.5748 + 2.1900i 0.7452 + 0.1100i 0.7633 + 0.2800i 0.9376 + 0.4500i 1.1025 + 0.4700i 1.2741 + 0.6400i 1.4480 + 0.8100i 1.6159 + 0.9800i Columns 10 through 15 0.3464 + 0.1900i 0.5128 + 0.3600i 0.6870 + 0.5300i 0.8531 + 0.7000i 1.0206 + 0.8700i 1.1919 + 1.0400i 0.5082 + 0.0300i 0.6737 + 0.2000i 0.8432 + 0.3700i 1.0177 + 0.5400i 1.1870 + 0.7100i 1.2009 + 0.8800i 0.6618 + 2.1200i 0.8330 + 0.0400i 1.0044 + 0.2100i 1.1797 + 0.3800i 1.3400 + 0.5500i 1.3700 + 0.7200i 0.8264 + 1.9600i 0.9929 + 2.1300i 1.1684 + 0.0500i 1.3375 + 0.2200i 1.3528 + 0.3900i 1.5298 + 0.5600i 0.9852 + 1.9500i 1.1506 + 1.9700i 1.3280 + 2.1400i 1.4970 + 0.0600i 1.5106 + 0.2300i 1.6804 + 0.4000i 1.1451 + 1.7900i 1.3105 + 1.8100i 1.4808 + 1.9800i 1.5041 + 2.1500i 1.6789 + 0.0700i 1.8451 + 0.2400i 1.3051 + 1.6300i 1.4744 + 1.8000i 1.6484 + 1.8200i 1.6629 + 1.9900i 1.8370 + 2.1600i 2.0007 + 0.0800i 1.4653 + 1.4700i 1.6397 + 1.6400i 1.6509 + 1.6600i 1.8206 + 1.8300i 1.9967 + 2.0000i 2.1640 + 2.1700i 1.6225 + 1.3100i 1.7993 + 1.4800i 1.8161 + 1.6500i 1.9871 + 1.6700i 2.1552 + 1.8400i 0.0799 + 2.0100i 1.7886 + 1.1500i 1.8082 + 1.3200i 1.9739 + 1.4900i 2.1428 + 1.5100i 0.0624 + 1.6800i 0.2328 + 1.8500i

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