ac0dcbf6f741dda3601fc68260987ffeb4ddbbe3
[alexxy/gromacs.git] / include / vveclib.h
1 /*
2  * $Id$
3  * 
4  *       This source code is part of
5  * 
6  *        G   R   O   M   A   C   S
7  * 
8  * GROningen MAchine for Chemical Simulations
9  * 
10  *               VERSION 2.0
11  * 
12  * Copyright (c) 1991-1999
13  * BIOSON Research Institute, Dept. of Biophysical Chemistry
14  * University of Groningen, The Netherlands
15  * 
16  * Please refer to:
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)
20  * 
21  * Also check out our WWW page:
22  * http://md.chem.rug.nl/~gmx
23  * or e-mail to:
24  * gromacs@chem.rug.nl
25  * 
26  * And Hey:
27  * Green Red Orange Magenta Azure Cyan Skyblue
28  */
29
30 #ifndef _vveclib_h
31 #define _vveclib_h
32
33 static char *SRCID_vveclib_h = "$Id$";
34
35 #ifdef HAVE_CONFIG_H
36 #include <config.h>
37 #endif
38
39 #ifdef HAVE_IDENT
40 #ident  "@(#) vveclib.h 1.11 2/2/97"
41 #endif /* HAVE_IDENT */
42
43 #include "typedefs.h"
44
45 /* 
46  * Interface module for vector library.
47  * This is a set of routines that uses 
48  * - libfv  on the i860
49  * - veclib on the convex (future)
50  * - some general C-routines
51  *
52  * The routines provided here just provide a standard header for
53  * all systems.
54  * All routine-names start with "v_"
55  * All routines take type real which can be single or double
56  * depending on options set and machine.
57  * All routines take an integer N as first parameter which is
58  * the vector length.
59  */
60
61 extern double Flops;            /* The number of flops to date  */
62
63 #define FV_SAFE 12   /* Make your arrays FV_SAFE longer allways */
64
65 extern void v_scopy(int N,real s,real Z[]);
66 /* copy scalar to vector (Z[i] := s) */
67
68 extern void v_vcopy(int N,real X[],real Z[]);
69 /* copy vector X to vector Z (Z[i] := X[i]) */
70
71 extern real v_inner(int N,real X[],real Y[]);
72 /* calculate the inner product of X and Y */
73
74 extern void v_scopy_s(int N,real s,real Z[],int stride);
75 /* copy scalar to each stride's element of Z (Z[i x stride] := s */
76
77 extern void v_gather(int N,real B[],int IX[],real Z[]);
78 /* gather vector: Z[i] := B[IX[i]] */
79
80 extern void v_scatter(int N,real B[],int IX[],real Z[]);
81 /* scatter vector: Z[IX[i]] := B[i] */
82
83 extern void v_gather_us(int N,real B[],unsigned short IX[],real Z[]);
84 /* gather vector: Z[i] := B[IX[i]] */
85
86 extern void v_scatter_us(int N,real B[],unsigned short IX[],real Z[]);
87 /* scatter vector: Z[IX[i]] := B[i] */
88
89 extern void v_gather_us_s(int N,real B[],unsigned short IX[],real Z[],
90                           int stride);
91 /* gather vector: Z[stride*i] := B[IX[stride*i]] */
92
93 extern void v_scatter_us_s(int N,real B[],unsigned short IX[],real Z[],
94                            int stride);
95 /* scatter vector: Z[IX[stride*i]] := B[stride*i] */
96
97 extern void v_sub(int N,real X[],real Y[],real Z[]);
98 /* vector subtract: Z[i] := X[i]-Y[i] */
99
100 extern void v_mul(int N,real X[],real Y[],real Z[]);
101 /* vector multiply: Z[i] := X[i]*Y[i] */
102
103 extern void v_add(int N,real X[],real Y[],real Z[]);
104 /* vector add: Z[i] := X[i]+Y[i] */
105
106 /********************* Other routines ****************************/
107
108 void dprod(tensor T, rvec V, rvec W);
109 /* calculate the direct product: T = V(x)W */
110
111 void fac_dprod(tensor T, rvec V, rvec W, real fac);
112 /* calculate the direct product and every component fac
113  * times to T: Tij += fac * [V(x)W]ij 
114  */
115
116 #endif  /* _vveclib_h */