diff options
Diffstat (limited to 'src/c/signalProcessing/amell')
-rw-r--r-- | src/c/signalProcessing/amell/amell.h | 27 | ||||
-rw-r--r-- | src/c/signalProcessing/amell/damella.c | 23 | ||||
-rw-r--r-- | src/c/signalProcessing/amell/damells.c | 57 | ||||
-rw-r--r-- | src/c/signalProcessing/amell/int_amell.h | 18 |
4 files changed, 125 insertions, 0 deletions
diff --git a/src/c/signalProcessing/amell/amell.h b/src/c/signalProcessing/amell/amell.h new file mode 100644 index 0000000..30bd6c8 --- /dev/null +++ b/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/src/c/signalProcessing/amell/damella.c b/src/c/signalProcessing/amell/damella.c new file mode 100644 index 0000000..5c37e2a --- /dev/null +++ b/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/src/c/signalProcessing/amell/damells.c b/src/c/signalProcessing/amell/damells.c new file mode 100644 index 0000000..90c2053 --- /dev/null +++ b/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/src/c/signalProcessing/amell/int_amell.h b/src/c/signalProcessing/amell/int_amell.h new file mode 100644 index 0000000..5d0c86f --- /dev/null +++ b/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__! */ |