⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmatrix.h

📁 这是一个从音频信号里提取特征参量的程序
💻 H
📖 第 1 页 / 共 3 页
字号:
  }    // method: inverse  //  boolean inverse() {    return MMatrixMethods::inverse<TScalar,TIntegral>(*this, *this);  }    // method: inverse  //  boolean inverse(const MMatrix& matrix) {    return MMatrixMethods::inverse<TScalar,TIntegral>(*this, matrix);  }  // method: transpose  //  boolean transpose() {    return MMatrixMethods::transpose<TScalar,TIntegral>(*this, *this);  }    // method: transpose  //  boolean transpose(const MMatrix& matrix) {    return MMatrixMethods::transpose<TScalar,TIntegral>(*this, matrix);  }  // method: rank  //  long rank() const {    return MMatrixMethods::rank<TScalar,TIntegral>(*this);  }  // method: trace  //  TIntegral trace() const {    return MMatrixMethods::trace<TScalar,TIntegral>(*this);  }  // method: decompositionLU  //  boolean decompositionLU(MMatrix& lower_trig, MMatrix& upper_trig) const {    MVector<Long, long> vec;    long sign;    return MMatrixMethods::decompositionLU<TScalar, TIntegral>(*this,							       lower_trig,							       upper_trig,							       vec, sign,							       THRESH_STABLE);  }  // method: decompositionLU  //  boolean decompositionLU(MMatrix& lower_trig, MMatrix& upper_trig,			  MVector<Long, long>& index, long& sign,			  double stabilize = THRESH_STABLE) const {    return MMatrixMethods::decompositionLU(*this, lower_trig, upper_trig,					   index, sign, stabilize);  }  // method: decompositionCholesky  //  boolean decompositionCholesky(MMatrix& ltri) const {    return MMatrixMethods::decompositionCholesky(*this, ltri);  }  // method: decompositionSVD  //  boolean decompositionSVD(MMatrix& u, MMatrix& w, MMatrix& v) const {    return MMatrixMethods::decompositionSVD(*this, u, w, v);  }  // method: eigen  //  find the eigenvalues and vectors for a matrix   //  boolean eigen(TVector& eigvals, MMatrix& eigvects) const {    return MMatrixMethods::eigen(*this, eigvals, eigvects);  }  // method: luSolve  //  boolean luSolve(MVector<TScalar, TIntegral>& out_vec,		  const MMatrix& l,		  const MMatrix& u,		  const MVector<TScalar, TIntegral>& in_vec) const {    VectorLong index(l.getNumRows());    index.ramp(0, 1);    return MMatrixMethods::luSolve(out_vec, l, u, index, in_vec);  }  // method: luSolve  //  boolean luSolve(MVector<TScalar, TIntegral>& out_vec,		  const MMatrix& l,		  const MMatrix& u,		  const VectorLong& index,		  const MVector<TScalar, TIntegral>& in_vec) const {    return MMatrixMethods::luSolve(out_vec, l, u, index, in_vec);  }  // method: choleskySolve  //  boolean choleskySolve(MVector<TScalar, TIntegral>& out_vec,			const MMatrix& l,			const MVector<TScalar, TIntegral>& in_vec) const {    return MMatrixMethods::choleskySolve(out_vec, l, in_vec);  }  // method: svdSolve  //  boolean svdSolve(MVector<TScalar, TIntegral>& out_vec,		   const MMatrix& u,		   const MMatrix& w,		   const MMatrix& v,		   const MVector<TScalar, TIntegral>& in_vec,		   boolean zero_singulars = false) const {    return MMatrixMethods::svdSolve(out_vec, u, w, v, in_vec, zero_singulars);  }  // method: matrix-vector multiplication  //  boolean multv(TVector& output_vector, const TVector& input_vector) const {    return MMatrixMethods::multv<TScalar,TIntegral>(*this, output_vector,						    input_vector);  }  // method: vector-matrix multiplication  //    boolean vmult(TVector& output_vector, const TVector& input_vector) const {    return MMatrixMethods::vmult<TScalar,TIntegral>(*this, output_vector,						    input_vector);  }   // method: quadratic  //  compute (input) * (*this) * (transpose(input))  //  boolean quadratic(MMatrix& output, const MMatrix& input) const {    return MMatrixMethods::quadratic<TScalar,TIntegral>(output, *this, input);  }  // method: quadratic  //  compute (in_vec) * (*this) * (transpose(in_vec))  //  boolean quadratic(TIntegral& output, const TVector& in_vec) const {    return MMatrixMethods::quadratic<TScalar,TIntegral>(output, *this, in_vec);  }  // method: outerProduct  //  compute (*this) * transpose(*this)  //  boolean outerProduct() {    return MMatrixMethods::outerProduct<TScalar,TIntegral>(*this, *this,							   *this);  }  // method: outerProduct  //  compute (in_mat) * transpose(in_mat)  //  template<class TAScalar, class TAIntegral>      boolean outerProduct(const MMatrix<TAScalar, TAIntegral>& in_mat) {    return MMatrixMethods::outerProduct<TScalar,TIntegral>(*this, in_mat,							   in_mat);  }  // method: outerProduct  //  compute (in_mat1) * transpose(in_mat2)  //  template<class TAScalar, class TAIntegral>      boolean outerProduct(const MMatrix& in_mat1,		       const MMatrix<TAScalar, TAIntegral>& in_mat2) {    return MMatrixMethods::outerProduct<TScalar,TIntegral>(*this, in_mat1,							   in_mat2);  }  // method: outerProduct  //  compute (in_vec) * transpose(in_vec)  //  boolean outerProduct(const TVector& in_vec) {    return MMatrixMethods::outerProduct<TScalar,TIntegral>(*this, in_vec,							   in_vec);  }  // method: outerProduct  //  compute (in_vec1) * transpose(in_vec2)  //  template<class TAScalar, class TAIntegral>      boolean outerProduct(const TVector& in_vec1,		       const MVector<TAScalar, TAIntegral>& in_vec2) {    return MMatrixMethods::outerProduct<TScalar,TIntegral>(*this, in_vec1,							   in_vec2);  }  //---------------------------------------------------------------------------  //  // class-specific public methods:  //  other matrix to scalar mathematical methods   //  //--------------------------------------------------------------------------  // method: sum  //  calculate the sum of all the elements in the matrix  //  TIntegral sum() const {    return MMatrixMethods::sum<TScalar,TIntegral>(*this);  }  // method: sum of square  //  calculate the sum of squares of all the elements in the matrix  //    TIntegral sumSquare() const {    return MMatrixMethods::sumSquare<TScalar,TIntegral>(*this);  }  // method: sumColumn  //  calculate the sum of all elements in the given column  //  TIntegral sumColumn(long col_index) const {    return MMatrixMethods::sumColumn<TScalar,TIntegral>(*this, col_index);  }    // method: sumRow  //  calculate the sum of all elements in the given row  //    TIntegral sumRow(long row_index) const {    return MMatrixMethods::sumRow<TScalar,TIntegral>(*this, row_index);  }    // method: mean  //  calculate the mean of all the elements in the matrix  //    TIntegral mean() const {    return sum() / (nrows_d * ncols_d);  }  // method: rms  //  calculate the rms of all the elements in the matrix  //    TIntegral rms() const {    return (TIntegral)Integral::sqrt(var());  }  // method: variance  //  calculate the variance of all elements as a 1-D array  //  TIntegral var() const {    return MMatrixMethods::var<TScalar,TIntegral>(*this);  }  //---------------------------------------------------------------------------  //  // private methods  //  //---------------------------------------------------------------------------private:  //---------------------------------------------------------------------------  //  // private methods:  //  indexing methods  //  //--------------------------------------------------------------------------  // method: index  //  this method gives the index of an element in the vector for storage  //  long index(long row_index, long col_index) const {    return index(row_index, col_index, nrows_d, ncols_d);  }  // method: index  //  long index(long row_index, long col_index, long num_rows, long num_cols,	     Integral::MTYPE type = Integral::UNCHANGED) const;      // method: reverseIndex  //  get the row index and column index of the element in the matrix  //  from the vector index  //  boolean reverseIndex(long& row_index, long& col_index,		       long vec_index) const {    return MMatrixMethods::reverseIndex(*this, row_index, col_index,					vec_index);  }    // method: startRow  //  get the row index of first available element of a particular column  //  long startRow(long row_index,	Integral::MTYPE type_1,		Integral::MTYPE type_2 = Integral::UNCHANGED) const;    // method: stopRow  //  get the row index of last available element of a particular column  //  long stopRow(long row_index,	       Integral::MTYPE type_1,	       Integral::MTYPE type_2 = Integral::UNCHANGED) const;    // method: startColumn  //  get the column index of first available element of a particular row  //  long startColumn(long row_index, Integral::MTYPE type_1,		   Integral::MTYPE type_2 = Integral::UNCHANGED) const;    // method: stopColumn  //  get the column index of last available element of a particular row  //  long stopColumn(long row_index, Integral::MTYPE type_1,		  Integral::MTYPE type_2 = Integral::UNCHANGED) const;    // method: vecLength  //  this method gives the length of the storage vector for a given  //  dimension and type of the matrix  //  long vecLength() const {    return vecLength(nrows_d, ncols_d, type_d);  }    // other resizing methods:  //  these methods facilitate setDimensions, and other such methods,  //  that require matrix type-specific operations and computations.  //  long vecLength(long nrows, long ncols, Integral::MTYPE type) const;  boolean vecResetCapacity(long nrows, long ncols, Integral::MTYPE type);  boolean vecResizeCapacity(long nrows, long ncols);  boolean vecCreateLength(long nrows, long ncols, Integral::MTYPE type);  boolean vecDimensionLength(long nrows, long ncols, boolean preserve_values);  // method: randIndicesSparse  //  a method that generates random non-zero values in a sparse matrix.  //  boolean randIndicesSparse(Random& generator = Random::GLOBAL_UNIFORM) {    return MMatrixMethods::randIndicesSparse<TScalar, TIntegral>(*this,								 generator);  }  // other type-specific indexing methods  //  boolean sortSparse();    //---------------------------------------------------------------------------  //  // private methods:  //  linear algebra-related methods  //  //--------------------------------------------------------------------------  // method: multiplyRowByColumn  //  multiply the specified row of one matrix with the specified  //  column of the other matrix. this is used in the multiply methods  //  template <class TAScalar, class TAIntegral>    TIntegral multiplyRowByColumn(const MMatrix& matrix_for_row, const				MMatrix<TAScalar, TAIntegral>& matrix_for_col,				long row_index, long col_index) const {    return MMatrixMethods::multiplyRowByColumn<TScalar, TIntegral>      (*this, matrix_for_row, matrix_for_col, row_index, col_index);  }  // method: multiplyRowByRow  //  multiply the specified row of one matrix with the specified  //  row of the other matrix. this is used in the outerProduct methods  //  template <class TAScalar, class TAIntegral>    TIntegral multiplyRowByRow(const MMatrix& m1,			     const MMatrix<TAScalar, TAIntegral>& m2,			     long row_m1, long row_m2) const {    return MMatrixMethods::multiplyRowByRow<TScalar, TIntegral>      (*this, m1, m2, row_m1, row_m2);  }  // method: determinantLU  //  TIntegral determinantLU() const {    return MMatrixMethods::determinantLU<TScalar,TIntegral>(*this);  }  // method: determinantLU  //  TIntegral determinantLU(const MMatrix& matrix) const {    return MMatrixMethods::determinantLU<TScalar,TIntegral>(matrix);  }  // method: determinantMinor  //  TIntegral determinantMinor() const {    return MMatrixMethods::determinantMinor<TScalar,TIntegral>(*this);  }  // method: determinantMinor  //  TIntegral determinantMinor(const MMatrix& matrix) const {    return MMatrixMethods::determinantMinor<TScalar,TIntegral>(matrix);  }  // method: eigenComputeVector  //  boolean eigenComputeVector(MVector<TScalar, TIntegral>& eigvect,			     TIntegral eigval) {    return false;  }  // method: eigenBalance  //  boolean eigenBalance() {    return false;  }  // method: eigenEliminateHessenberg  //  boolean eigenEliminateHessenberg() {    return false;  }  // method: eigenHessenbergQR  //  boolean eigenHessenbergQR(MVector<TScalar, TIntegral>& eigval_real,			    MVector<TScalar, TIntegral>& eigval_imag) {    return false;  }  //---------------------------------------------------------------------------  //  // private methods:  //  type conversion and streaming  //  //--------------------------------------------------------------------------  // check methods: these methods check properties of the matrix  //  boolean checkSquare(long nrows, long ncols, Integral::MTYPE type) const;  Integral::MTYPE checkType(Integral::MTYPE type) const;    // method: assignStream  //  assign the matrix from a vector containing the stream of data  //  boolean assignStream(long nrows, long ncols,		       const TVector& vec, Integral::MTYPE type) {    return MMatrixMethods::assignStream<TScalar, TIntegral>(*this, nrows,							    ncols, vec, type);  }  // method: assign  //  array conversion methods  //  reads complex numbers from array of real numbers  //    - imaginary components are at the end of the array  //  this method is used only in diagnoese method.  //  boolean assignComplexDiagnose(long num_rows, long num_cols,				  const double* arg,				  Integral::MTYPE type = Integral::DEF_MTYPE) {    return MMatrixMethods::assignComplexDiagnose<TScalar, TIntegral>      (*this, num_rows, num_cols, arg, type);  }      //---------------------------------------------------------------------------  //  // friend classes:  //  while friend classes and functions are generally discouraged,  //  they are used in the MMatrix class to circumvent the  //  template delayed compilation problem.   //  //--------------------------------------------------------------------------  friend class MMatrixMethods;};// template specialization//  these methods are for MMatrix<Double, double> only because they//  use values related to float-point precision//template<> booleanMMatrix<Byte, byte>::eigen(MVector<Byte, byte>&, MMatrix<Byte,byte>&) const {  return false;}template<> booleanMMatrix<Ushort, ushort>::eigen(MVector<Ushort, ushort>&,			       MMatrix<Ushort,ushort>&) const {  return false;}template<> booleanMMatrix<Ulong, ulong>::eigen(MVector<Ulong, ulong>&,			     MMatrix<Ulong,ulong>&) const {  return false;}template<> booleanMMatrix<Ullong, ullong>::eigen(MVector<Ullong, ullong>&,			       MMatrix<Ullong,ullong>&)  const {  return false;}template<> booleanMMatrix<Double, double>::eigenComputeVector(MVector<Double, double>&					    eigvect,					    double eigval) {  return MMatrixMethods::eigenComputeVector(*this, eigvect, eigval);}template<> booleanMMatrix<Float, float>::eigenComputeVector(MVector<Float, float>&					  eigvect,					  float eigval) {  return MMatrixMethods::eigenComputeVector(*this, eigvect, eigval);}template<> booleanMMatrix<Double, double>::eigenBalance() {  return MMatrixMethods::eigenBalance(*this);}template<> booleanMMatrix<Float, float>::eigenBalance() {  return MMatrixMethods::eigenBalance(*this);}template<> booleanMMatrix<Double, double>::eigenEliminateHessenberg() {  return MMatrixMethods::eigenEliminateHessenberg(*this);}template<> booleanMMatrix<Float, float>::eigenEliminateHessenberg() {  return MMatrixMethods::eigenEliminateHessenberg(*this);}template<> booleanMMatrix<Double, double>::eigenHessenbergQR(MVector<Double, double>&					   eigval_real,					   MVector<Double, double>&					   eigval_imag) {  return MMatrixMethods::eigenHessenbergQR(*this, eigval_real, eigval_imag);}template<> booleanMMatrix<Float, float>::eigenHessenbergQR(MVector<Float, float>&					 eigval_real,					 MVector<Float, float>&					 eigval_imag) {  return MMatrixMethods::eigenHessenbergQR(*this, eigval_real, eigval_imag);}// end of include file//#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -