function _identityVector(size, format) {
    switch (size.length) {
      case 0:
        return format ? matrix(format) : [];

      case 1:
        return _identity(size[0], size[0], format);

      case 2:
        return _identity(size[0], size[1], format);

      default:
        throw new Error('Vector containing two values expected');
    }
  }
Create a 2-dimensional identity matrix with size m x n or n x n.
The matrix has ones on the diagonal and zeros elsewhere.

Syntax:

   math.identity(n)
   math.identity(n, format)
   math.identity(m, n)
   math.identity(m, n, format)
   math.identity([m, n])
   math.identity([m, n], format)

Examples:

   math.identity(3)                    // returns [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
   math.identity(3, 2)                 // returns [[1, 0], [0, 1], [0, 0]]

   const A = [[1, 2, 3], [4, 5, 6]]
   math.identity(math.size(A))         // returns [[1, 0, 0], [0, 1, 0]]

See also:

   diag, ones, zeros, size, range

@param {...number | Matrix | Array} size   The size for the matrix
@param {string} [format]                   The Matrix storage format

@return {Matrix | Array | number} A matrix with ones on the diagonal.