Cody

# Problem 2694. The Matrix Construction

Solution 1709941

Submitted on 18 Jan 2019 by HH
• Size: 9
• This is the leading solution.
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
CN = 7; Dim = 2; Y= [1 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 1] assert(isequal(MatrixProduction(CN,Dim),Y))

Y = 1 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 1 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In MatrixProduction (line 2) In ScoringEngineTestPoint1 (line 8) In solutionTest (line 3)]

2   Pass
CN = 6; Dim = 2; Y= [1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 ] assert(isequal(MatrixProduction(CN,Dim),Y))

Y = 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In MatrixProduction (line 2) In ScoringEngineTestPoint2 (line 6) In solutionTest (line 5)]

3   Pass
CN = 10; Dim = 1; Y= eye(10) assert(isequal(MatrixProduction(CN,Dim),Y))

Y = 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In MatrixProduction (line 2) In ScoringEngineTestPoint3 (line 4) In solutionTest (line 7)]

4   Pass
CN = 12; Dim = 3; Y= [ 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1] assert(isequal(MatrixProduction(CN,Dim),Y))

Y = 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In MatrixProduction (line 2) In ScoringEngineTestPoint4 (line 7) In solutionTest (line 9)]

5   Pass
CN = 17; Dim = 7; Y= [1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 ]; assert(isequal(MatrixProduction(CN,Dim),Y))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In MatrixProduction (line 2) In ScoringEngineTestPoint5 (line 6) In solutionTest (line 11)]

6   Pass
CN = 20; Dim = 10; Y= [ones(1,10) zeros(1,10); zeros(1,10) ones(1,10)]; assert(isequal(MatrixProduction(CN,Dim),Y))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In MatrixProduction (line 2) In ScoringEngineTestPoint6 (line 4) In solutionTest (line 13)]