#include #include #include #include #include #include "hamilton.h" /* declaration of els */ #include "op.h" /* This file contains the matrix-vector multiplication routines */ #ifdef USE_MPI #include "usempi.h" #endif elslist els={NULL,NULL,NULL,NULL,0,0,0,0}; /***********************************************************************/ /* Routine for vector producets of the positive-definite matrix of the generalized eigenvalue problem. Here, the matrix is the identity. */ #ifdef USE_MPI extern fsub OPM(integer *n, doublereal *x, doublereal *y, integer *our_comm_world) #else extern fsub OPM(integer *n, doublereal *x, doublereal *y) #endif { memcpy(y,x,(*n)*sizeof(doublereal)); return SUBRETURN; } /* complex version */ #ifdef USE_MPI extern fsub ZOPM(integer *n, doublecomplex *x, doublecomplex *y, integer *our_comm_world) #else extern fsub ZOPM(integer *n, doublecomplex *x, doublecomplex *y) #endif { memcpy(y,x,(*n)*sizeof(doublecomplex)); return SUBRETURN; } /***********************************************************************/ /* Routine for the matrix-vector multplies P and Q are Given (same), R is Answer */ #ifdef USE_MPI /* list of nonzero matrix elements used by elop and opm. */ extern fsub OP(integer *n, doublereal *P, doublereal *Q, doublereal *R, integer *our_comm_world) { /*****Give a local copy of the given vector to all pe's*****/ int my_id, comm_size,int_n=*n; integer counter, i; integer counti, countk, initcount, PointI; int *recvsendarray; int *displs; element *tempsum,*given_vector; MPI_Comm_rank(*our_comm_world, &my_id); MPI_Comm_size(*our_comm_world, &comm_size); recvsendarray=malloc(comm_size*sizeof(int)); displs=malloc((comm_size+1)*sizeof(int)); tempsum=malloc(els.n*sizeof(element)); given_vector=malloc(els.n*sizeof(element)); for(counter=0; counter