示例#1
0
//==============================================================================
void AztecDVBR_Matrix::matvec(const Aztec_LSVector& x, Aztec_LSVector& y) const {
    	
// AztecDVBR_Matrix::matvec --- form y = Ax

    assert(isLoaded());

    int *proc_config = amap_->getProcConfig();
    double *b = (double*)x.startPointer();
    double *c = (double*)y.startPointer();

    AZ_VBR_matvec_mult(b, c, Amat_, proc_config);

    return;
}
/**=========================================================================**/
double Aztec_LSVector::dotProd (const Aztec_LSVector& y) const {

/** Aztec_LSVector::dotProd --- returns dot product of two vectors **/

   int N_update = amap_->localSize();

   double *pv = (double*)localCoeffs_;
   double *py = (double*)y.startPointer();

   double dot = AZ_gdot(N_update, pv, py, amap_->getProcConfig());

   return dot;
}
/**=========================================================================**/
void Aztec_LSVector::addVec (double s, const Aztec_LSVector& c) {

/** Aztec_LSVector::addVec --- add multiple of a vector:  s*c **/

   int N_update = amap_->localSize();
   int one = 1;

   double *pv = localCoeffs_;
   double *pc = (double*)c.startPointer();

   DAXPY_F77(&N_update,&s,pc,&one,pv,&one);

   return;
}
/**=========================================================================**/
void Aztec_LSVector::assign(const Aztec_LSVector& rhs) {

   if ((amap_->globalSize() != rhs.amap_->globalSize()) ||
      (amap_->localSize() != rhs.amap_->localSize()) ) {
      fei::console_out() << "Aztec_LSVector::assign: ERROR, incompatible maps."
           << " Aborting assignment." << FEI_ENDL;
      return;
   }

   int N_update = amap_->localSize();
   double *pr = (double*)rhs.startPointer();

   for(int i=0; i<N_update; ++i) {
     localCoeffs_[i] = pr[i];
   }

   return;
}