res_with_prec — computes the residual r = Ax-b with precision
[r,norm2_r] = res_with_prec(A, x, b)
real or complex sparse matrix (m x n)
column vector (n x 1) or matrix (n x p)
column vector (m x 1) or matrix (m x p)
column vector (m x 1) or matrix (m x p)
scalar or vector (1 x p) when b is a m x p matrix
This function computes the residual of a linear system r = Ax - b
(together
with its 2-norm) with the additionnal precision provided on "Intel like"
FPU (80 bits in place of 64) if the compiler translate "long double" to
use it. Else one must get the same than using A*x - b
at the scilab level.
In both cases using [r, nr] = res_with_prec(A,x,b)
is
faster than r = A*x - b
(and faster than r = A*x - b; nr = norm(r)
).
When p > 1
, norm2_r(i)
is the 2-norm of the vector r(:,i)
.