function
Tests.Assertions.spdResidual
Maximum residual of a successful SPD solve
Public declarations
Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.
| Role | Name | Type | Dimensions / attributes / default | Description |
|---|---|---|---|---|
| input | A | Real | [:, size(A, 1)] | |
| input | B | Real | [size(A, 1), :] | |
| output | residual | Real | |
Modelica declarations and implementation
Show parameters, interfaces and source
Parameters, inputs, outputs, defaults and equations from the source file.
function spdResidual "Maximum residual of a successful SPD solve"
input Real A[:, size(A, 1)];
input Real B[size(A, 1), :];
output Real residual;
protected
Real X[size(B, 1), size(B, 2)];
Boolean ok;
algorithm
(X, ok) := LinearAlgebra.solveSPD(A, B);
assert(ok, "solveSPD rejected a positive-definite test matrix");
residual := Tests.Assertions.maxAbsMatrix(A * X - B);
end spdResidual;