@d4c/numjs
    Preparing search index...

    Function identity

    • The identity array is a square array with ones on the main diagonal.

      Parameters

      • n: number

        number of rows (and columns) in n x n output.

      • Optionaldtype: ArrayLikeConstructor | DType

        Defaut is "array". The type of the output array. E.g., 'uint8' or Uint8Array.

      Returns NdArray

      n x n array with its main diagonal set to one, and all other elements 0