void MICAcceleratorMatrixCOO<ValueType>::ApplyAdd(const BaseVector<ValueType> &in, const ValueType scalar,
                                                  BaseVector<ValueType> *out) const {
  
  if (this->get_nnz() > 0) {
    
    assert(in.  get_size() >= 0);
    assert(out->get_size() >= 0);
    assert(in.  get_size() == this->get_ncol());
    assert(out->get_size() == this->get_nrow());
    
    
    const MICAcceleratorVector<ValueType> *cast_in = dynamic_cast<const MICAcceleratorVector<ValueType>*> (&in) ; 
    MICAcceleratorVector<ValueType> *cast_out      = dynamic_cast<      MICAcceleratorVector<ValueType>*> (out) ; 
    
    assert(cast_in != NULL);
    assert(cast_out!= NULL);

    spmv_add_coo(this->local_backend_.MIC_dev,
		 this->mat_.row,
		 this->mat_.col,
		 this->mat_.val,
		 this->get_nrow(),
		 this->get_nnz(),
		 scalar,
		 cast_in->vec_,
		 cast_out->vec_);

  }

}
Ejemplo n.º 2
0
void MICAcceleratorMatrixHYB<ValueType>::Apply(const BaseVector<ValueType> &in, BaseVector<ValueType> *out) const {

  if (this->get_nnz() > 0) {
    
    assert(in.  get_size() >= 0);
    assert(out->get_size() >= 0);
    assert(in.  get_size() == this->get_ncol());
    assert(out->get_size() == this->get_nrow());
    
    
    const MICAcceleratorVector<ValueType> *cast_in = dynamic_cast<const MICAcceleratorVector<ValueType>*> (&in) ; 
    MICAcceleratorVector<ValueType> *cast_out      = dynamic_cast<      MICAcceleratorVector<ValueType>*> (out) ; 
    
    assert(cast_in != NULL);
    assert(cast_out!= NULL);

    spmv_ell(this->local_backend_.MIC_dev,
	     this->mat_.ELL.col,
	     this->mat_.ELL.val,
	     this->get_nrow(),
	     this->get_ncol(),
	     this->get_ell_max_row(),
	     cast_in->vec_,
	     cast_out->vec_);

    spmv_add_coo(this->local_backend_.MIC_dev,
		 this->mat_.COO.row,
		 this->mat_.COO.col,
		 this->mat_.COO.val,
		 this->get_nrow(),
		 this->get_coo_nnz(),
		 ValueType(1.0),
		 cast_in->vec_,
		 cast_out->vec_);
 

  }
}