4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
12 * Copyright (c) 1991-2001
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * If you want to redistribute modifications, please consider that
22 * scientific software is very special. Version control is crucial -
23 * bugs must be traceable. We will be happy to consider code for
24 * inclusion in the official distribution, but derived work must not
25 * be called official GROMACS. Details are found in the README & COPYING
26 * files - if they are missing, get the official version at www.gromacs.org.
28 * To help us fund GROMACS development, we humbly ask that you cite
29 * the papers on the package - you can find them in the top README file.
31 * Do check out http://www.gromacs.org , or mail us at gromacs@gromacs.org .
34 * Giving Russians Opium May Alter Current Situation
40 static char *SRCID_vveclib_h = "$Id$";
46 #ident "@(#) vveclib.h 1.11 2/2/97"
47 #endif /* HAVE_IDENT */
52 * Interface module for vector library.
53 * This is a set of routines that uses
55 * - veclib on the convex (future)
56 * - some general C-routines
58 * The routines provided here just provide a standard header for
60 * All routine-names start with "v_"
61 * All routines take type real which can be single or double
62 * depending on options set and machine.
63 * All routines take an integer N as first parameter which is
67 extern double Flops; /* The number of flops to date */
69 #define FV_SAFE 12 /* Make your arrays FV_SAFE longer allways */
71 extern void v_scopy(int N,real s,real Z[]);
72 /* copy scalar to vector (Z[i] := s) */
74 extern void v_vcopy(int N,real X[],real Z[]);
75 /* copy vector X to vector Z (Z[i] := X[i]) */
77 extern real v_inner(int N,real X[],real Y[]);
78 /* calculate the inner product of X and Y */
80 extern void v_scopy_s(int N,real s,real Z[],int stride);
81 /* copy scalar to each stride's element of Z (Z[i x stride] := s */
83 extern void v_gather(int N,real B[],int IX[],real Z[]);
84 /* gather vector: Z[i] := B[IX[i]] */
86 extern void v_scatter(int N,real B[],int IX[],real Z[]);
87 /* scatter vector: Z[IX[i]] := B[i] */
89 extern void v_gather_us(int N,real B[],unsigned short IX[],real Z[]);
90 /* gather vector: Z[i] := B[IX[i]] */
92 extern void v_scatter_us(int N,real B[],unsigned short IX[],real Z[]);
93 /* scatter vector: Z[IX[i]] := B[i] */
95 extern void v_gather_us_s(int N,real B[],unsigned short IX[],real Z[],
97 /* gather vector: Z[stride*i] := B[IX[stride*i]] */
99 extern void v_scatter_us_s(int N,real B[],unsigned short IX[],real Z[],
101 /* scatter vector: Z[IX[stride*i]] := B[stride*i] */
103 extern void v_sub(int N,real X[],real Y[],real Z[]);
104 /* vector subtract: Z[i] := X[i]-Y[i] */
106 extern void v_mul(int N,real X[],real Y[],real Z[]);
107 /* vector multiply: Z[i] := X[i]*Y[i] */
109 extern void v_add(int N,real X[],real Y[],real Z[]);
110 /* vector add: Z[i] := X[i]+Y[i] */
112 /********************* Other routines ****************************/
114 void dprod(tensor T, rvec V, rvec W);
115 /* calculate the direct product: T = V(x)W */
117 void fac_dprod(tensor T, rvec V, rvec W, real fac);
118 /* calculate the direct product and every component fac
119 * times to T: Tij += fac * [V(x)W]ij
122 #endif /* _vveclib_h */