예제 #1
0
void LocalVector<ValueType>::PointWiseMult(const LocalVector<ValueType> &x, const LocalVector<ValueType> &y) {

    LOG_DEBUG(this, "LocalVector::(x, y)",
              "");

    assert(this->get_size() == x.get_size());
    assert(this->get_size() == y.get_size());
    assert( ( (this->vector_ == this->vector_host_)  && (x.vector_ == x.vector_host_)  && (y.vector_ == y.vector_host_)) ||
            ( (this->vector_ == this->vector_accel_) && (x.vector_ == x.vector_accel_) && (y.vector_ == y.vector_accel_)) );

    if (this->get_size() > 0 ) {
        this->vector_->PointWiseMult(*x.vector_, *y.vector_);
    }

}
예제 #2
0
void LocalVector<ValueType>::ScaleAdd2(const ValueType alpha, const LocalVector<ValueType> &x, const ValueType beta, const LocalVector<ValueType> &y, const ValueType gamma) {

    LOG_DEBUG(this, "LocalVector::ScaleAdd2()",
              alpha << " " << beta);

    assert(this->get_size() == x.get_size());
    assert(this->get_size() == y.get_size());
    assert( ( (this->vector_ == this->vector_host_)  && (x.vector_ == x.vector_host_)  && (y.vector_ == y.vector_host_)) ||
            ( (this->vector_ == this->vector_accel_) && (x.vector_ == x.vector_accel_) && (y.vector_ == y.vector_accel_)) );

    if (this->get_size() > 0 ) {
        this->vector_->ScaleAdd2(alpha, *x.vector_, beta, *y.vector_, gamma);
    }

}
예제 #3
0
void LocalVector<ValueType>::CopyFromPermute(const LocalVector<ValueType> &src,
                                             const LocalVector<int> &permutation) {

    LOG_DEBUG(this, "LocalVector::CopyFromPermute()",
              "");

    assert(&src != NULL);
    assert(&src != this);
    assert(&permutation != NULL);
    assert(permutation.get_size() == this->get_size());
    assert(this->get_size() == src.get_size());
    assert( ( (this->vector_ == this->vector_host_)  && (src.vector_ == src.vector_host_)  && (permutation.vector_ == permutation.vector_host_)) ||
            ( (this->vector_ == this->vector_accel_) && (src.vector_ == src.vector_accel_) && (permutation.vector_ == permutation.vector_accel_)) );

    if (this->get_size() > 0 ) {
        this->vector_->CopyFromPermute(*src.vector_, *permutation.vector_);
    }

}
예제 #4
0
void LocalVector<ValueType>::PartialSum(const LocalVector<ValueType> &x) {

    LOG_DEBUG(this, "LocalVector::PartialSum()",
              "");

    assert(this->get_size() == x.get_size());
    assert( ( (this->vector_ == this->vector_host_)  && (x.vector_ == x.vector_host_)) ||
            ( (this->vector_ == this->vector_accel_) && (x.vector_ == x.vector_accel_)) );

    if (this->get_size() > 0 ) {
        this->vector_->PartialSum(*x.vector_);
    }

}
예제 #5
0
void LocalVector<ValueType>::ScaleAdd(const ValueType alpha, const LocalVector<ValueType> &x) {

    LOG_DEBUG(this, "LocalVector::ScaleAdd()",
              alpha);

    assert(this->get_size() == x.get_size());
    assert( ( (this->vector_ == this->vector_host_)  && (x.vector_ == x.vector_host_)) ||
            ( (this->vector_ == this->vector_accel_) && (x.vector_ == x.vector_accel_)) );

    if (this->get_size() > 0 ) {
        this->vector_->ScaleAdd(alpha, *x.vector_);
    }

}
예제 #6
0
void LocalVector<ValueType>::PermuteBackward(const LocalVector<int> &permutation) {

    LOG_DEBUG(this, "LocalVector::PermuteBackward()",
              "");

    assert(&permutation != NULL);
    assert(permutation.get_size() == this->get_size());
    assert( ( (this->vector_ == this->vector_host_)  && (permutation.vector_ == permutation.vector_host_)) ||
            ( (this->vector_ == this->vector_accel_) && (permutation.vector_ == permutation.vector_accel_)) );

    if (this->get_size() > 0 ) {
        this->vector_->PermuteBackward(*permutation.vector_);
    }

}
예제 #7
0
ValueType LocalVector<ValueType>::DotNonConj(const LocalVector<ValueType> &x) const {

    LOG_DEBUG(this, "LocalVector::DotNonConj()",
              "");

    assert(this->get_size() == x.get_size());
    assert( ( (this->vector_ == this->vector_host_)  && (x.vector_ == x.vector_host_)) ||
            ( (this->vector_ == this->vector_accel_) && (x.vector_ == x.vector_accel_)) );

    if (this->get_size() > 0 ) {
        return this->vector_->DotNonConj(*x.vector_);
    } else {
        return ValueType(0.0);
    }

}
예제 #8
0
void LocalVector<ValueType>::CopyFrom(const LocalVector<ValueType> &src,
                                      const int src_offset,
                                      const int dst_offset,
                                      const int size) {

    LOG_DEBUG(this, "LocalVector::CopyFrom()",
              "src_offset=" << src_offset <<
              " dst_offset=" << dst_offset <<
              " size=" << size);

    assert(&src != NULL);
    assert(&src != this);
    assert(src_offset < src.get_size());
    assert(dst_offset < this->get_size());

    assert( ( (this->vector_ == this->vector_host_)  && (src.vector_ == src.vector_host_)) ||
            ( (this->vector_ == this->vector_accel_) && (src.vector_ == src.vector_accel_)) );

    this->vector_->CopyFrom(*src.vector_, src_offset, dst_offset, size);

}
예제 #9
0
void LocalVector<ValueType>::ScaleAddScale(const ValueType alpha, const LocalVector<ValueType> &x, const ValueType beta,
                                           const int src_offset,
                                           const int dst_offset,
                                           const int size) {

    LOG_DEBUG(this, "LocalVector::ScaleAddScale()",
              alpha << " " << beta << " " <<
              "src_offset=" << src_offset <<
              " dst_offset=" << dst_offset <<
              " size=" << size);

    assert(&x != NULL);
    assert(src_offset < x.get_size());
    assert(dst_offset < this->get_size());
    assert( ( (this->vector_ == this->vector_host_)  && (x.vector_ == x.vector_host_)) ||
            ( (this->vector_ == this->vector_accel_) && (x.vector_ == x.vector_accel_)) );

    if (this->get_size() > 0 ) {
        this->vector_->ScaleAddScale(alpha, *x.vector_, beta,
                                     src_offset, dst_offset, size);
    }

}