Debian Codegraph @

packages/seacas/libraries/chaco/eigen/checkeig.c

raw
1 /*
2 * Copyright(C) 1999-2020, 2023 National Technology & Engineering Solutions
3 * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
4 * NTESS, the U.S. Government retains certain rights in this software.
5 *
6 * See packages/seacas/LICENSE for details
7 */
8
9 #include "defs.h"
10 #include "structs.h"
11
12 /* Check an eigenpair of A by direct multiplication. */
13 double checkeig(double *err, struct vtx_data **A, double *y, int n, double lambda, double *vwsqrt,
14 double *work)
15 {
16 double resid;
17 double normy;
18
19 splarax(err, A, n, y, vwsqrt, work);
20 scadd(err, 1, n, -lambda, y);
21 normy = ch_norm(y, 1, n);
22 resid = ch_norm(err, 1, n) / normy;
23 return (resid);
24 }