Exemplo n.º 1
0
        public static double ComputeResidual(CompressedColumnStorage <Complex> A, Complex[] x, Complex[] b, bool relativeError = true)
        {
            var e = Vector.Clone(b);

            A.Multiply(-1.0, x, 1.0, e);

            if (relativeError)
            {
                return(Vector.Norm(e) / (A.FrobeniusNorm() * Vector.Norm(b)));
            }

            return(Vector.Norm(e));
        }