Mentions légales du service

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

Fix Faust::Transform::spectralNorm issue #111.

parent 57f6377a
Branches
Tags
No related merge requests found
......@@ -222,6 +222,10 @@ namespace Faust
* \brief Replaces the Faust by its conjugate.
*/
void conjugate();
/**
* \brief Inplace adjoint.
*/
void adjoint();
void updateNonZeros();
void setOp(const char op, faust_unsigned_int& nbRowOp, faust_unsigned_int& nbColOp)const;
/**
......
......@@ -582,7 +582,7 @@ double Faust::Transform<FPP,Cpu>::spectralNorm(const int nbr_iter_max, double th
//std::cout<<"copy constructor"<<std::endl;
Faust::Transform<FPP,Cpu> AtA((*this)); // modif AL <FPP,Cpu>
//std::cout<<"transposition"<<std::endl;
AtA.transpose();
AtA.adjoint();
if (getNbCol() < getNbRow())
{
AtA.multiply((*this));
......@@ -1033,7 +1033,7 @@ M = data[0]->Clone();
void Faust::Transform<FPP,Cpu>::transpose()
{
int nbFact=size();
reverse(data.begin(),data.end());
std::reverse(data.begin(),data.end());
for (int i=0;i<nbFact;i++)
{
data[i]->transpose();
......@@ -1043,9 +1043,17 @@ void Faust::Transform<FPP,Cpu>::transpose()
template<typename FPP>
void Faust::Transform<FPP,Cpu>::conjugate()
{
typename std::vector<Faust::MatGeneric<FPP,Cpu>*>::iterator it;
for(it = data.begin(); it != data.end(); it++){
it->conjugate();
for(auto it = data.begin(); it != data.end(); it++){
(*it)->conjugate();
}
}
template<typename FPP>
void Faust::Transform<FPP,Cpu>::adjoint()
{
std::reverse(data.begin(),data.end());
for(auto it = data.begin(); it != data.end(); it++){
(*it)->adjoint();
}
}
......
......@@ -582,7 +582,6 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
if(!strcmp("normalize", cmd))
{
int ord = (int) mxGetScalar(prhs[2]);
if(ord == 2) ord = -2; //tmp workaround to the bug in normalization according 2-norm on complex Faust
Faust::TransformHelper<SCALAR,Cpu>* th = core_ptr->normalize(ord);
plhs[0] = convertPtr2Mat<Faust::TransformHelper<SCALAR,Cpu> >(th);
return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment