Relative-error and array-comparison helpers used in tests and consistency checks. The relative-error normalization is by the first argument, so callers should avoid a zero reference value.
if (allclose(reference, calculated, 1.0e-8_pr)) print *, "consistent"
Check whether all elements of two arrays agree within rtol.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=pr), | intent(in) | :: | x(:) |
First array |
||
| real(kind=pr), | intent(in) | :: | y(:) |
Second array |
||
| real(kind=pr), | intent(in) | :: | rtol |
Relative tolerance |
Return the absolute relative error with x as reference.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=pr), | intent(in) | :: | x |
Nonzero reference value. |
||
| real(kind=pr), | intent(in) | :: | y |
Value compared against the reference. |