Skip to content

Commit 75a5a23

Browse files
committed
document .inv.A
1 parent dc0127b commit 75a5a23

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

doc/specs/stdlib_linalg.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ This interface is equivalent to the `pure` version of determinant [[stdlib_linal
887887

888888
### Return value
889889

890-
Returns a real scalar value that represents the determinnt of the matrix.
890+
Returns a real scalar value that represents the determinant of the matrix.
891891

892892
Raises `LINALG_ERROR` if the matrix is singular.
893893
Raises `LINALG_VALUE_ERROR` if the matrix is non-square.
@@ -898,3 +898,37 @@ Exceptions trigger an `error stop`.
898898
```fortran
899899
{!example/linalg/example_determinant2.f90!}
900900
```
901+
902+
## `.inv.` - Inverse operator of a square matrix
903+
904+
### Status
905+
906+
Experimental
907+
908+
### Description
909+
910+
This operator returns the inverse of a `real` or `complex` square matrix \( A \).
911+
The inverse \( A^{-1} \) is defined such that \( A \cdot A^{-1} = A^{-1} \cdot A = I_n \).
912+
913+
This interface is equivalent to the function version of [[stdlib_linalg(module):inv(interface)]].
914+
915+
### Syntax
916+
917+
`b = ` [[stdlib_linalg(module):operator(.inv.)(interface)]] `(a)`
918+
919+
### Arguments
920+
921+
`a`: Shall be a rank-2 square array of any `real` or `complex` kinds. It is an `intent(in)` argument.
922+
923+
### Return value
924+
925+
Returns a rank-2 square array with the same type, kind and rank as `a`, that contains the inverse of `a`.
926+
927+
If the matrix is singular or non-square, the operator returns zeros.
928+
929+
### Example
930+
931+
```fortran
932+
{!example/linalg/example_inverse1.f90!}
933+
```
934+

src/stdlib_linalg.fypp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,22 @@ module stdlib_linalg
589589

590590
! Operator interface
591591
interface operator(.inv.)
592+
!! version: experimental
593+
!!
594+
!! Inverse operator of a square matrix
595+
!! ([Specification](../page/specs/stdlib_linalg.html#inv-inverse-operator-of-a-square-matrix))
596+
!!
597+
!!### Summary
598+
!! Operator interface for computing the inverse of a square `real` or `complex` matrix.
599+
!!
600+
!!### Description
601+
!!
602+
!! This operator interface provides a convenient way to compute the inverse of a matrix.
603+
!! Supported data types include `real` and `complex`.
604+
!!
605+
!!@note The provided functions are intended for square matrices.
606+
!!@note BLAS/LAPACK backends do not currently support extended precision (``xdp``).
607+
!!
592608
#:for rk,rt,ri in RC_KINDS_TYPES
593609
#:if rk!="xdp"
594610
module function stdlib_linalg_inverse_${ri}$_operator(a) result(inva)

0 commit comments

Comments
 (0)