diff options
Diffstat (limited to 'src/c/elementaryFunctions')
36 files changed, 975 insertions, 17 deletions
diff --git a/src/c/elementaryFunctions/includes/ismatrix.h b/src/c/elementaryFunctions/includes/ismatrix.h index 072bfdc..0dd8b4a 100644 --- a/src/c/elementaryFunctions/includes/ismatrix.h +++ b/src/c/elementaryFunctions/includes/ismatrix.h @@ -17,6 +17,7 @@ #include "types.h" #include "doubleComplex.h" #include "floatComplex.h" +#include "uint16.h" #ifdef __cplusplus extern "C" { @@ -30,6 +31,8 @@ char gismatrixa(char*); char gismatrixs(char); char zismatrixa(doubleComplex*); char zismatrixs(doubleComplex); +char u16ismatrixa(uint16*); +char u16ismatrixs(uint16); #ifdef __cplusplus } /* extern "C" */ diff --git a/src/c/elementaryFunctions/includes/isvector.h b/src/c/elementaryFunctions/includes/isvector.h index 5f45abb..75599cd 100644 --- a/src/c/elementaryFunctions/includes/isvector.h +++ b/src/c/elementaryFunctions/includes/isvector.h @@ -22,13 +22,13 @@ extern "C" { #endif -char disvectora(double* , int); +char disvectora(double* , int, int); char disvectors(double); -char sisvectora( float* , int); +char sisvectora( float* , int, int); char sisvectors( float); -char gisvectora(char* , int); +char gisvectora(char* , int, int ); char gisvectors(char); -char zisvectora(doubleComplex*, int); +char zisvectora(doubleComplex*, int, int); char zisvectors(doubleComplex); #ifdef __cplusplus diff --git a/src/c/elementaryFunctions/includes/nanmax.h b/src/c/elementaryFunctions/includes/nanmax.h new file mode 100644 index 0000000..bea83f7 --- /dev/null +++ b/src/c/elementaryFunctions/includes/nanmax.h @@ -0,0 +1,40 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __NANMAX_H__ +#define __NANMAX_H__ + + +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "int16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double dnanmaxa (double* , int); +void dnanmaxrowa (double*, int , int, double*); +void dnanmaxcola (double*, int , int, double*); + +float snanmaxa (float* , int); +void snanmaxrowa (float*, int , int, float*); +void snanmaxcola (float*, int , int, float*); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/c/elementaryFunctions/includes/pmodulo.h b/src/c/elementaryFunctions/includes/pmodulo.h new file mode 100644 index 0000000..d46febc --- /dev/null +++ b/src/c/elementaryFunctions/includes/pmodulo.h @@ -0,0 +1,40 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#ifndef __PMODULO_H__ +#define __PMODULO_H__ + + +#include "types.h" +#include "doubleComplex.h" +#include "floatComplex.h" +#include "int16.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dpmoduloa(double*, int ,double*, double*); +double dpmodulos(double, double); + +void spmoduloa(float*, int ,float*, float*); +float spmodulos(float, float); + +void i16pmoduloa(int16*, int ,int16*, int16*); +int16 i16pmodulos(int16, int16); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_ismatrix.h b/src/c/elementaryFunctions/interfaces/int_ismatrix.h index 56dfc85..96352d1 100644 --- a/src/c/elementaryFunctions/interfaces/int_ismatrix.h +++ b/src/c/elementaryFunctions/interfaces/int_ismatrix.h @@ -21,6 +21,8 @@ #define g0ismatrixg0(in) gismatrixs(in) #define z2ismatrixg0(in, size) zismatrixa(in) #define z0ismatrixg0(in) zismatrixs(in) +#define u162ismatrixg0(in, size) u16ismatrixa(in) +#define u160ismatrixg0(in) u16ismatrixs(in) #endif diff --git a/src/c/elementaryFunctions/interfaces/int_isvector.h b/src/c/elementaryFunctions/interfaces/int_isvector.h index 6d943bd..a4edaea 100644 --- a/src/c/elementaryFunctions/interfaces/int_isvector.h +++ b/src/c/elementaryFunctions/interfaces/int_isvector.h @@ -13,13 +13,13 @@ #ifndef __INT_ISVECTOR_H__ #define __INT_ISVECTOR_H__ -#define d2isvectorg0(in, size ) disvectora(in, size[0]) +#define d2isvectorg0(in, size ) disvectora(in, size[0], size[1]) #define d0isvectorg0(in) disvectors(in) -#define s2isvectorg0(in , size) sisvectora(in, size[0]) +#define s2isvectorg0(in , size) sisvectora(in, size[0], size[1]) #define s0isvectorg0(in) sisvectors(in) -#define g2isvectorg0(in, size) gisvectora(in, size[0]) +#define g2isvectorg0(in, size) gisvectora(in, size[0], size[1]) #define g0isvectorg0(in) gisvectors(in) -#define z2isvectorg0(in, size) zisvectora(in , size[0]) +#define z2isvectorg0(in, size) zisvectora(in , size[0], size[1]) #define z0isvectorg0(in) zisvectors(in) diff --git a/src/c/elementaryFunctions/interfaces/int_nanmax.h b/src/c/elementaryFunctions/interfaces/int_nanmax.h new file mode 100644 index 0000000..dd3df71 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_nanmax.h @@ -0,0 +1,27 @@ + /*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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#ifndef __INT_NANMAX_H__ +#define __INT_NANMAX_H__ + +#define d2nanmaxd0(in1, size) dnanmaxa(in1,size[0]* size[1]) +#define d2g2nanmaxd2(in1, size1, in2, size2, out) (in2[0]=='r') ? dnanmaxrowa(in1, size1[0], size1[1], out) : dnanmaxcola(in1, size1[0] , size1[1], out) + +#define s2nanmaxs0(in1, size) snanmaxa(in1,size[0]* size[1]) +#define s2g2nanmaxs2(in1, size1, in2, size2, out) (in2[0]=='r') ? snanmaxrowa(in1, size1[0], size1[1], out) : snanmaxcola(in1, size1[0] , size1[1], out) + + +//#define i160i160pmoduloi160(in1, in2) i16pmodulos(in1,in2) +//#define i162i162pmoduloi162(in1, size1, in2, size2, out) i16pmoduloa(in1,size1[0]*size1[1],in2, out) + + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_pmodulo.h b/src/c/elementaryFunctions/interfaces/int_pmodulo.h new file mode 100644 index 0000000..72b1277 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_pmodulo.h @@ -0,0 +1,26 @@ + /*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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + + +#ifndef __INT_PMODULO_H__ +#define __INT_PMODULO_H__ + +#define d0d0pmodulod0(in1, in2) dpmodulos(in1,in2) +#define d2d2pmodulod2(in1, size1, in2, size2, out) dpmoduloa(in1,size1[0]*size1[1],in2, out) + +#define s0s0pmodulos0(in1, in2) spmodulos(in1,in2) +#define s2s2pmodulos2(in1, size1, in2, size2, out) spmoduloa(in1,size1[0]*size1[1],in2, out) + +#define i160i160pmoduloi160(in1, in2) i16pmodulos(in1,in2) +#define i162i162pmoduloi162(in1, size1, in2, size2, out) i16pmoduloa(in1,size1[0]*size1[1],in2, out) + + +#endif diff --git a/src/c/elementaryFunctions/ismatrix/dismatrixs.c b/src/c/elementaryFunctions/ismatrix/dismatrixs.c index f1c99dc..15edcf2 100644 --- a/src/c/elementaryFunctions/ismatrix/dismatrixs.c +++ b/src/c/elementaryFunctions/ismatrix/dismatrixs.c @@ -17,6 +17,6 @@ #include "types.h" char dismatrixs(double in) { - char out= 'F' ; + char out= 'T' ; return out; } diff --git a/src/c/elementaryFunctions/ismatrix/gismatrixa.c b/src/c/elementaryFunctions/ismatrix/gismatrixa.c new file mode 100644 index 0000000..f728814 --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/gismatrixa.c @@ -0,0 +1,22 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +char gismatrixa(char* in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/gismatrixs.c b/src/c/elementaryFunctions/ismatrix/gismatrixs.c new file mode 100644 index 0000000..61a3062 --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/gismatrixs.c @@ -0,0 +1,22 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +char gismatrixs(char in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/sismatrixa.c b/src/c/elementaryFunctions/ismatrix/sismatrixa.c new file mode 100644 index 0000000..44335b8 --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/sismatrixa.c @@ -0,0 +1,22 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +char sismatrixa(float* in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/sismatrixs.c b/src/c/elementaryFunctions/ismatrix/sismatrixs.c new file mode 100644 index 0000000..d6c6f23 --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/sismatrixs.c @@ -0,0 +1,22 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +char sismatrixs(float in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/u16ismatrixa.c b/src/c/elementaryFunctions/ismatrix/u16ismatrixa.c new file mode 100644 index 0000000..c16d54c --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/u16ismatrixa.c @@ -0,0 +1,23 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +#include "uint16.h" +char u16ismatrixa(uint16* in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/u16ismatrixs.c b/src/c/elementaryFunctions/ismatrix/u16ismatrixs.c new file mode 100644 index 0000000..6431357 --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/u16ismatrixs.c @@ -0,0 +1,23 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +#include "uint16.h" +char u16ismatrixs(uint16 in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/zismatrixa.c b/src/c/elementaryFunctions/ismatrix/zismatrixa.c new file mode 100644 index 0000000..32d7260 --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/zismatrixa.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" +char zismatrixa(doubleComplex* in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/ismatrix/zismatrixs.c b/src/c/elementaryFunctions/ismatrix/zismatrixs.c new file mode 100644 index 0000000..d38592c --- /dev/null +++ b/src/c/elementaryFunctions/ismatrix/zismatrixs.c @@ -0,0 +1,24 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "ismatrix.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" +char zismatrixs(doubleComplex in) +{ + char out= 'T' ; + return out; +} diff --git a/src/c/elementaryFunctions/isvector/disvectora.c b/src/c/elementaryFunctions/isvector/disvectora.c index 3c41027..a96485b 100644 --- a/src/c/elementaryFunctions/isvector/disvectora.c +++ b/src/c/elementaryFunctions/isvector/disvectora.c @@ -15,9 +15,9 @@ #include <math.h> #include "isvector.h" #include "types.h" -char disvectora(double* inp, int size1) +char disvectora(double* inp, int row, int col) { - if(size1 ==1) + if(row ==1 || col==1) return 'T'; return 'F'; } diff --git a/src/c/elementaryFunctions/isvector/gisvectora.c b/src/c/elementaryFunctions/isvector/gisvectora.c index d2e261e..758fa87 100644 --- a/src/c/elementaryFunctions/isvector/gisvectora.c +++ b/src/c/elementaryFunctions/isvector/gisvectora.c @@ -16,9 +16,9 @@ #include "isvector.h" #include "types.h" #include "string.h" -char gisvectora(char *inp, int size1) +char gisvectora(char *inp, int row, int col) { - if(size1 ==1) + if(row ==1 || col==1) return 'T'; return 'F'; } diff --git a/src/c/elementaryFunctions/isvector/sisvectora.c b/src/c/elementaryFunctions/isvector/sisvectora.c index 09ad651..d6a4821 100644 --- a/src/c/elementaryFunctions/isvector/sisvectora.c +++ b/src/c/elementaryFunctions/isvector/sisvectora.c @@ -15,9 +15,9 @@ #include <math.h> #include "isvector.h" #include "types.h" -char sisvectora(float* inp, int size1) +char sisvectora(float* inp, int row, int col) { - if(size1 ==1) + if(row ==1 || col==1) return 'T'; return 'F'; } diff --git a/src/c/elementaryFunctions/isvector/zisvectora.c b/src/c/elementaryFunctions/isvector/zisvectora.c index fba7812..0ed64a6 100644 --- a/src/c/elementaryFunctions/isvector/zisvectora.c +++ b/src/c/elementaryFunctions/isvector/zisvectora.c @@ -17,9 +17,9 @@ #include "isvector.h" #include "types.h" -char zisvectora(doubleComplex *inp, int size1) +char zisvectora(doubleComplex *inp, int row, int col) { - if(size1 ==1) + if(row ==1 || col==1) return 'T'; return 'F'; } diff --git a/src/c/elementaryFunctions/nanmax/dnanmaxa.c b/src/c/elementaryFunctions/nanmax/dnanmaxa.c new file mode 100644 index 0000000..4ff4a1a --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/dnanmaxa.c @@ -0,0 +1,53 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmax.h" +#include "types.h" +double dnanmaxa(double* in, int size) +{ +double high; +for(int i=0; i<size; i++) +{ + if( !(isnan(in[i])) ) + { + high= in[i]; + break; + + } +} + + + + for(int i=0; i< size; i++) + { + if( !(isnan(in[i])) ) + { + if( in[i] > high) + { + high= in[i]; + + } + + + } + + + } + + + +return high; + +} diff --git a/src/c/elementaryFunctions/nanmax/dnanmaxcola.c b/src/c/elementaryFunctions/nanmax/dnanmaxcola.c new file mode 100644 index 0000000..9db0742 --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/dnanmaxcola.c @@ -0,0 +1,35 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmax.h" +#include "types.h" +#include "uint16.h" + +void dnanmaxcola(double *in, int row, int col, double* out) +{ + double inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= dnanmaxa( inter, col); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmax/dnanmaxrowa.c b/src/c/elementaryFunctions/nanmax/dnanmaxrowa.c new file mode 100644 index 0000000..191fa01 --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/dnanmaxrowa.c @@ -0,0 +1,36 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmax.h" +#include "types.h" +#include "uint16.h" + +void dnanmaxrowa(double *in, int row, int col, double* out) +{ + double inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= dnanmaxa( inter, row); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmax/snanmaxa.c b/src/c/elementaryFunctions/nanmax/snanmaxa.c new file mode 100644 index 0000000..1eab1ac --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/snanmaxa.c @@ -0,0 +1,53 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmax.h" +#include "types.h" +float snanmaxa(float* in, int size) +{ +float high; +for(int i=0; i<size; i++) +{ + if( !(isnan(in[i])) ) + { + high= in[i]; + break; + + } +} + + + + for(int i=0; i< size; i++) + { + if( !(isnan(in[i])) ) + { + if( in[i] > high) + { + high= in[i]; + + } + + + } + + + } + + + +return high; + +} diff --git a/src/c/elementaryFunctions/nanmax/snanmaxcola.c b/src/c/elementaryFunctions/nanmax/snanmaxcola.c new file mode 100644 index 0000000..b408052 --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/snanmaxcola.c @@ -0,0 +1,35 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmax.h" +#include "types.h" +#include "uint16.h" + +void snanmaxcola(float *in, int row, int col, float* out) +{ + float inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= snanmaxa( inter, col); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmax/snanmaxrowa.c b/src/c/elementaryFunctions/nanmax/snanmaxrowa.c new file mode 100644 index 0000000..ab1ce0c --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/snanmaxrowa.c @@ -0,0 +1,36 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmax.h" +#include "types.h" +#include "uint16.h" + +void snanmaxrowa(float *in, int row, int col, float* out) +{ + float inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= snanmaxa( inter, row); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmax/znanmaxa.c b/src/c/elementaryFunctions/nanmax/znanmaxa.c new file mode 100644 index 0000000..6283bf1 --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/znanmaxa.c @@ -0,0 +1,57 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "nanmax.h" +#include "types.h" +#include "doubleComplex.h" +#include "abs.h" + +doubleComplex znanmaxa(doubleComplex* in, int size) +{ +doubleComplex high=0; int k=0; +for(int i=0; i<size; i++) +{ + if( !(isnan(in[i])) ) + { + high= in[i]; + break; + k= 1; + } +} + + + + for(int i=0; i< size; i++) + { + if( !(isnan(in[i])) ) + { + if( zabss(in[i]) > zabss(high)) + { + high= in[i]; + + } + + + } + + + } + + +if(k != 0) +return high; +else +return - 0.0/0.0; +} diff --git a/src/c/elementaryFunctions/nanmax/znanmaxcola.c b/src/c/elementaryFunctions/nanmax/znanmaxcola.c new file mode 100644 index 0000000..ffb96b2 --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/znanmaxcola.c @@ -0,0 +1,36 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmax.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" + +void znanmaxcola(doubleComplex *in, int row, int col, doubleComplex* out) +{ + doubleComplex inter[col]; + + +for(int i=0; i< row; i++) + { + for(int j=0 ; j< col; j++) + { + inter[j]= in[i+ (j*row)]; + + } + out[i]= znanmaxa( inter, col); + + } + + +} diff --git a/src/c/elementaryFunctions/nanmax/znanmaxrowa.c b/src/c/elementaryFunctions/nanmax/znanmaxrowa.c new file mode 100644 index 0000000..e035e77 --- /dev/null +++ b/src/c/elementaryFunctions/nanmax/znanmaxrowa.c @@ -0,0 +1,37 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + + +#include "nanmax.h" +#include "types.h" +#include "uint16.h" +#include "doubleComplex.h" + +void znanmaxrowa(doubleComplex *in, int row, int col, doubleComplex* out) +{ + doubleComplex inter[row]; + + + +for(int i=0; i< col; i++) + { + for(int j=0 ; j< row; j++) + { + inter[j]= in[j+ (i*row)]; + + } + out[i]= znanmaxa( inter, row); + + } + + +} diff --git a/src/c/elementaryFunctions/pmodulo/dpmoduloa.c b/src/c/elementaryFunctions/pmodulo/dpmoduloa.c new file mode 100644 index 0000000..0817987 --- /dev/null +++ b/src/c/elementaryFunctions/pmodulo/dpmoduloa.c @@ -0,0 +1,32 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "pmodulo.h" +#include "types.h" +void dpmoduloa(double* inp1, int size, double* inp2, double* out) +{ + + + for(int i=0; i< size; i++) + { + + out[i]= dpmodulos(inp1[i], inp2[i]); + + } + + + + +} diff --git a/src/c/elementaryFunctions/pmodulo/dpmodulos.c b/src/c/elementaryFunctions/pmodulo/dpmodulos.c new file mode 100644 index 0000000..6144177 --- /dev/null +++ b/src/c/elementaryFunctions/pmodulo/dpmodulos.c @@ -0,0 +1,54 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "pmodulo.h" +#include "types.h" + +double dpmodulos(double inp1, double inp2) +{ + if( inp1>0 && inp2>0) + + { + return fmod(inp1,inp2); + + } + + + if( inp1>0 && inp2<0) + + { + + return fmod(inp1,inp2); + + } + + + if(inp1<0 && inp2>0) + + { + + return ((fmod(inp1,inp2))+(inp2)); + + + } + + if(inp1<0 && inp2<0) + { + + return ((fmod(inp1,inp2))-(inp2)); + + } + +} diff --git a/src/c/elementaryFunctions/pmodulo/i16pmoduloa.c b/src/c/elementaryFunctions/pmodulo/i16pmoduloa.c new file mode 100644 index 0000000..bb76d7f --- /dev/null +++ b/src/c/elementaryFunctions/pmodulo/i16pmoduloa.c @@ -0,0 +1,33 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "int16.h" +#include "pmodulo.h" +#include "types.h" +void i16pmoduloa(int16* inp1, int size, int16* inp2, int16* out) +{ + + + for(int i=0; i< size; i++) + { + + out[i]= i16pmodulos(inp1[i], inp2[i]); + + } + + + + +} diff --git a/src/c/elementaryFunctions/pmodulo/i16pmodulos.c b/src/c/elementaryFunctions/pmodulo/i16pmodulos.c new file mode 100644 index 0000000..f7f86c5 --- /dev/null +++ b/src/c/elementaryFunctions/pmodulo/i16pmodulos.c @@ -0,0 +1,55 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "int16.h" +#include "pmodulo.h" +#include "types.h" + +int16 i16pmodulos(int16 inp1, int16 inp2) +{ + if( inp1>0 && inp2>0) + + { + return inp1%inp2; + + } + + + if( inp1>0 && inp2<0) + + { + + return inp1%inp2; + + } + + + if(inp1<0 && inp2>0) + + { + + return ((inp1%inp2)+(inp2)); + + + } + + if(inp1<0 && inp2<0) + { + + return ((inp1%inp2)-(inp2)); + + } + +} diff --git a/src/c/elementaryFunctions/pmodulo/spmoduloa.c b/src/c/elementaryFunctions/pmodulo/spmoduloa.c new file mode 100644 index 0000000..87b2a2f --- /dev/null +++ b/src/c/elementaryFunctions/pmodulo/spmoduloa.c @@ -0,0 +1,32 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "pmodulo.h" +#include "types.h" +void spmoduloa(float* inp1, int size, float* inp2, float* out) +{ + + + for(int i=0; i< size; i++) + { + + out[i]= spmodulos(inp1[i], inp2[i]); + + } + + + + +} diff --git a/src/c/elementaryFunctions/pmodulo/spmodulos.c b/src/c/elementaryFunctions/pmodulo/spmodulos.c new file mode 100644 index 0000000..9ab6bc4 --- /dev/null +++ b/src/c/elementaryFunctions/pmodulo/spmodulos.c @@ -0,0 +1,54 @@ +/* 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: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "pmodulo.h" +#include "types.h" + +float spmodulos(float inp1, float inp2) +{ + if( inp1>0 && inp2>0) + + { + return fmod(inp1,inp2); + + } + + + if( inp1>0 && inp2<0) + + { + + return fmod(inp1,inp2); + + } + + + if(inp1<0 && inp2>0) + + { + + return ((fmod(inp1,inp2))+(inp2)); + + + } + + if(inp1<0 && inp2<0) + { + + return ((fmod(inp1,inp2))-(inp2)); + + } + +} |