Mentions légales du service

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

Add Faust::Vect::mean().

parent 92e38424
No related branches found
No related tags found
No related merge requests found
...@@ -191,6 +191,7 @@ namespace Faust ...@@ -191,6 +191,7 @@ namespace Faust
const FPP& operator()(faust_unsigned_int i)const{return vec(i);} const FPP& operator()(faust_unsigned_int i)const{return vec(i);}
bool equality(Vect<FPP,Cpu> const &x, FPP precision) const; bool equality(Vect<FPP,Cpu> const &x, FPP precision) const;
FPP mean();
// friend algebra // friend algebra
......
...@@ -214,6 +214,16 @@ FPP Faust::Vect<FPP,Cpu>::mean_relative_error(const Faust::Vect<FPP,Cpu>& v_ref) ...@@ -214,6 +214,16 @@ FPP Faust::Vect<FPP,Cpu>::mean_relative_error(const Faust::Vect<FPP,Cpu>& v_ref)
return tmp.mean(); return tmp.mean();
} }
template<typename FPP>
FPP Faust::Vect<FPP,Cpu>::mean()
{
FPP m = 0;
for(int i=0; i < size(); i++)
m += getData()[i];
m /= size();
return m;
}
template<typename FPP> template<typename FPP>
template<typename FPP1> template<typename FPP1>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment