You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/specs/stdlib_linalg.md
+54-2Lines changed: 54 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -610,7 +610,9 @@ Experimental
610
610
611
611
This function computes the solution to a linear matrix equation \( A \cdot x = b \), where \( A \) is a square, full-rank, `real` or `complex` matrix.
612
612
613
-
Result vector or array `x` returns the exact solution to within numerical precision, provided that the matrix is not ill-conditioned. The solver is based on LAPACK's `*GESV` backends.
613
+
Result vector or array `x` returns the exact solution to within numerical precision, provided that the matrix is not ill-conditioned.
614
+
An error is returned if the matrix is rank-deficient or singular to working precision.
615
+
The solver is based on LAPACK's `*GESV` backends.
614
616
615
617
### Syntax
616
618
@@ -640,7 +642,57 @@ For a full-rank matrix, returns an array value that represents the solution to t
640
642
641
643
Raises `LINALG_ERROR` if the matrix is singular to working precision.
642
644
Raises `LINALG_VALUE_ERROR` if the matrix and rhs vectors have invalid/incompatible sizes.
643
-
Exceptions trigger an `error stop`.
645
+
If `err` is not present, exceptions trigger an `error stop`.
646
+
647
+
### Example
648
+
649
+
```fortran
650
+
{!example/linalg/example_solve1.f90!}
651
+
652
+
{!example/linalg/example_solve2.f90!}
653
+
```
654
+
655
+
## `solve_lu` - Solves a linear matrix equation or a linear system of equations (subroutine interface).
656
+
657
+
### Status
658
+
659
+
Experimental
660
+
661
+
### Description
662
+
663
+
This subroutine computes the solution to a linear matrix equation \( A \cdot x = b \), where \( A \) is a square, full-rank, `real` or `complex` matrix.
664
+
665
+
Result vector or array `x` returns the exact solution to within numerical precision, provided that the matrix is not ill-conditioned.
666
+
An error is returned if the matrix is rank-deficient or singular to working precision.
`a`: Shall be a rank-2 `real` or `complex` square array containing the coefficient matrix. It is normally an `intent(in)` argument. If `overwrite_a=.true.`, it is an `intent(inout)` argument and is destroyed by the call.
680
+
681
+
`b`: Shall be a rank-1 or rank-2 array of the same kind as `a`, containing the right-hand-side vector(s). It is an `intent(in)` argument.
682
+
683
+
`x`: Shall be a rank-1 or rank-2 array of the same kind and size as `b`, that returns the solution(s) to the system. It is an `intent(inout)` argument, and must have the `contiguous` property.
684
+
685
+
`overwrite_a` (optional): Shall be an input logical flag. if `.true.`, input matrix `a` will be used as temporary storage and overwritten. This avoids internal data allocation. This is an `intent(in)` argument.
686
+
687
+
`err` (optional): Shall be a `type(linalg_state_type)` value. This is an `intent(out)` argument.
688
+
689
+
### Return value
690
+
691
+
For a full-rank matrix, returns an array value that represents the solution to the linear system of equations.
692
+
693
+
Raises `LINALG_ERROR` if the matrix is singular to working precision.
694
+
Raises `LINALG_VALUE_ERROR` if the matrix and rhs vectors have invalid/incompatible sizes.
695
+
If `err` is not present, exceptions trigger an `error stop`.
0 commit comments