8000 Add specifications for returning upper (`triu`) and lower (`tril`) triangular matrices by kgryte · Pull Request #243 · data-apis/array-api · GitHub
[go: up one dir, main page]

Skip to content

Add specifications for returning upper (triu) and lower (tril) triangular matrices #243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 20, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix typo and remove device keyword
  • Loading branch information
kgryte committed Sep 13, 2021
commit f440a8dc60473892a1da37725658dd0683900b13
16 changes: 3 additions & 13 deletions spec/API_specification/creation_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ Returns a new array filled with ones and having the same `shape` as an input arr
- an array having the same shape as `x` and filled with ones.

(function-tril)=
### tril(x, /, *, k=0, device=None)
### tril(x, /, *, k=0)

Returns the lower triangular part of a matrix (or a stack of matrices) `x`.

Expand All @@ -391,11 +391,6 @@ The lower triangular part of the matrix is defined as the elements on and below

```{note}
The main diagonal is defined as the set of indices `{(i, i)}` for `i` on the interval `[0, min(M, N) - 1]`.
```

- **device**: _Optional\[ <device> ]_

- device on which to place the created array. If `device` is `None`, the default device must be used, not `x.device`. Default: `None`.

#### Returns

Expand All @@ -404,9 +399,9 @@ The lower triangular part of the matrix is defined as the elements on and below
- an array containing the lower triangular part(s). The returned array must have the same shape and data type as `x`. All elements above the specified diagonal `k` must be zeroed.

(function-triu)=
### triu(x, /, *, k=0, device=None)
### triu(x, /, *, k=0)

Returns the uppder triangular part of a matrix (or a stack of matrices) `x`.
Returns the upper triangular part of a matrix (or a stack of matrices) `x`.

```{note}
The upper triangular part of the matrix is defined as the elements on and above the specified diagonal `k`.
Expand All @@ -424,11 +419,6 @@ The upper triangular part of the matrix is defined as the elements on and above

```{note}
The main diagonal is defined as the set of indices `{(i, i)}` for `i` on the interval `[0, min(M, N) - 1]`.
```

- **device**: _Optional\[ <device> ]_

- device on which to place the created array. If `device` is `None`, the default device must be used, not `x.device`. Default: `None`.

#### Returns

Expand Down
0