Debian Codegraph @

packages/seacas/libraries/chaco/eigen/orthogvec.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
11 void orthogvec(double *vec1, /* vector to be orthogonalized */
12 int beg, int end, /* start and stop range for vector */
13 double *vec2 /* vector to be orthogonalized against */
14 )
15 {
16 double alpha;
17
18 alpha = -dot(vec1, beg, end, vec2) / dot(vec2, beg, end, vec2);
19 scadd(vec1, beg, end, alpha, vec2);
20 }
21
22 void orthogvec_float(float *vec1, /* vector to be orthogonalized */
23 int beg, int end, /* start and stop range for vector */
24 float *vec2 /* vector to be orthogonalized against */
25 )
26 {
27 float alpha;
28
29 alpha = -dot_float(vec1, beg, end, vec2) / dot_float(vec2, beg, end, vec2);
30 scadd_float(vec1, beg, end, alpha, vec2);
31 }