Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 199e614a authored by hhakim's avatar hhakim
Browse files

Add GPU TransformHelper::power_iteration support.

Update to gpu_mod@04b59b9e.
Commit related to issue #192.
parent 8e50a9b6
No related branches found
No related tags found
No related merge requests found
Subproject commit 99364247691c1cb8bc469fb126812cff0462b476
Subproject commit 04b59b9eec5ea2d28ed8d26c41a531e58f6b3ca7
......@@ -200,8 +200,7 @@ namespace Faust
template<typename FPP>
FPP TransformHelper<FPP,GPU2>::power_iteration(const faust_unsigned_int nb_iter_max, const Real<FPP>& threshold, int& flag)
{
throw std::runtime_error("power_iteration not yet supported.");
//TODO: simple to add in gpu_mod
return this->transform->power_iteration(nb_iter_max, threshold, flag);
}
template<typename FPP>
......
......@@ -341,6 +341,17 @@ namespace Faust
return marr_funcs->spectral_norm(gpu_mat_arr, threshold, nb_iter_max);
}
template<>
@FAUST_SCALAR_FOR_GM@ Transform<@FAUST_SCALAR_FOR_GM@,GPU2>::power_iteration(int32_t nb_iter_max, float threshold, int& flag)
{
auto marr_funcs = GPUModHandler::get_singleton()->marr_funcs((@FAUST_SCALAR_FOR_GM@)(0));
if(gpu_mat_arr == nullptr) throw std::runtime_error("gpu_mat_arr is nullptr");
//TODO: update gpu_mod to handle output flag
@FAUST_SCALAR_FOR_GM@ lambda;
marr_funcs->power_iteration(gpu_mat_arr, threshold, nb_iter_max, reinterpret_cast<@GM_SCALAR@*>(&lambda));
return lambda;
}
template<>
void Faust::Transform<@FAUST_SCALAR_FOR_GM@,GPU2>::multiply(const Faust::Transform<@FAUST_SCALAR_FOR_GM@,GPU2> & A)
{
......
......@@ -69,6 +69,7 @@ namespace Faust
void multiply(const FPP& a, const int32_t id=-1);
Vect<FPP,GPU2> multiply(const Vect<FPP,GPU2>& x, const char opThis='N');
Real<FPP> spectralNorm(int32_t nb_iter_max, float threshold, int& flag);
FPP power_iteration(int32_t nb_iter_max, float threshold, int& flag);
Real<FPP> normL1(const bool transpose = false) const;
void tocpu(Transform<FPP, Cpu>& cpu_transf) const;
Transform<FPP, Cpu> tocpu() const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment