libcm is a C development framework with an emphasis on audio signal processing applications.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

cmVectOps.h 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #ifndef cmVectOps_h
  2. #define cmVectOps_h
  3. #ifdef OS_OSX
  4. #include <Accelerate/Accelerate.h>
  5. typedef __CLPK_integer int_lap_t;
  6. #else
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. typedef int int_lap_t;
  11. extern int ilaenv_(int*, char *, char *, int*, int*, int*, int*, int, int );
  12. extern void dgetrf_( int*, int*, double*, int*, int*, int* );
  13. extern void dgetri_( int* arn, double* a, int* lda, int* ipiv, double* w, int* wn, int* info );
  14. extern void sgetrf_( int*, int*, float*, int*, int*, int* );
  15. extern void sgetri_( int* arn, float* a, int* lda, int* ipiv, float* w, int* wn, int* info );
  16. extern void dgesv_( int*, int*, double*, int*, int*, double*, int*, int* );
  17. extern void sgesv_( int*, int*, float*, int*, int*, float*, int*, int* );
  18. extern void dpotrf_(char*, int*, double*, int*, int* );
  19. extern void spotrf_(char*, int*, float*, int*, int* );
  20. #ifdef __cplusplus
  21. }
  22. #endif
  23. #endif
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. // Constants for use with cmVOX_LPSinc()
  28. enum { kNoLpSincFlags=0, kHighPass_LPSincFl=0x01, kNormalize_LPSincFl=0x02 };
  29. // Constants for use with cmVOX_MelMask()
  30. enum{ kNoMelFlags=0, kShiftMelFl=0x01, kNormalizeMelFl=0x02 };
  31. // Constants for use with cmVOX_TerhardtThresholdMask()
  32. enum { kNoTtmFlags=0, kModifiedTtmFl=0x01 };
  33. // Constants for cmVOX_MultMMM1() and cmVOX_MultMMM2()
  34. enum { kTransposeM0Fl=0x01, kTransposeM1Fl=0x02 };
  35. #define kDefaultMelBandCnt (36)
  36. #define kDefaultBarkBandCnt (24)
  37. #include "cmVectOpsTemplateMain.h"
  38. #define cmDefaultFieldWidth (10)
  39. #define cmDefaultDecPlCnt (4)
  40. // Flags for extended print control
  41. #define cmPrintNoColLabelsFl (0)
  42. #define cmPrintMatlabLabelsFl (1)
  43. #define cmPrintShortLabelsFl (2)
  44. void cmVOI_Print( cmRpt_t* rpt, unsigned rn, unsigned cn, const int* sp );
  45. void cmVOU_Print( cmRpt_t* rpt, unsigned rn, unsigned cn, const unsigned* sp );
  46. void cmVOI_PrintL( const char* label, cmRpt_t* rpt, unsigned rn, unsigned cn, const int* sp );
  47. void cmVOU_PrintL( const char* label, cmRpt_t* rpt, unsigned rn, unsigned cn, const unsigned* sp );
  48. unsigned* cmVOU_Mod( unsigned* dbp, unsigned dn, unsigned modVal );
  49. unsigned* cmVOU_Hist( unsigned* hbp, unsigned hn, const unsigned* sbp, unsigned sn );
  50. /// Fill vbp[vn] with random integer values between 0 and maxValue.
  51. unsigned* cmVOU_Random( unsigned* vbp, unsigned vn, unsigned maxValue );
  52. /// Fill vbp[vn] with vn unique random integer values between 0 and maxValue.
  53. /// Do not use this function to generate a reordering of a consecutive
  54. /// sequence of random values use cmVOU_RandomSeq instead.
  55. /// For best efficiency 'mavValue' should be large compared to 'vn'.
  56. unsigned* cmVOU_UniqueRandom( unsigned* vbp, unsigned vn, unsigned maxValue );
  57. /// FIll vbp[vn] the sequence 0:vn-1 in randomized order.
  58. unsigned* cmVOU_RandomSeq( unsigned* vbp, unsigned vn );
  59. cmReal_t cmVOU_Mean( const unsigned* sp, unsigned sn );
  60. cmReal_t cmVOU_Variance(const unsigned* sp, unsigned sn, const cmReal_t* mean);
  61. cmReal_t cmVOI_Mean( const int* sp, unsigned sn );
  62. cmReal_t cmVOI_Variance(const int* sp, unsigned sn, const cmReal_t* mean);
  63. // Complex vector * matrix multiply
  64. // dbp[1,dn] = v[1,vn] * m[vn,dn]
  65. cmComplexR_t* cmVORC_MultVVM( cmComplexR_t* dbp, unsigned dn, const cmComplexR_t* vp, unsigned vn, const cmComplexR_t* m );
  66. #define cmAbs(x) _Generic((x), double:fabs, float:fabsf, int:abs, unsigned:abs, default:fabs )(x)
  67. #define cmIsClose(x0,x1,eps) _Generic((x0), double:cmIsCloseD, float:cmIsCloseF, int:cmIsCloseI, unsigned:cmIsCloseU, default:cmIsCloseD)(x0,x1,eps)
  68. #ifdef __cplusplus
  69. }
  70. #endif
  71. #endif