Mentions légales du service

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

Remove functions (C++, py/matfaust) related to Faust-vector product optimizations.

They are most likely useless, the default F*v from the left to the right is the good way to do in almost all cases.
parent 5b602719
No related branches found
No related tags found
No related merge requests found
...@@ -102,7 +102,6 @@ namespace Faust ...@@ -102,7 +102,6 @@ namespace Faust
virtual MatDense<FPP, Cpu> multiply(const MatDense<FPP,Cpu> &A, const bool transpose=false, const bool conjugate=false); virtual MatDense<FPP, Cpu> multiply(const MatDense<FPP,Cpu> &A, const bool transpose=false, const bool conjugate=false);
virtual void update_total_nnz(); virtual void update_total_nnz();
void set_FM_mul_mode(const int mul_order_opt_mode, const bool silent=true); void set_FM_mul_mode(const int mul_order_opt_mode, const bool silent=true);
void set_Fv_mul_mode(const int mode);
virtual MatDense<FPP, Cpu> multiply(const MatSparse<FPP,Cpu> &A, const bool transpose=false, const bool conjugate=false); virtual MatDense<FPP, Cpu> multiply(const MatSparse<FPP,Cpu> &A, const bool transpose=false, const bool conjugate=false);
virtual TransformHelper<FPP, Cpu>* multiply(const TransformHelper<FPP, Cpu>*) const; virtual TransformHelper<FPP, Cpu>* multiply(const TransformHelper<FPP, Cpu>*) const;
...@@ -172,7 +171,6 @@ namespace Faust ...@@ -172,7 +171,6 @@ namespace Faust
virtual TransformHelper<FPP,Cpu>* optimize_multiply(std::function<void()> f, const bool transp=false, const bool inplace=false, const int nsamples=1, const char* op_name="unamed_op"); virtual TransformHelper<FPP,Cpu>* optimize_multiply(std::function<void()> f, const bool transp=false, const bool inplace=false, const int nsamples=1, const char* op_name="unamed_op");
virtual TransformHelper<FPP,Cpu>* optimize_time(const bool transp=false, const bool inplace=false, const int nsamples=1); virtual TransformHelper<FPP,Cpu>* optimize_time(const bool transp=false, const bool inplace=false, const int nsamples=1);
virtual TransformHelper<FPP,Cpu>* optimize_time_full(const bool transp=false, const bool inplace=false, const int nsamples=1); virtual TransformHelper<FPP,Cpu>* optimize_time_full(const bool transp=false, const bool inplace=false, const int nsamples=1);
virtual TransformHelper<FPP,Cpu>* optimize_time_Fv(const bool transp=false, const bool inplace=false, const int nsamples=1);
/** /**
\brief Returns the left hand side factors of this from index 0 to id included (as a new TransformHelper obj). \brief Returns the left hand side factors of this from index 0 to id included (as a new TransformHelper obj).
......
...@@ -302,21 +302,6 @@ namespace Faust { ...@@ -302,21 +302,6 @@ namespace Faust {
return this->optimize_multiply([this](){this->get_product();}, transp, inplace, nsamples, "Faust-toarray"); return this->optimize_multiply([this](){this->get_product();}, transp, inplace, nsamples, "Faust-toarray");
} }
template<typename FPP>
TransformHelper<FPP,Cpu>* TransformHelper<FPP,Cpu>::optimize_time_Fv(const bool transp /* deft to false */, const bool inplace, /* deft to 1 */ const int nsamples)
{
// generate a random vector
Faust::Vect<FPP,Cpu> *v = nullptr;
if(transp)
v = Faust::Vect<FPP,Cpu>::rand(this->getNbRow());
else
v = Faust::Vect<FPP,Cpu>::rand(this->getNbCol());
return this->optimize_multiply([this, &v, &transp, &inplace, &nsamples]()
{
this->multiply(*v, transp);
}, transp, inplace, nsamples, "Faust-vector mul.");
}
template<typename FPP> template<typename FPP>
TransformHelper<FPP,Cpu>* TransformHelper<FPP,Cpu>::optimize_multiply(std::function<void()> f, const bool transp /* deft to false */, const bool inplace, /* deft to 1 */ const int nsamples, const char* op_name) TransformHelper<FPP,Cpu>* TransformHelper<FPP,Cpu>::optimize_multiply(std::function<void()> f, const bool transp /* deft to false */, const bool inplace, /* deft to 1 */ const int nsamples, const char* op_name)
{ {
...@@ -528,16 +513,6 @@ namespace Faust { ...@@ -528,16 +513,6 @@ namespace Faust {
} }
template<typename FPP>
void TransformHelper<FPP,Cpu>::set_Fv_mul_mode(const int Fv_mul_mode)
{
this->Fv_mul_mode = Fv_mul_mode;
std::cout << "changed Faust-vector mul. mode to: " << this->Fv_mul_mode;
if(! this->Fv_mul_mode)
std::cout << " (opt. disabled, default mul.)";
std::cout << std::endl;
}
template<typename FPP> template<typename FPP>
TransformHelper<FPP, Cpu>* TransformHelper<FPP,Cpu>::multiply(const TransformHelper<FPP, Cpu>* th_right) const TransformHelper<FPP, Cpu>* TransformHelper<FPP,Cpu>::multiply(const TransformHelper<FPP, Cpu>* th_right) const
{ {
......
%> \brief Enumeration class of all matrix chain multiplication methods available to multiply a Faust to a matrix, to a vector or to compute Faust.toarray(). %> \brief Enumeration class of all matrix chain multiplication methods available to multiply a Faust to a matrix or to compute Faust.full().
%> These methods are used by Faust.optimize_time(). %> These methods are used by Faust.optimize_time().
% ========================================================= % =========================================================
classdef FaustMulMode classdef FaustMulMode
......
...@@ -48,8 +48,6 @@ void faust_optimize(const mxArray **prhs, const int nrhs, mxArray **plhs, const ...@@ -48,8 +48,6 @@ void faust_optimize(const mxArray **prhs, const int nrhs, mxArray **plhs, const
template <typename SCALAR, FDevice DEV> template <typename SCALAR, FDevice DEV>
void set_FM_mul_mode(const mxArray **prhs, const int nrhs, mxArray **plhs, const int nlhs); void set_FM_mul_mode(const mxArray **prhs, const int nrhs, mxArray **plhs, const int nlhs);
template <typename SCALAR, FDevice DEV>
void set_Fv_mul_mode(const mxArray **prhs, const int nrhs, mxArray **plhs, const int nlhs);
#include "faust_optimize.hpp" #include "faust_optimize.hpp"
#endif #endif
...@@ -19,12 +19,3 @@ void set_FM_mul_mode(const mxArray **prhs, const int nrhs, mxArray **plhs, const ...@@ -19,12 +19,3 @@ void set_FM_mul_mode(const mxArray **prhs, const int nrhs, mxArray **plhs, const
core_ptr->set_FM_mul_mode(mode); core_ptr->set_FM_mul_mode(mode);
return; return;
} }
template <typename SCALAR, FDevice DEV>
void set_Fv_mul_mode(const mxArray **prhs, const int nrhs, mxArray **plhs, const int nlhs)
{
Faust::TransformHelper<SCALAR,DEV>* core_ptr = convertMat2Ptr<Faust::TransformHelper<SCALAR,DEV> >(prhs[1]);
const int mode = (int) mxGetScalar(prhs[2]);
core_ptr->set_Fv_mul_mode(mode);
return;
}
...@@ -118,15 +118,6 @@ classdef FaustCore < handle ...@@ -118,15 +118,6 @@ classdef FaustCore < handle
end end
end end
function set_Fv_mul_mode(this, mode)
if(isa(this.objectHandle, 'integer'))
if (this.isRealFlag)
mexFaustReal('set_Fv_mul_mode', this.objectHandle, mode);
else
mexFaustCplx('set_Fv_mul_mode', this.objectHandle, mode);
end
end
end
end end
end end
......
...@@ -3019,7 +3019,7 @@ class FaustTorch: ...@@ -3019,7 +3019,7 @@ class FaustTorch:
class FaustMulMode: class FaustMulMode:
""" """
<b/> Enumeration class of all matrix chain multiplication methods available to multiply a Faust to a matrix, to a vector or to compute Faust.toarray(). <b/> Enumeration class of all matrix chain multiplication methods available to multiply a Faust to a matrix or to compute Faust.toarray().
These methods are used by Faust.optimize_time(). These methods are used by Faust.optimize_time().
...@@ -3031,8 +3031,6 @@ class FaustMulMode: ...@@ -3031,8 +3031,6 @@ class FaustMulMode:
>>> from numpy.random import rand >>> from numpy.random import rand
>>> F = frand(100, 100, 5, [100, 1024]) >>> F = frand(100, 100, 5, [100, 1024])
>>> F.m_faust.set_FM_mul_mode(FaustMulMode.ORDER_ALL_BEST_MIXED) # method used to compute Faust-matrix product or Faust.toarray() >>> F.m_faust.set_FM_mul_mode(FaustMulMode.ORDER_ALL_BEST_MIXED) # method used to compute Faust-matrix product or Faust.toarray()
>>> F.m_faust.set_Fv_mul_mode(FaustMulMode.DEFAULT) # method used to compute Faust-vector product
>>> F*rand(F.shape[1],1) # Faust-vector mul. using the DEFAULT method
>>> F*rand(F.shape[1], 512) # Faust-matrix mul. using method ORDER_ALL_BEST_MIXED >>> F*rand(F.shape[1], 512) # Faust-matrix mul. using method ORDER_ALL_BEST_MIXED
>>> F.toarray() # using the same method >>> F.toarray() # using the same method
""" """
......
...@@ -97,7 +97,6 @@ class FaustCoreCpp ...@@ -97,7 +97,6 @@ class FaustCoreCpp
void get_product(FPP* y_data, int y_nrows, int y_ncols); void get_product(FPP* y_data, int y_nrows, int y_ncols);
void multiply(FPP* y_data, int y_nrows, int y_ncols, FPP* x_data, int* x_row_ptr, int* x_id_col, int x_nnz, int x_nrows, int x_ncols); void multiply(FPP* y_data, int y_nrows, int y_ncols, FPP* x_data, int* x_row_ptr, int* x_id_col, int x_nnz, int x_nrows, int x_ncols);
void set_FM_mul_mode(const int mode, const bool silent=true); void set_FM_mul_mode(const int mode, const bool silent=true);
void set_Fv_mul_mode(const int mode);
void multiply(FPP* value_y,int nbrow_y,int nbcol_y,const FPP* value_x,int nbrow_x,int nbcol_x/*,bool isTranspose*/)const; void multiply(FPP* value_y,int nbrow_y,int nbcol_y,const FPP* value_x,int nbrow_x,int nbcol_x/*,bool isTranspose*/)const;
FaustCoreCpp<FPP,DEV>* mul_faust(FaustCoreCpp<FPP,DEV>* right); FaustCoreCpp<FPP,DEV>* mul_faust(FaustCoreCpp<FPP,DEV>* right);
FaustCoreCpp<FPP,DEV>* vertcat(FaustCoreCpp<FPP,DEV>* right) const; FaustCoreCpp<FPP,DEV>* vertcat(FaustCoreCpp<FPP,DEV>* right) const;
......
...@@ -183,12 +183,6 @@ void FaustCoreCpp<FPP,DEV>::set_FM_mul_mode(const int mode, const bool silent/*= ...@@ -183,12 +183,6 @@ void FaustCoreCpp<FPP,DEV>::set_FM_mul_mode(const int mode, const bool silent/*=
this->transform->set_FM_mul_mode(mode, silent); this->transform->set_FM_mul_mode(mode, silent);
} }
template<typename FPP, FDevice DEV>
void FaustCoreCpp<FPP,DEV>::set_Fv_mul_mode(const int mode)
{
this->transform->set_Fv_mul_mode(mode);
}
template<typename FPP, FDevice DEV> template<typename FPP, FDevice DEV>
unsigned long long FaustCoreCpp<FPP,DEV>::nnz() const unsigned long long FaustCoreCpp<FPP,DEV>::nnz() const
{ {
......
...@@ -13,7 +13,6 @@ cdef extern from "FaustCoreCpp.h": ...@@ -13,7 +13,6 @@ cdef extern from "FaustCoreCpp.h":
void multiply(FPP* value_y,int nbrow_y,int nbcol_y,FPP* value_x, void multiply(FPP* value_y,int nbrow_y,int nbcol_y,FPP* value_x,
int nbrow_x, int nbcol_x);#,bool isTranspose*/); int nbrow_x, int nbcol_x);#,bool isTranspose*/);
void set_FM_mul_mode(const int mode, const bool silent); void set_FM_mul_mode(const int mode, const bool silent);
void set_Fv_mul_mode(const int mode);
# Faust-by-csr product -> dense mat # Faust-by-csr product -> dense mat
void multiply(FPP* y_data, int y_nrows, int y_ncols, FPP* x_data, int* x_row_ptr, int* x_id_col, int x_nnz, int x_nrows, int x_ncols); void multiply(FPP* y_data, int y_nrows, int y_ncols, FPP* x_data, int* x_row_ptr, int* x_id_col, int x_nnz, int x_nrows, int x_ncols);
unsigned int getNbRow() const unsigned int getNbRow() const
......
...@@ -301,10 +301,6 @@ cdef class FaustCoreGen@TYPE_NAME@@PROC@: ...@@ -301,10 +301,6 @@ cdef class FaustCoreGen@TYPE_NAME@@PROC@:
def set_FM_mul_mode(self, mode, silent=True): def set_FM_mul_mode(self, mode, silent=True):
self.@CORE_OBJ@.set_FM_mul_mode(mode, silent) self.@CORE_OBJ@.set_FM_mul_mode(mode, silent)
def set_Fv_mul_mode(self, mode):
self.@CORE_OBJ@.set_Fv_mul_mode(mode)
# print information about the faust (size, number of factor, type of factor (dense/sparse) ...) # print information about the faust (size, number of factor, type of factor (dense/sparse) ...)
def display(self): def display(self):
self.@CORE_OBJ@.Display() self.@CORE_OBJ@.Display()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment