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 typedef struct _VecScatterCtx* VecScatterCtx; 23 24 extern int VecCreateSequential(int,Vec *); 25 extern int VecCreateSequentialBLAS(int,Vec *); 26 27 #if defined(HAVE_MPI) 28 #include "comm.h" 29 extern int VecCreateMPI(MPI_Comm,int,int,Vec *); 30 extern int VecCreateMPIBLAS(MPI_Comm,int,int,Vec *); 31 #endif 32 33 extern int VecCreateInitialVector(int,Vec *); 34 35 36 37 38 extern int VecDot(Vec, Vec, Scalar*); 39 extern int VecTDot(Vec, Vec, Scalar*); 40 extern int VecMDot(int, Vec ,Vec*,Scalar*); 41 extern int VecMTDot(int, Vec ,Vec*,Scalar*); 42 extern int VecNorm(Vec, double*); 43 extern int VecASum(Vec, Scalar*); 44 extern int VecMax(Vec, int *, Scalar*); 45 extern int VecScale(Scalar*, Vec); 46 extern int VecCopy(Vec, Vec); 47 extern int VecSet(Scalar*, Vec); 48 extern int VecSwap(Vec, Vec); 49 extern int VecAXPY(Scalar*, Vec, Vec); 50 extern int VecMAXPY(int, Scalar*, Vec ,Vec*); 51 extern int VecAYPX(Scalar*, Vec, Vec); 52 extern int VecWAXPY(Scalar*, Vec, Vec, Vec); 53 extern int VecPMult(Vec, Vec, Vec); 54 extern int VecPDiv(Vec, Vec, Vec); 55 extern int VecCreate(Vec,Vec *); 56 extern int VecDestroy(Vec); 57 extern int VecGetVecs(Vec, int,Vec **); 58 extern int VecFreeVecs(Vec*,int); 59 60 extern int VecAddValues(Vec, int, int *,Scalar*); 61 extern int VecInsertValues(Vec, int, int *,Scalar*); 62 extern int VecBeginAssembly(Vec); 63 extern int VecEndAssembly(Vec); 64 65 extern int VecScatterBegin(Vec,IS,Vec,IS,VecScatterCtx *); 66 extern int VecScatterEnd(Vec,IS,Vec,IS,VecScatterCtx *); 67 68 extern int VecScatterAddBegin(Vec,IS,Vec,IS,VecScatterCtx *); 69 extern int VecScatterAddEnd(Vec,IS,Vec,IS,VecScatterCtx *); 70 71 extern int VecGetArray(Vec,Scalar**); 72 extern int VecValidVector(Vec); 73 extern int VecView(Vec, Viewer); 74 75 extern int VecGetSize(Vec,int *); 76 extern int VecGetLocalSize(Vec,int *); 77 78 /* utility routines */ 79 extern int VecReciprocal(Vec); 80 81 #endif 82 83 84