Skip to content

Update dtype requirements for existing linear algebra APIs #148

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
Apr 11, 2021
Merged
Changes from all commits
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
28 changes: 14 additions & 14 deletions spec/API_specification/linear_algebra_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ Returns the cross product of 3-element vectors. If `x1` and `x2` are multi-dimen

- **x1**: _<array>_

- first input array. Must have a data type of either `float32` or `float64`.
- first input array. Should have a numeric data type.

- **x2**: _<array>_

- second input array. Must have the same shape as `x1`. Must have a data type of either `float32` or `float64`.
- second input array. Must have the same shape as `x1`. Should have a numeric data type.

- **axis**: _int_

Expand All @@ -43,7 +43,7 @@ Returns the cross product of 3-element vectors. If `x1` and `x2` are multi-dimen

- **out**: _<array>_

- an array containing the cross products. The returned array must have a data type determined by {ref}`type-promotion` rules.
- an array containing the cross products. The returned array must have a data type determined by {ref}`type-promotion`.

(function-det)=
### det(x, /)
Expand All @@ -54,13 +54,13 @@ Returns the determinant of a square matrix (or stack of square matrices) `x`.

- **x**: _<array>_

- input array having shape `(..., M, M)` and whose innermost two dimensions form square matrices. Must have a data type of either `float32` or `float64`.
- input array having shape `(..., M, M)` and whose innermost two dimensions form square matrices. Should have a floating-point data type.

#### Returns

- **out**: _<array>_

- if `x` is a two-dimensional array, a zero-dimensional array containing the determinant; otherwise, a non-zero dimensional array containing the determinant for each square matrix. The returned array must have a data type determined by {ref}`type-promotion` rules.
- if `x` is a two-dimensional array, a zero-dimensional array containing the determinant; otherwise, a non-zero dimensional array containing the determinant for each square matrix. The returned array must have the same data type as `x`.

(function-diagonal)=
### diagonal(x, /, *, axis1=0, axis2=1, offset=0)
Expand Down Expand Up @@ -120,19 +120,19 @@ TODO
(function-inv)=
### inv(x, /)

Computes the multiplicative inverse of a square matrix (or stack of square matrices) `x`.
Computes the multiplicative inverse of a square matrix (or a stack of square matrices) `x`.

#### Parameters

- **x**: _<array>_

- input array having shape `(..., M, M)` and whose innermost two dimensions form square matrices. Must have a data type of either `float32` or `float64`.
- input array having shape `(..., M, M)` and whose innermost two dimensions form square matrices. Should have a floating-point data type.

#### Returns

- **out**: _<array>_

- an array containing the multiplicative inverses. The returned array must have the same data type and shape as `x`.
- an array containing the multiplicative inverses. The returned array must have a floating-point data type determined by {ref}`type-promotion` and must have the same shape as `x`.

(function-lstsq)=
### lstsq()
Expand Down Expand Up @@ -163,7 +163,7 @@ Computes the matrix or vector norm of `x`.

- **x**: _<array>_

- input array. Must have a data type of either `float32` or `float64`.
- input array. Should have a floating-point data type.

- **axis**: _Optional\[ Union\[ int, Tuple\[ int, int ] ] ]_

Expand Down Expand Up @@ -231,7 +231,7 @@ Computes the matrix or vector norm of `x`.

- **out**: _<array>_

- an array containing the norms. If `axis` is `None`, the output array must be a zero-dimensional array containing a vector norm. If `axis` is a scalar value (`int` or `float`), the output array must have a rank which is one less than the rank of `x`. If `axis` is a 2-tuple, the output array must have a rank which is two less than the rank of `x`. The returned array must have the same data type as `x`.
- an array containing the norms. If `axis` is `None`, the returned array must be a zero-dimensional array containing a vector norm. If `axis` is a scalar value (`int` or `float`), the returned array must have a rank which is one less than the rank of `x`. If `axis` is a 2-tuple, the returned array must have a rank which is two less than the rank of `x`. The returned array must have a floating-point data type determined by {ref}`type-promotion`.

(function-outer)=
### outer(x1, x2, /)
Expand All @@ -242,17 +242,17 @@ Computes the outer product of two vectors `x1` and `x2`.

- **x1**: _<array>_

- first one-dimensional input array of size `N`. Must have a data type of either `float32` or `float64`.
- first one-dimensional input array of size `N`. Should have a numeric data type.

- **x2**: _<array>_

- second one-dimensional input array of size `M`. Must have a data type of either `float32` or `float64`.
- second one-dimensional input array of size `M`. Should have a numeric data type.

#### Returns

- **out**: _<array>_

- a two-dimensional array containing the outer product and whose shape is `NxM`. The returned array must have a data type determined by {ref}`type-promotion` rules.
- a two-dimensional array containing the outer product and whose shape is `(N, M)`. The returned array must have a data type determined by {ref}`type-promotion`.

(function-pinv)=
### pinv()
Expand Down Expand Up @@ -288,7 +288,7 @@ Returns the sum along the specified diagonals. If `x` has more than two dimensio

- **x**: _<array>_

- input array. Must have at least `2` dimensions.
- input array. Must have at least `2` dimensions. Should have a numeric data type.

- **axis1**: _int_

Expand Down