Mentions légales du service

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

Implement the optional normalization of Hadamard transform in the C++ backend...

Implement the optional normalization of Hadamard transform in the C++ backend (yet to use in wrappers).

Issue #112 related.
parent 8a819ef5
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ namespace Faust { ...@@ -8,7 +8,7 @@ namespace Faust {
* \brief Fast Walsh-Hadamard Transform. * \brief Fast Walsh-Hadamard Transform.
*/ */
template<typename FPP> template<typename FPP>
void wht_factors(unsigned int n, vector<MatGeneric<FPP,Cpu>*>& factors, const bool cloning_fact=true); void wht_factors(unsigned int n, vector<MatGeneric<FPP,Cpu>*>& factors, const bool cloning_fact=true, const bool norma=false);
} }
#include "faust_WHT.hpp" #include "faust_WHT.hpp"
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
namespace Faust { namespace Faust {
template<typename FPP> template<typename FPP>
void wht_factors(unsigned int n, vector<MatGeneric<FPP,Cpu>*>& factors, const bool cloning_fact) void wht_factors(unsigned int n, vector<MatGeneric<FPP,Cpu>*>& factors, const bool cloning_fact, const bool norma)
{ {
if(n == 0) if(n == 0)
{ {
...@@ -93,6 +93,12 @@ namespace Faust { ...@@ -93,6 +93,12 @@ namespace Faust {
else else
factors[i] = factor; factors[i] = factor;
if(norma)
{
factors[0] = factor->Clone();
*factors[0] *= static_cast<FPP>(1.0/sqrt((float)order));
}
} }
} }
} }
...@@ -86,7 +86,7 @@ template<typename FPP> ...@@ -86,7 +86,7 @@ template<typename FPP>
void Faust::spgemm(const Faust::MatSparse<FPP,Cpu> & A,const Faust::MatDense<FPP,Cpu> & B, Faust::MatDense<FPP,Cpu> & C,const FPP & alpha, const FPP & beta, char typeA, char typeB); void Faust::spgemm(const Faust::MatSparse<FPP,Cpu> & A,const Faust::MatDense<FPP,Cpu> & B, Faust::MatDense<FPP,Cpu> & C,const FPP & alpha, const FPP & beta, char typeA, char typeB);
template<typename FPP> template<typename FPP>
void Faust::wht_factors(unsigned int n, vector<MatGeneric<FPP,Cpu>*>& factors, const bool); void Faust::wht_factors(unsigned int n, vector<MatGeneric<FPP,Cpu>*>& factors, const bool, const bool);
//! \namespace Faust //! \namespace Faust
//! \brief Faust namespace contains the principal class of the project. //! \brief Faust namespace contains the principal class of the project.
...@@ -106,7 +106,7 @@ namespace Faust ...@@ -106,7 +106,7 @@ namespace Faust
{ {
friend Faust::TransformHelper<FPP,Cpu>; // TODO: limit to needed member functions only friend Faust::TransformHelper<FPP,Cpu>; // TODO: limit to needed member functions only
friend void Faust::wht_factors<>(unsigned int n, vector<MatGeneric<FPP,Cpu>*>& factors, const bool); friend void Faust::wht_factors<>(unsigned int n, vector<MatGeneric<FPP,Cpu>*>& factors, const bool, const bool);
friend class MatDense<FPP,Cpu>; friend class MatDense<FPP,Cpu>;
//friend void MatDense<FPP,Cpu>::operator+=(const MatSparse<FPP,Cpu>& S); //friend void MatDense<FPP,Cpu>::operator+=(const MatSparse<FPP,Cpu>& S);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment