Cody

# Problem 752. Is X a Fibonacci Matrix?

Solution 2049051

Submitted on 6 Dec 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
x = [0 1;1 1]; tf = true; assert(isequal(isFibMat(x),tf)) clear all;

q = 0 1 1 1 z = 2×2 logical array 1 1 1 1 m = 1 1 1 1 tf = 1

2   Fail
x = [1 0;1 1]; tf = false; assert(isequal(isFibMat(x),tf)) clear all;

q = 0 1 1 1 z = 2×2 logical array 1 1 1 1 m = 1 1 1 1 tf = 1

Assertion failed.

3   Fail
x = [0 1;1 1]^40; tf = true; assert(isequal(isFibMat(x),tf)) clear all;

q = 0 1 1 1 z = 2×2 logical array 0 0 0 0 m = 1 1 1 1 tf = 0

Assertion failed.

4   Pass
x = [0 1;1 1]^40+1; tf = false; assert(isequal(isFibMat(x),tf)) clear all;

q = 0 1 1 1 z = 2×2 logical array 0 0 0 0 m = 1 1 1 1 tf = 0

5   Fail
x = [0 1;1 1]^17; tf = true; assert(isequal(isFibMat(x),tf)) clear all;

q = 0 1 1 1 z = 2×2 logical array 0 0 0 0 m = 1 1 1 1 tf = 0

Assertion failed.

6   Pass
x = [0 1;1 1]^17-5; tf = false; assert(isequal(isFibMat(x),tf)) clear all;

q = 0 1 1 1 z = 2×2 logical array 0 0 0 0 m = 1 1 1 1 tf = 0

7   Fail
x = [0 0 1;0 1 1;1 1 1]^3; tf = false; assert(isequal(isFibMat(x),tf)) clear all;

q = 0 1 1 1 z = 3×3 logical array 1 0 0 0 0 0 0 0 0 m = 1 1 1 1

Matrix dimensions must agree. Error in isFibMat (line 8) if z==m Error in Test7 (line 3) assert(isequal(isFibMat(x),tf))

8   Fail
x = [0 0 1;0 1 1]; tf = false; assert(isequal(isFibMat(x),tf)) clear all;

q = 0 1 1 1 z = 2×3 logical array 1 1 1 1 1 1 m = 1 1 1 1

Matrix dimensions must agree. Error in isFibMat (line 8) if z==m Error in Test8 (line 3) assert(isequal(isFibMat(x),tf))

9   Fail
x = [[0 1;1 1]^3 [5; 8]]; tf = false; assert(isequal(isFibMat(x),tf)) clear all;

q = 0 1 1 1 z = 2×3 logical array 1 0 0 0 0 0 m = 1 1 1 1

Matrix dimensions must agree. Error in isFibMat (line 8) if z==m Error in Test9 (line 3) assert(isequal(isFibMat(x),tf))

10   Fail
x = uint8([0 1; 1 1]^5); tf = true; assert(isequal(isFibMat(x),tf)) clear all;

q = 0 1 1 1 z = 2×2 logical array 0 0 0 0 m = 1 1 1 1 tf = 0

Assertion failed.

11   Pass
x = -([0 1; 1 1]^5); tf = false; assert(isequal(isFibMat(x),tf)) clear all;

q = 0 1 1 1 z = 2×2 logical array 0 0 0 0 m = 1 1 1 1 tf = 0

12   Pass
x = [0 1; 1 1]^5; x(2) = nan; tf = false; assert(isequal(isFibMat(x),tf)) clear all;

q = 0 1 1 1 z = 2×2 logical array 0 0 0 0 m = 1 1 1 1 tf = 0

13   Pass
x = [4 7;7 11]; tf = false; assert(isequal(isFibMat(x),tf)) clear all;

q = 0 1 1 1 z = 2×2 logical array 0 0 0 0 m = 1 1 1 1 tf = 0

14   Fail
for ii = 1:55 assert(true==isFibMat([0 1;1 1]^ii)) end

q = 0 1 1 1 z = 2×2 logical array 1 1 1 1 m = 1 1 1 1 tf = 1 q = 0 1 1 1 z = 2×2 logical array 1 1 1 0 m = 1 1 1 1 tf = 0

Assertion failed.