1
s (ones), and all the other elements are all 0
s (zeroes).
n
as a parameter and returns the identity matrix of order \( n \times n \).
idMatrix
should be a function.
testString: assert(typeof idMatrix=='function');
- text: idMatrix(1)
should return an array.
testString: assert(Array.isArray(idMatrix(1)));
- text: idMatrix(1)
should return [ [ 1 ] ]
.
testString: assert.deepEqual(idMatrix(1),results[0]);
- text: idMatrix(2)
should return [ [ 1, 0 ], [ 0, 1 ] ]
.
testString: assert.deepEqual(idMatrix(2),results[1]);
- text: idMatrix(3)
should return [ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ]
.
testString: assert.deepEqual(idMatrix(3),results[2]);
- text: idMatrix(4)
should return [ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ]
.
testString: assert.deepEqual(idMatrix(4),results[3]);
```