Mentions légales du service

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

multiplication faust-matrix transposee en matlab

parent 457d305b
No related branches found
No related tags found
No related merge requests found
...@@ -14,341 +14,341 @@ ...@@ -14,341 +14,341 @@
#ifdef __COMPILE_TIMERS__ #ifdef __COMPILE_TIMERS__
#include "faust_Timer.h" #include "faust_Timer.h"
#endif #endif
// modif AL AL // modif AL AL
#include "faust_Vect.h" #include "faust_Vect.h"
#include "faust_Transform.h" #include "faust_Transform.h"
#include "faust_BlasHandle.h" #include "faust_BlasHandle.h"
/*! \class Faust::MatDense MatDenseDense.h /*! \class Faust::MatDense MatDenseDense.h
* \brief Class template representing dense matrix <br> * \brief Class template representing dense matrix <br>
* This class implements basic linear algebra operation (addition, multiplication, frobenius and spectral norm...) <br> * This class implements basic linear algebra operation (addition, multiplication, frobenius and spectral norm...) <br>
* The matrix format is ColMajor. <br> * The matrix format is ColMajor. <br>
* \tparam T scalar numeric type, e.g float or double * \tparam T scalar numeric type, e.g float or double
*/ */
//template<typename FPP, Device DEVICE> class MatDense; //template<typename FPP, Device DEVICE> class MatDense;
//template<typename FPP, Device DEVICE> class MatSparse; //template<typename FPP, Device DEVICE> class MatSparse;
//template<typename FPP, Device DEVICE> class Vect; //template<typename FPP, Device DEVICE> class Vect;
//template<typename FPP, Device DEVICE> class Transform; //template<typename FPP, Device DEVICE> class Transform;
// //
////! \fn add ////! \fn add
////! \brief (*this) = (*this) + A ////! \brief (*this) = (*this) + A
//template<typename FPP> //template<typename FPP>
//void Faust::add(const Faust::MatDense<FPP,Cpu> & A, const Faust::MatDense<FPP,Cpu> & B, Faust::MatDense<FPP,Cpu> & C); //void Faust::add(const Faust::MatDense<FPP,Cpu> & A, const Faust::MatDense<FPP,Cpu> & B, Faust::MatDense<FPP,Cpu> & C);
// //
////! \fn gemm_core ////! \fn gemm_core
////! \brief performs ?? ////! \brief performs ??
//template<typename FPP> //template<typename FPP>
//void Faust::gemm_core(const Faust::MatDense<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::gemm_core(const Faust::MatDense<FPP,Cpu> & A,const Faust::MatDense<FPP,Cpu> & B, Faust::MatDense<FPP,Cpu> & C,const FPP alpha, const FPP beta, char typeA, char typeB);
// //
////! \fn gemm ////! \fn gemm
////! \brief performs ?? ////! \brief performs ??
//template<typename FPP> //template<typename FPP>
//void Faust::gemm(const Faust::MatDense<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::gemm(const Faust::MatDense<FPP,Cpu> & A,const Faust::MatDense<FPP,Cpu> & B, Faust::MatDense<FPP,Cpu> & C,const FPP alpha, const FPP beta, char typeA, char typeB);
// //
////! \fn multiply ////! \fn multiply
////! \brief performs ?? ////! \brief performs ??
//template<typename FPP> //template<typename FPP>
//void Faust::multiply(const Faust::MatDense<FPP,Cpu> & A,const Faust::MatDense<FPP,Cpu> & B, Faust::MatDense<FPP,Cpu> & C); //void Faust::multiply(const Faust::MatDense<FPP,Cpu> & A,const Faust::MatDense<FPP,Cpu> & B, Faust::MatDense<FPP,Cpu> & C);
//template<typename FPP> //template<typename FPP>
//void Faust::multiply(const Faust::Transform<FPP,Cpu> & A, const Faust::MatDense<FPP,Cpu> & B, Faust::MatDense<FPP,Cpu> & C,const FPP & alpha, char typeA, char typeMult); //void Faust::multiply(const Faust::Transform<FPP,Cpu> & A, const Faust::MatDense<FPP,Cpu> & B, Faust::MatDense<FPP,Cpu> & C,const FPP & alpha, char typeA, char typeMult);
// //
////! \fn Faust::gemv ////! \fn Faust::gemv
////! \brief performs ?? ////! \brief performs ??
//template<typename FPP> //template<typename FPP>
//void Faust::gemv(const Faust::MatDense<FPP,Cpu> & A,const Faust::Vect<FPP,Cpu> & x,Faust::Vect<FPP,Cpu> & y,const FPP & alpha, const FPP & beta, char typeA); //void Faust::gemv(const Faust::MatDense<FPP,Cpu> & A,const Faust::Vect<FPP,Cpu> & x,Faust::Vect<FPP,Cpu> & y,const FPP & alpha, const FPP & beta, char typeA);
// //
////! \fn Faust::spgemm ////! \fn Faust::spgemm
////! \brief performs ?? ////! \brief performs ??
//template<typename FPP> //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);
// //
//! \namespace Faust //! \namespace Faust
//! \brief Faust namespace contains the principal class of the project. //! \brief Faust namespace contains the principal class of the project.
namespace Faust namespace Faust
{ {
template<typename FPP, Device DEVICE> class MatDense; template<typename FPP, Device DEVICE> class MatDense;
template<typename FPP, Device DEVICE> class MatSparse; template<typename FPP, Device DEVICE> class MatSparse;
template<typename FPP, Device DEVICE> class Vect; template<typename FPP, Device DEVICE> class Vect;
template<typename FPP, Device DEVICE> class Transform; template<typename FPP, Device DEVICE> class Transform;
//! \fn add //! \fn add
//! \brief (*this) = (*this) + A //! \brief (*this) = (*this) + A
template<typename FPP> template<typename FPP>
void add(const Faust::MatDense<FPP,Cpu> & A, const Faust::MatDense<FPP,Cpu> & B, Faust::MatDense<FPP,Cpu> & C); void add(const Faust::MatDense<FPP,Cpu> & A, const Faust::MatDense<FPP,Cpu> & B, Faust::MatDense<FPP,Cpu> & C);
//! \fn gemm_core //! \fn gemm_core
//! \brief performs ?? //! \brief performs ??
template<typename FPP> template<typename FPP>
void gemm_core(const Faust::MatDense<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 gemm_core(const Faust::MatDense<FPP,Cpu> & A,const Faust::MatDense<FPP,Cpu> & B, Faust::MatDense<FPP,Cpu> & C,const FPP alpha, const FPP beta, char typeA, char typeB);
//! \fn gemm //! \fn gemm
//! \brief performs ?? //! \brief performs ??
template<typename FPP> template<typename FPP>
void gemm(const Faust::MatDense<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 gemm(const Faust::MatDense<FPP,Cpu> & A,const Faust::MatDense<FPP,Cpu> & B, Faust::MatDense<FPP,Cpu> & C,const FPP alpha, const FPP beta, char typeA, char typeB);
//! \fn multiply //! \fn multiply
//! \brief performs ?? //! \brief performs ??
template<typename FPP> template<typename FPP>
void multiply(const Faust::MatDense<FPP,Cpu> & A,const Faust::MatDense<FPP,Cpu> & B, Faust::MatDense<FPP,Cpu> & C); void multiply(const Faust::MatDense<FPP,Cpu> & A,const Faust::MatDense<FPP,Cpu> & B, Faust::MatDense<FPP,Cpu> & C);
template<typename FPP> template<typename FPP>
void multiply(const Faust::Transform<FPP,Cpu> & A, const Faust::MatDense<FPP,Cpu> & B, Faust::MatDense<FPP,Cpu> & C,const FPP & alpha, char typeA, char typeMult); void multiply(const Faust::Transform<FPP,Cpu> & A, const Faust::MatDense<FPP,Cpu> & B, Faust::MatDense<FPP,Cpu> & C,const FPP & alpha, char typeA, char typeMult);
//! \fn Faust::gemv //! \fn Faust::gemv
//! \brief performs ?? //! \brief performs ??
template<typename FPP> template<typename FPP>
void gemv(const Faust::MatDense<FPP,Cpu> & A,const Faust::Vect<FPP,Cpu> & x,Faust::Vect<FPP,Cpu> & y,const FPP & alpha, const FPP & beta, char typeA); void gemv(const Faust::MatDense<FPP,Cpu> & A,const Faust::Vect<FPP,Cpu> & x,Faust::Vect<FPP,Cpu> & y,const FPP & alpha, const FPP & beta, char typeA);
//! \fn Faust::spgemm //! \fn Faust::spgemm
//! \brief performs ?? //! \brief performs ??
template<typename FPP> template<typename FPP>
void 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 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, Device DEVICE> template<typename FPP, Device DEVICE>
class MatDense; class MatDense;
template<typename FPP, Device DEVICE> template<typename FPP, Device DEVICE>
class MatGeneric; class MatGeneric;
template<typename FPP, Device DEVICE> template<typename FPP, Device DEVICE>
class Transform; class Transform;
//template<Device DEVICE> class BlasHandle; //template<Device DEVICE> class BlasHandle;
template<typename FPP> template<typename FPP>
class MatDense<FPP,Cpu> : public Faust::MatGeneric<FPP,Cpu> class MatDense<FPP,Cpu> : public Faust::MatGeneric<FPP,Cpu>
{ {
/// All derived class template of MatDense are considered as friends /// All derived class template of MatDense are considered as friends
template<class,Device> friend class MatDense; template<class,Device> friend class MatDense;
public: public:
static const char * name; static const char * name;
//void gemm(const MatDense<FPP,Cpu> & A,const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C,const FPP & alpha, const FPP & beta, char typeA, char typeB); //void gemm(const MatDense<FPP,Cpu> & A,const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C,const FPP & alpha, const FPP & beta, char typeA, char typeB);
//! \fn faust_gemm //! \fn faust_gemm
//! \brief performs ?? //! \brief performs ??
//! //!
void faust_gemm(const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C,const FPP & alpha, const FPP & beta, char typeA, char typeB)const {gemm<FPP>((*this),B,C,alpha,beta,typeA,typeB);} /*! void faust_gemm(const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C,const FPP & alpha, const FPP & beta, char typeA, char typeB)const {gemm<FPP>((*this),B,C,alpha,beta,typeA,typeB);} /*!
* \brief Constructor MatDense * \brief Constructor MatDense
* \tparam data : pointer to the data array of the matrix * \tparam data : pointer to the data array of the matrix
\tparam nbRow : number of row of the matrix \tparam nbRow : number of row of the matrix
\tparam nbCol : number of column of the matrix \tparam nbCol : number of column of the matrix
*/ */
MatDense(const FPP *data_,const faust_unsigned_int nbRow, const faust_unsigned_int nbCol ); MatDense(const FPP *data_,const faust_unsigned_int nbRow, const faust_unsigned_int nbCol );
MatDense() : MatGeneric<FPP,Cpu>(), mat(0,0), isIdentity(false), isZeros(false) {} MatDense() : MatGeneric<FPP,Cpu>(), mat(0,0), isIdentity(false), isZeros(false) {}
/*! /*!
* \brief Copy Constructor of MatDense * \brief Copy Constructor of MatDense
* \tparam A : another MatDense * \tparam A : another MatDense
*/ */
MatDense(const MatDense<FPP,Cpu> & A) : MatGeneric<FPP,Cpu>(A.dim1,A.dim2), mat(A.mat), isIdentity(A.isIdentity), isZeros(A.isZeros) {} MatDense(const MatDense<FPP,Cpu> & A) : MatGeneric<FPP,Cpu>(A.dim1,A.dim2), mat(A.mat), isIdentity(A.isIdentity), isZeros(A.isZeros) {}
template<typename FPP1> template<typename FPP1>
MatDense(const MatDense<FPP1,Cpu> & A){this->operator=(A);} MatDense(const MatDense<FPP1,Cpu> & A){this->operator=(A);}
template<typename FPP1> template<typename FPP1>
MatDense(const Faust::MatSparse<FPP1,Cpu> & A){this->operator=(A);} MatDense(const Faust::MatSparse<FPP1,Cpu> & A){this->operator=(A);}
MatDense(const Faust::MatSparse<FPP,Cpu> & A){this->operator=(A);} MatDense(const Faust::MatSparse<FPP,Cpu> & A){this->operator=(A);}
MatDense(const faust_unsigned_int nbRow, const faust_unsigned_int nbCol) : MatGeneric<FPP,Cpu>(nbRow,nbCol), mat(nbRow,nbCol), isIdentity(false), isZeros(false){} MatDense(const faust_unsigned_int nbRow, const faust_unsigned_int nbCol) : MatGeneric<FPP,Cpu>(nbRow,nbCol), mat(nbRow,nbCol), isIdentity(false), isZeros(false){}
MatDense(const faust_unsigned_int nbRow) : MatGeneric<FPP,Cpu>(nbRow,nbRow), mat(nbRow,nbRow), isIdentity(false), isZeros(false){} MatDense(const faust_unsigned_int nbRow) : MatGeneric<FPP,Cpu>(nbRow,nbRow), mat(nbRow,nbRow), isIdentity(false), isZeros(false){}
/// Destructor of MatDense /// Destructor of MatDense
~MatDense(){resize(0,0);} ~MatDense(){resize(0,0);}
//! \brief resize the MatDense //! \brief resize the MatDense
//! \param nbRow : new number of row of the matrix //! \param nbRow : new number of row of the matrix
//! \param nbCol : new number of column of the matrix //! \param nbCol : new number of column of the matrix
//! \warning nbRow and nbCol must be greater or equal to 0 //! \warning nbRow and nbCol must be greater or equal to 0
void resize(const faust_unsigned_int nbRow,const faust_unsigned_int nbCol); void resize(const faust_unsigned_int nbRow,const faust_unsigned_int nbCol);
//! \brief resize the MatDense //! \brief resize the MatDense
//! \param nbRow : new number of row and column of the matrix //! \param nbRow : new number of row and column of the matrix
//! \warning nbRow must be greater or equal to 0 //! \warning nbRow must be greater or equal to 0
void resize(const faust_unsigned_int nbRow){resize(nbRow,nbRow);} void resize(const faust_unsigned_int nbRow){resize(nbRow,nbRow);}
//! \brief Check if the dimension of the matrix are consistent, if not throws an error //! \brief Check if the dimension of the matrix are consistent, if not throws an error
void check_dim_validity(); void check_dim_validity();
//! \brief Set the matrix to the zero matrix //! \brief Set the matrix to the zero matrix
void setZeros(); void setZeros();
//! \brief Set the matrix to the one diagonal matrix //! \brief Set the matrix to the one diagonal matrix
void setEyes(); void setEyes();
//! \brief Access to the ith coefficient of the matrix pointer, Colmajor format and zero indexing //! \brief Access to the ith coefficient of the matrix pointer, Colmajor format and zero indexing
//! \param i : position //! \param i : position
//! \return : ith coefficient of the matrix //! \return : ith coefficient of the matrix
FPP& operator[](faust_unsigned_int i){isZeros=false; isIdentity=false;return mat.data()[i];} FPP& operator[](faust_unsigned_int i){isZeros=false; isIdentity=false;return mat.data()[i];}
//! \brief Access to the ith coefficient of the matrix pointer, Colmajor format and zero indexing (version with "[]" ) //! \brief Access to the ith coefficient of the matrix pointer, Colmajor format and zero indexing (version with "[]" )
//! \param i : position //! \param i : position
//! \return : read-only ith coefficient of the matrix //! \return : read-only ith coefficient of the matrix
const FPP& operator[](faust_unsigned_int i)const{return mat.data()[i];} const FPP& operator[](faust_unsigned_int i)const{return mat.data()[i];}
//! \brief Access to the ith coefficient of the matrix pointer, Colmajor format and zero indexing (version with "()" ) //! \brief Access to the ith coefficient of the matrix pointer, Colmajor format and zero indexing (version with "()" )
//! \param i : position //! \param i : position
//! \return : read-only ith coefficient of the matrix //! \return : read-only ith coefficient of the matrix
const FPP& operator()(faust_unsigned_int i)const{return mat.data()[i];} const FPP& operator()(faust_unsigned_int i)const{return mat.data()[i];}
//! \brief Access to (i,j) coefficient of the matrix pointer in zero indexing //! \brief Access to (i,j) coefficient of the matrix pointer in zero indexing
//! \param i : row position //! \param i : row position
//! \param j : col position //! \param j : col position
//! \return : read-only (i,j) coefficient of the matrix //! \return : read-only (i,j) coefficient of the matrix
const FPP& operator()(faust_unsigned_int i, faust_unsigned_int j)const{return mat.data()[j*this->dim1+i];} const FPP& operator()(faust_unsigned_int i, faust_unsigned_int j)const{return mat.data()[j*this->dim1+i];}
void operator*=(const Faust::MatSparse<FPP,Cpu>& M); void operator*=(const Faust::MatSparse<FPP,Cpu>& M);
void operator+=(const Faust::MatSparse<FPP,Cpu>& M); void operator+=(const Faust::MatSparse<FPP,Cpu>& M);
void operator-=(const Faust::MatSparse<FPP,Cpu>& M); void operator-=(const Faust::MatSparse<FPP,Cpu>& M);
void multiplyLeft(const Faust::MatSparse<FPP,Cpu>& M); void multiplyLeft(const Faust::MatSparse<FPP,Cpu>& S,const char TransS='N');
FPP* getData(){isZeros=false; isIdentity=false;return mat.data();} FPP* getData(){isZeros=false; isIdentity=false;return mat.data();}
const FPP* getData()const{return mat.data();} const FPP* getData()const{return mat.data();}
bool isEqual(const MatDense<FPP,Cpu> & B) const; bool isEqual(const MatDense<FPP,Cpu> & B) const;
bool isEqual(const MatDense<FPP,Cpu> & B, FPP threshold) const; bool isEqual(const MatDense<FPP,Cpu> & B, FPP threshold) const;
//! \brief Initialize MatDense from text file //! \brief Initialize MatDense from text file
//! \param filename : name of the file //! \param filename : name of the file
//! The first line of the file contains 2 integers : the number of row and the number of column. <br> //! The first line of the file contains 2 integers : the number of row and the number of column. <br>
//! All the other line contains one coefficient in ColMajor access //! All the other line contains one coefficient in ColMajor access
void init_from_file(const char* filename); void init_from_file(const char* filename);
//! Absolute value calculated from the library eigen. //! Absolute value calculated from the library eigen.
void abs() {mat=mat.cwiseAbs();} void abs() {mat=mat.cwiseAbs();}
//! \brief Compute the Frobenius norm of the MatDense //! \brief Compute the Frobenius norm of the MatDense
//! \return the Frobenius norm //! \return the Frobenius norm
FPP norm() const {return mat.norm();} FPP norm() const {return mat.norm();}
//! \brief Normalize the matrix according to its Frobenius norm //! \brief Normalize the matrix according to its Frobenius norm
void normalize() {scalarMultiply(1.0/norm());} void normalize() {scalarMultiply(1.0/norm());}
//! \param nbr_iter_max : maximum number of iteration for the power algo //! \param nbr_iter_max : maximum number of iteration for the power algo
//! \param threshold : threshold until convergence //! \param threshold : threshold until convergence
//! \param flag : convergence flag //! \param flag : convergence flag
//! \return Return the estimated spectral norm (maximum singular value in absolute value) using power iteration algorithm //! \return Return the estimated spectral norm (maximum singular value in absolute value) using power iteration algorithm
//! See also, template<typename FPP> FPP power_iteration(const MatDense<FPP,Cpu> & A, const faust_unsigned_int nbr_iter_max,FPP threshold,faust_int & flag); //! See also, template<typename FPP> FPP power_iteration(const MatDense<FPP,Cpu> & A, const faust_unsigned_int nbr_iter_max,FPP threshold,faust_int & flag);
FPP spectralNorm(const faust_unsigned_int nbr_iter_max,FPP threshold, faust_int & flag,Faust::BlasHandle<Cpu> blas_handle=Faust::BlasHandle<Cpu>()) const; FPP spectralNorm(const faust_unsigned_int nbr_iter_max,FPP threshold, faust_int & flag,Faust::BlasHandle<Cpu> blas_handle=Faust::BlasHandle<Cpu>()) const;
//! \brief Compute the trace of the MatDense //! \brief Compute the trace of the MatDense
//! \return the trace //! \return the trace
FPP trace() const {return mat.trace();} FPP trace() const {return mat.trace();}
//! \brief Transpose the MatDense //! \brief Transpose the MatDense
void transpose(); void transpose();
//! \brief Replace this by (this) * A //! \brief Replace this by (this) * A
void multiplyRight(MatDense<FPP,Cpu> const& A); void multiplyRight(MatDense<FPP,Cpu> const& A);
//! \brief Replace this by A * (*this) //! \brief Replace this by A * (*this)
void multiplyLeft(MatDense<FPP,Cpu> const& A); void multiplyLeft(MatDense<FPP,Cpu> const& A);
//! \brief replace this by lambda * (*this) //! \brief replace this by lambda * (*this)
void scalarMultiply(FPP const lambda); void scalarMultiply(FPP const lambda);
//! \brief replace this by lambda * (*this) using element by element multiplication //! \brief replace this by lambda * (*this) using element by element multiplication
void scalarMultiply(MatDense<FPP,Cpu> const& A); void scalarMultiply(MatDense<FPP,Cpu> const& A);
//! \brief (*this) = (*this) + A //! \brief (*this) = (*this) + A
void add(MatDense<FPP,Cpu> const& A); void add(MatDense<FPP,Cpu> const& A);
//! \brief (*this) = (*this) - A //! \brief (*this) = (*this) - A
void sub(MatDense<FPP,Cpu> const& A); void sub(MatDense<FPP,Cpu> const& A);
//! \brief Displays the MatDense //! \brief Displays the MatDense
void Display() const; void Display() const;
//! \brief Write MatDense into text file //! \brief Write MatDense into text file
//! \param filename : name of the file //! \param filename : name of the file
//! //!
//! The first line of the file contains 2 integer : the number of row and the number of column //! The first line of the file contains 2 integer : the number of row and the number of column
//! All the other line contains one coefficient in ColMajor access of the MatDense //! All the other line contains one coefficient in ColMajor access of the MatDense
void print_file(const char* filename)const; void print_file(const char* filename)const;
void operator=(MatDense<FPP,Cpu> const& A); void operator=(MatDense<FPP,Cpu> const& A);
template<typename FPP1> template<typename FPP1>
void operator=(MatDense<FPP1,Cpu> const& A); void operator=(MatDense<FPP1,Cpu> const& A);
template<typename FPP1> template<typename FPP1>
void operator=(Faust::MatSparse<FPP1,Cpu> const& A){Faust::MatSparse<FPP,Cpu> AT(A);this->operator=(AT);}; void operator=(Faust::MatSparse<FPP1,Cpu> const& A){Faust::MatSparse<FPP,Cpu> AT(A);this->operator=(AT);};
void operator=(Faust::MatSparse<FPP,Cpu> const& A); void operator=(Faust::MatSparse<FPP,Cpu> const& A);
void operator-=(MatDense<FPP,Cpu> const& A){sub(A);} void operator-=(MatDense<FPP,Cpu> const& A){sub(A);}
void operator+=(MatDense<FPP,Cpu> const& A){add(A);} void operator+=(MatDense<FPP,Cpu> const& A){add(A);}
void operator*=(MatDense<FPP,Cpu> const& A){multiplyRight(A);} void operator*=(MatDense<FPP,Cpu> const& A){multiplyRight(A);}
void operator*=(FPP lambda){scalarMultiply(lambda);} void operator*=(FPP lambda){scalarMultiply(lambda);}
void operator/=(FPP lambda){scalarMultiply(1.0/lambda);} void operator/=(FPP lambda){scalarMultiply(1.0/lambda);}
// friend void gemm_core<>(const MatDense<FPP,Cpu> & A,const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C,const FPP alpha, const FPP beta, char typeA, char typeB); // friend void gemm_core<>(const MatDense<FPP,Cpu> & A,const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C,const FPP alpha, const FPP beta, char typeA, char typeB);
// friend void multiply<>(const MatDense<FPP,Cpu> & A,const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C); // friend void multiply<>(const MatDense<FPP,Cpu> & A,const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C);
// friend void spgemm<>(const Faust::MatSparse<FPP,Cpu> & A,const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C,const FPP & alpha, const FPP & beta, char typeA, char typeB); // friend void spgemm<>(const Faust::MatSparse<FPP,Cpu> & A,const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C,const FPP & alpha, const FPP & beta, char typeA, char typeB);
// friend void multiply<>(const Faust::Transform<FPP,Cpu> & A, const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C,const FPP & alpha, char typeA, char typeMult); // friend void multiply<>(const Faust::Transform<FPP,Cpu> & A, const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C,const FPP & alpha, char typeA, char typeMult);
// friend void Faust::gemv<>(const MatDense<FPP,Cpu> & A,const Faust::Vect<FPP,Cpu> & x,Faust::Vect<FPP,Cpu> & y,const FPP & alpha, const FPP & beta, char typeA); // friend void Faust::gemv<>(const MatDense<FPP,Cpu> & A,const Faust::Vect<FPP,Cpu> & x,Faust::Vect<FPP,Cpu> & y,const FPP & alpha, const FPP & beta, char typeA);
// modif AL AL // modif AL AL
friend void Faust::gemm_core<>(const MatDense<FPP,Cpu> & A,const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C,const FPP alpha, const FPP beta, char typeA, char typeB); friend void Faust::gemm_core<>(const MatDense<FPP,Cpu> & A,const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C,const FPP alpha, const FPP beta, char typeA, char typeB);
friend void Faust::multiply<>(const MatDense<FPP,Cpu> & A,const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C); friend void Faust::multiply<>(const MatDense<FPP,Cpu> & A,const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C);
friend void Faust::spgemm<>(const Faust::MatSparse<FPP,Cpu> & A,const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C,const FPP & alpha, const FPP & beta, char typeA, char typeB); friend void Faust::spgemm<>(const Faust::MatSparse<FPP,Cpu> & A,const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C,const FPP & alpha, const FPP & beta, char typeA, char typeB);
friend void Faust::multiply<>(const Faust::Transform<FPP,Cpu> & A, const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C,const FPP & alpha, char typeA, char typeMult); friend void Faust::multiply<>(const Faust::Transform<FPP,Cpu> & A, const MatDense<FPP,Cpu> & B, MatDense<FPP,Cpu> & C,const FPP & alpha, char typeA, char typeMult);
friend void Faust::gemv<>(const MatDense<FPP,Cpu> & A,const Faust::Vect<FPP,Cpu> & x,Faust::Vect<FPP,Cpu> & y,const FPP & alpha, const FPP & beta, char typeA); friend void Faust::gemv<>(const MatDense<FPP,Cpu> & A,const Faust::Vect<FPP,Cpu> & x,Faust::Vect<FPP,Cpu> & y,const FPP & alpha, const FPP & beta, char typeA);
bool estIdentite()const{return isIdentity;} bool estIdentite()const{return isIdentity;}
bool estNulle()const{return isZeros;} bool estNulle()const{return isZeros;}
private: private:
Eigen::Matrix<FPP, Eigen::Dynamic, Eigen::Dynamic> mat; Eigen::Matrix<FPP, Eigen::Dynamic, Eigen::Dynamic> mat;
bool isIdentity; bool isIdentity;
bool isZeros; bool isZeros;
static const char * m_className; static const char * m_className;
#ifdef __COMPILE_TIMERS__ #ifdef __COMPILE_TIMERS__
public: public:
Faust::Timer t_local_muliplyLeft; Faust::Timer t_local_muliplyLeft;
//temporary members //temporary members
static Faust::Timer t_constr; static Faust::Timer t_constr;
static Faust::Timer t_get_coeff; static Faust::Timer t_get_coeff;
static Faust::Timer t_get_coeffs; static Faust::Timer t_get_coeffs;
static Faust::Timer t_set_coeff; static Faust::Timer t_set_coeff;
static Faust::Timer t_set_coeffs; static Faust::Timer t_set_coeffs;
static Faust::Timer t_set_coeffs2; static Faust::Timer t_set_coeffs2;
static Faust::Timer t_resize; static Faust::Timer t_resize;
static Faust::Timer t_check_dim; static Faust::Timer t_check_dim;
static Faust::Timer t_max; static Faust::Timer t_max;
static Faust::Timer t_transpose; static Faust::Timer t_transpose;
static Faust::Timer t_mult_right; static Faust::Timer t_mult_right;
static Faust::Timer t_mult_left; static Faust::Timer t_mult_left;
static Faust::Timer t_scalar_multiply; static Faust::Timer t_scalar_multiply;
static Faust::Timer t_add; static Faust::Timer t_add;
static Faust::Timer t_sub; static Faust::Timer t_sub;
static Faust::Timer t_print_file; static Faust::Timer t_print_file;
static Faust::Timer t_spectral_norm; static Faust::Timer t_spectral_norm;
static Faust::Timer t_spectral_norm2; static Faust::Timer t_spectral_norm2;
static Faust::Timer t_power_iteration; static Faust::Timer t_power_iteration;
static Faust::Timer t_multiply; static Faust::Timer t_multiply;
static Faust::Timer t_gemm; static Faust::Timer t_gemm;
static Faust::Timer t_add_ext; static Faust::Timer t_add_ext;
void print_timers()const; void print_timers()const;
#endif #endif
}; };
} }
#include "faust_MatDense.hpp" #include "faust_MatDense.hpp"
......
...@@ -552,9 +552,11 @@ void Faust::MatDense<FPP,Cpu>::scalarMultiply(Faust::MatDense<FPP,Cpu> const& A) ...@@ -552,9 +552,11 @@ void Faust::MatDense<FPP,Cpu>::scalarMultiply(Faust::MatDense<FPP,Cpu> const& A)
template<typename FPP> template<typename FPP>
void Faust::MatDense<FPP,Cpu>::multiplyLeft(const Faust::MatSparse<FPP,Cpu>& S) void Faust::MatDense<FPP,Cpu>::multiplyLeft(const Faust::MatSparse<FPP,Cpu>& S,const char TransS)
{ {
if(S.dim2 != this->dim1) faust_unsigned_int nbColOpS,nbRowOpS;
S.setOp(TransS,nbRowOpS,nbColOpS);
if(nbColOpS != this->dim1)
{ {
//std::cerr << "Error in Faust::MatDense<FPP,Cpu>::operator*= : incorrect matrix dimensions" << std::endl; //std::cerr << "Error in Faust::MatDense<FPP,Cpu>::operator*= : incorrect matrix dimensions" << std::endl;
//exit(EXIT_FAILURE); //exit(EXIT_FAILURE);
...@@ -566,16 +568,24 @@ void Faust::MatDense<FPP,Cpu>::multiplyLeft(const Faust::MatSparse<FPP,Cpu>& S) ...@@ -566,16 +568,24 @@ void Faust::MatDense<FPP,Cpu>::multiplyLeft(const Faust::MatSparse<FPP,Cpu>& S)
this->operator=(S); this->operator=(S);
isIdentity = false; isIdentity = false;
isZeros = false; isZeros = false;
if (TransS == 'T')
this->transpose();
} }
else if (isZeros) else if (isZeros)
{ {
resize(S.dim1, this->dim2); resize(nbRowOpS, this->dim2);
setZeros(); setZeros();
} }
else else
{ {
mat = S.mat * mat;
this->dim1 = S.dim1; if (TransS == 'N')
mat = S.mat * mat;
else
mat = S.mat.transpose() * mat;
this->dim1 = nbRowOpS;
} }
} }
......
...@@ -198,11 +198,11 @@ namespace Faust ...@@ -198,11 +198,11 @@ namespace Faust
//! *this = S * (*this)
friend void Faust::MatDense<FPP,Cpu>::multiplyLeft(const MatSparse<FPP,Cpu>& S);
//! *this = S * (*this) //! *this = S * (*this)
friend void Faust::Vect<FPP,Cpu>::multiplyLeft(MatSparse<FPP,Cpu> const& A,const char TransA='N'); friend void Faust::Vect<FPP,Cpu>::multiplyLeft(MatSparse<FPP,Cpu> const& S,const char TransS='N');
friend void Faust::MatDense<FPP,Cpu>::multiplyLeft(MatSparse<FPP,Cpu> const& S,const char TransS='N');
friend void Faust::multiply<>(const Faust::Transform<FPP,Cpu> & A, const Faust::MatDense<FPP,Cpu> & B, Faust::MatDense<FPP,Cpu> & C,const FPP & alpha, char typeA, char typeMult); friend void Faust::multiply<>(const Faust::Transform<FPP,Cpu> & A, const Faust::MatDense<FPP,Cpu> & B, Faust::MatDense<FPP,Cpu> & C,const FPP & alpha, char typeA, char typeMult);
friend void Faust::spgemm<>(const 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); friend void Faust::spgemm<>(const 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);
......
...@@ -100,7 +100,8 @@ namespace Faust ...@@ -100,7 +100,8 @@ namespace Faust
void scalarMultiply(const FPP scalar); void scalarMultiply(const FPP scalar);
FPP spectralNorm(const int nbr_iter_max, FPP threshold, int &flag) const; FPP spectralNorm(const int nbr_iter_max, FPP threshold, int &flag) const;
~Transform(){} ~Transform(){}
Faust::Vect<FPP,Cpu> multiply(const Faust::Vect<FPP,Cpu> x,const char opThis); const Faust::Vect<FPP,Cpu> multiply(const Faust::Vect<FPP,Cpu> x,const char opThis='N') const;
Faust::MatDense<FPP,Cpu> multiply(const Faust::MatDense<FPP,Cpu> A,const char opThis='N') const;
void operator=(const Transform<FPP,Cpu>& f){data=f.data;totalNonZeros=f.totalNonZeros;} void operator=(const Transform<FPP,Cpu>& f){data=f.data;totalNonZeros=f.totalNonZeros;}
......
...@@ -466,10 +466,9 @@ void Faust::Transform<FPP,Cpu>::transpose() ...@@ -466,10 +466,9 @@ void Faust::Transform<FPP,Cpu>::transpose()
template<typename FPP> template<typename FPP>
Faust::Vect<FPP,Cpu> Faust::Transform<FPP,Cpu>::multiply(const Faust::Vect<FPP,Cpu> x,const char opThis) Faust::Vect<FPP,Cpu> Faust::Transform<FPP,Cpu>::multiply(const Faust::Vect<FPP,Cpu> x,const char opThis) const
{ {
int nbRowOpThis,nbColOpThis;
if (size() == 0) if (size() == 0)
handleWarning("Faust::Transform<FPP,Cpu> : multiply : empty Faust::Transform<FPP,Cpu>"); handleWarning("Faust::Transform<FPP,Cpu> : multiply : empty Faust::Transform<FPP,Cpu>");
...@@ -478,12 +477,12 @@ Faust::Vect<FPP,Cpu> Faust::Transform<FPP,Cpu>::multiply(const Faust::Vect<FPP,C ...@@ -478,12 +477,12 @@ Faust::Vect<FPP,Cpu> Faust::Transform<FPP,Cpu>::multiply(const Faust::Vect<FPP,C
if (opThis == 'N') if (opThis == 'N')
{ {
for (int i=size()-1 ; i >= 0 ; i--) for (int i=this->size()-1 ; i >= 0 ; i--)
vec.multiplyLeft(data[i]); vec.multiplyLeft(data[i]);
}else }else
{ {
for (int i=0 ; i < size() ; i++) for (int i=0 ; i < this->size() ; i++)
{ {
vec.multiplyLeft(data[i],opThis); vec.multiplyLeft(data[i],opThis);
} }
...@@ -493,14 +492,38 @@ Faust::Vect<FPP,Cpu> Faust::Transform<FPP,Cpu>::multiply(const Faust::Vect<FPP,C ...@@ -493,14 +492,38 @@ Faust::Vect<FPP,Cpu> Faust::Transform<FPP,Cpu>::multiply(const Faust::Vect<FPP,C
}
template<typename FPP>
Faust::MatDense<FPP,Cpu> Faust::Transform<FPP,Cpu>::multiply(const Faust::MatDense<FPP,Cpu> A,const char opThis) const
{
if (size() == 0)
handleWarning("Faust::Transform<FPP,Cpu> : multiply : empty Faust::Transform<FPP,Cpu>");
Faust::MatDense<FPP,Cpu> mat(A);
if (opThis == 'N')
{
for (int i=this->size()-1 ; i >= 0 ; i--)
mat.multiplyLeft(data[i]);
}else
{
for (int i=0 ; i < this->size() ; i++)
{
mat.multiplyLeft(data[i],opThis);
}
}
return mat;
} }
...@@ -508,6 +531,8 @@ Faust::Vect<FPP,Cpu> Faust::Transform<FPP,Cpu>::multiply(const Faust::Vect<FPP,C ...@@ -508,6 +531,8 @@ Faust::Vect<FPP,Cpu> Faust::Transform<FPP,Cpu>::multiply(const Faust::Vect<FPP,C
template<typename FPP> template<typename FPP>
void Faust::Transform<FPP,Cpu>::setOp(const char op, faust_unsigned_int& nbRowOp, faust_unsigned_int& nbColOp)const void Faust::Transform<FPP,Cpu>::setOp(const char op, faust_unsigned_int& nbRowOp, faust_unsigned_int& nbColOp)const
{ {
......
...@@ -85,7 +85,7 @@ namespace Faust ...@@ -85,7 +85,7 @@ namespace Faust
//! \brief Vect::multiplyLeft is used to replace this by A * (*this) //! \brief Vect::multiplyLeft is used to replace this by A * (*this)
//! \param A is a matrix (dense or sparse). //! \param A is a matrix (dense or sparse).
void multiplyLeft(Faust::MatDense<FPP,Cpu> const& A); //{Faust::gemv(A, *this, *this, 1.0, 0.0, 'N');} void multiplyLeft(Faust::MatDense<FPP,Cpu> const& A); //{Faust::gemv(A, *this, *this, 1.0, 0.0, 'N');}
void multiplyLeft(Faust::MatSparse<FPP,Cpu> const& A,const char TransA='N'); void multiplyLeft(Faust::MatSparse<FPP,Cpu> const& S,const char TransS='N');
FPP sum()const{return vec.sum();} FPP sum()const{return vec.sum();}
FPP mean()const{return vec.mean();} FPP mean()const{return vec.mean();}
......
...@@ -201,13 +201,13 @@ void Faust::Vect<FPP,Cpu>::multiplyLeft(Faust::MatDense<FPP,Cpu> const& A) ...@@ -201,13 +201,13 @@ void Faust::Vect<FPP,Cpu>::multiplyLeft(Faust::MatDense<FPP,Cpu> const& A)
} }
template<typename FPP> template<typename FPP>
void Faust::Vect<FPP,Cpu>::multiplyLeft(Faust::MatSparse<FPP,Cpu> const& A,const char transA) void Faust::Vect<FPP,Cpu>::multiplyLeft(Faust::MatSparse<FPP,Cpu> const& S,const char transS)
{ {
faust_unsigned_int nbColOpA,nbRowOpA; faust_unsigned_int nbColOpS,nbRowOpS;
A.setOp(transA,nbRowOpA,nbColOpA); S.setOp(transS,nbRowOpS,nbColOpS);
if(nbColOpA != vec.size()) if(nbColOpS != vec.size())
{ {
handleError(m_className,"multiplyLeft : incorrect dimensions"); handleError(m_className,"multiplyLeft : incorrect dimensions");
...@@ -216,10 +216,10 @@ void Faust::Vect<FPP,Cpu>::multiplyLeft(Faust::MatSparse<FPP,Cpu> const& A,cons ...@@ -216,10 +216,10 @@ void Faust::Vect<FPP,Cpu>::multiplyLeft(Faust::MatSparse<FPP,Cpu> const& A,cons
#ifdef __COMPILE_TIMERS__ #ifdef __COMPILE_TIMERS__
t_local_multiplyLeft.start(); t_local_multiplyLeft.start();
#endif #endif
if (transA == 'N') if (transS == 'N')
vec = A.mat * vec; vec = S.mat * vec;
else else
vec = A.mat.transpose() * vec; vec = S.mat.transpose() * vec;
#ifdef __COMPILE_TIMERS__ #ifdef __COMPILE_TIMERS__
t_local_multiplyLeft.stop(); t_local_multiplyLeft.stop();
cout <<"0 "<<setprecision(10)<<t_local_multiplyLeft.get_time()<<endl; cout <<"0 "<<setprecision(10)<<t_local_multiplyLeft.get_time()<<endl;
...@@ -227,7 +227,7 @@ void Faust::Vect<FPP,Cpu>::multiplyLeft(Faust::MatSparse<FPP,Cpu> const& A,cons ...@@ -227,7 +227,7 @@ void Faust::Vect<FPP,Cpu>::multiplyLeft(Faust::MatSparse<FPP,Cpu> const& A,cons
#endif #endif
dim = nbRowOpA; this->dim = nbRowOpS;
} }
#endif #endif
...@@ -65,105 +65,7 @@ FPP Faust::power_iteration(const Faust::Transform<FPP,Cpu> & A, const int nbr_i ...@@ -65,105 +65,7 @@ FPP Faust::power_iteration(const Faust::Transform<FPP,Cpu> & A, const int nbr_i
} }
//////////// modif AL AL //////////// modif AL AL
template<typename FPP>
void Faust::multiply(const Faust::Transform<FPP,Cpu> & A, const Faust::MatDense<FPP,Cpu> & B, Faust::MatDense<FPP,Cpu> & C,const FPP & alpha, char typeA, char typeMult)
{
int nbRowOpA,nbRowOpB,nbColOpA,nbColOpB, nbFact;
if ((&(C.mat)) == (&(B.mat)))
{
handleError("Faust::Transform algebra "," Faust::multiply : C is the same object as B");
}
nbFact = A.size();
if (nbFact != 0)
{
if (typeA == 'T')
{
nbRowOpA = A.getNbCol();
nbColOpA = A.getNbRow();
}else
{
nbRowOpA = A.getNbRow();
nbColOpA = A.getNbCol();
}
}
nbRowOpB = B.getNbRow();
nbColOpB = B.getNbCol();
if (nbFact != 0)
{
if (typeMult == 'R')
{
if (nbColOpA != nbRowOpB)
{
handleError("Faust::Transform algebra "," Faust::multiply : dimension of Faust::Transform<FPP,Cpu> 1 and Faust::MatSparse mismatch");
}
}else
{
if (nbColOpB != nbRowOpA)
{
handleError("Faust::Transform algebra "," Faust::multiply : dimension of Faust::Transform<FPP,Cpu> A and Faust::MatSparse B mismatch");
}
}
}else
{
handleWarning(" Faust::Transform<FPP,Cpu>_algebra : Faust::multiply : empty Faust::Transform<FPP,Cpu>");
}
// if the Faust::Transform<FPP,Cpu> A is empty, it's considere as the identity, so C = equal B, it is useful into the algorithm Faust::Palm4MSA, where the Faust::Transform<FPP,Cpu>s L and R can be empty
C = B;
C.scalarMultiply(alpha);
C.resize(nbRowOpB,nbColOpB);
if (nbFact != 0)
{
if (typeA == 'T')
{
if(typeMult == 'R')
{
for (int i=0 ; i<nbFact ; i++)
{
C.mat = A.data[i].mat.transpose() * C.mat;
}
C.resize(nbRowOpA,nbColOpB);
}else
{
for (int i=nbFact-1 ; i>=0 ; i--)
{
C.mat = C.mat * A.data[i].mat.transpose();
}
C.resize(nbRowOpB,nbColOpA);
}
}else
{
if(typeMult == 'R')
{
for (int i=nbFact-1 ; i>=0 ; i--)
{
C.mat = A.data[i].mat * C.mat;
}
C.resize(nbRowOpA,nbColOpB);
}else
{
for (int i=0 ; i<nbFact ; i++)
{
C.mat = C.mat*A.data[i].mat;
}
C.resize(nbRowOpB,nbColOpA);
}
}
}
}
//////////// modif AL AL //////////// modif AL AL
...@@ -171,25 +73,14 @@ FPP Faust::power_iteration(const Faust::Transform<FPP,Cpu> & A, const int nbr_i ...@@ -171,25 +73,14 @@ FPP Faust::power_iteration(const Faust::Transform<FPP,Cpu> & A, const int nbr_i
template<typename FPP> template<typename FPP>
Faust::Vect<FPP,Cpu> Faust::operator*(const Faust::Transform<FPP,Cpu>& f, const Faust::Vect<FPP,Cpu>& v) Faust::Vect<FPP,Cpu> Faust::operator*(const Faust::Transform<FPP,Cpu>& f, const Faust::Vect<FPP,Cpu>& v)
{ {
Faust::Vect<FPP,Cpu> vec(v);
if (f.size() == 0)
handleWarning("Faust::Transform<FPP,Cpu> algebra : operator* : empty Faust::Transform<FPP,Cpu>");
for (int i=f.size()-1 ; i >= 0 ; i--) return f.multiply(v);
vec.multiplyLeft(f.data[i]);
return vec;
} }
template<typename FPP> template<typename FPP>
Faust::MatDense<FPP,Cpu> Faust::operator*(const Faust::Transform<FPP,Cpu>& f, const Faust::MatDense<FPP,Cpu>& M) Faust::MatDense<FPP,Cpu> Faust::operator*(const Faust::Transform<FPP,Cpu>& f, const Faust::MatDense<FPP,Cpu>& M)
{ {
Faust::MatDense<FPP,Cpu> A(M); return f.multiply(M);
if (f.size() == 0)
handleWarning("Faust::Transform<FPP,Cpu> algebra : operator * : empty Faust::Transform<FPP,Cpu>");
for (int i=f.size()-1 ; i >= 0 ; i--)
A.multiplyLeft(f.data[i]);
return A;
} }
#endif #endif
...@@ -278,7 +278,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) ...@@ -278,7 +278,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{ {
Faust::MatDense<FFPP,Cpu> A(ptr_data, nbRowA, nbColA); Faust::MatDense<FFPP,Cpu> A(ptr_data, nbRowA, nbColA);
Faust::MatDense<FFPP,Cpu> B(nbRowB, nbColA); Faust::MatDense<FFPP,Cpu> B(nbRowB, nbColA);
B = (*core_ptr)*A; B = (*core_ptr).multiply(A,op);
const mwSize dims[2]={nbRowB,nbColB}; const mwSize dims[2]={nbRowB,nbColB};
if(sizeof(FFPP)==sizeof(float)) if(sizeof(FFPP)==sizeof(float))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment