Cody

Solution 1846132

Submitted on 11 Jun 2019 by Jean-Marie Sainthillier
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
filetext = fileread('polyMult.m'); assert(~contains(filetext,'regexp'))

2   Pass
c1 = randi(1000); c2 = randi(1000); assert(isequal(c1*c2,polyMult(c1,c2)))

3   Pass
c1 = [0 -1; 0 0; 1 0]; c2 = [1; -2]; c = [0 -1; 0 2; 1 0; -2 0]; assert(isequal(c,polyMult(c1,c2)))

4   Pass
c1 = [0 -1; 0 0; 1 0]; c2 = reshape([1; -2],[1 1 2]); c = reshape([0 0 1 -1 0 0 0 0 -2 2 0 0],[3 2 2]); assert(isequal(c,polyMult(c1,c2)))

5   Pass
c1 = reshape([0 0 0 1 -1 0 0 0],[4 1 2]); c2 = [0 -1; 0 0; 1 0]; c3 = zeros([3 3 3]); c3([9 21 25]) = [1 1 1]; c3(27) = -1; c4 = reshape([1; -2],[1 1 2]); c = zeros(8,4,5); c([56 91 104 118 126 139 149 153]) = -2*ones(1,8); c([30 53 78 88 92 101 115 123]) = -1*ones(1,8); c([24 59 72 86 94 107 117 121]) = 1*ones(1,8); c([62 85 110 120 124 133 147 155]) = 2*ones(1,8); assert(isequal(c,polyMult(c1,polyMult(c2,polyMult(c3,c4)))))

6   Pass
c1 = randi(1000,[2 3 4]); c2 = randi(1000,[4 5 1]); assert(isequal(polyMult(c1,c2),polyMult(c2,c1)))