Skip to content

Commit cda4b0d

Browse files
committed
document qr_space
1 parent 7c9d5b4 commit cda4b0d

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

doc/specs/stdlib_linalg.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,3 +898,31 @@ Exceptions trigger an `error stop`.
898898
```fortran
899899
{!example/linalg/example_determinant2.f90!}
900900
```
901+
902+
## `qr_space` - Compute internal working space requirements for the QR factorization.
903+
904+
### Status
905+
906+
Experimental
907+
908+
### Description
909+
910+
This subroutine computes the internal working space requirements for the QR factorization, [[stdlib_linalg(module):qr(interface)]] .
911+
912+
### Syntax
913+
914+
`call ` [[stdlib_linalg(module):qr_space(interface)]] `(a, lwork, [, err])`
915+
916+
### Arguments
917+
918+
`a`: Shall be a rank-2 `real` or `complex` array containing the coefficient matrix. It is an `intent(in)` argument.
919+
920+
`lwork`: Shall be an `integer` scalar, that returns the minimum array size required for the working storage in [[stdlib_linalg(module):qr(interface)]] to factorize `a`.
921+
922+
`err` (optional): Shall be a `type(linalg_state_type)` value. This is an `intent(out)` argument.
923+
924+
### Example
925+
926+
```fortran
927+
{!example/linalg/example_qr_space.f90!}
928+
```

src/stdlib_linalg.fypp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,19 @@ module stdlib_linalg
476476

477477
! Return the working array space required by the QR factorization solver
478478
interface qr_space
479+
!! version: experimental
480+
!!
481+
!! Computes the working array space required by the QR factorization solver
482+
!! ([Specification](../page/specs/stdlib_linalg.html#qr-space-compute-internal-working-space-requirements-for-the-qr-factorization))
483+
!!
484+
!!### Description
485+
!!
486+
!! This interface returns the size of the `real` or `complex` working storage required by the
487+
!! QR factorization solver. The working size only depends on the kind (`real` or `complex`) and size of
488+
!! the matrix being factorized. Storage size can be used to pre-allocate a working array in case several
489+
!! repeated QR factorizations to a same-size matrix are sought. If pre-allocated working arrays
490+
!! are provided, no internal allocations will take place during the factorization.
491+
!!
479492
#:for rk,rt,ri in RC_KINDS_TYPES
480493
#:if rk!="xdp"
481494
pure module subroutine get_qr_${ri}$_workspace(a,lwork,err)

0 commit comments

Comments
 (0)