Mentions légales du service

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

Add MatSparse::real(MatSparse&) and MatDense::real(MatDense&) functions.

parent 0408aa1a
No related branches found
No related tags found
No related merge requests found
......@@ -382,6 +382,7 @@ namespace Faust
//
// If the matrix is real, it does nothing.
void real();
void real(MatDense<Real<FPP>, Cpu> & real_mat) const;
Real<FPP> normL1(const bool transpose=false) const;
Real<FPP> normL1(faust_unsigned_int&, const bool transpose=false) const;
Real<FPP> normInf(const bool transpose=false) const;
......
......@@ -43,6 +43,7 @@
#include <type_traits>
#include "faust_linear_algebra.h"
#include <limits>
......@@ -430,6 +431,13 @@ namespace Faust
mat = mat.real().eval().template cast<FPP>();
}
template<typename FPP>
void MatDense<FPP,Cpu>::real(MatDense<Real<FPP>, Cpu> & real_mat) const
{
real_mat.resize(this->getNbRow(), this->getNbCol());
real_mat.mat = mat.real().eval().template cast<Real<FPP>>();
}
template<typename FPP>
void MatDense<FPP,Cpu>::multiply(MatSparse<FPP,Cpu> & M, char opThis) const
{
......
......@@ -126,6 +126,8 @@ namespace Faust
friend TransformHelperPoly<FPP>; // TODO: limit to needed member functions only
friend void wht_factors<>(unsigned int n, std::vector<MatGeneric<FPP,Cpu>*>& factors, const bool, const bool);
friend class MatDense<FPP,Cpu>;
friend class MatSparse<std::complex<double>, Cpu>;
friend class MatSparse<double, Cpu>;
//friend void MatDense<FPP,Cpu>::operator+=(const MatSparse<FPP,Cpu>& S);
public:
......@@ -406,6 +408,9 @@ namespace Faust
*/
void hstack(MatSparse<FPP, Cpu>& left, MatSparse<FPP, Cpu>& right);
void real(MatSparse<Real<FPP>, Cpu> & real_mat) const;
void print_bufs(const std::string name="");
void print_asarray(const std::string name="");
static MatSparse<FPP, Cpu>* randMat(faust_unsigned_int num_rows, faust_unsigned_int num_cols, Real<FPP> density);
......
......@@ -1437,4 +1437,10 @@ void Faust::copy_sp_mat(Faust::MatSparse<FPP,Cpu>& src, Faust::MatSparse<FPP, Cp
memcpy(dst.getRowPtr(), src.getRowPtr(), (src.getNbRow()+1)*sizeof(int));
}
template<typename FPP>
void Faust::MatSparse<FPP,Cpu>::real(MatSparse<Real<FPP>, Cpu> &real_mat) const
{
real_mat.resize(this->nnz, this->getNbRow(), this->getNbCol());
real_mat.mat = mat.real().eval().template cast<Real<FPP>>();
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment