From e3a018ec4ebf35da4e5acb2fbfb850f5697125ec Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Tue, 19 Jan 2021 12:09:33 -0800 Subject: [PATCH 01/11] Add solve specification --- .../linear_algebra_functions.md | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/spec/API_specification/linear_algebra_functions.md b/spec/API_specification/linear_algebra_functions.md index ba92aa7b0..a9921c9d0 100644 --- a/spec/API_specification/linear_algebra_functions.md +++ b/spec/API_specification/linear_algebra_functions.md @@ -270,9 +270,25 @@ TODO TODO (function-solve)= -### solve() +### solve(x1, x2, /) -TODO +Returns the solution to the system of linear equations represented by the well-determined (i.e., full rank) linear matrix equation `AX = B`. + +#### Parameters + +- **x1**: _<array>_ + + - coefficient array `A` having shape `(..., M, M)` and whose innermost two dimensions form square matrices. Must be of full rank (i.e., all rows or, equivalently, columns must be linearly independent). Must have a data type of either `float32` or `float64`. + +- **x2**: _<array>_ + + - ordinate (or "dependent variable") array `B` having shape `(..., M, K)`. Must have a data type of either `float32` or `float64`. Must be compatible with `x1` (see {ref}`broadcasting`). + +#### Returns + +- **out**: _Tuple\[ <array>, ... ]_ + + - a namedtuple whose first element must have the field name `x` and must be an array containing the solution to the system `AX = B` for each square matrix. The array containing the solutions must have the same shape as `x2` (i.e., the array corresponding to `B`) and must have a data type determined by {ref}`type-promotion` rules. (function-svd)= ### svd() From 719b744399f9033cf04f82811dad384352ef09af Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Mon, 25 Jan 2021 11:08:57 -0800 Subject: [PATCH 02/11] Remove statement --- 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 a9921c9d0..cc326431b 100644 --- a/spec/API_specification/linear_algebra_functions.md +++ b/spec/API_specification/linear_algebra_functions.md @@ -282,7 +282,7 @@ Returns the solution to the system of linear equations represented by the well-d - **x2**: _<array>_ - - ordinate (or "dependent variable") array `B` having shape `(..., M, K)`. Must have a data type of either `float32` or `float64`. Must be compatible with `x1` (see {ref}`broadcasting`). + - ordinate (or "dependent variable") array `B` having shape `(..., M, K)`. Must have a data type of either `float32` or `float64`. #### Returns From 5b34273e5165e9eedddf8a4511f1dd4bafaf23bc Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 24 Mar 2021 13:03:18 -0700 Subject: [PATCH 03/11] Update to return an array, rather than a single-element 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 cc326431b..6baba92fe 100644 --- a/spec/API_specification/linear_algebra_functions.md +++ b/spec/API_specification/linear_algebra_functions.md @@ -286,9 +286,9 @@ Returns the solution to the system of linear equations represented by the well-d #### Returns -- **out**: _Tuple\[ <array>, ... ]_ +- **out**: _<array>_ - - a namedtuple whose first element must have the field name `x` and must be an array containing the solution to the system `AX = B` for each square matrix. The array containing the solutions must have the same shape as `x2` (i.e., the array corresponding to `B`) and must have a data type determined by {ref}`type-promotion` rules. + - an array containing the solution to the system `AX = B` for each square matrix. Must be the same shape as `x2` (i.e., the array corresponding to `B`) and must have a data type determined by {ref}`type-promotion` rules. (function-svd)= ### svd() From ba4060f6a9b73978b895d55e03e225b582bf2738 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 24 Mar 2021 13:07:39 -0700 Subject: [PATCH 04/11] Update language --- 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 6baba92fe..3c75615ce 100644 --- a/spec/API_specification/linear_algebra_functions.md +++ b/spec/API_specification/linear_algebra_functions.md @@ -288,7 +288,7 @@ Returns the solution to the system of linear equations represented by the well-d - **out**: _<array>_ - - an array containing the solution to the system `AX = B` for each square matrix. Must be the same shape as `x2` (i.e., the array corresponding to `B`) and must have a data type determined by {ref}`type-promotion` rules. + - an array containing the solution to the system `AX = B` for each square matrix. Must have the same shape as `x2` (i.e., the array corresponding to `B`) and must have a data type determined by {ref}`type-promotion` rules. (function-svd)= ### svd() From 5a9f65bc6bb26c25dee43e9576fe91a3145feaa7 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 24 Mar 2021 13:08:09 -0700 Subject: [PATCH 05/11] Update copy --- 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 3c75615ce..39a69ca67 100644 --- a/spec/API_specification/linear_algebra_functions.md +++ b/spec/API_specification/linear_algebra_functions.md @@ -288,7 +288,7 @@ Returns the solution to the system of linear equations represented by the well-d - **out**: _<array>_ - - an array containing the solution to the system `AX = B` for each square matrix. Must have the same shape as `x2` (i.e., the array corresponding to `B`) and must have a data type determined by {ref}`type-promotion` rules. + - an array containing the solution to the system `AX = B` for each square matrix. Must have the same shape as `x2` (i.e., the array corresponding to `B`). Must have a data type determined by {ref}`type-promotion` rules. (function-svd)= ### svd() From 9efc47c0ce2672296304871771dc214ad31d7225 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 24 Mar 2021 13:15:20 -0700 Subject: [PATCH 06/11] 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 39a69ca67..85783ded0 100644 --- a/spec/API_specification/linear_algebra_functions.md +++ b/spec/API_specification/linear_algebra_functions.md @@ -282,7 +282,7 @@ Returns the solution to the system of linear equations represented by the well-d - **x2**: _<array>_ - - ordinate (or "dependent variable") array `B` having shape `(..., M, K)`. Must have a data type of either `float32` or `float64`. + - ordinate (or "dependent variable") array `B` having shape `(..., M, K)`, where each column `k` defines a set of ordinate values for which to compute a solution. Must have a data type of either `float32` or `float64`. #### Returns From 8acb011ebdc7abb393572cf0977f44c1ebab2ba0 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 24 Mar 2021 13:51:45 -0700 Subject: [PATCH 07/11] Add note regarding broadcast compatibility --- 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 85783ded0..b278a8c34 100644 --- a/spec/API_specification/linear_algebra_functions.md +++ b/spec/API_specification/linear_algebra_functions.md @@ -282,7 +282,7 @@ Returns the solution to the system of linear equations represented by the well-d - **x2**: _<array>_ - - ordinate (or "dependent variable") array `B` having shape `(..., M, K)`, where each column `k` defines a set of ordinate values for which to compute a solution. Must have a data type of either `float32` or `float64`. + - ordinate (or "dependent variable") array `B` having shape `(..., M, K)`, where each column `k` defines a set of ordinate values for which to compute a solution. Must be compatible with `shape(x1)[:-1]` (see {ref}`broadcasting`). Must have a data type of either `float32` or `float64`. #### Returns From d83e979ad829cb5ba07ac08c1985b932115d9cce Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 24 Mar 2021 14:56:37 -0700 Subject: [PATCH 08/11] Add support for providing an ordinate vector --- 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 b278a8c34..7f7a56aa2 100644 --- a/spec/API_specification/linear_algebra_functions.md +++ b/spec/API_specification/linear_algebra_functions.md @@ -282,7 +282,7 @@ Returns the solution to the system of linear equations represented by the well-d - **x2**: _<array>_ - - ordinate (or "dependent variable") array `B` having shape `(..., M, K)`, where each column `k` defines a set of ordinate values for which to compute a solution. Must be compatible with `shape(x1)[:-1]` (see {ref}`broadcasting`). Must have a data type of either `float32` or `float64`. + - ordinate (or "dependent variable") array `B`. If `x2` has shape `(..., M)`, `x2` is equivalent to an array having shape `(..., M, 1)`, and `shape(x2)` must be compatible with `shape(x1)[:-1]` (see {ref}`broadcasting`). If `x2` has shape `(..., M, K)`, each column `k` defines a set of ordinate values for which to compute a solution, and `shape(x2)[:-1]` must be compatible with `shape(x1)[:-1]` (see {ref}`broadcasting`). Must have a data type of either `float32` or `float64`. #### Returns From 079493ce0cd66cb7e5997604c8e2ea7aa36e28c4 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 24 Mar 2021 16:54:39 -0700 Subject: [PATCH 09/11] Update dtype requirements --- spec/API_specification/linear_algebra_functions.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/API_specification/linear_algebra_functions.md b/spec/API_specification/linear_algebra_functions.md index 4fbfd911d..e6b9fd0c7 100644 --- a/spec/API_specification/linear_algebra_functions.md +++ b/spec/API_specification/linear_algebra_functions.md @@ -278,17 +278,17 @@ Returns the solution to the system of linear equations represented by the well-d - **x1**: _<array>_ - - coefficient array `A` having shape `(..., M, M)` and whose innermost two dimensions form square matrices. Must be of full rank (i.e., all rows or, equivalently, columns must be linearly independent). Must have a data type of either `float32` or `float64`. + - coefficient array `A` having shape `(..., M, M)` and whose innermost two dimensions form square matrices. Must be of full rank (i.e., all rows or, equivalently, columns must be linearly independent). Should have a floating-point data type. - **x2**: _<array>_ - - ordinate (or "dependent variable") array `B`. If `x2` has shape `(..., M)`, `x2` is equivalent to an array having shape `(..., M, 1)`, and `shape(x2)` must be compatible with `shape(x1)[:-1]` (see {ref}`broadcasting`). If `x2` has shape `(..., M, K)`, each column `k` defines a set of ordinate values for which to compute a solution, and `shape(x2)[:-1]` must be compatible with `shape(x1)[:-1]` (see {ref}`broadcasting`). Must have a data type of either `float32` or `float64`. + - ordinate (or "dependent variable") array `B`. If `x2` has shape `(..., M)`, `x2` is equivalent to an array having shape `(..., M, 1)`, and `shape(x2)` must be compatible with `shape(x1)[:-1]` (see {ref}`broadcasting`). If `x2` has shape `(..., M, K)`, each column `k` defines a set of ordinate values for which to compute a solution, and `shape(x2)[:-1]` must be compatible with `shape(x1)[:-1]` (see {ref}`broadcasting`). Should have a floating-point data type. #### Returns - **out**: _<array>_ - - an array containing the solution to the system `AX = B` for each square matrix. Must have the same shape as `x2` (i.e., the array corresponding to `B`). Must have a data type determined by {ref}`type-promotion` rules. + - an array containing the solution to the system `AX = B` for each square matrix. The returned array must have the same shape as `x2` (i.e., the array corresponding to `B`) and must have a floating-point data type determined by {ref}`type-promotion` rules. (function-svd)= ### svd() From 36e96d2e7ac232afb317d666d9dbdc6dafd0da20 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 24 Mar 2021 17:39:28 -0700 Subject: [PATCH 10/11] Update copy --- 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 e6b9fd0c7..84c886774 100644 --- a/spec/API_specification/linear_algebra_functions.md +++ b/spec/API_specification/linear_algebra_functions.md @@ -288,7 +288,7 @@ Returns the solution to the system of linear equations represented by the well-d - **out**: _<array>_ - - an array containing the solution to the system `AX = B` for each square matrix. The returned array must have the same shape as `x2` (i.e., the array corresponding to `B`) and must have a floating-point data type determined by {ref}`type-promotion` rules. + - an array containing the solution to the system `AX = B` for each square matrix. The returned array must have the same shape as `x2` (i.e., the array corresponding to `B`) and must have a floating-point data type determined by {ref}`type-promotion`. (function-svd)= ### svd() From ffafa264769f6f754fe3ceaeeb69761a37cb9af9 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Mon, 26 Apr 2021 02:31:25 -0700 Subject: [PATCH 11/11] 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 84c886774..729c81af6 100644 --- a/spec/API_specification/linear_algebra_functions.md +++ b/spec/API_specification/linear_algebra_functions.md @@ -269,8 +269,8 @@ TODO TODO -(function-solve)= -### solve(x1, x2, /) +(function-linalg-solve)= +### linalg.solve(x1, x2, /) Returns the solution to the system of linear equations represented by the well-determined (i.e., full rank) linear matrix equation `AX = B`.