Create an identity matrix with an optional diagonal offset.
Numeric.create.eye(height, columns = height, offset = 0)Builds an identity matrix with a shifted diagonal.
- Parameters:
height: Number of rows in the matrixcolumns: Number of columns in the matrixoffset: Diagonal offset of the ones
- Returns: Identity matrix
- NumPy: Covers
np.eye,np.identitythrough a single Numerix method.
import Numeric from '@neabyte/numerix'
const matrix = Numeric.create.eye(3)
console.log(matrix)
// [[1,0,0],[0,1,0],[0,0,1]]import Numeric from '@neabyte/numerix'
const matrix = Numeric.create.eye(2, 3)
console.log(matrix)
// [[1,0,0],[0,1,0]]import Numeric from '@neabyte/numerix'
const matrix = Numeric.create.eye(3, 3, 1)
console.log(matrix)
// [[0,1,0],[0,0,1],[0,0,0]]import Numeric from '@neabyte/numerix'
const matrix = Numeric.create.eye(1, 2)
console.log(matrix)
// [[1,0]]