spLib
Loading...
Searching...
No Matches
vmath.h
Go to the documentation of this file.
1
4#ifndef SPLIB_VMATH_H
5#define SPLIB_VMATH_H
6
7#include <sp/vector.h>
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13#if defined(MACOS)
14#pragma import on
15#endif
16
24 /*----@addtogroup vmathGroup----*/
25
31extern void svabs(spSVector x);
34extern void lvabs(spLVector x);
37extern void fvabs(spFVector x);
41extern void dvabs(spDVector x);
54
62extern void svsqrt(spSVector x);
65extern void lvsqrt(spLVector x);
68extern void fvsqrt(spFVector x);
71extern void dvsqrt(spDVector x);
84
92extern void svsquare(spSVector x);
95extern void lvsquare(spLVector x);
98extern void fvsquare(spFVector x);
101extern void dvsquare(spDVector x);
114
122extern void svsign(spSVector x);
125extern void lvsign(spLVector x);
128extern void fvsign(spFVector x);
132extern void dvsign(spDVector x);
146
154extern void svcumsum(spSVector x);
157extern void lvcumsum(spLVector x);
160extern void fvcumsum(spFVector x);
163extern void dvcumsum(spDVector x);
176
184extern void svcumprod(spSVector x);
187extern void lvcumprod(spLVector x);
190extern void fvcumprod(spFVector x);
193extern void dvcumprod(spDVector x);
206
214extern void svcodiff(spSVector x, double coef);
217extern void lvcodiff(spLVector x, double coef);
220extern void fvcodiff(spFVector x, double coef);
225extern void dvcodiff(spDVector x, double coef);
228extern spSVector xsvcodiff(spSVector x, double coef);
231extern spLVector xlvcodiff(spLVector x, double coef);
234extern spFVector xfvcodiff(spFVector x, double coef);
239extern spDVector xdvcodiff(spDVector x, double coef);
240
243#define svdiff(x) svcodiff(x, 1.0);
246#define lvdiff(x) lvcodiff(x, 1.0);
249#define fvdiff(x) fvcodiff(x, 1.0);
254#define dvdiff(x) dvcodiff(x, 1.0);
257#define xsvdiff(x) xsvcodiff(x, 1.0);
260#define xlvdiff(x) xlvcodiff(x, 1.0);
263#define xfvdiff(x) xfvcodiff(x, 1.0);
268#define xdvdiff(x) xdvcodiff(x, 1.0);
269
277extern long svsum(spSVector x);
280extern long lvsum(spLVector x);
283extern float fvsum(spFVector x);
286extern double dvsum(spDVector x);
287
290extern long svisum(spSVector x);
293extern long lvisum(spLVector x);
296extern float fvisum(spFVector x);
299extern double dvisum(spDVector x);
300
303extern long svsqsum(spSVector x);
306extern long lvsqsum(spLVector x);
309extern float fvsqsum(spFVector x);
312extern double dvsqsum(spDVector x);
313
316extern long svabssum(spSVector x);
319extern long lvabssum(spLVector x);
322extern float fvabssum(spFVector x);
325extern double dvabssum(spDVector x);
326
334extern long svprod(spSVector x);
337extern long lvprod(spLVector x);
340extern float fvprod(spFVector x);
343extern double dvprod(spDVector x);
344
347extern long svriprod(spSVector x, long *oiprod);
350extern long lvriprod(spLVector x, long *oiprod);
353extern float fvriprod(spFVector x, float *oiprod);
356extern double dvriprod(spDVector x, double *oiprod);
357
365extern double svnorm(spSVector x, long p);
368extern double lvnorm(spLVector x, long p);
371extern float fvnorm(spFVector x, long p);
378extern double dvnorm(spDVector x, long p);
379
387extern long svdot(spSVector x, spSVector y);
390extern long lvdot(spLVector x, spLVector y);
393extern float fvdot(spFVector x, spFVector y);
396extern double dvdot(spDVector x, spDVector y);
397
400extern void svcplxdot(spSVector x, spSVector y, long *re, long *im);
403extern void lvcplxdot(spLVector x, spLVector y, long *re, long *im);
406extern void fvcplxdot(spFVector x, spFVector y, float *re, float *im);
409extern void dvcplxdot(spDVector x, spDVector y, double *re, double *im);
410
418extern double svvar(spSVector x, double *mean);
421extern double lvvar(spLVector x, double *mean);
424extern float fvvar(spFVector x, float *mean);
430extern double dvvar(spDVector x, double *mean);
431
434extern double svstd(spSVector x, double *mean);
437extern double lvstd(spLVector x, double *mean);
440extern float fvstd(spFVector x, float *mean);
446extern double dvstd(spDVector x, double *mean);
447
450#define svmean(x) ((double)svsum(x) / (double)x->length)
453#define lvmean(x) ((double)lvsum(x) / (double)x->length)
456#define fvmean(x) (fvsum(x) / (float)x->length)
459#define dvmean(x) (dvsum(x) / (double)x->length)
460
468extern short svmin(spSVector x, long *index);
471extern long lvmin(spLVector x, long *index);
474extern float fvmin(spFVector x, long *index);
480extern double dvmin(spDVector x, long *index);
481
484extern short svmax(spSVector x, long *index);
487extern long lvmax(spLVector x, long *index);
490extern float fvmax(spFVector x, long *index);
496extern double dvmax(spDVector x, long *index);
497
500extern void svscmin(spSVector x, short a);
503extern void lvscmin(spLVector x, long a);
506extern void fvscmin(spFVector x, float a);
509extern void dvscmin(spDVector x, double a);
510
513extern void svscmax(spSVector x, short a);
516extern void lvscmax(spLVector x, long a);
519extern void fvscmax(spFVector x, float a);
522extern void dvscmax(spDVector x, double a);
523
526extern void svelmin(spSVector x, spSVector y);
529extern void lvelmin(spLVector x, spLVector y);
532extern void fvelmin(spFVector x, spFVector y);
535extern void dvelmin(spDVector x, spDVector y);
536
539extern void svelmax(spSVector x, spSVector y);
542extern void lvelmax(spLVector x, spLVector y);
545extern void fvelmax(spFVector x, spFVector y);
548extern void dvelmax(spDVector x, spDVector y);
549
553#define SP_NMINMAX_OPTION_PEAK_ONLY 1
554#define SP_NMINMAX_OPTION_ZERO_EDGES (1<<1)
555extern spLVector xsvnmin(spSVector x, long n, long margin, unsigned long options);
556extern spLVector xlvnmin(spLVector x, long n, long margin, unsigned long options);
557extern spLVector xfvnmin(spFVector x, long n, long margin, unsigned long options);
558extern spLVector xdvnmin(spDVector x, long n, long margin, unsigned long options);
559extern spLVector xsvnmax(spSVector x, long n, long margin, unsigned long options);
560extern spLVector xlvnmax(spLVector x, long n, long margin, unsigned long options);
561extern spLVector xfvnmax(spFVector x, long n, long margin, unsigned long options);
562extern long dvnmax(spLVector idx, spDVector x, long margin, unsigned long options);
563extern spLVector xdvnmax(spDVector x, long n, long margin, unsigned long options);
564
570extern void svsort(spSVector x);
573extern void lvsort(spLVector x);
576extern void fvsort(spFVector x);
579extern void dvsort(spDVector x);
592
594extern void spheapsort(void *keysptr, void *valuesptr, long length,
595 int (*compare_func)(void *keysptr, long i, long j),
596 void (*swap_func)(void *keysptr, void *valuesptr, long i, long j));
597
612
615extern double svmedian(spSVector x);
618extern double lvmedian(spLVector x);
621extern float fvmedian(spFVector x);
626extern double dvmedian(spDVector x);
629extern spSVector xsvmedian(spSVector x, double *median);
632extern spLVector xlvmedian(spLVector x, double *median);
635extern spFVector xfvmedian(spFVector x, float *median);
641extern spDVector xdvmedian(spDVector x, double *median);
642
650extern long svzerocross(spSVector x, int slope_sign);
653extern long lvzerocross(spLVector x, int slope_sign);
656extern long fvzerocross(spFVector x, int slope_sign);
663extern long dvzerocross(spDVector x, int slope_sign);
664
667/*-- the following functions are supported for float and double only --*/
668
674extern void fvangle(spFVector x);
680extern void dvangle(spDVector x);
684
692extern void fvcos(spFVector x);
695extern void dvcos(spDVector x);
702
705extern void fvsin(spFVector x);
708extern void dvsin(spDVector x);
715
718extern void fvtan(spFVector x);
721extern void dvtan(spDVector x);
728
731extern void fvcosh(spFVector x);
734extern void dvcosh(spDVector x);
741
744extern void fvsinh(spFVector x);
747extern void dvsinh(spDVector x);
754
757extern void fvtanh(spFVector x);
760extern void dvtanh(spDVector x);
767
770extern void fvacos(spFVector x);
773extern void dvacos(spDVector x);
780
783extern void fvasin(spFVector x);
786extern void dvasin(spDVector x);
793
796extern void fvatan(spFVector x);
799extern void dvatan(spDVector x);
806
809extern void fvatan2(spFVector y, spFVector x, spBool reverse);
814extern void dvatan2(spDVector y, spDVector x, spBool reverse);
822
830extern void fvexp(spFVector x);
833extern void dvexp(spDVector x);
840
843extern void fvlog(spFVector x);
846extern void dvlog(spDVector x);
853
856extern void fvlog10(spFVector x);
859extern void dvlog10(spDVector x);
866
869extern void fvdecibela(spFVector x);
873extern void dvdecibela(spDVector x);
881
884extern void fvdecibelp(spFVector x);
888extern void dvdecibelp(spDVector x);
896
899extern void fvundecibelp(spFVector x);
902extern void dvundecibelp(spDVector x);
909
912extern void fvdecibel(spFVector x);
915extern void dvdecibel(spDVector x);
922
925extern void fvundecibel(spFVector x);
928extern void dvundecibel(spDVector x);
935
943extern void fvrandun(spFVector x);
946extern void dvrandun(spDVector x);
947
950extern spFVector xfvrandunul(spPlugin *plugin, long length, spBool unlock_flag);
953extern spDVector xdvrandunul(spPlugin *plugin, long length, spBool unlock_flag);
954
957extern spFVector xfvrandun(long length);
960extern spDVector xdvrandun(long length);
961
964extern void fvgauss(spFVector x, float mu, float sigma);
967extern void dvgauss(spDVector x, double mu, double sigma);
968
971extern spFVector xfvgaussul(spPlugin *plugin, long length, float mu, float sigma, spBool unlock_flag);
974extern spDVector xdvgaussul(spPlugin *plugin, long length, double mu, double sigma, spBool unlock_flag);
975
978extern spFVector xfvgauss(long length, float mu, float sigma);
981extern spDVector xdvgauss(long length, double mu, double sigma);
982
985extern void fvrandn(spFVector x);
988extern void dvrandn(spDVector x);
989
992extern spFVector xfvrandnul(spPlugin *plugin, long length, spBool unlock_flag);
995extern spDVector xdvrandnul(spPlugin *plugin, long length, spBool unlock_flag);
996
999extern spFVector xfvrandn(long length);
1002extern spDVector xdvrandn(long length);
1003
1006 /*----@addtogroup vmathGroup----*/
1007
1009extern double dvscpolyval(spDVector p, double x);
1010extern void dvcplxpolyval(spDVector p, double xre, double xim, double *oyre, double *oyim);
1011extern void dvpolyval(spDVector iox, spDVector p);
1012extern spDVector xdvpolyval(spDVector x, spDVector p);
1013
1014#if defined(MACOS)
1015#pragma import off
1016#endif
1017
1018#ifdef __cplusplus
1019} /* Close scope of 'extern "C"' declaration */
1020#endif
1021
1022#endif /* SPLIB_VMATH_H */
int spBool
spFVector xfvmedian(spFVector x, float *median)
spFVector xfvcumprod(spFVector x)
void svabs(spSVector x)
void dvabs(spDVector x)
spLVector xlvcodiff(spLVector x, double coef)
spFVector xfvrandn(long length)
void svelmax(spSVector x, spSVector y)
void lvelmax(spLVector x, spLVector y)
short svmax(spSVector x, long *index)
double dvsqsum(spDVector x)
void dvtan(spDVector x)
spFVector xfvtanh(spFVector x)
void dvtanh(spDVector x)
spDVector xdvasin(spDVector x)
double dvmin(spDVector x, long *index)
spFVector xfvsin(spFVector x)
spSVector xsvcumprod(spSVector x)
void fvlog(spFVector x)
void lvabs(spLVector x)
void svcodiff(spSVector x, double coef)
long svzerocross(spSVector x, int slope_sign)
spDVector xdvgaussul(spPlugin *plugin, long length, double mu, double sigma, spBool unlock_flag)
void dvcumprod(spDVector x)
spDVector xdvatan2(spDVector y, spDVector x)
void lvsqrt(spLVector x)
long svsqsum(spSVector x)
void dvsquare(spDVector x)
spFVector xfvrandunul(spPlugin *plugin, long length, spBool unlock_flag)
void dvangle(spDVector x)
float fvmedian(spFVector x)
long lvriprod(spLVector x, long *oiprod)
long svabssum(spSVector x)
spSVector xsvcodiff(spSVector x, double coef)
spDVector xdvgauss(long length, double mu, double sigma)
void fvelmax(spFVector x, spFVector y)
void svcumsum(spSVector x)
void lvelmin(spLVector x, spLVector y)
double dvnorm(spDVector x, long p)
long fvzerocross(spFVector x, int slope_sign)
void fvsign(spFVector x)
long svisum(spSVector x)
long lvzerocross(spLVector x, int slope_sign)
long lvisum(spLVector x)
void dvatan2(spDVector y, spDVector x, spBool reverse)
float fvvar(spFVector x, float *mean)
spSVector xsvcumsum(spSVector x)
double svmedian(spSVector x)
spDVector xdvacos(spDVector x)
float fvisum(spFVector x)
void dvcos(spDVector x)
void fvsquare(spFVector x)
void fvrandun(spFVector x)
spFVector xfvlog10(spFVector x)
void fvrandn(spFVector x)
spFVector xfvdecibela(spFVector x)
short svmin(spSVector x, long *index)
double dvdot(spDVector x, spDVector y)
long svprod(spSVector x)
void dvscmax(spDVector x, double a)
double lvnorm(spLVector x, long p)
float fvprod(spFVector x)
void dvelmax(spDVector x, spDVector y)
void fvasin(spFVector x)
spLVector xlvabs(spLVector x)
spDVector xdvsign(spDVector x)
spFVector xfvcodiff(spFVector x, double coef)
spDVector xdvundecibelp(spDVector x)
void svsquare(spSVector x)
void lvcumprod(spLVector x)
void dvdecibelp(spDVector x)
spFVector xfvsquare(spFVector x)
spFVector xfvcumsum(spFVector x)
void svcplxdot(spSVector x, spSVector y, long *re, long *im)
float fvriprod(spFVector x, float *oiprod)
spFVector xfvcos(spFVector x)
spLVector xlvsort(spLVector x)
void fvabs(spFVector x)
spDVector xdvrandnul(spPlugin *plugin, long length, spBool unlock_flag)
spDVector xdvcos(spDVector x)
double dvvar(spDVector x, double *mean)
void fvlog10(spFVector x)
long lvabssum(spLVector x)
void dvscmin(spDVector x, double a)
void lvcodiff(spLVector x, double coef)
spSVector xsvsquare(spSVector x)
void dvexp(spDVector x)
long svriprod(spSVector x, long *oiprod)
spFVector xfvgaussul(spPlugin *plugin, long length, float mu, float sigma, spBool unlock_flag)
double dvabssum(spDVector x)
double dvmax(spDVector x, long *index)
spLVector xfvsortidx(spFVector x)
double lvmedian(spLVector x)
double lvstd(spLVector x, double *mean)
spFVector xfvlog(spFVector x)
spFVector xfvundecibelp(spFVector x)
void lvscmin(spLVector x, long a)
spLVector xlvcumprod(spLVector x)
void fvtanh(spFVector x)
void dvacos(spDVector x)
void fvexp(spFVector x)
void fvelmin(spFVector x, spFVector y)
long lvdot(spLVector x, spLVector y)
spSVector xsvsort(spSVector x)
void svsign(spSVector x)
void fvundecibel(spFVector x)
void fvdecibela(spFVector x)
long dvzerocross(spDVector x, int slope_sign)
double lvvar(spLVector x, double *mean)
spFVector xfvasin(spFVector x)
void lvsort(spLVector x)
void svelmin(spSVector x, spSVector y)
void fvsinh(spFVector x)
void dvcumsum(spDVector x)
spLVector xlvsquare(spLVector x)
void fvcos(spFVector x)
spDVector xdvtanh(spDVector x)
spLVector xsvsortidx(spSVector x)
spFVector xfvsqrt(spFVector x)
void dvcosh(spDVector x)
long lvsqsum(spLVector x)
double svstd(spSVector x, double *mean)
void dvlog(spDVector x)
void fvcumsum(spFVector x)
spFVector xfvatan(spFVector x)
double dvisum(spDVector x)
double svnorm(spSVector x, long p)
void dvlog10(spDVector x)
spDVector xdvsqrt(spDVector x)
spDVector xdvundecibel(spDVector x)
double dvsum(spDVector x)
void fvcosh(spFVector x)
spDVector xdvlog(spDVector x)
spLVector xlvmedian(spLVector x, double *median)
double dvprod(spDVector x)
void svsort(spSVector x)
float fvmax(spFVector x, long *index)
spDVector xdvrandunul(spPlugin *plugin, long length, spBool unlock_flag)
void dvelmin(spDVector x, spDVector y)
void svsqrt(spSVector x)
spFVector xfvtan(spFVector x)
spFVector xfvexp(spFVector x)
void svscmax(spSVector x, short a)
spDVector xdvsin(spDVector x)
spDVector xdvsort(spDVector x)
void dvundecibel(spDVector x)
spDVector xdvexp(spDVector x)
void fvatan2(spFVector y, spFVector x, spBool reverse)
float fvsqsum(spFVector x)
float fvmin(spFVector x, long *index)
long svsum(spSVector x)
void dvdecibela(spDVector x)
void dvundecibelp(spDVector x)
spDVector xdvlog10(spDVector x)
spDVector xdvcumprod(spDVector x)
void lvcplxdot(spLVector x, spLVector y, long *re, long *im)
long lvprod(spLVector x)
spDVector xdvcosh(spDVector x)
void fvscmax(spFVector x, float a)
void lvcumsum(spLVector x)
double dvstd(spDVector x, double *mean)
spFVector xfvgauss(long length, float mu, float sigma)
spDVector xdvabs(spDVector x)
spFVector xfvsign(spFVector x)
void dvsort(spDVector x)
void fvatan(spFVector x)
spDVector xdvdecibelp(spDVector x)
spFVector xfvabs(spFVector x)
spLVector xlvsign(spLVector x)
void lvsign(spLVector x)
spDVector xdvrandn(long length)
spDVector xdvsquare(spDVector x)
float fvdot(spFVector x, spFVector y)
float fvnorm(spFVector x, long p)
float fvstd(spFVector x, float *mean)
double svvar(spSVector x, double *mean)
void dvrandn(spDVector x)
void fvtan(spFVector x)
spDVector xdvcodiff(spDVector x, double coef)
void dvsign(spDVector x)
void dvcplxdot(spDVector x, spDVector y, double *re, double *im)
spLVector xlvsortidx(spLVector x)
void fvcplxdot(spFVector x, spFVector y, float *re, float *im)
void fvdecibel(spFVector x)
void fvcodiff(spFVector x, double coef)
spFVector xfvatan2(spFVector y, spFVector x)
long svdot(spSVector x, spSVector y)
spFVector xfvrandnul(spPlugin *plugin, long length, spBool unlock_flag)
spSVector xsvsign(spSVector x)
void svscmin(spSVector x, short a)
void fvangle(spFVector x)
spFVector xfvcosh(spFVector x)
long lvsum(spLVector x)
spDVector xdvcumsum(spDVector x)
void fvsqrt(spFVector x)
void fvsort(spFVector x)
long lvmin(spLVector x, long *index)
float fvsum(spFVector x)
void dvasin(spDVector x)
void fvscmin(spFVector x, float a)
spSVector xsvsqrt(spSVector x)
spFVector xfvrandun(long length)
double dvriprod(spDVector x, double *oiprod)
void dvsqrt(spDVector x)
void fvundecibelp(spFVector x)
void fvgauss(spFVector x, float mu, float sigma)
void fvsin(spFVector x)
void dvgauss(spDVector x, double mu, double sigma)
void dvsinh(spDVector x)
void lvsquare(spLVector x)
void dvatan(spDVector x)
float fvabssum(spFVector x)
spDVector xdvdecibela(spDVector x)
spFVector xfvdecibelp(spFVector x)
spSVector xsvabs(spSVector x)
spDVector xdvrandun(long length)
spLVector xdvsortidx(spDVector x)
spFVector xfvundecibel(spFVector x)
spDVector xdvangle(spDVector x)
double dvmedian(spDVector x)
long lvmax(spLVector x, long *index)
spFVector xfvdecibel(spFVector x)
spFVector xfvsinh(spFVector x)
spLVector xlvcumsum(spLVector x)
spDVector xdvsinh(spDVector x)
spDVector xdvatan(spDVector x)
void dvsin(spDVector x)
void fvcumprod(spFVector x)
void dvcodiff(spDVector x, double coef)
spDVector xdvtan(spDVector x)
void dvdecibel(spDVector x)
void dvrandun(spDVector x)
spFVector xfvacos(spFVector x)
spFVector xfvsort(spFVector x)
void fvacos(spFVector x)
spDVector xdvdecibel(spDVector x)
spLVector xlvsqrt(spLVector x)
void lvscmax(spLVector x, long a)
void fvdecibelp(spFVector x)
spDVector xdvmedian(spDVector x, double *median)
void svcumprod(spSVector x)
spSVector xsvmedian(spSVector x, double *median)
spFVector xfvangle(spFVector x)
Vector type that contains the elements of double type.
Definition vector.h:248
Vector type that contains the elements of float type.
Definition vector.h:214
Vector type that contains the elements of long type.
Definition vector.h:180
Vector type that contains the elements of short type.
Definition vector.h:146