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
The `stdlib_error` module provides a derived type holding information on the state of operations within the standard library and procedures for expert control of workflows.
12
+
An optional `state_type` variable to hold such information is provided as a form of expert API.
13
+
If the user does not require state information but fatal errors are encountered during execution, the program will undergo a hard stop.
14
+
Instead, if the state argument is present, the program will never stop but will return detailed error information into the state handler.
The `state_type` is defined as a derived type containing an integer error flag and fixed-size character strings to store an error message and the location of the error state change.
22
+
Fixed-size string storage was chosen to facilitate the compiler's memory allocation and ultimately ensure maximum computational performance.
23
+
24
+
A similarly named generic interface, `state_type`, is provided to allow the developer to create diagnostic messages and raise error flags easily.
25
+
The call starts with an error flag or the location of the event and is followed by an arbitrary list of `integer`, `real`, `complex`, or `character` variables.
26
+
Numeric variables may be provided as either scalars or rank-1 (array) inputs.
27
+
28
+
#### Type-bound procedures
29
+
30
+
The following convenience type-bound procedures are provided:
31
+
-`print()` returns an allocatable character string containing state location, message, and error flag;
32
+
-`print_message()` returns an allocatable character string containing the state message;
33
+
-`ok()` returns a `logical` flag that is `.true.` in case of successful state (`flag==STDLIB_SUCCESS`);
34
+
-`error()` returns a `logical` flag that is `.true.` in case of an error state (`flag/=STDLIB_SUCCESS`).
35
+
36
+
#### Status
37
+
38
+
Experimental
39
+
40
+
#### Example
41
+
42
+
```fortran
43
+
{!example/error/example_error_state1.f90!}
44
+
```
45
+
46
+
## Error flags provided
47
+
48
+
The module provides the following state flags:
49
+
-`STDLIB_SUCCESS`: Successful execution
50
+
-`STDLIB_VALUE_ERROR`: Numerical errors (such as infinity, not-a-number, range bounds) are encountered.
51
+
-`STDLIB_LINALG_ERROR`: Linear Algebra errors are encountered, such as non-converging iterations, impossible operations, etc.
52
+
-`STDLIB_INTERNAL_ERROR`: Provided as a developer safeguard for internal errors that should never occur.
53
+
-`STDLIB_IO_ERROR`: Input/Output-related errors, such as file reading/writing failures.
54
+
-`STDLIB_FS_ERROR`: File system-related errors, such as directory access issues.
55
+
56
+
## Comparison operators provided
57
+
58
+
The module provides overloaded comparison operators for all comparisons of a `state_type` variable with an integer error flag: `<`, `<=`, `==`, `>=`, `>`, `/=`.
Copy file name to clipboardExpand all lines: doc/specs/stdlib_linalg_state_type.md
+15-25
Original file line number
Diff line number
Diff line change
@@ -8,37 +8,27 @@ title: linalg_state_type
8
8
9
9
## Introduction
10
10
11
-
The `stdlib_linalg_state` module provides a derived type holding information on the
12
-
state of linear algebra operations, and procedures for expert control of linear algebra workflows.
13
-
All linear algebra procedures are engineered to support returning an optional `linalg_state_type`
14
-
variable to holds such information, as a form of expert API. If the user does not require state
15
-
information, but fatal errors are encountered during the execution of linear algebra routines, the
16
-
program will undergo a hard stop.
17
-
Instead, if the state argument is present, the program will never stop, but will return detailed error
18
-
information into the state handler.
11
+
The `stdlib_linalg_state` module provides a derived type holding information on the state of linear algebra operations, and procedures for expert control of linear algebra workflows.
12
+
All linear algebra procedures are engineered to support returning an optional `linalg_state_type` variable to hold such information, as a form of expert API. If the user does not require state information but fatal errors are encountered during the execution of linear algebra routines, the program will undergo a hard stop.
13
+
Instead, if the state argument is present, the program will never stop but will return detailed error information into the state handler.
The `linalg_state_type` is defined as a derived type containing an integer error flag, and
26
-
fixed-size character strings to store an error message and the location of the error state change.
27
-
Fixed-size string storage was chosen to facilitate the compiler's memory allocation and ultimately
28
-
ensure maximum computational performance.
20
+
The `linalg_state_type` is an extension of the `state_type` derived type, containing an integer error flag and fixed-size character strings to store an error message and the location of the error state change.
21
+
Fixed-size string storage was chosen to facilitate the compiler's memory allocation and ultimately ensure maximum computational performance.
29
22
30
-
A similarly named generic interface, `linalg_state_type`, is provided to allow the developer to
31
-
create diagnostic messages and raise error flags easily. The call starts with an error flag or
32
-
the location of the event, and is followed by an arbitrary list of `integer`, `real`, `complex` or
33
-
`character` variables. Numeric variables may be provided as either scalars or rank-1 (array) inputs.
23
+
A similarly named generic interface, `linalg_state_type`, is provided to allow the developer to create diagnostic messages and raise error flags easily. The call starts with an error flag or the location of the event and is followed by an arbitrary list of `integer`, `real`, `complex`, or `character` variables. Numeric variables may be provided as either scalars or rank-1 (array) inputs.
34
24
35
25
#### Type-bound procedures
36
26
37
-
The following convenience type-bound procedures are provided:
27
+
The following convenience type-bound procedures are inherited from `state_type` and available:
38
28
-`print()` returns an allocatable character string containing state location, message, and error flag;
39
29
-`print_message()` returns an allocatable character string containing the state message;
40
30
-`ok()` returns a `logical` flag that is `.true.` in case of successful state (`flag==LINALG_SUCCESS`);
41
-
-`error()` returns a `logical` flag that is `.true.` in case of error state (`flag/=LINALG_SUCCESS`).
31
+
-`error()` returns a `logical` flag that is `.true.` in case of an error state (`flag/=LINALG_SUCCESS`).
42
32
43
33
#### Status
44
34
@@ -52,13 +42,13 @@ Experimental
52
42
53
43
## Error flags provided
54
44
55
-
The module provides the following state flags:
56
-
-`LINALG_SUCCESS`: Successful execution
57
-
-`LINALG_VALUE_ERROR`: Numerical errors (such as infinity, not-a-number, range bounds) are encountered.
58
-
-`LINALG_ERROR`: Linear Algebra errors are encountered, such as: non-converging iterations, impossible operations, etc.
59
-
-`LINALG_INTERNAL_ERROR`: Provided as a developer safeguard for internal errors that should never occur.
45
+
The module provides the following state flags, mapped to the general `state_type` error flags:
46
+
-`LINALG_SUCCESS`: Successful execution (equivalent to `STDLIB_SUCCESS`)
47
+
-`LINALG_VALUE_ERROR`: Numerical errors (such as infinity, not-a-number, range bounds) are encountered (equivalent to `STDLIB_VALUE_ERROR`).
48
+
-`LINALG_ERROR`: Linear Algebra errors are encountered, such as non-converging iterations, and impossible operations (equivalent to `STDLIB_LINALG_ERROR`).
49
+
-`LINALG_INTERNAL_ERROR`: Provided as a developer safeguard for internal errors that should never occur (equivalent to `STDLIB_INTERNAL_ERROR`).
60
50
61
51
## Comparison operators provided
62
52
63
-
The module provides overloaded comparison operators for all comparisons of a `linalg_state_type` variable
64
-
with an integer error flag: `<`, `<=`, `==`, `>=`, `>`, `/=`.
53
+
The module provides overloaded comparison operators for all comparisons of a `linalg_state_type` variable with an integer error flag: `<`, `<=`, `==`, `>=`, `>`, `/=`.
0 commit comments