Skip to content

Commit 296c35a

Browse files
committed
modify: docs to add err argument
1 parent dd191d7 commit 296c35a

1 file changed

Lines changed: 29 additions & 9 deletions

File tree

doc/specs/stdlib_specialmatrices.md

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,30 +64,40 @@ Tridiagonal matrices are available with all supported data types as `tridiagonal
6464

6565
- To construct a tridiagonal matrix from already allocated arrays `dl` (lower diagonal, size `n-1`), `dv` (main diagonal, size `n`) and `du` (upper diagonal, size `n-1`):
6666

67-
`A = ` [[stdlib_specialmatrices(module):tridiagonal(interface)]] `(dl, dv, du)`
67+
`A = ` [[stdlib_specialmatrices(module):tridiagonal(interface)]] `(dl, dv, du [, err])`
6868

6969
- To construct a tridiagonal matrix of size `n x n` with scalar diagonal elements `dl` (lower diagonal), `dv` (main diagonal), and `du` (upper diagonal):
7070

71-
`A = ` [[stdlib_specialmatrices(module):tridiagonal(interface)]] `(dl, dv, du, n)`
71+
`A = ` [[stdlib_specialmatrices(module):tridiagonal(interface)]] `(dl, dv, du, n [, err])`
7272

7373
#### Arguments
7474

7575
##### Constructing from arrays
7676

77-
`A = tridiagonal(dl, dv, du)`
77+
`A = tridiagonal(dl, dv, du [, err])`
7878

7979
- `dl`: Shall be a rank-1 array of type `real` or `complex` with the same kind as the resulting matrix. It is an `intent(in)` argument.
8080
- `dv`: Shall be a rank-1 array of type `real` or `complex` with the same kind as the resulting matrix. It is an `intent(in)` argument.
8181
- `du`: Shall be a rank-1 array of type `real` or `complex` with the same kind as the resulting matrix. It is an `intent(in)` argument.
82+
- `err` (optional): Shall be a `type(linalg_state_type)` variable. It is an `intent(out)` argument.
83+
If the input arrays are not of compatible sizes, the routine calls `linalg_error_handling`.
84+
If `err` is present, it is assigned `LINALG_VALUE_ERROR`.
85+
If `err` is not present, the program terminates via `error stop`.
86+
In either case, the elements of the resulting matrix `A` are unassigned.
8287

8388
##### Constructing from constant diagonal values
8489

85-
`A = tridiagonal(dl, dv, du, n)`
90+
`A = tridiagonal(dl, dv, du, n [, err])`
8691

8792
- `dl`: Shall be a scalar of type `real` or `complex` with the same kind as the resulting matrix. It is an `intent(in)` argument.
8893
- `dv`: Shall be a scalar of type `real` or `complex` with the same kind as the resulting matrix. It is an `intent(in)` argument.
8994
- `du`: Shall be a scalar of type `real` or `complex` with the same kind as the resulting matrix. It is an `intent(in)` argument.
90-
`n`: Shall be a positive `integer`. It is an `intent(in)` argument.
95+
- `n`: Shall be a positive `integer`. It is an `intent(in)` argument.
96+
- `err` (optional): Shall be a `type(linalg_state_type)` variable. It is an `intent(out)` argument.
97+
If a non-positive matrix size is provided, the routine calls `linalg_error_handling`.
98+
If `err` is present, it is assigned `LINALG_VALUE_ERROR`.
99+
If `err` is not present, the program terminates via `error stop`.
100+
In either case, the elements of the resulting matrix `A` are unassigned.
91101

92102
#### Example
93103

@@ -135,28 +145,38 @@ Symmetric tridiagonal matrices are available with all supported data types as `s
135145

136146
- To construct a symmetric tridiagonal matrix from already allocated arrays `du` (off-diagonal, size `n-1`) and `dv` (main diagonal, size `n`):
137147

138-
`A = ` [[stdlib_specialmatrices(module):sym_tridiagonal(interface)]] `(du, dv)`
148+
`A = ` [[stdlib_specialmatrices(module):sym_tridiagonal(interface)]] `(du, dv [, err])`
139149

140150
- To construct a symmetric tridiagonal matrix of size `n x n` with scalar diagonal elements `du` (off-diagonal) and `dv` (main diagonal):
141151

142-
`A = ` [[stdlib_specialmatrices(module):sym_tridiagonal(interface)]] `(du, dv, n)`
152+
`A = ` [[stdlib_specialmatrices(module):sym_tridiagonal(interface)]] `(du, dv, n [, err])`
143153

144154
#### Arguments
145155

146156
##### Constructing from arrays
147157

148-
`A = sym_tridiagonal(du, dv)`
158+
`A = sym_tridiagonal(du, dv [, err])`
149159

150160
- `du`: Shall be a rank-1 array of type `real` or `complex` with the same kind as the resulting matrix. It is an `intent(in)` argument.
151161
- `dv`: Shall be a rank-1 array of type `real` or `complex` with the same kind as the resulting matrix. It is an `intent(in)` argument.
162+
- `err` (optional): Shall be a `type(linalg_state_type)` variable. It is an `intent(out)` argument.
163+
If the input arrays are not of compatible sizes, the routine calls `linalg_error_handling`.
164+
If `err` is present, it is assigned `LINALG_VALUE_ERROR`.
165+
If `err` is not present, the program terminates via `error stop`.
166+
In either case, the elements of the resulting matrix `A` are unassigned.
152167

153168
##### Constructing from constant diagonal values
154169

155-
`A = sym_tridiagonal(du, dv, n)`
170+
`A = sym_tridiagonal(du, dv, n [, err])`
156171

157172
- `du`: Shall be a scalar of type `real` or `complex` with the same kind as the resulting matrix. It is an `intent(in)` argument.
158173
- `dv`: Shall be a scalar of type `real` or `complex` with the same kind as the resulting matrix. It is an `intent(in)` argument.
159174
- `n`: Shall be a positive `integer`. It is an `intent(in)` argument.
175+
- `err` (optional): Shall be a `type(linalg_state_type)` variable. It is an `intent(out)` argument.
176+
If a non-positive matrix size is provided, the routine calls `linalg_error_handling`.
177+
If `err` is present, it is assigned `LINALG_VALUE_ERROR`.
178+
If `err` is not present, the program terminates via `error stop`.
179+
In either case, the elements of the resulting matrix `A` are unassigned.
160180

161181
#### Example
162182

0 commit comments

Comments
 (0)