GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • 
  • Consortium for Python Data API Standards
  • API specification
  • Creation Functions
  • Purpose and scope
  • Terms and Definitions
  • Use cases
  • Assumptions
  • Design topics & constraints
  • Future API standard evolution
  • Array object
  • Broadcasting
  • Constants
  • Data Type Functions

This view

  • Original page
  • New address

GeezerVison is showing data-apis.org — eye — Python array API standard DRAFT documentation

eye¶

eye(n_rows: int, n_cols: int | None = None, /, *, k: int = 0, dtype: dtype | None = None, device: device | None = None) → array¶

Returns a two-dimensional array with ones on the kth diagonal and zeros elsewhere.

Note

An output array having a complex floating-point data type must have the value 1 + 0j along the kth diagonal and 0 + 0j elsewhere.

Parameters:
  • n_rows (int) – number of rows in the output array.

  • n_cols (Optional[int]) – number of columns in the output array. If None, the default number of columns in the output array is equal to n_rows. Default: None.

  • k (int) – index of the diagonal. A positive value refers to an upper diagonal, a negative value to a lower diagonal, and 0 to the main diagonal. Default: 0.

  • dtype (Optional[dtype]) – output array data type. If dtype is None, the output array data type must be the default real-valued floating-point data type. Default: None.

  • device (Optional[device]) – device on which to place the created array. Default: None.

Returns:

out (array) – an array where all elements are equal to zero, except for the kth diagonal, whose values are equal to one.

Notes

Changed in version 2022.12: Added complex data type support.

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.