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

📄 cmatrix.h

📁 矩阵类
💻 H
📖 第 1 页 / 共 4 页
字号:
BOOL MTX_MinAbsColIndex( const MTX *M, const unsigned col, double *value, unsigned *row );  

/// \brief  Computes the absolute minimum element in the specified row and its index.
/// If there are several equal minimum elements, the first index from the beginning is returned.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_MinAbsRowIndex( const MTX *M, const unsigned row, double *value, unsigned *col );


/// \brief  Computes the maximum element in the specified column.
/// If the matrix is real, only the real value, re is set, im = 0. 
/// If the matrix is complex, both re and im are set.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_MaxColumn( const MTX *M, const unsigned col, double *re, double *im );

/// \brief  Computes the maximum element in the specified row.
/// If the matrix is real, only the real value, re is set, im = 0. 
/// If the matrix is complex, both re and im are set.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_MaxRow( const MTX *M, const unsigned row, double *re, double *im );


/// \brief  Computes the minimum element in the specified column.
/// If the matrix is real, only the real value, re is set, im = 0. 
/// If the matrix is complex, both re and im are set.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_MinColumn( const MTX *M, const unsigned col, double *re, double *im );


/// \brief  Computes the minimum element in the specified row.
/// If the matrix is real, only the real value, re is set, im = 0. 
/// If the matrix is complex, both re and im are set.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_MinRow( const MTX *M, const unsigned row, double *re, double *im );


/// \brief  Computes the absolute maximum element in the specified column.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_MaxAbsColumn( const MTX *M, const unsigned col, double *value );

/// \brief  Computes the absolute maximum element in the specified row.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_MaxAbsRow( const MTX *M, const unsigned row, double *value );


/// \brief  Computes the absolute minimum element in the specified column.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_MinAbsColumn( const MTX *M, const unsigned col, double *value );

/// \brief  Computes the absolute minimum element in the specified row.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_MinAbsRow( const MTX *M, const unsigned row, double *value );


/// \brief  Computes the absolute maximum element for the entire matrix and its row and column index.
/// If there are several equal maximum elements, the first index from the beginning is returned.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_MaxAbsIndex( const MTX *M, double* value, unsigned *row, unsigned *col );

/// \brief  Computes the maximum element for the entire matrix and its row and column index.
/// If there are several equal maximum elements, the first index from the beginning is returned.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_MaxIndex( const MTX *M, double *re, double *im, unsigned *row, unsigned *col );

/// \brief  Computes the absolute maximum element for the entire matrix.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_MaxAbs( const MTX *M, double* value );

/// \brief  Computes the maximum element for the entire matrix.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_Max( const MTX *M, double *re, double *im );


/// \brief  Computes the absolute minimum element for the entire matrix and its row and column index.
/// If there are several equal minimum elements, the first index from the beginning is returned.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_MinAbsIndex( const MTX *M, double* value, unsigned *row, unsigned *col );

/// \brief  Computes the minimum element for the entire matrix and its row and column index.
/// If there are several equal minimum elements, the first index from the beginning is returned.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_MinIndex( const MTX *M, double *re, double *im, unsigned *row, unsigned *col );

/// \brief  Computes the absolute minimum element for the entire matrix.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_MinAbs( const MTX *M, double* value );

/// \brief  Computes the minimum element for the entire matrix.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_Min( const MTX *M, double *re, double *im );


/// \brief  Computes the range of the data in the specified column. 
/// Range = MaxVal - MinVal.
/// If the matrix is real, only the real value, re is set, im = 0. 
/// If the matrix is complex, both re and im are set.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_ColumnRange( const MTX *M, const unsigned col, double *re, double *im );
   

/// \brief  Computes the range of the data in the specified row. 
/// Range = MaxVal - MinVal.
/// If the matrix is real, only the real value, re is set, im = 0. 
/// If the matrix is complex, both re and im are set.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_RowRange( const MTX *M, const unsigned row, double *re, double *im );

/// \brief  Computes the range of the data in the matrix. 
/// Range = MaxVal - MinVal.
/// If the matrix is real, only the real value, re is set, im = 0. 
/// If the matrix is complex, both re and im are set.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_Range( const MTX *M, double *re, double *im );


/// \brief  Computes the sum for the specified column.
/// If the matrix is real, only the real value, re is set, im = 0. 
/// If the matrix is complex, both re and im are set.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_ColumnSum( const MTX *M, const unsigned col,  double *re, double *im );

/// \brief  Computes the sum of the absolute values for the specified column.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_ColumnSumAbs( const MTX *M, const unsigned col, double *value );


/// \brief  Computes the sum for the specified row.
/// If the matrix is real, only the real value, re is set, im = 0. 
/// If the matrix is complex, both re and im are set.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_RowSum( const MTX *M, const unsigned row, double *re, double *im );

/// \brief  Computes the sum of the data in the matrix .
/// If the matrix is real, only the real value, re is set, im = 0. 
/// If the matrix is complex, both re and im are set.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_Sum( const MTX *M, double *re, double *im );



/// \brief  Computes the sample mean for the specified column.
/// If the matrix is real, only the real value, re is set, im = 0. 
/// If the matrix is complex, both re and im are set.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_ColumnMean( const MTX *M, const unsigned col, double *re, double *im );

/// \brief  Computes the sample mean for the specified row.
/// If the matrix is real, only the real value, re is set, im = 0. 
/// If the matrix is complex, both re and im are set.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_RowMean( const MTX *M, const unsigned row, double *re, double *im );

/// \brief  Computes the sample mean for the matrix.
/// If the matrix is real, only the real value, re is set, im = 0. 
/// If the matrix is complex, both re and im are set.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_Mean( const MTX *M, double *re, double *im );




/// \brief  Computes the sample standard deviation for the specified column.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_ColumnStdev( const MTX *M, const unsigned col, double *value );

/// \brief  Computes the sample standard deviation for the specified row.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_RowStdev( const MTX *M, const unsigned row, double *value );

/// \brief  Computes the sample standard deviation for the matrix.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_Stdev( const MTX *M, double *value );



/// \brief  Computes the sample variance for the specified column.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_ColumnVar( const MTX *M, const unsigned col, double *value );

/// \brief  Computes the sample variance for the specified row.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_RowVar( const MTX *M, const unsigned row, double *value );

/// \brief  Computes the sample variance for the matrix.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_Var( const MTX *M, double *value );


/// \brief  Computes the norm of the specified column.
/// If real, norm = sqrt( sum( val*val ) ).
/// If complex, norm = sqrt( sum( val*conjugate(val) ) ).
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_ColumnNorm( const MTX *M, const unsigned col, double *value );

/// \brief  Computes the norm of the specified row.
/// If real, norm = sqrt( sum( val*val ) ).
/// If complex, norm = sqrt( sum( val*conjugate(val) ) ).
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_RowNorm( const MTX *M, const unsigned row, double *value );

/// \brief  Computes the norm of the matrix.
/// If real, norm = sqrt( sum( val*val ) ).
/// If complex, norm = sqrt( sum( val*conjugate(val) ) ).
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_Norm( const MTX *M, double *value );


/// \brief  Computes the sample RMS value for the specified column.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_ColumnRMS( const MTX *M, const unsigned col, double *value );

/// \brief  Computes the sample RMS value for the specified row.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_RowRMS( const MTX *M, const unsigned row, double *value );

/// \brief  Computes the sample RMS value for the matrix.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_RMS( const MTX *M, double *value );


/// \brief  Computes the sample skewness value for the specified column.
/// The skewness is the third central moment divided by the cube of the standard deviation.
/// If the matrix is real, only the real value, re is set, im = 0. 
/// If the matrix is complex, both re and im are set.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_ColumnSkewness( const MTX *M, const unsigned col, double *re, double* im );

/// \brief  Computes the sample skewness value for the specified row.
/// The skewness is the third central moment divided by the cube of the standard deviation.
/// If the matrix is real, only the real value, re is set, im = 0. 
/// If the matrix is complex, both re and im are set.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_RowSkewness( const MTX *M, const unsigned row, double *re, double* im );

/// \brief  Computes the sample skewness value for the matrix.
/// The skewness is the third central moment divided by the cube of the standard deviation.
/// If the matrix is real, only the real value, re is set, im = 0. 
/// If the matrix is complex, both re and im are set.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_Skewness( const MTX *M, double *re, double* im );



/// \brief  Computes the sample kurtosis value for the specified column.
/// The kurtosis is the fourth central moment divided by fourth power of the standard deviation.
/// If the matrix is real, only the real value, re is set, im = 0. 
/// If the matrix is complex, both re and im are set.
/// To adjust the computed kurtosis value for bias, subtract 3 from the real component.
/// Reference: http://en.wikipedia.org/wiki/Kurtosis.
/// Reference: http://mathworld.wolfram.com/Kurtosis.html (kurtosis proper is computed).
/// \return TRUE if successful, FALSE otherwise.
// g_2 = \frac{m_4}{m_{2}^2} = \frac{n\,\sum_{i=1}^n (x_i - \overline{x})^4}{\left(\sum_{i=1}^n (x_i - \overline{x})^2\right)^2}.
BOOL MTX_ColumnKurtosis( const MTX *M, const unsigned col, double *re, double *im );

/// \brief  Computes the sample kurtosis value for the specified row.
/// The kurtosis is the fourth central moment divided by fourth power of the standard deviation.
/// If the matrix is real, only the real value, re is set, im = 0. 
/// If the matrix is complex, both re and im are set.
/// To adjust the computed kurtosis value for bias, subtract 3 from the real component.
/// Reference: http://en.wikipedia.org/wiki/Kurtosis.
/// Reference: http://mathworld.wolfram.com/Kurtosis.html (kurtosis proper is computed).
///
/// \return TRUE if successful, FALSE otherwise.
// g_2 = \frac{m_4}{m_{2}^2} = \frac{n\,\sum_{i=1}^n (x_i - \overline{x})^4}{\left(\sum_{i=1}^n (x_i - \overline{x})^2\right)^2}.
BOOL MTX_RowKurtosis( const MTX *M, const unsigned row, double *re, double *im );


/// \brief  Computes the sample kurtosis value for the matrix.
/// The kurtosis is the fourth central moment divided by fourth power of the standard deviation.
/// If the matrix is real, only the real value, re is set, im = 0. 
/// If the matrix is complex, both re and im are set.
/// To adjust the computed kurtosis value for bias, subtract 3 from the real component.
/// Reference: http://en.wikipedia.org/wiki/Kurtosis.
/// Reference: http://mathworld.wolfram.com/Kurtosis.html (kurtosis proper is computed).
///
/// \return TRUE if successful, FALSE otherwise.
// g_2 = \frac{m_4}{m_{2}^2} = \frac{n\,\sum_{i=1}^n (x_i - \overline{x})^4}{\left(\sum_{i=1}^n (x_i - \overline{x})^2\right)^2}.
BOOL MTX_Kurtosis( const MTX *M, double *re, double *im );





////
// Matrix specific

/// \brief  Computes the trace of M where M is a square matrix.
/// Trace = Sum of diagonal elements.
/// If the matrix is real, only the real value, re is set, im = 0. 
/// If the matrix is complex, both re and im are set.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_Trace( const MTX *M, double *re, double *im );

/// \brief  Sets the diagonal elements of M into D as a column vector
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_Diagonal( const MTX *M, MTX *D );

/// \brief  Sorts each column of M in ascending order.
/// If complex, sorts based on magnitude.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_SortAscending( MTX *M );
                                                       
/// \brief  Sorts each column of M in descending order.
/// If complex, sorts based on magnitude.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_SortDescending( MTX *M );

/// \brief  Sorts a specific column in ascending order.
/// If complex, sorts based on magnitude.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_SortColumnAscending( MTX *M, const unsigned col );

/// \brief  Sorts a specific column in descending order.
/// If complex, sorts based on magnitude.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_SortColumnDescending( MTX *M, const unsigned col );

/// \brief  Sorts a specific column in ascending order and fills a MTX column vector with the sorted index.
/// The index vector will be resized if index->nrows != M->nrows
/// If complex, sorts based on magnitude.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_SortColumnIndexed( MTX *M, const unsigned col, MTX *index );

/// \brief  Sorts the entire matrix by a specific column.
/// If complex, sorts based on magnitude.
///
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_SortByColumn( MTX *M, const unsigned col );



/// \brief  Saves a matrix to the specified file path using a proprietary compressed format.
/// ADVANCED EDITION ONLY!
/// \return TRUE if successful, FALSE otherwise.
BOOL MTX_SaveCompressed( const MTX *M, const char *path );

⌨️ 快捷键说明

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