From e196ff525070c1753898d1e73b404b37d95ae5f3 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Thu, 14 Jan 2021 00:23:54 -0800 Subject: [PATCH 1/6] Add Cholesky spec --- .../linear_algebra_functions.md | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/spec/API_specification/linear_algebra_functions.md b/spec/API_specification/linear_algebra_functions.md index ba92aa7b0..698450ec6 100644 --- a/spec/API_specification/linear_algebra_functions.md +++ b/spec/API_specification/linear_algebra_functions.md @@ -16,9 +16,27 @@ A conforming implementation of the array API standard must provide and support t (function-cholesky)= -### cholesky() +### cholesky(x, /, *, upper=False) -TODO +Returns the Cholesky decomposition of a symmetric positive-definite matrix (or a stack of symmetric positive-definite 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`. + +- **upper**: _bool_ + + - If `True`, the result must be the upper-triangular Cholesky factor. If `False`, the result must be the lower-triangular Cholesky factor. Default: `False`. + +#### Returns + +- **out**: _Tuple\[ <array>, ... ]_ + + - a named tuple whose first element has the field name `c` and is an array containing the Cholesky factors for each square matrix. The array containing the Cholesky factors must have the same data type and shape as `x`. (function-cross)= ### cross(x1, x2, /, *, axis=-1) From 10b19ea7e53cd1bf0207be994b292936ccdf18bd Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Thu, 14 Jan 2021 01:08:12 -0800 Subject: [PATCH 2/6] Update description --- spec/API_specification/linear_algebra_functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/API_specification/linear_algebra_functions.md b/spec/API_specification/linear_algebra_functions.md index 698450ec6..7fd1a97d6 100644 --- a/spec/API_specification/linear_algebra_functions.md +++ b/spec/API_specification/linear_algebra_functions.md @@ -36,7 +36,7 @@ Returns the Cholesky decomposition of a symmetric positive-definite matrix (or a - **out**: _Tuple\[ <array>, ... ]_ - - a named tuple whose first element has the field name `c` and is an array containing the Cholesky factors for each square matrix. The array containing the Cholesky factors must have the same data type and shape as `x`. + - a namedtuple whose first element must have the field name `c` and must be an array containing the Cholesky factors for each square matrix. The array containing the Cholesky factors must have the same data type and shape as `x`. (function-cross)= ### cross(x1, x2, /, *, axis=-1) From b1728afd185133152a17f312a070d76914cc1ba5 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 24 Mar 2021 13:18:32 -0700 Subject: [PATCH 3/6] Return an array rather than a tuple --- spec/API_specification/linear_algebra_functions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/API_specification/linear_algebra_functions.md b/spec/API_specification/linear_algebra_functions.md index 7fd1a97d6..93aacd0a5 100644 --- a/spec/API_specification/linear_algebra_functions.md +++ b/spec/API_specification/linear_algebra_functions.md @@ -34,9 +34,9 @@ Returns the Cholesky decomposition of a symmetric positive-definite matrix (or a #### Returns -- **out**: _Tuple\[ <array>, ... ]_ +- **out**: _<array>_ - - a namedtuple whose first element must have the field name `c` and must be an array containing the Cholesky factors for each square matrix. The array containing the Cholesky factors must have the same data type and shape as `x`. + - an array containing the Cholesky factors for each square matrix. Must have the same data type and shape as `x`. (function-cross)= ### cross(x1, x2, /, *, axis=-1) From 1218c1b569c7ac8d05249452027b6dba45e096ed Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 24 Mar 2021 16:34:54 -0700 Subject: [PATCH 4/6] Update dtype requirements --- spec/API_specification/linear_algebra_functions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/API_specification/linear_algebra_functions.md b/spec/API_specification/linear_algebra_functions.md index 1a881c941..8fd2127c3 100644 --- a/spec/API_specification/linear_algebra_functions.md +++ b/spec/API_specification/linear_algebra_functions.md @@ -26,7 +26,7 @@ Returns the Cholesky decomposition of a symmetric positive-definite matrix (or a - **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. - **upper**: _bool_ @@ -36,7 +36,7 @@ Returns the Cholesky decomposition of a symmetric positive-definite matrix (or a - **out**: _<array>_ - - an array containing the Cholesky factors for each square matrix. Must have the same data type and shape as `x`. + - an array containing the Cholesky factors for each square matrix. The returned array must have the same data type and shape as `x`. (function-cross)= ### cross(x1, x2, /, *, axis=-1) From b476125c863c96821b731ab5e508976bb443fadb Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 24 Mar 2021 17:34:56 -0700 Subject: [PATCH 5/6] Update dtype requirements --- spec/API_specification/linear_algebra_functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/API_specification/linear_algebra_functions.md b/spec/API_specification/linear_algebra_functions.md index 8fd2127c3..ef0b9776b 100644 --- a/spec/API_specification/linear_algebra_functions.md +++ b/spec/API_specification/linear_algebra_functions.md @@ -36,7 +36,7 @@ Returns the Cholesky decomposition of a symmetric positive-definite matrix (or a - **out**: _<array>_ - - an array containing the Cholesky factors for each square matrix. The returned array must have the same data type and shape as `x`. + - an array containing the Cholesky factors for each square matrix. The returned array must have a floating-point data type determined by {ref}`type-promotion` and shape as `x`. (function-cross)= ### cross(x1, x2, /, *, axis=-1) From 717078aca937950373edc6d6a293101a81ac65c6 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Mon, 26 Apr 2021 02:26:20 -0700 Subject: [PATCH 6/6] Move API to submodule --- spec/API_specification/linear_algebra_functions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/API_specification/linear_algebra_functions.md b/spec/API_specification/linear_algebra_functions.md index ef0b9776b..d22e4fd85 100644 --- a/spec/API_specification/linear_algebra_functions.md +++ b/spec/API_specification/linear_algebra_functions.md @@ -15,8 +15,8 @@ A conforming implementation of the array API standard must provide and support t -(function-cholesky)= -### cholesky(x, /, *, upper=False) +(function-linalg-cholesky)= +### linalg.cholesky(x, /, *, upper=False) Returns the Cholesky decomposition of a symmetric positive-definite matrix (or a stack of symmetric positive-definite matrices) `x`.