Cody

# Problem 44258. Outer product of multiple vectors

Solution 1418536

Submitted on 17 Jan 2018 by David Verrelli
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

2   Pass
y = outerProduct([],[]); assert(isempty(y))

y = []

3   Pass
x = randi(100); y = randi(100); assert(isequal(outerProduct(x,y),x*y))

y = 990

4   Pass
x = randi(100,[1 100]); y = randi(100,[1 90]); assert(isequal(outerProduct(x,y),x.'*y)) assert(isequal(outerProduct(x.',y),x.'*y)) assert(isequal(outerProduct(x,y.'),x.'*y))

y = Columns 1 through 14 854 1246 798 882 294 714 812 126 1358 714 420 252 392 770 2318 3382 2166 2394 798 1938 2204 342 3686 1938 1140 684 1064 2090 915 1335 855 945 315 765 870 135 1455 765 450 270 420 825 5795 8455 5415 5985 1995 4845 5510 855 9215 4845 2850 1710 2660 5225 3904 5696 3648 4032 1344 3264 3712 576 6208 3264 1920 1152 1792 3520 4697 6853 4389 4851 1617 3927 4466 693 7469 3927 2310 1386 2156 4235 1464 2136 1368 1512 504 1224 1392 216 2328 1224 720 432 672 1320 305 445 285 315 105 255 290 45 485 255 150 90 140 275 5612 8188 5244 5796 1932 4692 5336 828 8924 4692 2760 1656 2576 5060 1586 2314 1482 1638 546 1326 1508 234 2522 1326 780 468 728 1430 3660 5340 3420 3780 1260 3060 3480 540 5820 3060 1800 1080 1680 3300 3782 5518 3534 3906 1302 3162 3596 558 6014 3162 1860 1116 1736 3410 305 445 285 315 105 255 290 45 485 255 150 90 140 275 5917 8633 5529 6111 2037 4947 5626 873 9409 4947 2910 1746 2716 5335 5307 7743 4959 5481 1827 4437 5046 783 8439 4437 2610 1566 2436 4785 5124 7476 4788 5292 1764 4284 4872 756 8148 4284 2520 1512 2352 4620 2196 3204 2052 2268 756 1836 2088 324 3492 1836 1080 648 1008 1980 5368 7832 5016 5544 1848 4488 5104 792 8536 4488 2640 1584 2464 4840 1159 1691 1083 1197 399 969 1102 171 1843 969 570 342 532 1045 2867 4183 2679 2961 987 2397 2726 423 4559 2397 1410 846 1316 2585 854 1246 798 882 294 714 812 126 1358 714 420 252 392 770 366 534 342 378 126 306 348 54 582 306 180 108 168 330 1037 1513 969 1071 357 867 986 153 1649 867 510 306 476 935 3111 4539 2907 3213 1071 2601 2958 459 4947 2601 1530 918 1428 2805 3904 5696 3648 4032 1344 3264 3712 576 6208 3264 1920 1152 1792 3520 2562 3738 2394 2646 882 2142 2436 378 4074 2142 1260 756 1176 2310 1159 1691 1083 1197 399 969 1102 171 1843 969 570 342 532 1045 1403 2047 1311 1449 483 1173 1334 207 2231 1173 690 414 644 1265 2562 3738 2394 2646 882 2142 2436 378 4074 2142 1260 756 1176 2310 2928 4272 2736 3024 1008 2448 2784 432 4656 2448 1440 864 1344 2640 5795 8455 5415 5985 1995 4845 5510 855 9215 4845 2850 1710 2660 5225 5978 8722 5586 6174 2058 4998 5684 882 9506 4998 2940 1764 2744 5390 1525 2225 1425 1575 525 1275 1450 225 2425 1275 750 450 700 1375 3904 5696 3648 4032 1344 3264 3712 576 6208 3264 1920 1152 1792 3520 2562 3738 2394 2646 882 2142 2436 378 4074 2142 1260 756 1176 2310 6100 8900 5700 6300 2100 5100 5800 900 9700 5100 3000 1800 2800 5500 5551 8099 5187 5733 1911 4641 5278 819 8827 4641 2730 1638 2548 5005 5795 8455 5415 5985 1995 4845 5510 855 9215 4845 2850 1710 2660 5225 2928 4272 2736 3024 1008 2448 2784 432 4656 2448 1440 864 1344 2640 3965 5785 3705 4095 1365 3315 3770 585 6305 3315 1950 1170 1820 3575 2562 3738 2394 2646 882 2142 2436 378 4074 2142 1260 756 1176 2310 2684 3916 2508 2772 924 2244 2552 396 4268 2244 1320 792 1232 2420 976 1424 912 1008 336 816 928 144 1552 816 480 288 448 880 3904 5696 3648 4032 1344 3264 3712 576 6208 3264 1920 1152 1792 3520 915 1335 855 945 315 765 870 135 1455 765 450 270 420 825 1586 2314 1482 1638 546 1326 1508 234 2522 1326 780 468 728 1430 5185 7565 4845 5355 1785 4335 4930 765 8245 4335 2550 1530 2380 4675 2013 2937 1881 2079 693 1683 1914 297 3201 1683 990 594 924 1815 5612 8188 5244 5796 1932 4692 5336 828 8924 4692 2760 1656 2576 5060 854 1246 798 882 294 714 812 126 1358 714 420 252 392 770 3843 5607 3591 3969 1323 3213 3654 567 6111 3213 1890 1134 1764 3465 1403 2047 1311 1449 483 1173 1334 207 2231 1173 690 414 644 1265 5185 7565 4845 5355 1785 4335 4930 765 8245 4335 2550 1530 2380 4675 4087 5963 3819 4221 1407 3417 3886 603 6499 3417 2010 1206 1876 3685 915 1335 855 945 315 765 870 135 1455 765 450 270 420 825 6100 8900 5700 6300 2100 5100 5800 900 9700 5100 3000 1800 2800 5500 427 623 399 441 147 357 406 63 679 357 210 126 196 385 2745 4005 2565 2835 945 2295 2610 405 4365 2295 1350 810 1260 2475 3660 5340 3420 3780 1260 3060 3480 540 5820 3060 1800 1080 1680 3300 ...

5   Pass
x = randi(100,[1 1000]); xc = num2cell(x); assert(isequal(outerProduct(xc{:}),prod(x)))

y = 3752 y = 1.4813e+09 y = 9.1247e+13 y = 2.4168e+18 y = 3.9426e+23 y = 4.8541e+28 y = 1.4417e+33 y = 6.8335e+37 y = 1.1087e+42 y = 1.0364e+47 y = 1.3581e+52 y = 1.5619e+57 y = 2.6879e+62 y = 5.4152e+67 y = 1.5108e+73 y = 2.3980e+77 y = 2.0546e+82 y = 9.2582e+87 y = 2.6592e+93 y = 3.1124e+98 y = 1.6967e+103 y = 2.3778e+107 y = 7.4378e+110 y = 9.8402e+114 y = 1.3093e+120 y = 1.6497e+124 y = 2.7220e+129 y = 1.2576e+133 y = 1.7933e+138 y = 1.9285e+143 y = 4.4709e+147 y = 3.6617e+151 y = 3.1784e+155 y = 1.5256e+159 y = 5.9499e+163 y = 3.7318e+168 y = 3.9990e+173 y = 6.5983e+176 y = 7.8245e+181 y = 1.5703e+186 y = 3.0150e+190 y = 1.3292e+195 y = 6.5651e+199 y = 3.7815e+204 y = 5.7653e+209 y = 7.4695e+213 y = 1.7257e+219 y = 2.5539e+224 y = 2.9114e+227 y = 5.0608e+232 y = 1.6312e+238 y = 3.1711e+243 y = 1.6073e+248 y = 1.3787e+253 y = 2.2045e+258 y = 1.2731e+263 y = 3.5062e+268 y = 7.8903e+272 y = 3.5349e+276 y = 1.9855e+281 y = 3.6796e+286 y = 7.6742e+291 y = 1.1818e+296 y = 3.4805e+300 y = 6.3359e+305 y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf y = Inf