Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 71834d5d authored by Nicolas Bellot's avatar Nicolas Bellot Committed by hhakim
Browse files

ajout method isReal a la classe Faust::Transform

parent a46390d7
Branches
Tags
No related merge requests found
......@@ -134,6 +134,14 @@ int main(int argc, char* argv[])
Faust::Transform<FPP,Cpu> F(list_fact,1.0,ispOtimized);
F.Display();
if (!F.isReal())
{
std::cerr<<"F.isreal() invalid value, F must be made of real scalar "<<std::endl;
exit(EXIT_FAILURE);
}
int nbRowF = F.getNbRow();
int nbColF = F.getNbCol();
......
......@@ -133,6 +133,13 @@ int main(int argc, char* argv[])
bool ispOtimized = false;
Faust::Transform<CPX,Cpu> F(list_fact,1.0,ispOtimized);
F.Display();
if (F.isReal())
{
std::cerr<<"F.isreal() invalid value, F must be complex "<<std::endl;
exit(EXIT_FAILURE);
}
int nbRowF = F.getNbRow();
int nbColF = F.getNbCol();
......
......@@ -104,6 +104,11 @@ namespace Faust
* */
void check_factors_validity() const;
/** \brief
* check if the Transform has real scalar or complex scalar
* */
bool isReal() const;
/** \brief Constructor
* \param facts : Vector including dense matrix*/
Transform(const std::vector<Faust::MatDense<FPP,Cpu> >&facts);
......
......@@ -42,6 +42,7 @@
#include "faust_Vect.h"
#include <complex>
//#include "faust_HierarchicalFact.h"
//#include "faust_Params.h"
#include "faust_linear_algebra.h"
......@@ -51,7 +52,8 @@
#include <fstream>
#include "faust_BlasHandle.h"
#include "faust_SpBlasHandle.h"
#include <complex>
#include <typeinfo>
......@@ -287,6 +289,27 @@ void Faust::Transform<FPP,Cpu>::updateNonZeros()
}
template<typename FPP>
bool Faust::Transform<FPP,Cpu>::isReal() const
{
bool isReal = (typeid(FPP) == typeid(double));
isReal = (isReal || (typeid(FPP) == typeid(float)) );
bool isComplex = (typeid(FPP) == typeid(std::complex<double>));
isComplex = (isComplex || (typeid(FPP) == typeid(std::complex<float>)) );
if ( (!isComplex) && (!isReal) )
{
handleError(m_className,"isReal : unknown type of scalar");
}
return isReal;
}
template<typename FPP>
Faust::MatDense<FPP,Cpu> Faust::Transform<FPP,Cpu>::get_product(const char opThis)const
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment