diff options
Diffstat (limited to '2.3-1/src/c/signalProcessing')
-rw-r--r-- | 2.3-1/src/c/signalProcessing/%sn/zmodsna.c | 143 | ||||
-rw-r--r-- | 2.3-1/src/c/signalProcessing/amell/amell.h | 27 | ||||
-rw-r--r-- | 2.3-1/src/c/signalProcessing/amell/damella.c | 23 | ||||
-rw-r--r-- | 2.3-1/src/c/signalProcessing/amell/damells.c | 57 | ||||
-rw-r--r-- | 2.3-1/src/c/signalProcessing/amell/int_amell.h | 18 | ||||
-rw-r--r-- | 2.3-1/src/c/signalProcessing/ell1mag/dell1maga.c | 40 | ||||
-rw-r--r-- | 2.3-1/src/c/signalProcessing/ell1mag/ell1mag.h | 28 | ||||
-rw-r--r-- | 2.3-1/src/c/signalProcessing/ell1mag/int_ell1mag.h | 18 | ||||
-rw-r--r-- | 2.3-1/src/c/signalProcessing/ell1mag/zell1maga.c | 40 | ||||
-rw-r--r-- | 2.3-1/src/c/signalProcessing/filt_sinc/dfilt_sincs.c | 11 | ||||
-rw-r--r-- | 2.3-1/src/c/signalProcessing/includes/amell.h | 28 | ||||
-rw-r--r-- | 2.3-1/src/c/signalProcessing/includes/ell1mag.h | 29 | ||||
-rw-r--r-- | 2.3-1/src/c/signalProcessing/interfaces/int_amell.h | 19 | ||||
-rw-r--r-- | 2.3-1/src/c/signalProcessing/interfaces/int_ell1mag.h | 19 | ||||
-rw-r--r-- | 2.3-1/src/c/signalProcessing/interfaces/int_modsn.h | 2 |
15 files changed, 490 insertions, 12 deletions
diff --git a/2.3-1/src/c/signalProcessing/%sn/zmodsna.c b/2.3-1/src/c/signalProcessing/%sn/zmodsna.c index 33052a32..85bc0c16 100644 --- a/2.3-1/src/c/signalProcessing/%sn/zmodsna.c +++ b/2.3-1/src/c/signalProcessing/%sn/zmodsna.c @@ -13,12 +13,153 @@ #include<math.h> #include "modsn.h" #include "doubleComplex.h" +#define CA 0.0003 + + +doubleComplex zmodsnsproto(doubleComplex uu,double emmc,doubleComplex* sni) +{ + doubleComplex ans; + double uur,uui; + uur=zreals(uu); + uui=zimags(uu); + double sr,cr,dr; + //Performing Elliptic Function operation for the real values + double a1,b1,c1,d1,emc1,u1; + double em1[14],en1[14]; + int i1,ii1,l1,bo1; + emc1=1-emmc; + u1=uur; + if(emc1) + { + bo1=(emc1<0.0); + if(bo1) + { + d1=1.0-emc1; + emc1/=-1.0/d1; + u1*=(d1=sqrt(d1)); + } + a1=1.0; + dr=1.0; + for(i1=1;i1<=13;i1++) + { + l1=i1; + em1[i1]=a1; + en1[i1]=(emc1=sqrt(emc1)); + c1=0.5*(a1+emc1); + if(fabs(a1-emc1)<=CA*a1)break; + emc1*=a1; + a1=c1; + } + u1*=c1; + sr=sin(u1); + cr=cos(u1); + if(sr) + { + a1=cr/sr; + c1*=a1; + for(ii1=l1;ii1>=1;ii1--) + { + b1=em1[ii1]; + a1*=c1; + c1*=dr; + dr=(en1[ii1]+a1)/(b1+a1); + a1=c1/b1; + } + a1=1.0/sqrt(c1*c1+1.0); + sr=(sr>=0.0?a1:-a1); + cr=c1*(sr); + } + if(bo1) + { + a1=dr; + dr=cr; + cr=a1; + sr/=d1; + } + } + else + { + cr=1.0/cosh(u1); + dr=cr; + sr=tanh(u1); + } + //////////////////////////////////////////////////////////////// + double si,ci,di; + //Performing Elleptic Function operation for the imaginary values + double a,b,c,d,emc,u; + double em[14],en[14]; + int i,ii,l,bo; + //double s1,c1,d1; + emc=emmc; + u=uui; + if(emc) + { + bo=(emc<0.0); + if(bo) + { + d=1.0-emc; + emc/=-1.0/d; + u*=(d=sqrt(d)); + } + a=1.0; + di=1.0; + for(i=1;i<=13;i++) + { + l=i; + em[i]=a; + en[i]=(emc=sqrt(emc)); + c=0.5*(a+emc); + if(fabs(a-emc)<=CA*a)break; + emc*=a; + a=c; + } + u*=c; + si=sin(u); + ci=cos(u); + if(si) + { + a=ci/si; + c*=a; + for(ii=l;ii>=1;ii--) + { + b=em[ii]; + a*=c; + c*=di; + di=(en[ii]+a)/(b+a); + a=c/b; + } + a=1.0/sqrt(c*c+1.0); + si=(si>=0.0?a:-a); + ci=c*(si); + } + if(bo) + { + a=di; + di=ci; + ci=a; + si/=d; + } + } + else + { + ci=1.0/cosh(u); + di=ci; + si=tanh(u); + } + ///////////////////////////////////////////////////////// + double delta; + delta=ci*ci + emmc*sr*sr*si*si; + double snir,snii; + snir=(sr*di)/delta; + snii=(cr*dr*si*ci)/delta; + *sni=DoubleComplex(snir,snii); +} void zmodsna(doubleComplex* uu,int size,double emmc,doubleComplex* sn) { int i; for(i=0;i<size;i++) { - sn[i]=zmodsns(uu[i],emmc); + zmodsnsproto(uu[i],emmc,&sn[i]); } } diff --git a/2.3-1/src/c/signalProcessing/amell/amell.h b/2.3-1/src/c/signalProcessing/amell/amell.h new file mode 100644 index 00000000..30bd6c82 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/amell/amell.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __AMELL_H__ +#define __AMELL_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double damells(double u,double x); + +#ifdef __cplusplus +} /* extern "c" */ +#endif + +#endif /*__AMELL_H__*/ diff --git a/2.3-1/src/c/signalProcessing/amell/damella.c b/2.3-1/src/c/signalProcessing/amell/damella.c new file mode 100644 index 00000000..5c37e2a5 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/amell/damella.c @@ -0,0 +1,23 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ +#include<stdio.h> +#include<math.h> +#include "amell.h" + +void damella(double* u,int size,double x,double* oup) +{ + int i; + for(i=0;i<size;i++) + { + oup[i]=damells(u[i],x); + } +} diff --git a/2.3-1/src/c/signalProcessing/amell/damells.c b/2.3-1/src/c/signalProcessing/amell/damells.c new file mode 100644 index 00000000..90c20530 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/amell/damells.c @@ -0,0 +1,57 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#include<stdio.h> +#include<math.h> +#include "amell.h" +#define N 30 +#define DBL_EPSILON 2.2204460492503131E-16 + + +double damells(double u,double x) +{ + double a[N+1]; + double g[N+1]; + double c[N+1]; + double two_n; + double phi; + double k; + int n; + k=(long double)fabs(x); + if(k==1.0) + return 0; + if(k>1.0) + printf("Wrong type of input argument type #2"); + + a[0]=1.0; + g[0]=sqrt(1.0-k*k); + c[0]=k; + two_n=1.0; + for(n=0;n<N;n++) + { + if(fabs(a[n]-g[n])<(a[n]*DBL_EPSILON)) + { + break; + } + two_n+=two_n; + a[n+1]=0.5*(a[n]+g[n]); + g[n+1]=sqrt(a[n]*g[n]); + c[n+1]=0.5*(a[n]-g[n]); + } + phi=two_n*a[n]*u; + for(;n>0;n--) + { + phi=0.5*(phi+asin(c[n]*sin(phi)/a[n])); + } + return (double)phi; +} + diff --git a/2.3-1/src/c/signalProcessing/amell/int_amell.h b/2.3-1/src/c/signalProcessing/amell/int_amell.h new file mode 100644 index 00000000..5d0c86f6 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/amell/int_amell.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_AMELL_H__ +#define __INT_AMELL_H__ + +#define d0d0amelld0(u,x) damells(u,x) + +#endif /* !__INT_AMELL_H__! */ diff --git a/2.3-1/src/c/signalProcessing/ell1mag/dell1maga.c b/2.3-1/src/c/signalProcessing/ell1mag/dell1maga.c new file mode 100644 index 00000000..9af0c8e8 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/ell1mag/dell1maga.c @@ -0,0 +1,40 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#include<stdio.h> +#include "modsn.h" +#include "ell1mag.h" +#include "doubleComplex.h" + +void dell1maga(double eps,double m1,double* z,int size,double* oup ) +{ + double s[size]; + int i; + for(i=0;i<size;i++) + { + s[i]=zmodsns(z[i],m1); + } + double un[size]; + int j; + for(j=0;j<size;j++) + { + un[j]=1; + } + double v; + int k; + for(k=0;k<size;k++) + { + v=un[k]/(un[k]+(eps*eps*s[k]*s[k])); + oup[k]=v; + } +} + diff --git a/2.3-1/src/c/signalProcessing/ell1mag/ell1mag.h b/2.3-1/src/c/signalProcessing/ell1mag/ell1mag.h new file mode 100644 index 00000000..8fffc0c6 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/ell1mag/ell1mag.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __ELL1MAG_H__ +#define __ELL1MAG_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dell1mags(double eps,double m1,doubleComplex* z,int size,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__ELL1MAG_H__*/ diff --git a/2.3-1/src/c/signalProcessing/ell1mag/int_ell1mag.h b/2.3-1/src/c/signalProcessing/ell1mag/int_ell1mag.h new file mode 100644 index 00000000..590a0abd --- /dev/null +++ b/2.3-1/src/c/signalProcessing/ell1mag/int_ell1mag.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_ELL1MAG_H__ +#define __INT_ELL1MAG_H__ + +#define d0d0z2ell1magd2(eps,m1,z,size,oup) dell1mags(eps,m1,z,size,oup) + +#endif /* !__INT_ELL1MAG_H__! */ diff --git a/2.3-1/src/c/signalProcessing/ell1mag/zell1maga.c b/2.3-1/src/c/signalProcessing/ell1mag/zell1maga.c new file mode 100644 index 00000000..6e7a6f93 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/ell1mag/zell1maga.c @@ -0,0 +1,40 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#include<stdio.h> +#include "modsn.h" +#include "ell1mag.h" +#include "doubleComplex.h" + +void zell1maga(double eps,double m1,doubleComplex* z,int size,double* oup ) +{ + doubleComplex s[size]; + int i; + for(i=0;i<size;i++) + { + s[i]=zmodsns(z[i],m1); + } + double un[size]; + int j; + for(j=0;j<size;j++) + { + un[j]=1; + } + doubleComplex v; + int k; + for(k=0;k<size;k++) + { + v=un[k]/(un[k]+(eps*eps*s[k]*s[k])); + oup[k]=zreals(v); + } +} + diff --git a/2.3-1/src/c/signalProcessing/filt_sinc/dfilt_sincs.c b/2.3-1/src/c/signalProcessing/filt_sinc/dfilt_sincs.c index 65aaaa65..1b7d1b18 100644 --- a/2.3-1/src/c/signalProcessing/filt_sinc/dfilt_sincs.c +++ b/2.3-1/src/c/signalProcessing/filt_sinc/dfilt_sincs.c @@ -46,13 +46,4 @@ void dfilt_sincs(double N,double fc,double* oup) oup[k]=xn[k]/xd[k]; } } -/* -int main() -{ - int n; - double fl; - n=5; - fl=0.2; - filt_sinc(n,fl); -} -*/ + diff --git a/2.3-1/src/c/signalProcessing/includes/amell.h b/2.3-1/src/c/signalProcessing/includes/amell.h new file mode 100644 index 00000000..2336d3cb --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/amell.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __AMELL_H__ +#define __AMELL_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double damells(double u,double x); +void damella(double* u,int size,double x,double* oup); + +#ifdef __cplusplus +} /* extern "c" */ +#endif + +#endif /*__AMELL_H__*/ diff --git a/2.3-1/src/c/signalProcessing/includes/ell1mag.h b/2.3-1/src/c/signalProcessing/includes/ell1mag.h new file mode 100644 index 00000000..e881cca9 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/ell1mag.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __ELL1MAG_H__ +#define __ELL1MAG_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void zell1maga(double eps,double m1,doubleComplex* z,int size,double* oup); +void dell1maga(double eps,double m1,double* z,int size,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__ELL1MAG_H__*/ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_amell.h b/2.3-1/src/c/signalProcessing/interfaces/int_amell.h new file mode 100644 index 00000000..10719ac5 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_amell.h @@ -0,0 +1,19 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_AMELL_H__ +#define __INT_AMELL_H__ + +#define d0d0amelld0(u,x) damells(u,x) +#define d2d0amelld2(u,size,x,oup) damella(u,size[1],x,oup) + +#endif /* !__INT_AMELL_H__! */ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_ell1mag.h b/2.3-1/src/c/signalProcessing/interfaces/int_ell1mag.h new file mode 100644 index 00000000..c30ffef6 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_ell1mag.h @@ -0,0 +1,19 @@ +/* Copyright (C) 2017 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_ELL1MAG_H__ +#define __INT_ELL1MAG_H__ + +#define d0d0z2ell1magd2(eps,m1,z,size,oup) zell1maga(eps,m1,z,size[1],oup) +#define d0d0d2ell1magd2(eps,m1,z,size,oup) dell1maga(eps,m1,z,size[1],oup) + +#endif /* !__INT_ELL1MAG_H__! */ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_modsn.h b/2.3-1/src/c/signalProcessing/interfaces/int_modsn.h index 0d32eb06..56c8f8cb 100644 --- a/2.3-1/src/c/signalProcessing/interfaces/int_modsn.h +++ b/2.3-1/src/c/signalProcessing/interfaces/int_modsn.h @@ -18,4 +18,4 @@ #define d2d0modsnd2(uu,size,emmc,sn) dmodsna(uu,size[1],emmc,sn) #define z2d0modsnz2(uu,size,emmc,sn) zmodsna(uu,size[1],emmc,sn) -#endif /* !INT_MODSN_H__! */ +#endif /* !__INT_MODSN_H__! */ |