xref: /petsc/include/petscvec.h (revision f0479e8c2158d05ab5c06def5bd82110ef658075) !
12eac72dbSBarry Smith /*
22eac72dbSBarry Smith    This defines the abstract vector component. These are patterned
32eac72dbSBarry Smith    after the Level-1 Blas, but with some additions that have proved
42eac72dbSBarry Smith    useful. These include routines to allocate and free vectors.
52eac72dbSBarry Smith 
62eac72dbSBarry Smith    Note that the routines that are normally thought of as returning a
72eac72dbSBarry Smith    value (e.g., dot, norm) return their value through an argument.
82eac72dbSBarry Smith    This allows these routines to be used with other datatype, such
92eac72dbSBarry Smith    as float and dcomplex.
102eac72dbSBarry Smith 
112eac72dbSBarry Smith    All vectors should be declared as a Vec. All vector routines begin
122eac72dbSBarry Smith    with Vec.
132eac72dbSBarry Smith 
142eac72dbSBarry Smith 
152eac72dbSBarry Smith  */
162eac72dbSBarry Smith 
172eac72dbSBarry Smith #ifndef __VEC_PACKAGE
182eac72dbSBarry Smith #define __VEC_PACKAGE
192eac72dbSBarry Smith #include "is.h"
202eac72dbSBarry Smith 
21*f0479e8cSBarry Smith #define VEC_COOKIE 0x101010
22*f0479e8cSBarry Smith 
232eac72dbSBarry Smith typedef struct _Vec*           Vec;
2420563c6bSBarry Smith typedef struct _VecScatterCtx* VecScatterCtx;
252eac72dbSBarry Smith 
268ed539a5SBarry Smith extern int VecCreateSequential(int,Vec *);
278ed539a5SBarry Smith extern int VecCreateSequentialBLAS(int,Vec *);
282eac72dbSBarry Smith 
298ed539a5SBarry Smith extern int VecCreateMPI(MPI_Comm,int,int,Vec *);
308ed539a5SBarry Smith extern int VecCreateMPIBLAS(MPI_Comm,int,int,Vec *);
312eac72dbSBarry Smith 
328ed539a5SBarry Smith extern int VecCreateInitialVector(int,Vec *);
332eac72dbSBarry Smith 
348ed539a5SBarry Smith extern int VecDot(Vec, Vec, Scalar*);
358ed539a5SBarry Smith extern int VecTDot(Vec, Vec, Scalar*);
368ed539a5SBarry Smith extern int VecMDot(int,      Vec ,Vec*,Scalar*);
378ed539a5SBarry Smith extern int VecMTDot(int,      Vec ,Vec*,Scalar*);
388ed539a5SBarry Smith extern int VecNorm(Vec, double*);
3920563c6bSBarry Smith extern int VecASum(Vec, double*);
408ed539a5SBarry Smith extern int VecMax(Vec, int *,    Scalar*);
418ed539a5SBarry Smith extern int VecScale(Scalar*, Vec);
428ed539a5SBarry Smith extern int VecCopy(Vec, Vec);
438ed539a5SBarry Smith extern int VecSet(Scalar*, Vec);
448ed539a5SBarry Smith extern int VecSwap(Vec, Vec);
458ed539a5SBarry Smith extern int VecAXPY(Scalar*, Vec, Vec);
468ed539a5SBarry Smith extern int VecMAXPY(int,      Scalar*, Vec ,Vec*);
478ed539a5SBarry Smith extern int VecAYPX(Scalar*, Vec, Vec);
488ed539a5SBarry Smith extern int VecWAXPY(Scalar*, Vec, Vec, Vec);
498ed539a5SBarry Smith extern int VecPMult(Vec, Vec, Vec);
508ed539a5SBarry Smith extern int VecPDiv(Vec, Vec, Vec);
518ed539a5SBarry Smith extern int VecCreate(Vec,Vec *);
528ed539a5SBarry Smith extern int VecDestroy(Vec);
538ed539a5SBarry Smith extern int VecGetVecs(Vec, int,Vec **);
548ed539a5SBarry Smith extern int VecFreeVecs(Vec*,int);
552eac72dbSBarry Smith 
5620563c6bSBarry Smith typedef enum {NotSetValues, InsertValues, AddValues} InsertMode;
5720563c6bSBarry Smith 
5820563c6bSBarry Smith extern int VecSetValues(Vec, int, int *,Scalar*,InsertMode);
598ed539a5SBarry Smith extern int VecBeginAssembly(Vec);
608ed539a5SBarry Smith extern int VecEndAssembly(Vec);
618ed539a5SBarry Smith 
6220563c6bSBarry Smith extern int VecScatterBegin(Vec,IS,Vec,IS,InsertMode,VecScatterCtx *);
6320563c6bSBarry Smith extern int VecScatterEnd(Vec,IS,Vec,IS,InsertMode,VecScatterCtx *);
6420563c6bSBarry Smith extern int VecScatterCtxCreate(Vec,IS,Vec,IS,VecScatterCtx *);
6520563c6bSBarry Smith extern int VecScatterCtxDestroy(VecScatterCtx);
668ed539a5SBarry Smith 
678ed539a5SBarry Smith extern int VecGetArray(Vec,Scalar**);
688ed539a5SBarry Smith extern int VecValidVector(Vec);
698ed539a5SBarry Smith extern int VecView(Vec, Viewer);
708ed539a5SBarry Smith 
718ed539a5SBarry Smith extern int VecGetSize(Vec,int *);
728ed539a5SBarry Smith extern int VecGetLocalSize(Vec,int *);
738ed539a5SBarry Smith 
748ed539a5SBarry Smith /* utility routines */
758ed539a5SBarry Smith extern int VecReciprocal(Vec);
762eac72dbSBarry Smith 
772eac72dbSBarry Smith #endif
782eac72dbSBarry Smith 
792eac72dbSBarry Smith 
80