Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 2599439c authored by Carrivain Pascal's avatar Carrivain Pascal Committed by hhakim
Browse files

add generic code for triu_sp and tril_sp constraints

parent 12dcef08
No related branches found
No related tags found
No related merge requests found
......@@ -173,6 +173,8 @@ namespace Faust
void prox_sp(int32_t k, bool normalized=false, bool pos=false) const;
void prox_spcol(int32_t k, bool normalized=false, bool pos=false) const;
void prox_splin(int32_t k, bool normalized=false, bool pos=false) const;
void prox_triu_sp(int32_t k, bool normalized=false, bool pos=false) const;
void prox_tril_sp(int32_t k, bool normalized=false, bool pos=false) const;
void real(MatDense<Real<FPP>, GPU2>& real_mat) const;
template<typename FPP2>
MatDense<Real<FPP2>, GPU2> to_real() const;
......
......@@ -87,6 +87,11 @@ namespace Faust
template<typename FPP> void prox_skperm(MatDense<FPP, GPU2> & M,const unsigned int k, const bool normalized=true, const bool pos=false);
template<typename FPP>
void prox_triu_sp(MatDense<FPP,GPU2> & M,faust_unsigned_int k, const bool normalized=true, const bool pos=false, const bool pure_gpu=true);
template<typename FPP>
void prox_tril_sp(MatDense<FPP,GPU2> & M,faust_unsigned_int k, const bool normalized=true, const bool pos=false, const bool pure_gpu=true);
}
#include "faust_prox_gpu.hpp"
......
......@@ -214,6 +214,33 @@ namespace Faust
M = cpuM;
}
template<typename FPP>
void prox_triu_sp(MatDense<FPP,GPU2> & M, faust_unsigned_int k, const bool normalized/*=true*/, const bool pos/*=false*/, const bool pure_gpu/*=true*/)
{
prox_tri_sp(M, k, true, normalized, pos, pure_gpu)
}
template<typename FPP>
void prox_tril_sp(MatDense<FPP,GPU2> & M, faust_unsigned_int k, const bool normalized/*=true*/, const bool pos/*=false*/, const bool pure_gpu/*=true*/)
{
prox_tri_sp(M, k, false, normalized, pos, pure_gpu)
}
template<typename FPP>
void prox_tri_sp(MatDense<FPP,GPU2> & M, faust_unsigned_int k, bool upper, const bool normalized/*=true*/, const bool pos/*=false*/, const bool pure_gpu/*=true*/)
{
if(pure_gpu)
{
M.prox_tri_sp(k, upper, normalized, pos);
}
else
{
MatDense<FPP,Cpu> cpuM = M.tocpu();
prox_tri_sp(cpuM, k, upper, normalized, pos);
M = cpuM;
}
}
}
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment