Real reduce( const Elementwise::ReductionOp<Real> &r ) const {

    Real result = r.initialValue();
    r.reduce(vec1_->reduce(r),result);
    r.reduce(vec2_->reduce(r),result);
    return result;
  }
 Real reduce( const Elementwise::ReductionOp<Real> &r ) const {
   Real result = r.initialValue();
   Real pval = pvec_->reduce(r);
   Real aval = avec_->reduce(r);
   r.reduce(pval,result);
   r.reduce(aval,result);
   return result;
 }
Exemple #3
0
 Real reduce( const Elementwise::ReductionOp<Real> &r ) const {
   Real result = r.initialValue();
   r.reduce(vec_->reduce(r),result);
   if (augmented_) {
     r.reduce(stat_vec_->reduce(r),result);
   }
   return result;
 }
 Real reduce( const Elementwise::ReductionOp<Real> &r ) const {
   Real result = r.initialValue();
   uint dimension  = std_vec_->size();
   for(uint i=0; i<dimension; ++i) {
     r.reduce((*std_vec_)[i],result);
   }
   return result;
 }
  Real reduce( const Elementwise::ReductionOp<Real> &r ) const {

    Real result = r.initialValue();

    for( size_type i=0; i<vecs_->size(); ++i ) {
      r.reduce((*vecs_)[i]->reduce(r),result);
    }     
    return result;

  }
 void reduceAll(Real* input, Real* output,
                const Elementwise::ReductionOp<Real> &r) {
   int nB = this->numBatches();
   std::vector<Real> receiveBuffer(nB);
   Teuchos::gather<Ordinal,Real>(input,1,&receiveBuffer[0],1,0,*comm_);
   output[0] = r.initialValue();
   for (int i = 0; i < nB; i++) {
     r.reduce(receiveBuffer[i],output[0]);
   }
   Teuchos::broadcast<Ordinal,Real>(*comm_,0,1,output);
 }
T
MiniTensorVector<T, N>::
reduce(Elementwise::ReductionOp<T> const & r) const
{
  T
  result = r.initialValue();

  auto const
  dim = vector_.get_dimension();

  for(minitensor::Index i{0}; i < dim; ++i) {
    r.reduce(vector_(i), result);
  }

  return result;
}