Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 324fa67f authored by hhakim's avatar hhakim
Browse files

Implement MatSparse<GPU2>::multiply(MatDense<GPU2>), Matdense<GPU2>::multiplyLeft(MatSparse<GPU2>).

parent 196d0707
No related branches found
No related tags found
No related merge requests found
...@@ -481,6 +481,12 @@ namespace Faust ...@@ -481,6 +481,12 @@ namespace Faust
} }
} }
template<>
void Faust::MatDense<@FAUST_SCALAR_FOR_GM@,GPU2>::multiplyLeft(MatSparse<@FAUST_SCALAR_FOR_GM@,GPU2> const& S, const char transS)
{
S.multiply(*this);
}
template<> template<>
void Faust::MatDense<@FAUST_SCALAR_FOR_GM@, GPU2>::operator=(const MatDense<@FAUST_SCALAR_FOR_GM@, Cpu>& A) void Faust::MatDense<@FAUST_SCALAR_FOR_GM@, GPU2>::operator=(const MatDense<@FAUST_SCALAR_FOR_GM@, Cpu>& A)
{ {
......
...@@ -79,6 +79,7 @@ namespace Faust ...@@ -79,6 +79,7 @@ namespace Faust
void multiplyRight(const MatDense<FPP, GPU2>& A); void multiplyRight(const MatDense<FPP, GPU2>& A);
//! \brief Replace (this) by S * (this) //! \brief Replace (this) by S * (this)
void multiplyLeft(const MatSparse<FPP, Cpu>& S, const char transS='N'); void multiplyLeft(const MatSparse<FPP, Cpu>& S, const char transS='N');
void multiplyLeft(const MatSparse<FPP, GPU2>& S, const char transS='N');
void multiply(const Vect<FPP, GPU2>& vec, Vect<FPP, GPU2>& out_vec) const; void multiply(const Vect<FPP, GPU2>& vec, Vect<FPP, GPU2>& out_vec) const;
//! \brief compute MatDense-vector multiplication //! \brief compute MatDense-vector multiplication
//! \param vec : the vector //! \param vec : the vector
......
...@@ -486,6 +486,18 @@ namespace Faust ...@@ -486,6 +486,18 @@ namespace Faust
vec.gpu_mat = gpu_dmat; vec.gpu_mat = gpu_dmat;
} }
template<>
void MatSparse<FSFG, GPU2>::multiply(MatDense<FSFG,GPU2>& mat, char opThis/*='N'*/) const
{
gm_Op gop_this;
char2gm_Op(opThis, gop_this);
auto spm_funcs = GPUModHandler::get_singleton()->spm_funcs((@FAUST_SCALAR_FOR_GM@)(0));
auto dsm_funcs = GPUModHandler::get_singleton()->dsm_funcs((@FAUST_SCALAR_FOR_GM@)(0));
auto gpu_dmat = spm_funcs->mul_gpu_dsm_ext(gpu_mat, mat.gpu_mat, nullptr, gop_this, OP_NOTRANSP);
dsm_funcs->free(mat.gpu_mat);
mat.gpu_mat = gpu_dmat;
}
template<> template<>
size_t Faust::MatSparse<FSFG,GPU2>::getNBytes() const size_t Faust::MatSparse<FSFG,GPU2>::getNBytes() const
{ {
......
...@@ -92,6 +92,7 @@ namespace Faust ...@@ -92,6 +92,7 @@ namespace Faust
std::string to_string(const bool transpose=false, const bool displaying_small_mat_elts=false) const; std::string to_string(const bool transpose=false, const bool displaying_small_mat_elts=false) const;
MatType getType() const; MatType getType() const;
void multiply(Vect<FPP,GPU2>& vec, char opThis='N') const; void multiply(Vect<FPP,GPU2>& vec, char opThis='N') const;
void multiply(MatDense<FPP,GPU2>& vec, char opThis='N') const;
~MatSparse(); ~MatSparse();
MatSparse<FPP,GPU2>* get_rows(faust_unsigned_int row_id_start, faust_unsigned_int num_rows) const; MatSparse<FPP,GPU2>* get_rows(faust_unsigned_int row_id_start, faust_unsigned_int num_rows) const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment