diff options
author | siddhu8990 | 2017-06-21 15:46:02 +0530 |
---|---|---|
committer | siddhu8990 | 2017-06-21 15:46:02 +0530 |
commit | cae632f23980b28f814dc9441df40032c8a4c1aa (patch) | |
tree | 39f70e6c4f694247f6b2c4e5db6fdb1e507b9408 /2.3-1/src | |
parent | 9abc909f1a02c7c0262e2d53b13504c7ee324fda (diff) | |
parent | 56aa185002761d966abebb5c67e6c1a2d5ee141c (diff) | |
download | Scilab2C-cae632f23980b28f814dc9441df40032c8a4c1aa.tar.gz Scilab2C-cae632f23980b28f814dc9441df40032c8a4c1aa.tar.bz2 Scilab2C-cae632f23980b28f814dc9441df40032c8a4c1aa.zip |
Merged Ankit's work, signal processing and string functions
Diffstat (limited to '2.3-1/src')
101 files changed, 3355 insertions, 34 deletions
diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/sinc/dsinca.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/sinc/dsinca.c new file mode 100644 index 00000000..0cd24e96 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/sinc/dsinca.c @@ -0,0 +1,46 @@ +/* Copyright (C) 2016 - 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 "sinc.h" +#define PI 3.14159265358979 +void dsinca(double* sample,int size,double* oup) +{ + int j; + for(j=0;j<size;j++) + { + if(sample[j]==0) + { + oup[j]=1; + } + else + { + oup[j]=(sin(sample[j]))/(sample[j]); + } + } +} +/* +int main() +{ + int n; + printf("Enter the length of the array"); + scanf("%d",&n); + double arr[100000]; + int i; + printf("Now enter the element of the array"); + for(i=0;i<n;i++) + { + scanf("%ld",&arr[i]); + } + sinc(arr[],n); +} +*/ diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/sinc/int_sinc.h b/2.3-1/src/c/elementaryFunctions/Trigonometry/sinc/int_sinc.h new file mode 100644 index 00000000..0dc969de --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/sinc/int_sinc.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - 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_SINC_H__ +#define __INT_SINC_H__ + +#define d2sincd2(sample,size,oup) dsinca(sample,size,oup) + +#endif /* !__INT_SINC_H__! */ diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/sinc/sinc.h b/2.3-1/src/c/elementaryFunctions/Trigonometry/sinc/sinc.h new file mode 100644 index 00000000..6a5c315b --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/sinc/sinc.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2016 - 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 __SINC_H__ +#define __SINC_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dsinca(double* sample,int size,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __SINC_H__ */ diff --git a/2.3-1/src/c/elementaryFunctions/Trigonometry/sinc/zsinca.c b/2.3-1/src/c/elementaryFunctions/Trigonometry/sinc/zsinca.c new file mode 100644 index 00000000..ad7d095b --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/Trigonometry/sinc/zsinca.c @@ -0,0 +1,31 @@ +/* Copyright (C) 2016 - 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 "sinc.h" +#include "sin.h" +#include "doubleComplex.h" +void zsinca(doubleComplex* sample,int size,doubleComplex* oup) +{ + int j; + for(j=0;j<size;j++) + { + if(sample[j]==0) + { + oup[j]==DoubleComplex(1,0); + } + else + { + oup[j]=zsins(sample[j])/sample[j]; + } + } +} diff --git a/2.3-1/src/c/elementaryFunctions/discrete_mathematics/gcd/u8gcda.c b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/gcd/u8gcda.c new file mode 100644 index 00000000..3d586232 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/gcd/u8gcda.c @@ -0,0 +1,60 @@ +/* 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> +/* This is the "gcd" function , which takes two input. first + one is the array and the second one is the length of the array. + Now to calculate the gcd of two elements we fin the maximum of + the two elements, and then iterate from maximum value down to 1, + and check whether the particular value divides the two elements. + And in this way we can calculate the gcd of the whole array. +*/ +#include "gcd.h" +uint8 u8gcdua(uint8* in,int size) +{ + + int temp; + if(size==1) + { + temp=*in; + } + else + { + int x=*in; + int y=*(in+1); + int max=(x>y)?x:y; + for(int i=max;i>=1;i--) + { + if(x%i==0 && y%i==0) + { + temp=i; + break; + } + } + for(int j=2;j<size;j++) + { + x=temp; + y=*(in+j); + max=(x>y)?x:y; + for(int i=max;i>=1;i--) + { + if(x%i==0 && y%i==0) + { + temp=i; + break; + } + } + } +} + + return temp; +} + diff --git a/2.3-1/src/c/elementaryFunctions/discrete_mathematics/lcm/u8lcma.c b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/lcm/u8lcma.c new file mode 100644 index 00000000..56856e43 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/lcm/u8lcma.c @@ -0,0 +1,68 @@ +/* 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> +/* This is the "lcm" function, accepting two inputs which are the array of integers + and second the size of the array. The algorithm works like this: + We take a temproary variable and store the lcm of the first two elements of the + array in it. Now using this temproary variable we recursively fin the lcm of + the whole array. + Now to fin the lcm of two elements we fin the maximum of the two elements and + check whether it is divisible by both the elements, if the condition is true we + get the lcm, else increase the maximum value by itself unless we get the lcm. +*/ +#include "lcm.h" +uint8 u8lcma(uint8* in,int size) +{ + long long int lcm_temp; + if(size==1) + { + lcm_temp=*in; + } + else + { + + int x1=*in; + int x2=*(in+1); + long long int max=(x1>x2)?x1:x2; + long long int i=max; + while(1) + { + if(i%x1==0 && i%x2==0) + { + lcm_temp=i; + break; + } + else + i+=max; + } + for(int j=2;j<size;j++) + { + x1=lcm_temp; + x2=*(in+j); + max=(x1>x2)?x1:x2; + i=max; + while(1) + { + if(i%x1==0 && i%x2==0) + { + lcm_temp=i; + break; + } + else + i+=max; + } + } + + } + return lcm_temp; +} + diff --git a/2.3-1/src/c/elementaryFunctions/includes/gcd.h b/2.3-1/src/c/elementaryFunctions/includes/gcd.h index eb75c973..179eea0e 100644 --- a/2.3-1/src/c/elementaryFunctions/includes/gcd.h +++ b/2.3-1/src/c/elementaryFunctions/includes/gcd.h @@ -1,31 +1,26 @@ -/* - * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab - * Copyright (C) 2007-2008 - INRIA - Bruno JOFRET - * - * 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 - * Author: Ukasha Noor - * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - * - */ +/* Copyright (C) 2016 - 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 __GCD_H__ #define __GCD_H__ - #include "types.h" -#ifdef __cplusplus -extern "C" { -#endif - -int8 u8gcds(int8 *in,int size); + #ifdef __cplusplus + extern "C"{ + #endif -void dgcda(double *in,int size,double *out); +uint8 u8gcda(uint8* in,int size); -#ifdef __cplusplus -} /* extern "C" */ -#endif + #ifdef __cplusplus + } /* extern "C" */ + #endif -#endif +#endif /*__GCD_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/includes/lcm.h b/2.3-1/src/c/elementaryFunctions/includes/lcm.h new file mode 100644 index 00000000..3a3e66fb --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/lcm.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2016 - 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 __LCM_H__ +#define __LCM_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint8 u8lcma(uint8* in,int size); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__LCM_H__*/ + diff --git a/2.3-1/src/c/elementaryFunctions/includes/sinc.h b/2.3-1/src/c/elementaryFunctions/includes/sinc.h new file mode 100644 index 00000000..8bc98d28 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/sinc.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2016 - 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 __SINC_H__ +#define __SINC_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dsinca(double* sample,int size,double* oup); +void zsinca(doubleComplex* sample,int size,doubleComplex* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __SINC_H__ */ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_gcd.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_gcd.h index c2135b70..f3e117c5 100644 --- a/2.3-1/src/c/elementaryFunctions/interfaces/int_gcd.h +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_gcd.h @@ -1,25 +1,25 @@ -/* Copyright (C) 2016 - IIT Bombay - FOSSEE + /* Copyright (C) 2016 - 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: Ukasha Noor + Author: Ankit Raj Organization: FOSSEE, IIT Bombay Email: toolbox@scilab.in -*/ - -/* THIS IS AN AUTOMATICALLY GENERATED FILE : DO NOT EDIT BY HAND. */ - + */ #ifndef __INT_GCD_H__ #define __INT_GCD_H__ -#include "gcd.h" - -#define u82gcdu80(in,size) u8gcds(in,size) + #ifdef __cplusplus + extern "C" { + #endif -#define d2gcdd2(in,size,out) dgcda(in,size[0]*size[1],out) +#define u82gcdu80(in,size) u8gcda(in,size[1]) -#endif + #ifdef __cplusplus + } /* extern "C" */ + #endif +#endif /*__INT_GCD_H__*/ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_lcm.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_lcm.h new file mode 100644 index 00000000..2ef1a081 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_lcm.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2016 - 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_LCM_H__ +#define __INT_LCM_H__ + #ifdef __cplusplus + extern "C" { + #endif + +#define u82lcmu80(in,size) u8lcma(in,size[1]) + + #ifdef __cplusplus + } /* extern "C" */ + #endif + +#endif /* !__INT_LCM_H__ */ diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_sinc.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_sinc.h new file mode 100644 index 00000000..35a519db --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_sinc.h @@ -0,0 +1,19 @@ +/* Copyright (C) 2016 - 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_SINC_H__ +#define __INT_SINC_H__ + +#define d2sincd2(sample,size,oup) dsinca(sample,size[1],oup) +#define z2sincz2(sample,size,oup) zsinca(sample,size[1],oup) + +#endif /* !__INT_SINC_H__! */ diff --git a/2.3-1/src/c/signalProcessing/%k/dmodka.c b/2.3-1/src/c/signalProcessing/%k/dmodka.c new file mode 100644 index 00000000..c0630ec0 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/%k/dmodka.c @@ -0,0 +1,97 @@ +#include<stdio.h> +#include<math.h> +#include "modk.h" +double max_calc(double* ptr,int sz) +{ + int i=0; + double mx; + if(ptr[0]<0) + { + ptr[0]=-1*ptr[0]; + } + mx=(ptr[0]); + //printf("%lf\n",mx); + for(i=1;i<sz;i++) + { + if(ptr[i]<0) + { + ptr[i]=-1*ptr[i]; + } + if(mx<(ptr[i])) + mx=(ptr[i]); + } + return mx; +} +void dmodka(double* inp,int size,double* oup) +{ + double ones[size],PI=M_PI; + double eps=pow(2,-52); + int i; + for(i=0;i<size;i++) + { + ones[i]=1; + } + double a[size],b[size],c[size],an[size],bn[size],cn[size],kans[size]; + + int j,kk,l,m; + for(j=0;j<size;j++) + { + a[j]=1; + } + for(kk=0;kk<size;kk++) + { + b[kk]=sqrt(ones[kk]-inp[kk]); + } + for(l=0;l<size;l++) + { + c[l]=sqrt(inp[l]); + + } + int x=0; + //double maxi; + //maxi=max_calc(c,size); + //printf("%lf",maxi); + + while(max_calc(c,size)>eps) + { + int q,w,r; + for(q=0;q<size;q++) + { + an[q]=0.5*(a[q]+b[q]); + } + for(w=0;w<size;w++) + { + bn[w]=sqrt(a[w]*b[w]); + } + for(r=0;r<size;r++) + { + cn[r]=0.5*(a[r]-b[r]); + } + int x,y,z; + for(x=0;x<size;x++) + { + a[x]=an[x]; + } + for(y=0;y<size;y++) + { + b[y]=bn[y]; + } + for(z=0;z<size;z++) + { + c[z]=cn[z]; + } + } + int q,w; + for(q=0;q<size;q++) + { + oup[q]=PI*(ones[q]/(2*a[q])); + } + +} +/* +int main() +{ + double m[3]={0.1,0.2,0.3}; + dka(m,3); +} +*/ diff --git a/2.3-1/src/c/signalProcessing/%k/int_modk.h b/2.3-1/src/c/signalProcessing/%k/int_modk.h new file mode 100644 index 00000000..ae09c50a --- /dev/null +++ b/2.3-1/src/c/signalProcessing/%k/int_modk.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_%K_H__ +#define __INT_%K_H__ + +#define d2modkz2(inp,size,oup) dmodka(inp,size,oup) + +#endif /* !INT_%K_H__! */ diff --git a/2.3-1/src/c/signalProcessing/%k/modk.h b/2.3-1/src/c/signalProcessing/%k/modk.h new file mode 100644 index 00000000..6b4a7e08 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/%k/modk.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 __%K_H__ +#define __%K_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dmodka(double* inp,int size,doubleComplex* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __%K_H__ */ + diff --git a/2.3-1/src/c/signalProcessing/%sn/dmodsna.c b/2.3-1/src/c/signalProcessing/%sn/dmodsna.c new file mode 100644 index 00000000..7e1e81c3 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/%sn/dmodsna.c @@ -0,0 +1,24 @@ +/* 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 "modsn.h" + +void dmodsna(double* uu,int size,double emmc,double* sn) +{ + int i; + for(i=0;i<size;i++) + { + sn[i]=dmodsns(uu[i],emmc); + } +} + diff --git a/2.3-1/src/c/signalProcessing/%sn/dmodsns.c b/2.3-1/src/c/signalProcessing/%sn/dmodsns.c new file mode 100644 index 00000000..06d0a6f0 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/%sn/dmodsns.c @@ -0,0 +1,93 @@ +/* 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 + Reference:- Abramowitz, Milton and Stegun, Irene A + Handbook of Mathematical Functions, Dover, 1965 + Chapter 16 (Sections 16.4, 16.13 and 16.15) + Link for FORTRAN code:-http://www.aip.de/groups/soe/local/numres/bookfpdf/f6-11.pdf +*/ + +#include<stdio.h> +#include<math.h> +#define CA 0.0003 +#include "modsn.h" +double dmodsns(double uu, double emmc) +{ + double a,b,c,d,emc,u; + double em[14],en[14]; + int i,ii,l,bo; + double sn,cn,dn; + emc=1-emmc; + u=uu; + if(emc) + { + bo=(emc<0.0); + if(bo) + { + d=1.0-emc; + emc/=-1.0/d; + u*=(d=sqrt(d)); + } + a=1.0; + dn=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; + sn=sin(u); + cn=cos(u); + if(sn) + { + a=cn/sn; + c*=a; + for(ii=l;ii>=1;ii--) + { + b=em[ii]; + a*=c; + c*=dn; + dn=(en[ii]+a)/(b+a); + a=c/b; + } + a=1.0/sqrt(c*c+1.0); + sn=(sn>=0.0?a:-a); + cn=c*(sn); + } + if(bo) + { + a=dn; + dn=cn; + cn=a; + sn/=d; + } + } + else + { + cn=1.0/cosh(u); + dn=cn; + sn=tanh(u); + } + return sn; +} +/* +int main() +{ + double u,k; + u=4; + k=0.7; + sn(u,k); +} +*/ diff --git a/2.3-1/src/c/signalProcessing/%sn/int_modsn.h b/2.3-1/src/c/signalProcessing/%sn/int_modsn.h new file mode 100644 index 00000000..179fb61f --- /dev/null +++ b/2.3-1/src/c/signalProcessing/%sn/int_modsn.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_MODSN_H__ +#define __INT_MODSN_H__ + +#define d0d0modsnd0(uu,emmc) dmodsns(uu,emmc) + +#endif /* !INT_MODSN_H__! */ diff --git a/2.3-1/src/c/signalProcessing/%sn/modsn.h b/2.3-1/src/c/signalProcessing/%sn/modsn.h new file mode 100644 index 00000000..c5896562 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/%sn/modsn.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 __MODSN_H__ +#define __MODSN_H__ +#include "types.h" + +#ifdef __cplusplus +extern "c" { +#endif + +double dmodsns(double uu, double emmc); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __MODSN_H__ */ diff --git a/2.3-1/src/c/signalProcessing/%sn/zmodsna.c b/2.3-1/src/c/signalProcessing/%sn/zmodsna.c new file mode 100644 index 00000000..33052a32 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/%sn/zmodsna.c @@ -0,0 +1,24 @@ +/* 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 "modsn.h" +#include "doubleComplex.h" + +void zmodsna(doubleComplex* uu,int size,double emmc,doubleComplex* sn) +{ + int i; + for(i=0;i<size;i++) + { + sn[i]=zmodsns(uu[i],emmc); + } +} diff --git a/2.3-1/src/c/signalProcessing/%sn/zmodsns.c b/2.3-1/src/c/signalProcessing/%sn/zmodsns.c new file mode 100644 index 00000000..5f35059f --- /dev/null +++ b/2.3-1/src/c/signalProcessing/%sn/zmodsns.c @@ -0,0 +1,161 @@ +/* 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 + Reference:- Abramowitz, Milton and Stegun, Irene A + Handbook of Mathematical Functions, Dover, 1965 + Chapter 16 (Sections 16.4, 16.13 and 16.15) + Link for FORTRAN code:-http://www.aip.de/groups/soe/local/numres/bookfpdf/f6-11.pdf +*/ + +#include<stdio.h> +#include<math.h> +#include "modsn.h" +#include "doubleComplex.h" +#define CA 0.0003 + +doubleComplex zmodsns(doubleComplex uu,double emmc) +{ + 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; + ans=DoubleComplex(snir,snii); + return ans; +} diff --git a/2.3-1/src/c/signalProcessing/buttmag/buttmag.h b/2.3-1/src/c/signalProcessing/buttmag/buttmag.h new file mode 100644 index 00000000..47e64af8 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/buttmag/buttmag.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2016 - 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 __BUTTMAG_H__ +#define __BUTTMAG_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dbuttmags(double order, double omegac, int size, double* sample,double* out); + +#ifdef __cplusplus +} /* extern "C"*/ +#endif + +#endif /* __BUTTMAG_H__ */ + diff --git a/2.3-1/src/c/signalProcessing/buttmag/dbuttmags.c b/2.3-1/src/c/signalProcessing/buttmag/dbuttmags.c new file mode 100644 index 00000000..dc40e814 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/buttmag/dbuttmags.c @@ -0,0 +1,33 @@ +/* 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 "buttmag.h" +void dbuttmags(double order, double omegac,double* sample,int size,double* out) +{ + double ones[size]; + int j,k; + for(j=0;j<size;j++) + { + ones[j]=1.0; + } + //double h[size]; + for(k=0;k<size;k++) + { + double x=ones[k]/(ones[k]+pow((sample[k]/omegac),(2*order))); + out[k]=x; + //printf("%lf\n",h[k]); + } + +} + diff --git a/2.3-1/src/c/signalProcessing/buttmag/int_buttmag.h b/2.3-1/src/c/signalProcessing/buttmag/int_buttmag.h new file mode 100644 index 00000000..9867438e --- /dev/null +++ b/2.3-1/src/c/signalProcessing/buttmag/int_buttmag.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - 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_BUTTMAG_H__ +#define __INT_BUTTMAG_H__ + +#define d0d0d2buttmagd2(order,omegac,size,sample,out) dbuttmags(order,omegac,size,sample,out) + +#endif /* !INT_BUTTMAG_H__! */ diff --git a/2.3-1/src/c/signalProcessing/buttmag/u8buttmags.c b/2.3-1/src/c/signalProcessing/buttmag/u8buttmags.c new file mode 100644 index 00000000..e7b52c22 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/buttmag/u8buttmags.c @@ -0,0 +1,33 @@ +/* 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 "buttmag.h" +void dbuttmags(int order, int omegac,double* sample,int size,double* out) +{ + double ones[size]; + int j,k; + for(j=0;j<size;j++) + { + ones[j]=1.0; + } + //double h[size]; + for(k=0;k<size;k++) + { + double x=ones[k]/(ones[k]+pow((sample[k]/omegac),(2*order))); + out[k]=x; + //printf("%lf\n",h[k]); + } + +} + diff --git a/2.3-1/src/c/signalProcessing/cheb1mag/cheb1mag.h b/2.3-1/src/c/signalProcessing/cheb1mag/cheb1mag.h new file mode 100644 index 00000000..369ee4ce --- /dev/null +++ b/2.3-1/src/c/signalProcessing/cheb1mag/cheb1mag.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2016 - 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 __CHEB1MAG_H__ +#define __CHEB1MAG_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dcheb1mags(double n, double omegac, double epsilon, double* sample,int size,double* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CHEB1MAG_H__ */ diff --git a/2.3-1/src/c/signalProcessing/cheb1mag/dcheb1mags.c b/2.3-1/src/c/signalProcessing/cheb1mag/dcheb1mags.c new file mode 100644 index 00000000..a4a459d4 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/cheb1mag/dcheb1mags.c @@ -0,0 +1,35 @@ +/* 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 "cheb1mag.h" +void dcheb1mags(double n, double omegac, double epsilon, double* sample,int size,double* out) +{ + double x; + int j; + double tn; + for(j=0;j<size;j++) + { + x=sample[j]/omegac; + if(x<=1) + { + tn=cos(n*acos(x)); + out[j]=1/(1+(epsilon*epsilon)*(tn*tn)); + } + else + { + tn=cosh(n*acosh(x)); + out[j]=1/(1+(epsilon*epsilon)*(tn*tn)); + } + } +} + diff --git a/2.3-1/src/c/signalProcessing/cheb1mag/int_cheb1mag.h b/2.3-1/src/c/signalProcessing/cheb1mag/int_cheb1mag.h new file mode 100644 index 00000000..fa0ff83e --- /dev/null +++ b/2.3-1/src/c/signalProcessing/cheb1mag/int_cheb1mag.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - 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_CHEB1MAG_H__ +#define __INT_CHEB1MAG_H__ + +#define d0d0d2cheb1magd2(n,omegac,epsilon,sample,size,out) dcheb1mags(n,omegac,epsilon,sample,size,out) + +#endif /* !__INT_CHEB1MAG_H__! */ diff --git a/2.3-1/src/c/signalProcessing/cheb2mag/cheb2mag.h b/2.3-1/src/c/signalProcessing/cheb2mag/cheb2mag.h new file mode 100644 index 00000000..0516ca51 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/cheb2mag/cheb2mag.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2016 - 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 __CHEB2MAG_H__ +#define __CHEB2MAG_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dcheb2mags(double n,double omegar, double A, double* sample,int size,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CHEB2MAG_H__ */ diff --git a/2.3-1/src/c/signalProcessing/cheb2mag/dcheb2mags.c b/2.3-1/src/c/signalProcessing/cheb2mag/dcheb2mags.c new file mode 100644 index 00000000..006c5917 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/cheb2mag/dcheb2mags.c @@ -0,0 +1,49 @@ +/* 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 "cheb2mag.h" +void dcheb2mags(double n,double omegar, double A, double* sample,int size,double* oup) +{ + double e; + //e=sqrt(A*A-1); + e=1/(pow(10,A/10)-1); + double x,k,cn,h,tp; + int i; + for(i=0;i<size;i++) + { + x=omegar/sample[i]; + if(x<=1) + { + tp=acos(x); + cn=cos(n*tp); + if(x==1) + { + h=1/(1+A*A-1); + } + else + { + h=1/(1+((A*A-1)/(cn*cn))); + } + + } + else + { + tp=acosh(x); + cn=cosh(n*tp); + h=e*(cn*cn)/(1+e*(cn*cn)); + + } + oup[i]=h; + } +} + diff --git a/2.3-1/src/c/signalProcessing/cheb2mag/int_cheb2mag.h b/2.3-1/src/c/signalProcessing/cheb2mag/int_cheb2mag.h new file mode 100644 index 00000000..05b77c2d --- /dev/null +++ b/2.3-1/src/c/signalProcessing/cheb2mag/int_cheb2mag.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - 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_CHEB2MAG_H__ +#define __INT_CHEB2MAG_H__ + +#define d0d0d0d2cheb2magd2(n,omegar,A,sample,size,oup) dcheb2mag(n,omegar,A,sample,size,oup) + +#endif /* !__INT_CHEB2MAG_H__! */ diff --git a/2.3-1/src/c/signalProcessing/ffilt/ffilt.h b/2.3-1/src/c/signalProcessing/ffilt/ffilt.h new file mode 100644 index 00000000..9b98f34c --- /dev/null +++ b/2.3-1/src/c/signalProcessing/ffilt/ffilt.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 __FFILT_H__ +#define __FFILT_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void gffilts(char* ft,double N,double fc,double fh,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __FFILT_H__ */ diff --git a/2.3-1/src/c/signalProcessing/ffilt/gffilts.c b/2.3-1/src/c/signalProcessing/ffilt/gffilts.c new file mode 100644 index 00000000..538daf3e --- /dev/null +++ b/2.3-1/src/c/signalProcessing/ffilt/gffilts.c @@ -0,0 +1,90 @@ +/* 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 "filt_sinc.h" +#include "ffilt.h" +void gffilts(char* ft,int size,double N,double fc,double fh,double* oup) +{ + int sz=N; + double X[sz]; + double no22=(N-1)/2; + int ino22=(int)no22; + if(ft[0]=='l') + { + dfilt_sincs(N,fc,X); + int k=0; + for(k=0;k<sz;k++) + { + oup[k]=X[k]; + } + } + else if(ft[0]=='h') + { + int k=0; + dfilt_sincs(N,fc,X); + for(k=0;k<sz;k++) + { + oup[k]=-1*X[k]; + } + int id=no22; + oup[id]=1+oup[id]; + } + else if(ft[0]=='b') + { + double wc=M_PI*(fh+fc); + fc=(fh-fc)/2; + dfilt_sincs(N,fc,X); + double Y[sz]; + double k=0; + for(k=-no22;k<=no22;k++) + { + int ind; + ind=k+no22; + Y[ind]=2*cos(wc*k); + } + int j=0; + for(j=0;j<sz;j++) + { + oup[j]=X[j]*Y[j]; + } + } + else if(ft[0]=='s') + { + double wc=M_PI*(fh+fc); + fc=(fh-fc)/2; + dfilt_sincs(N,fc,X); + double Y[sz]; + double k=0; + for(k=-no22;k<=no22;k++) + { + int ind; + ind=k+no22; + Y[ind]=2*cos(wc*k); + } + int j=0; + for(j=0;j<sz;j++) + { + oup[j]=-1*X[j]*Y[j]; + } + int id=no22; + oup[id]=1+oup[id]; + } +} +/* +int main() +{ + string s; + int n; + double fl,fh; +} +*/ diff --git a/2.3-1/src/c/signalProcessing/ffilt/int_ffilt.h b/2.3-1/src/c/signalProcessing/ffilt/int_ffilt.h new file mode 100644 index 00000000..83f44827 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/ffilt/int_ffilt.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_FFILT_H__ +#define __INT_FFILT_H__ + +#define g0d0d0d0ffiltd2(ft,N,fc,fh,oup) gffilts(ft,N,fc,fh,oup) + +#endif /* !__INT_FFILT_H__! */ 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 new file mode 100644 index 00000000..65aaaa65 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/filt_sinc/dfilt_sincs.c @@ -0,0 +1,58 @@ +/* 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 "filt_sinc.h" +void dfilt_sincs(double N,double fc,double* oup) +{ + double no2=(N-1)/2; + int ino2=(int)no2; + double wl=fc*2*M_PI; + int sz=N; + double xn[sz]; + double i; + int l,m; + for(i=-no2;i<=no2;i++) + { + l=i+no2; + xn[l]=sin(wl*i); + } + double xd[sz]; + double j; + printf("\n"); + for(j=-no2;j<=no2;j++) + { + m=j+no2; + xd[m]=M_PI*j; + } + if(ino2==no2) + { + xn[(int)no2]=2*fc; + xd[(int)no2]=1; + } + double x[sz]; + int k; + for(k=0;k<N;k++) + { + 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/filt_sinc/filt_sinc.h b/2.3-1/src/c/signalProcessing/filt_sinc/filt_sinc.h new file mode 100644 index 00000000..43b24151 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/filt_sinc/filt_sinc.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 __FILT_SINC_H__ +#define __FILT_SINC_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void u8filt_sincs(int N,double fc,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __FILT_SINC_H */ + diff --git a/2.3-1/src/c/signalProcessing/filt_sinc/int_filt_sinc.h b/2.3-1/src/c/signalProcessing/filt_sinc/int_filt_sinc.h new file mode 100644 index 00000000..5b7b07ae --- /dev/null +++ b/2.3-1/src/c/signalProcessing/filt_sinc/int_filt_sinc.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_FILT_SINC_H__ +#define __INT_FILT_SINC_H__ + +#define u80d0filt_sincd2(N,fc,oup) u8filt_sincs(N,fc,oup) + +#endif /* !__INT_FILT_SINC_H__! */ diff --git a/2.3-1/src/c/signalProcessing/fsfirlin/dfsfirlina.c b/2.3-1/src/c/signalProcessing/fsfirlin/dfsfirlina.c new file mode 100644 index 00000000..d2079f4d --- /dev/null +++ b/2.3-1/src/c/signalProcessing/fsfirlin/dfsfirlina.c @@ -0,0 +1,144 @@ +/* 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 "sincd.h" +#include "fsfirlin.h" +//#define PI 3.14159265358979 + +void dfsfirlina(double* hd,int size,double flag,double* hst) +{ + int n1=size,n; + if( n1%2==0) + { + n=2*n1; + } + else + { + n=2*n1+1; + } + double scd[8*n+1]; + //STRAT SINCD + double npt=4*n; + int sz=4*n; + double PI=M_PI; + double pas=PI/npt; + double om[sz+1]; + int i; + for(i=0;i<=sz;i++) + { + om[i]=i*pas; + } + double eps=pow(-1,(n-1)); + double s1[sz+1],s2[sz+1]; + double s[2*(sz)+1]; + double sr[2*(sz)+1]; + if(flag==1) + { + int j,k; + for(j=0;j<=4*n;j++) + { + s1[j]=sin(n*om[j]); + s2[j]=sin(om[j]); + } + s1[0]=n; + s2[0]=1; + s1[sz]=n*eps; + s2[sz]=1; + + for(k=0;k<=4*n;k++) + { + s[k]=s1[k]/s2[k]; + } + + int x; + for(x=0;x<=4*n;x++) + { + scd[sz-x]=s[x]; + } + int l; + for(l=4*n+1;l<=8*n;l++) + { + scd[l]=s[l-(sz)]; + } + int m; + for(m=0;m<=8*n;m++) + { + scd[m]=scd[m]/n; + } + } + else + { + int a; + for(a=0;a<=4*n;a++) + { + om[a]=om[a]-(PI/(2*n)); + } + int j,k; + for(j=0;j<=4*n;j++) + { + s1[j]=sin(n*om[j]); + s2[j]=sin(om[j]); + } + s1[2]=n; + s2[2]=1; + for(k=0;k<=4*n;k++) + { + s[k]=s1[k]/s2[k]; + } + int m; + for(m=0;m<=4*n;m++) + { + scd[m]=(eps*s[m])/n; + } + int l; + for(l=4*n+1;l<=8*n;l++) + { + scd[l]=s[l-(sz)]/n; + } + } + //END SINCD + int ii; + for(ii=4*n;ii<=6*n;ii++) + { + hst[ii-(4*n)]=hd[0]*scd[ii]; + } + + int epsi; + epsi=pow(-1,n-1); + int jj; + for(jj=1;jj<=(n1-1);jj++) + { + double tp1[2*n+1]; + double tp2[2*n+1]; + int k,l; + for(k=(-4*jj+4*n);k<=(-4*jj+6*n);k++) + { + tp1[k-(-4*jj+4*n)]=hd[jj]*scd[k]; + } + + for(l=(4*jj);l<=(4*jj+2*n);l++) + { + tp2[l-(4*jj)]=hd[jj]*(epsi*scd[l]); + } + int m; + for(m=0;m<=2*n;m++) + { + hst[m]=hst[m]+(tp1[m]+tp2[m]); + } + + } + + +} diff --git a/2.3-1/src/c/signalProcessing/fsfirlin/fsfirlin.h b/2.3-1/src/c/signalProcessing/fsfirlin/fsfirlin.h new file mode 100644 index 00000000..7337cbfe --- /dev/null +++ b/2.3-1/src/c/signalProcessing/fsfirlin/fsfirlin.h @@ -0,0 +1,26 @@ +/* Copyright (C) 2016 - 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 __FSFIRLIN_H__ +#define __FSFIRLIN_H__ +#include "types.h" +#include "sincd.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dfsfirlina(double* hd,int size,int flag,double* hst); + +#ifdef __cplusplus +} /* extern "C" */ +#endif diff --git a/2.3-1/src/c/signalProcessing/fsfirlin/int_fsfirlin.h b/2.3-1/src/c/signalProcessing/fsfirlin/int_fsfirlin.h new file mode 100644 index 00000000..857dae8c --- /dev/null +++ b/2.3-1/src/c/signalProcessing/fsfirlin/int_fsfirlin.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - 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_FSFIRLIN_H__ +#define __INT_FSFIRLIN_H__ + +#define d2u80fsfirlind2(hd,size,flag,hst) dfsfirlina(hd,size[1],flag,hst) + +#endif /* !__INT_FSFIRLIN_H__! */ diff --git a/2.3-1/src/c/signalProcessing/includes/buttmag.h b/2.3-1/src/c/signalProcessing/includes/buttmag.h new file mode 100644 index 00000000..ef17b7ea --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/buttmag.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 __BUTTMAG_H__ +#define __BUTTMAG_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dbuttmags(double order, double omegac, double* sample, int size,double* out); +void u8buttmags(int order, int omegac, double* sample, int size,double* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __BUTTMAG_H__ */ + diff --git a/2.3-1/src/c/signalProcessing/includes/cheb1mag.h b/2.3-1/src/c/signalProcessing/includes/cheb1mag.h new file mode 100644 index 00000000..369ee4ce --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/cheb1mag.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2016 - 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 __CHEB1MAG_H__ +#define __CHEB1MAG_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dcheb1mags(double n, double omegac, double epsilon, double* sample,int size,double* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CHEB1MAG_H__ */ diff --git a/2.3-1/src/c/signalProcessing/includes/cheb2mag.h b/2.3-1/src/c/signalProcessing/includes/cheb2mag.h new file mode 100644 index 00000000..0516ca51 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/cheb2mag.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2016 - 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 __CHEB2MAG_H__ +#define __CHEB2MAG_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dcheb2mags(double n,double omegar, double A, double* sample,int size,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __CHEB2MAG_H__ */ diff --git a/2.3-1/src/c/signalProcessing/includes/ffilt.h b/2.3-1/src/c/signalProcessing/includes/ffilt.h new file mode 100644 index 00000000..f38df6e6 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/ffilt.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 __FFILT_H__ +#define __FFILT_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void gffilts(char* ft,int size,double N,double fc,double fh,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __FFILT_H__ */ diff --git a/2.3-1/src/c/signalProcessing/includes/filt_sinc.h b/2.3-1/src/c/signalProcessing/includes/filt_sinc.h new file mode 100644 index 00000000..095ca91f --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/filt_sinc.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 __FILT_SINC_H__ +#define __FILT_SINC_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dfilt_sincs(double N,double fc,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __FILT_SINC_H */ + diff --git a/2.3-1/src/c/signalProcessing/includes/fsfirlin.h b/2.3-1/src/c/signalProcessing/includes/fsfirlin.h new file mode 100644 index 00000000..cf5fbbd0 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/fsfirlin.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 __FSFIRLIN_H__ +#define __FSFIRLIN_H__ +#include "types.h" +#include "sincd.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dfsfirlina(double* hd,int size,double flag,double* hst); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__FSFIRLIN_H__*/ diff --git a/2.3-1/src/c/signalProcessing/includes/modsn.h b/2.3-1/src/c/signalProcessing/includes/modsn.h new file mode 100644 index 00000000..d91dd9d3 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/modsn.h @@ -0,0 +1,31 @@ +/* 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 __MODSN_H__ +#define __MODSN_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dmodsns(double uu, double emmc); +doubleComplex zmodsns(doubleComplex uu,double emmc); +void dmodsna(double* uu,int size,double emmc,double* sn); +void zmodsna(doubleComplex* uu,int size,double emmc,doubleComplex* sn); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __MODSN_H__ */ diff --git a/2.3-1/src/c/signalProcessing/includes/sincd.h b/2.3-1/src/c/signalProcessing/includes/sincd.h new file mode 100644 index 00000000..9b7a3607 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/sincd.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2016 - 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 __SINCD_H__ +#define __SINCD_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dsincds(double n,double flg,double* oup); +void u8sincds(int n,int flg,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __SINCD_H__ */ + diff --git a/2.3-1/src/c/signalProcessing/includes/zpbutt.h b/2.3-1/src/c/signalProcessing/includes/zpbutt.h new file mode 100644 index 00000000..9eb88ad4 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/zpbutt.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2016 - 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 __ZPBUTT_H__ +#define __ZPBUTT_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dzpbutts(double n,double fl,doubleComplex* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __ZPBUTT_H__ */ + diff --git a/2.3-1/src/c/signalProcessing/includes/zpch1.h b/2.3-1/src/c/signalProcessing/includes/zpch1.h new file mode 100644 index 00000000..fbe850cc --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/zpch1.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2016 - 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 __ZPCH1_H__ +#define __ZPCH1_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dzpch1s(double N,double e,double wc,doubleComplex* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __ZPCH1_H__ */ diff --git a/2.3-1/src/c/signalProcessing/includes/zpch2.h b/2.3-1/src/c/signalProcessing/includes/zpch2.h new file mode 100644 index 00000000..d7c1c647 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/zpch2.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2016 - 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 __ZPCH2_H__ +#define __ZPCH2_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dzpch2s(double N, double A, double omegar,doubleComplex* zeros,doubleComplex* poles); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __ZPCH2_H__ */ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_buttmag.h b/2.3-1/src/c/signalProcessing/interfaces/int_buttmag.h new file mode 100644 index 00000000..4a33fafe --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_buttmag.h @@ -0,0 +1,19 @@ +/* Copyright (C) 2016 - 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_BUTTMAG_H__ +#define __INT_BUTTMAG_H__ + +#define d0d0d2buttmagd2(order,omegac,sample,size,out) dbuttmags(order,omegac,sample,size[1],out) +#define u80u80d2buttmagd2(order,omegac,sample,size,out) u8buttmags(order,omegac,sample,size[1],out) + +#endif /* !INT_BUTTMAG_H__! */ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_cheb1mag.h b/2.3-1/src/c/signalProcessing/interfaces/int_cheb1mag.h new file mode 100644 index 00000000..764e8c79 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_cheb1mag.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - 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_CHEB1MAG_H__ +#define __INT_CHEB1MAG_H__ + +#define d0d0d0d2cheb1magd2(n,omegac,epsilon,sample,size,out) dcheb1mags(n,omegac,epsilon,sample,size[1],out) + +#endif /* !__INT_CHEB1MAG_H__! */ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_cheb2mag.h b/2.3-1/src/c/signalProcessing/interfaces/int_cheb2mag.h new file mode 100644 index 00000000..b63db04d --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_cheb2mag.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - 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_CHEB2MAG_H__ +#define __INT_CHEB2MAG_H__ + +#define d0d0d0d2cheb2magd2(n,omegar,A,sample,size,oup) dcheb2mags(n,omegar,A,sample,size[1],oup) + +#endif /* !__INT_CHEB2MAG_H__! */ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_ffilt.h b/2.3-1/src/c/signalProcessing/interfaces/int_ffilt.h new file mode 100644 index 00000000..273b98f7 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_ffilt.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_FFILT_H__ +#define __INT_FFILT_H__ + +#define g2d0d0d0ffiltd2(ft,size,N,fc,fh,oup) gffilts(ft,size[1],N,fc,fh,oup) + +#endif /* !__INT_FFILT_H__! */ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_filt_sinc.h b/2.3-1/src/c/signalProcessing/interfaces/int_filt_sinc.h new file mode 100644 index 00000000..f90d0a62 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_filt_sinc.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_FILT_SINC_H__ +#define __INT_FILT_SINC_H__ + +#define d0d0filt_sincd2(N,fc,oup) dfilt_sincs(N,fc,oup) + +#endif /* !__INT_FILT_SINC_H__! */ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_fsfirlin.h b/2.3-1/src/c/signalProcessing/interfaces/int_fsfirlin.h new file mode 100644 index 00000000..3f6fb6e0 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_fsfirlin.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_FSFIRLIN_H__ +#define __INT_FSFIRLIN_H__ + +#define d2d0fsfirlind2(hd,size,flag,hst) dfsfirlina(hd,size[1],flag,hst) + +#endif /* !__INT_FSFIRLIN_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 new file mode 100644 index 00000000..0d32eb06 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_modsn.h @@ -0,0 +1,21 @@ +/* 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_MODSN_H__ +#define __INT_MODSN_H__ + +#define d0d0modsnd0(uu,emmc) dmodsns(uu,emmc) +#define z0d0modsnz0(uu,emmc) zmodsns(uu,emmc) +#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__! */ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_sincd.h b/2.3-1/src/c/signalProcessing/interfaces/int_sincd.h new file mode 100644 index 00000000..73136730 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_sincd.h @@ -0,0 +1,19 @@ +/* Copyright (C) 2016 - 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_SINCD_H__ +#define __INT_SINCD_H__ + +#define d0d0sincdd2(n,flg,oup) dsincds(n,flg,oup) +#define u80u80sincdd2(n,flg,oup) u8sincds(n,flg,oup) + +#endif /* !__INT_SINCD_H__! */ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_zpbutt.h b/2.3-1/src/c/signalProcessing/interfaces/int_zpbutt.h new file mode 100644 index 00000000..775c1026 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_zpbutt.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_ZPBUTT_H__ +#define __INT_ZPBUTT_H__ + +#define d0d0zpbuttz2d0(n,fl,out) dzpbutts(n,fl,out) + +#endif /* !INT_ZPBUTT_H__! */ + diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_zpch1.h b/2.3-1/src/c/signalProcessing/interfaces/int_zpch1.h new file mode 100644 index 00000000..429e7c36 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_zpch1.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - 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_ZPCH1_H__ +#define __INT_ZPCH1_H__ + +#define d0d0d0zpch1z2d0(N,e,wc,out) dzpch1s(N,e,wc,out) + +#endif /* !INT_ZPCH1_H__! */ diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_zpch2.h b/2.3-1/src/c/signalProcessing/interfaces/int_zpch2.h new file mode 100644 index 00000000..fcb12a7c --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_zpch2.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - 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_ZPCH2_H__ +#define __INT_ZPCH2_H__ + +#define d0d0d0zpch2z2z2d0(N,A,omegar,zeros,poles) dzpch2s(N,A,omegar,zeros,poles) + +#endif /* !INT_ZPCH2_H__! */ diff --git a/2.3-1/src/c/signalProcessing/sincd/dsincds.c b/2.3-1/src/c/signalProcessing/sincd/dsincds.c new file mode 100644 index 00000000..1475d8de --- /dev/null +++ b/2.3-1/src/c/signalProcessing/sincd/dsincds.c @@ -0,0 +1,99 @@ +/* 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 "sincd.h" +//#define PI 3.14159265358979 +void dsincds(double n,double flg,double* oup) +{ + double npt=4*n; + int sz=4*n; + double PI=M_PI; + double pas=PI/npt; + double om[sz+1]; + int i; + for(i=0;i<=sz;i++) + { + om[i]=i*pas; + } + double eps=pow(-1,(n-1)); + double s1[sz+1],s2[sz+1]; + double s[2*(sz)+1]; + double sr[2*(sz)+1]; + if(flg==1) + { + int j,k; + for(j=0;j<=4*n;j++) + { + s1[j]=sin(n*om[j]); + s2[j]=sin(om[j]); + } + s1[0]=n; + s2[0]=1; + s1[sz]=n*eps; + s2[sz]=1; + + for(k=0;k<=4*n;k++) + { + s[k]=s1[k]/s2[k]; + } + + int x; + for(x=0;x<=4*n;x++) + { + oup[sz-x]=s[x]; + } + int l; + for(l=4*n+1;l<=8*n;l++) + { + oup[l]=s[l-(sz)]; + } + int m; + for(m=0;m<=8*n;m++) + { + oup[m]=oup[m]/n; + } + } + else + { + int a; + for(a=0;a<=4*n;a++) + { + om[a]=om[a]-(PI/(2*n)); + } + int j,k; + for(j=0;j<=4*n;j++) + { + s1[j]=sin(n*om[j]); + s2[j]=sin(om[j]); + } + s1[2]=n; + s2[2]=1; + for(k=0;k<=4*n;k++) + { + s[k]=s1[k]/s2[k]; + } + int m; + for(m=0;m<=4*n;m++) + { + oup[m]=(eps*s[m])/n; + } + int l; + for(l=4*n+1;l<=8*n;l++) + { + oup[l]=s[l-(sz)]/n; + } + + } +} + diff --git a/2.3-1/src/c/signalProcessing/sincd/int_sincd.h b/2.3-1/src/c/signalProcessing/sincd/int_sincd.h new file mode 100644 index 00000000..a404978b --- /dev/null +++ b/2.3-1/src/c/signalProcessing/sincd/int_sincd.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - 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_SINCD_H__ +#define __INT_SINCD_H__ + +#define u80sincdd2(n,flg,oup) u8sincds(n,flg,oup) + +#endif /* !__INT_SINCD_H__! */ diff --git a/2.3-1/src/c/signalProcessing/sincd/sincd.h b/2.3-1/src/c/signalProcessing/sincd/sincd.h new file mode 100644 index 00000000..2df85a87 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/sincd/sincd.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2016 - 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 __SINCD_H__ +#define __SINCD_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void u8sincds(int n,int flg,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __SINCD_H__ */ + diff --git a/2.3-1/src/c/signalProcessing/sincd/u8sincds.c b/2.3-1/src/c/signalProcessing/sincd/u8sincds.c new file mode 100644 index 00000000..d03f48ae --- /dev/null +++ b/2.3-1/src/c/signalProcessing/sincd/u8sincds.c @@ -0,0 +1,98 @@ +/* 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 "sincd.h" +#define PI 3.14159265358979 +void u8sincds(int n,int flg,double* oup) +{ + double npt=4*n; + int sz=4*n; + double pas=PI/npt; + double om[sz+1]; + int i; + //om[0]=0; + for(i=0;i<=sz;i++) + { + om[i]=i*pas; + } + double eps=pow(-1,(n-1)); + double s1[sz+1],s2[sz+1]; + double s[2*(sz)+1]; + double sr[2*(sz)+1]; + if(flg==1) + { + int j,k; + for(j=0;j<=4*n;j++) + { + s1[j]=sin(n*om[j]); + s2[j]=sin(om[j]); + } + s1[0]=n; + s2[0]=1; + s1[sz]=n*eps; + s2[sz]=1; + + for(k=0;k<=4*n;k++) + { + s[k]=s1[k]/s2[k]; + } + + int x; + for(x=0;x<=4*n;x++) + { + oup[sz-x]=s[x]; + } + int l; + for(l=4*n+1;l<=8*n;l++) + { + oup[l]=s[l-(sz)]; + } + int m; + for(m=0;m<=8*n;m++) + { + oup[m]=oup[m]/n; + } + } + else + { + int a; + for(a=0;a<=4*n;a++) + { + om[a]=om[a]-(PI/(2*n)); + } + int j,k; + for(j=0;j<=4*n;j++) + { + s1[j]=sin(n*om[j]); + s2[j]=sin(om[j]); + } + s1[2]=n; + s2[2]=1; + for(k=0;k<=4*n;k++) + { + s[k]=s1[k]/s2[k]; + } + int m; + for(m=0;m<=4*n;m++) + { + oup[m]=(eps*s[m])/n; + } + int l; + for(l=4*n+1;l<=8*n;l++) + { + oup[l]=s[l-(sz)]/n; + } + + } +} diff --git a/2.3-1/src/c/signalProcessing/zpbutt/dzpbutts.c b/2.3-1/src/c/signalProcessing/zpbutt/dzpbutts.c new file mode 100644 index 00000000..33f22af9 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/zpbutt/dzpbutts.c @@ -0,0 +1,33 @@ +/* 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 "zpbutt.h" +#define PI 3.14159265 +double dzpbutts(double n,double fl,doubleComplex* out) +{ + double e= PI/(2.0*(n)); + int k; + double rl,cpx,gain; + for(k=1;k<=n;k++) + { + double v=2.0*(double)k+(n)-1.0; + rl=(fl)*cos(e*v); + cpx=(fl)*sin(e*v); + out[k-1]=DoubleComplex(rl,cpx); + } + gain=pow(fl,n); + +return gain; + +} + diff --git a/2.3-1/src/c/signalProcessing/zpbutt/int_zpbutt.h b/2.3-1/src/c/signalProcessing/zpbutt/int_zpbutt.h new file mode 100644 index 00000000..72eae8a2 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/zpbutt/int_zpbutt.h @@ -0,0 +1,19 @@ +/* Copyright (C) 2016 - 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_ZPBUTT_H__ +#define __INT_ZPBUTT_H__ + +#define d0d0zpbuttzada(n,fl,out,gain) dzpbutts(n,fl,out,gain) + +#endif /* !INT_ZPBUTT_H__ */ + diff --git a/2.3-1/src/c/signalProcessing/zpbutt/zpbutt.h b/2.3-1/src/c/signalProcessing/zpbutt/zpbutt.h new file mode 100644 index 00000000..6883942c --- /dev/null +++ b/2.3-1/src/c/signalProcessing/zpbutt/zpbutt.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2016 - 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 __ZPBUTT_H__ +#define __ZPBUTT_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dzpbutts(double* n,double* fl,doublecomplex* out,double* gain); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + diff --git a/2.3-1/src/c/signalProcessing/zpch1/dzpch1s.c b/2.3-1/src/c/signalProcessing/zpch1/dzpch1s.c new file mode 100644 index 00000000..ab7b6332 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/zpch1/dzpch1s.c @@ -0,0 +1,53 @@ +/* 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 "zpch1.h" +#include "multiplication.h" +#include "conj.h" +#include "abs.h" +#define PI 3.14159265 +double dzpch1s(double N,double e,double wc,doubleComplex* out) +{ + doubleComplex accumulate,tp; + double B,r,R,gain,realVal; + double temp=sqrt(1+e*e); + + B=pow((temp+1)/e,1/N); + + r=wc*((B*B-1)/(2*B)); + R=wc*((B*B+1)/(2*B)); + + int k; + double t1=1; + double t2=0; + accumulate=DoubleComplex(t1,t2); + for(k=0;k<N;k++) + { + double theta; + theta=(PI/2)+((2*k+1)*PI)/(2*N); + double xk,yk; + xk=r*cos(theta); + yk=R*sin(theta); + out[k]=DoubleComplex(xk,yk); + tp=DoubleComplex(xk,yk); + accumulate=zmuls(accumulate,tp); + } + + realVal=zreals(accumulate); + gain=dabss(realVal); + if (N==2*(int)(N/2)) + gain=gain/sqrt(1+e*e); +return gain; + +} + diff --git a/2.3-1/src/c/signalProcessing/zpch1/int_zpch1.h b/2.3-1/src/c/signalProcessing/zpch1/int_zpch1.h new file mode 100644 index 00000000..8933d1a2 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/zpch1/int_zpch1.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - 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_ZPCH1_H__ +#define __INT_ZPCH1_H__ + +#define d0d0d0zpch1z2d0(N,e,wc) dzpch1s(N,e,wc) + +#endif /* !INT_ZPCH1_H__! */ diff --git a/2.3-1/src/c/signalProcessing/zpch1/zpch1.h b/2.3-1/src/c/signalProcessing/zpch1/zpch1.h new file mode 100644 index 00000000..fbe850cc --- /dev/null +++ b/2.3-1/src/c/signalProcessing/zpch1/zpch1.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2016 - 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 __ZPCH1_H__ +#define __ZPCH1_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dzpch1s(double N,double e,double wc,doubleComplex* out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __ZPCH1_H__ */ diff --git a/2.3-1/src/c/signalProcessing/zpch2/dzpch2s.c b/2.3-1/src/c/signalProcessing/zpch2/dzpch2s.c new file mode 100644 index 00000000..22a46a64 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/zpch2/dzpch2s.c @@ -0,0 +1,63 @@ +/* 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 "zpch2.h" +#include "multiplication.h" +#include "abs.h" +#include "division.h" +#define PI 3.14159265 +double dzpch2s(double N, double A, double omegar,doubleComplex* zeros,doubleComplex* poles) +{ + int k,j; + double e,xk,realVal,gain; + doubleComplex accumulate1,accumulate2,tp1,tp2; + accumulate1=DoubleComplex(1,0); + accumulate2=DoubleComplex(1,0); + int ct=0; + for(k=1;k<=N;k++) + { + if(k!=((N+1)/2)) + { + ct++; + double num=PI*(2*k-1); + double den=2*N; + xk=cos(num/den); + double sk=omegar/xk; + zeros[k-1]=DoubleComplex(0,sk); + tp1=DoubleComplex(0,sk); + accumulate1=zmuls(accumulate1,tp1); + } + } + for(j=1;j<=N;j++) + { + double num=PI*(2*j-1); + double den=2*N; + double xk1=num/den; + double Gamma=pow((A+sqrt(A*A-1)),(1/N)); + double alpha=-((Gamma-1/Gamma)/2)*sin(xk1); + double Beta=((Gamma+1/Gamma)/2)*cos(xk1); + double normal=alpha*alpha+Beta*Beta; + poles[j-1]=DoubleComplex((omegar*alpha)/normal,(omegar*Beta)/normal); + tp2=DoubleComplex((omegar*alpha)/normal,(omegar*Beta)/normal); + accumulate2=zmuls(accumulate2,tp2); + } + double qt; + double ra2=zreals(accumulate2); + double ra1=zreals(accumulate1); + qt=dldivs(ra1,ra2); + gain=dabss(qt); + + return gain; + +} + diff --git a/2.3-1/src/c/signalProcessing/zpch2/int_zpch2.h b/2.3-1/src/c/signalProcessing/zpch2/int_zpch2.h new file mode 100644 index 00000000..683a7614 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/zpch2/int_zpch2.h @@ -0,0 +1,18 @@ +/* Copyright (C) 2016 - 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_ZPCH2_H__ +#define __INT_ZPCH2_H__ + +#define d0d0d0zpch2z2z2(N,A,omegar,zeros,poles) dzpch2s(N,A,omegar,zeros,poles) + +#endif /* !INT_ZPCH2_H__! */ diff --git a/2.3-1/src/c/signalProcessing/zpch2/zpch2.h b/2.3-1/src/c/signalProcessing/zpch2/zpch2.h new file mode 100644 index 00000000..0d191d5c --- /dev/null +++ b/2.3-1/src/c/signalProcessing/zpch2/zpch2.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2016 - 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 __ZPCH2_H__ +#define __ZPCH2_H__ +#include "types.h" +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dzpch2s(double N, double A, double omegar,doubleComplex* zeros,doubleComplex* poles); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __ZPCH2_H__ */ diff --git a/2.3-1/src/c/string/ascii/ascii.h b/2.3-1/src/c/string/ascii/ascii.h new file mode 100644 index 00000000..2d46b740 --- /dev/null +++ b/2.3-1/src/c/string/ascii/ascii.h @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - 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 __ASCII_H__ +#define __ASCII_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void gasciia(char* str,int size, int* out); + +#ifdef __cplusplus +}/* extern "C" */ +#endif + +#endif /*___ASCII_H__*/ diff --git a/2.3-1/src/c/string/ascii/dasciia.c b/2.3-1/src/c/string/ascii/dasciia.c new file mode 100644 index 00000000..d2452880 --- /dev/null +++ b/2.3-1/src/c/string/ascii/dasciia.c @@ -0,0 +1,21 @@ +/* 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 "ascii.h" +void dasciia(double* inp,int size,char* oup) +{ + int i; + for(i=0;i<size;i++) + { + oup[i]=(char)inp[i]; + } +} diff --git a/2.3-1/src/c/string/ascii/gasciia.c b/2.3-1/src/c/string/ascii/gasciia.c new file mode 100644 index 00000000..2cd80bfb --- /dev/null +++ b/2.3-1/src/c/string/ascii/gasciia.c @@ -0,0 +1,26 @@ +/* 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> +/* This is the "asciiconv" function which converts the given string + into its ascii equivalent. +*/ +#include "ascii.h" +void gasciia(char *str,int size,int* oup) +{ + + for(int i=0;i<size;i++) + { + *(oup+i)=(int)str[i]; + } + +} + diff --git a/2.3-1/src/c/string/ascii/int_ascii.h b/2.3-1/src/c/string/ascii/int_ascii.h new file mode 100644 index 00000000..36d83f8e --- /dev/null +++ b/2.3-1/src/c/string/ascii/int_ascii.h @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - 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_ASCII_H__ +#define __INT_ASCII_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define g2asciiu82(str,size,oup) gasciia(str,size,oup) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_ASCII_H__*/ diff --git a/2.3-1/src/c/string/includes/ascii.h b/2.3-1/src/c/string/includes/ascii.h new file mode 100644 index 00000000..fcf969da --- /dev/null +++ b/2.3-1/src/c/string/includes/ascii.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2016 - 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 __ASCII_H__ +#define __ASCII_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void gasciia(char* str,int size,int* oup); +void dasciia(double* inp,int size,char* oup); + +#ifdef __cplusplus +}/* extern "C" */ +#endif + +#endif /*___ASCII_H__*/ diff --git a/2.3-1/src/c/string/includes/strchr.h b/2.3-1/src/c/string/includes/strchr.h new file mode 100644 index 00000000..7e306413 --- /dev/null +++ b/2.3-1/src/c/string/includes/strchr.h @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - 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 __STRCHR_H__ +#define __STRCHR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void gstrchra(char* str,int size, char* key,int size2, char* out); + +#ifdef __cplusplus +}/* extern "C" */ +#endif + +#endif /*__STRCHR_H__*/ diff --git a/2.3-1/src/c/string/includes/strcspn.h b/2.3-1/src/c/string/includes/strcspn.h new file mode 100644 index 00000000..aa91fb47 --- /dev/null +++ b/2.3-1/src/c/string/includes/strcspn.h @@ -0,0 +1,26 @@ +/* Copyright (C) 2016 - 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 __STRCSPN_H__ +#define __STRCSPN_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint8 gstrcspna(char* str1,int size1,char* str2,int size2); + +#ifdef __cplusplus +}/* extern "C" */ +#endif + +#endif /* __STRCSPN_H */ diff --git a/2.3-1/src/c/string/includes/strncpy.h b/2.3-1/src/c/string/includes/strncpy.h new file mode 100644 index 00000000..f2aa705b --- /dev/null +++ b/2.3-1/src/c/string/includes/strncpy.h @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - 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 __STRNCPY_H__ +#define __STRNCPY_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void gstrncpya(char* str,int size,double key,char* oup); + +#ifdef __cplusplus +}/* extern "C" */ +#endif + +#endif /*__STRNCPY_H__*/ diff --git a/2.3-1/src/c/string/includes/strspn.h b/2.3-1/src/c/string/includes/strspn.h new file mode 100644 index 00000000..427caa4c --- /dev/null +++ b/2.3-1/src/c/string/includes/strspn.h @@ -0,0 +1,26 @@ +/* Copyright (C) 2016 - 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 __STRSPN_H__ +#define __STRSPN_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint8 gstrspna(char* str1,int size1,char* str2,int size2); + +#ifdef __cplusplus +}/* extern "C" */ +#endif + +#endif /* __STRSPN_H */ diff --git a/2.3-1/src/c/string/interfaces/int_ascii.h b/2.3-1/src/c/string/interfaces/int_ascii.h new file mode 100644 index 00000000..87b1b125 --- /dev/null +++ b/2.3-1/src/c/string/interfaces/int_ascii.h @@ -0,0 +1,26 @@ +/* Copyright (C) 2016 - 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_ASCII_H__ +#define __INT_ASCII_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define g2asciiu82(str,size,oup) gasciia(str,size[1],oup) +#define d2asciig2(inp,size,oup) dasciia(inp,size[1],oup) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_ASCII_H__*/ diff --git a/2.3-1/src/c/string/interfaces/int_strchr.h b/2.3-1/src/c/string/interfaces/int_strchr.h new file mode 100644 index 00000000..8747545b --- /dev/null +++ b/2.3-1/src/c/string/interfaces/int_strchr.h @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - 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_STRCHR_H__ +#define __INT_STRCHR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define g2g2strchrg2(str,size,key,size2,out) gstrchra(str,size[1],key,size2[1],out) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_STRCHR_H__*/ diff --git a/2.3-1/src/c/string/interfaces/int_strcspn.h b/2.3-1/src/c/string/interfaces/int_strcspn.h new file mode 100644 index 00000000..74c6379f --- /dev/null +++ b/2.3-1/src/c/string/interfaces/int_strcspn.h @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - 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_STRCSPN_H__ +#define __INT_STRCSPN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define g2g2strcspnu80(str1,size1,str2,size2) gstrcspna(str1,size1[1],str2,size2[1]) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_STRCSPN_H__*/ diff --git a/2.3-1/src/c/string/interfaces/int_strncpy.h b/2.3-1/src/c/string/interfaces/int_strncpy.h new file mode 100644 index 00000000..e7ffdb42 --- /dev/null +++ b/2.3-1/src/c/string/interfaces/int_strncpy.h @@ -0,0 +1,26 @@ +/* Copyright (C) 2016 - 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_STRNCPY_H__ +#define __INT_STRNCPY_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define g2d0strncpyg2(str,size,key,oup) gstrncpya(str,size[1],key,oup) + +#ifdef __cplusplus +} /* extern "C"*/ +#endif + +#endif /*__INT_STRNCPY_H__*/ + diff --git a/2.3-1/src/c/string/interfaces/int_strspn.h b/2.3-1/src/c/string/interfaces/int_strspn.h new file mode 100644 index 00000000..e4b06f72 --- /dev/null +++ b/2.3-1/src/c/string/interfaces/int_strspn.h @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - 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_STRSPN_H__ +#define __INT_STRSPN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define g2g2strspnu80(str1,size1,str2,size2) gstrspna(str1,size1[1],str2,size2[1]) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_STRSPN_H__*/ diff --git a/2.3-1/src/c/string/strchr/gstrchra.c b/2.3-1/src/c/string/strchr/gstrchra.c new file mode 100644 index 00000000..f2f54359 --- /dev/null +++ b/2.3-1/src/c/string/strchr/gstrchra.c @@ -0,0 +1,33 @@ +/* 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 + Organization: FOSSEE, IIT Bombay + Author: Ankit Raj + Email: toolbox@scilab.in +*/ +#include <stdio.h> +#include <string.h> +#include "strchr.h" + +void gstrchra(char* str,int size,char* key,int size2,char* out) +{ + int ind,i=0,j,k; + for(j=0;j<size;j++) + { + if(str[j]==key[0]) + { + ind=j; + break; + } + } + for(k=ind;k<size;k++) + { + out[i]=str[k]; + i++; + } +} + diff --git a/2.3-1/src/c/string/strchr/int_strchr.h b/2.3-1/src/c/string/strchr/int_strchr.h new file mode 100644 index 00000000..8747545b --- /dev/null +++ b/2.3-1/src/c/string/strchr/int_strchr.h @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - 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_STRCHR_H__ +#define __INT_STRCHR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define g2g2strchrg2(str,size,key,size2,out) gstrchra(str,size[1],key,size2[1],out) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_STRCHR_H__*/ diff --git a/2.3-1/src/c/string/strchr/strchr.h b/2.3-1/src/c/string/strchr/strchr.h new file mode 100644 index 00000000..7e306413 --- /dev/null +++ b/2.3-1/src/c/string/strchr/strchr.h @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - 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 __STRCHR_H__ +#define __STRCHR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void gstrchra(char* str,int size, char* key,int size2, char* out); + +#ifdef __cplusplus +}/* extern "C" */ +#endif + +#endif /*__STRCHR_H__*/ diff --git a/2.3-1/src/c/string/strcspn/gstrcspna.c b/2.3-1/src/c/string/strcspn/gstrcspna.c new file mode 100644 index 00000000..0d8de11b --- /dev/null +++ b/2.3-1/src/c/string/strcspn/gstrcspna.c @@ -0,0 +1,49 @@ +/* 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 + Organization: FOSSEE, IIT Bombay + Author: Ankit Raj + Email: toolbox@scilab.in +*/ +#include<stdio.h> +#include<string.h> +#include "strcspn.h" +uint8 gstrcspna(char *str1,int size1,char *str2,int size2) +{ + int ind; + for(int i=0;i<=size1;i++) + { + for(int j=0;j<=size2;j++) + { + if(str2[j]==str1[i]) + { + ind=j; + break; + } + } + } + return (ind+1); +} +/*int main() +{ + int n1,n2; + char inp1[100000],inp2[100000]; + printf("Enter the length of the first string"); + scanf("%d",&n1); + for(int i=0;i<=(n1+1);i++) + { + scanf("%c",&inp1[i]); + } + printf("Enter the length of the second string"); + scanf("%d",&n2 ); + for(int j=0;j<=(n2+1);j++) + { + scanf("%c",&inp2[j]); + } + strcspnfn(inp1,n1+1,inp2,n2+1); +} +*/ diff --git a/2.3-1/src/c/string/strcspn/int_strcspn b/2.3-1/src/c/string/strcspn/int_strcspn new file mode 100644 index 00000000..f2da3e45 --- /dev/null +++ b/2.3-1/src/c/string/strcspn/int_strcspn @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - 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_STRCSPN_H__ +#define __INT_STRCSPN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define g2g2strcspnu80(str1,size1,str2,size2) gstrcspna(str1,size1,str2,size2) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_STRCSPN_H__*/ diff --git a/2.3-1/src/c/string/strcspn/strcspn.h b/2.3-1/src/c/string/strcspn/strcspn.h new file mode 100644 index 00000000..6170afa2 --- /dev/null +++ b/2.3-1/src/c/string/strcspn/strcspn.h @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - 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 __STRCSPN_H__ +#define __STRCSPN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +uint8 gstrcspna(char* str1,int size1,char* str2,int size2); + +#ifdef __cplusplus +}/* extern "C" */ +#endif + +#endif /* __STRCSPN_H */ diff --git a/2.3-1/src/c/string/strncpy/gstrncpya.c b/2.3-1/src/c/string/strncpy/gstrncpya.c new file mode 100644 index 00000000..92801985 --- /dev/null +++ b/2.3-1/src/c/string/strncpy/gstrncpya.c @@ -0,0 +1,25 @@ +/* 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 + Organization: FOSSEE, IIT Bombay + Author: Ankit Raj + Email: toolbox@scilab.in +*/ +#include<stdio.h> +#include "strncpy.h" +void gstrncpya(char *str,int size,double key,char *oup) +{ + int j; + char c; + for(j=0;j<key;j++) + { + c=str[j]; + oup[j]=c; + } +} + + diff --git a/2.3-1/src/c/string/strncpy/int_strncpy.h b/2.3-1/src/c/string/strncpy/int_strncpy.h new file mode 100644 index 00000000..fcf245e3 --- /dev/null +++ b/2.3-1/src/c/string/strncpy/int_strncpy.h @@ -0,0 +1,26 @@ +/* Copyright (C) 2016 - 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_STRNCPY_H__ +#define __INT_STRNCPY_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define g2strncpyg2(str,key,oup) gstrncpya(str,key,oup) + +#ifdef __cplusplus +} /* extern "C"*/ +#endif + +#endif /*__INT_STRNCPY_H__*/ + diff --git a/2.3-1/src/c/string/strncpy/strncpy.h b/2.3-1/src/c/string/strncpy/strncpy.h new file mode 100644 index 00000000..38855504 --- /dev/null +++ b/2.3-1/src/c/string/strncpy/strncpy.h @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - 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 __STRNCPY_H__ +#define __STRNCPY_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void gstrncpya(char* str,int key,char* oup); + +#ifdef __cplusplus +}/* extern "C" */ +#endif + +#endif /*__STRNCPY_H__*/ diff --git a/2.3-1/src/c/string/strspn/gstrspna.c b/2.3-1/src/c/string/strspn/gstrspna.c new file mode 100644 index 00000000..94a5181e --- /dev/null +++ b/2.3-1/src/c/string/strspn/gstrspna.c @@ -0,0 +1,64 @@ +/* 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 + Organization: FOSSEE, IIT Bombay + Author: Ankit Raj + Email: toolbox@scilab.in +*/ +#include<stdio.h> +#include "strspn.h" + +int max(int a,int b){ + if(a>b) return a; + return b; +} +uint8 gstrspna(char *str1,int size1,char *str2,int size2) +{ + int i,j,ct=0,k=0,m=0; + for(i=0;i<size2;i++) + { + if(str1[0]==str2[i]) + { + k=i; + ct=0; + j=0; + while(str1[j]==str2[k]) + { + ct++; + j++; + k++; + if(j >= size1) break; + } + if(j==size1) + { + ct=ct-1; + } + m = max(m,ct); + } + } +return m; +} +/* +int main() +{ + int n1,n2; + char inp1[100000],inp2[100000]; + printf("Enter the length of the first string"); + scanf("%d",&n1); + for(int i=0;i<=(n1+1);i++) + { + scanf("%c",&inp1[i]); + } + printf("Enter the length of the second string"); + scanf("%d",&n2 ); + for(int j=0;j<=(n2+1);j++) + { + scanf("%c",&inp2[j]); + } + strcspnfn(inp1,n1+1,inp2,n2+1); +} +*/ diff --git a/2.3-1/src/c/string/strspn/int_strspn.h b/2.3-1/src/c/string/strspn/int_strspn.h new file mode 100644 index 00000000..506b311d --- /dev/null +++ b/2.3-1/src/c/string/strspn/int_strspn.h @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - 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_STRSPN_H__ +#define __INT_STRSPN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define g2g2strspnu80(str1,size1,str2,size2) gstrspna(str1,size1,str2,size2) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __INT_STRSPN_H__*/ diff --git a/2.3-1/src/c/string/strspn/strspn.h b/2.3-1/src/c/string/strspn/strspn.h new file mode 100644 index 00000000..f7c2a3cb --- /dev/null +++ b/2.3-1/src/c/string/strspn/strspn.h @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - 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 __STRSPN_H__ +#define __STRSPN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +uint8 gstrspna(char* str1,int size1,char* str2,int size2); + +#ifdef __cplusplus +}/* extern "C" */ +#endif + +#endif /* __STRSPN_H */ |