source: PSPA/madxPSPA/src/mad_vec.c @ 476

Last change on this file since 476 was 430, checked in by touze, 11 years ago

import madx-5.01.00

File size: 480 bytes
Line 
1#include "madx.h"
2
3double
4vdot(int* n, double* v1, double* v2)
5  /* returns dot product of vectors v1 and v2 */
6{
7  int i;
8  double dot = 0;
9  for (i = 0; i < *n; i++)  dot += v1[i] * v2[i];
10  return dot;
11}
12
13double
14vmod(int* n, double* v)
15{
16  int i;
17  double mod = 0;
18  for (i = 0; i < *n; i++)  mod += v[i] * v[i];
19  return sqrt(mod);
20}
21
22void
23zero_double(double* a, int n)
24  /* sets first n values in double array a to zero */
25{
26  int j;
27  for (j = 0; j < n; j++)  a[j] = 0;
28}
29
30
Note: See TracBrowser for help on using the repository browser.