4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
12 * Copyright (c) 1991-1999
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
17 * GROMACS: A message-passing parallel molecular dynamics implementation
18 * H.J.C. Berendsen, D. van der Spoel and R. van Drunen
19 * Comp. Phys. Comm. 91, 43-56 (1995)
21 * Also check out our WWW page:
22 * http://md.chem.rug.nl/~gmx
27 * Green Red Orange Magenta Azure Cyan Skyblue
33 static char *SRCID_vveclib_h
= "$Id$";
36 #ident "@(#) vveclib.h 1.11 2/2/97"
37 #endif /* HAVE_IDENT */
42 * Interface module for vector library.
43 * This is a set of routines that uses
45 * - veclib on the convex (future)
46 * - some general C-routines
48 * The routines provided here just provide a standard header for
50 * All routine-names start with "v_"
51 * All routines take type real which can be single or double
52 * depending on options set and machine.
53 * All routines take an integer N as first parameter which is
57 extern double Flops
; /* The number of flops to date */
59 #define FV_SAFE 12 /* Make your arrays FV_SAFE longer allways */
61 extern void v_scopy(int N
,real s
,real Z
[]);
62 /* copy scalar to vector (Z[i] := s) */
64 extern void v_vcopy(int N
,real X
[],real Z
[]);
65 /* copy vector X to vector Z (Z[i] := X[i]) */
67 extern real
v_inner(int N
,real X
[],real Y
[]);
68 /* calculate the inner product of X and Y */
70 extern void v_scopy_s(int N
,real s
,real Z
[],int stride
);
71 /* copy scalar to each stride's element of Z (Z[i x stride] := s */
73 extern void v_gather(int N
,real B
[],int IX
[],real Z
[]);
74 /* gather vector: Z[i] := B[IX[i]] */
76 extern void v_scatter(int N
,real B
[],int IX
[],real Z
[]);
77 /* scatter vector: Z[IX[i]] := B[i] */
79 extern void v_gather_us(int N
,real B
[],unsigned short IX
[],real Z
[]);
80 /* gather vector: Z[i] := B[IX[i]] */
82 extern void v_scatter_us(int N
,real B
[],unsigned short IX
[],real Z
[]);
83 /* scatter vector: Z[IX[i]] := B[i] */
85 extern void v_gather_us_s(int N
,real B
[],unsigned short IX
[],real Z
[],
87 /* gather vector: Z[stride*i] := B[IX[stride*i]] */
89 extern void v_scatter_us_s(int N
,real B
[],unsigned short IX
[],real Z
[],
91 /* scatter vector: Z[IX[stride*i]] := B[stride*i] */
93 extern void v_sub(int N
,real X
[],real Y
[],real Z
[]);
94 /* vector subtract: Z[i] := X[i]-Y[i] */
96 extern void v_mul(int N
,real X
[],real Y
[],real Z
[]);
97 /* vector multiply: Z[i] := X[i]*Y[i] */
99 extern void v_add(int N
,real X
[],real Y
[],real Z
[]);
100 /* vector add: Z[i] := X[i]+Y[i] */
102 /********************* Other routines ****************************/
104 void dprod(tensor T
, rvec V
, rvec W
);
105 /* calculate the direct product: T = V(x)W */
107 void fac_dprod(tensor T
, rvec V
, rvec W
, real fac
);
108 /* calculate the direct product and every component fac
109 * times to T: Tij += fac * [V(x)W]ij
112 #endif /* _vveclib_h */