Cody

# Problem 2694. The Matrix Construction

Solution 1973968

Submitted on 13 Oct 2019
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 l1 = 1 1 0 0 0 0 0 l1 = 0 0 1 1 0 0 0 y = 1 1 0 0 0 0 0 0 0 1 1 0 0 0 l1 = 0 0 0 0 1 1 0 y = 1 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 l1 = 1 0 0 0 0 0 1 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

2   Fail
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 l1 = 1 1 0 0 0 0 l1 = 0 0 1 1 0 0 y = 1 1 0 0 0 0 0 0 1 1 0 0 l1 = 0 0 0 0 1 1 y = 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 l1 = 1 1 0 0 0 0 y = 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0

Assertion failed.

3   Fail
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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