np_diag
Create a diagonal array from a list or extract the diagonal of an existing array. Specify the diagonal index and optional data type.
Instructions
Create a diagonal array or extract the diagonal of an array.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| k | Yes | If a list, creates diagonal array from it. If an int, extracts that diagonal. | |
| dtype | No | The data type of the array (default: "float64"). | float64 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |