1 /* 2 This defines the abstract vector component. These are patterned 3 after the Level-1 Blas, but with some additions that have proved 4 useful. These include routines to allocate and free vectors. 5 6 Note that the routines that are normally thought of as returning a 7 value (e.g., dot, norm) return their value through an argument. 8 This allows these routines to be used with other datatype, such 9 as float and dcomplex. 10 11 All vectors should be declared as a Vec. All vector routines begin 12 with Vec. 13 14 15 */ 16 17 #ifndef __VEC_PACKAGE 18 #define __VEC_PACKAGE 19 #include "is.h" 20 21 typedef struct _Vec* Vec; 22 23 extern int VecCreateSequential(int,Vec *); 24 extern int VecCreateSequentialBLAS(int,Vec *); 25 26 #if defined(USING_MPI) 27 extern int VecCreateMPI(MPI_Comm,int,int,Vec *); 28 extern int VecCreateMPIBLAS(MPI_Comm,int,int,Vec *); 29 #endif 30 31 extern int VecCreateInitialVector(int,Vec *); 32 33 34 35 36 extern int VecDot(Vec, Vec, Scalar*); 37 extern int VecTDot(Vec, Vec, Scalar*); 38 extern int VecMDot(int, Vec ,Vec*,Scalar*); 39 extern int VecMTDot(int, Vec ,Vec*,Scalar*); 40 extern int VecNorm(Vec, double*); 41 extern int VecASum(Vec, Scalar*); 42 extern int VecMax(Vec, int *, Scalar*); 43 extern int VecScale(Scalar*, Vec); 44 extern int VecCopy(Vec, Vec); 45 extern int VecSet(Scalar*, Vec); 46 extern int VecSwap(Vec, Vec); 47 extern int VecAXPY(Scalar*, Vec, Vec); 48 extern int VecMAXPY(int, Scalar*, Vec ,Vec*); 49 extern int VecAYPX(Scalar*, Vec, Vec); 50 extern int VecWAXPY(Scalar*, Vec, Vec, Vec); 51 extern int VecPMult(Vec, Vec, Vec); 52 extern int VecPDiv(Vec, Vec, Vec); 53 extern int VecCreate(Vec,Vec *); 54 extern int VecDestroy(Vec); 55 extern int VecGetVecs(Vec, int,Vec **); 56 extern int VecFreeVecs(Vec*,int); 57 58 extern int VecAddValues(Vec, int, int *,Scalar*); 59 extern int VecInsertValues(Vec, int, int *,Scalar*); 60 extern int VecBeginAssembly(Vec); 61 extern int VecEndAssembly(Vec); 62 63 extern int VecScatterBegin(Vec,IS,Vec,IS,ISScatterCtx *); 64 extern int VecScatterEnd(Vec,IS,Vec,IS,ISScatterCtx *); 65 66 extern int VecScatterAddBegin(Vec,IS,Vec,IS,ISScatterCtx *); 67 extern int VecScatterAddEnd(Vec,IS,Vec,IS,ISScatterCtx *); 68 69 extern int VecGetArray(Vec,Scalar**); 70 extern int VecValidVector(Vec); 71 extern int VecView(Vec, Viewer); 72 73 extern int VecGetSize(Vec,int *); 74 extern int VecGetLocalSize(Vec,int *); 75 76 /* utility routines */ 77 extern int VecReciprocal(Vec); 78 79 #endif 80 81 82