diff options
Diffstat (limited to '2.3-1/src/c/elementaryFunctions')
36 files changed, 975 insertions, 17 deletions
diff --git a/2.3-1/src/c/elementaryFunctions/includes/ismatrix.h b/2.3-1/src/c/elementaryFunctions/includes/ismatrix.h index 072bfdcb..0dd8b4a3 100644 --- a/2.3-1/src/c/elementaryFunctions/includes/ismatrix.h +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/includes/isvector.h b/2.3-1/src/c/elementaryFunctions/includes/isvector.h index 5f45abbe..75599cdd 100644 --- a/2.3-1/src/c/elementaryFunctions/includes/isvector.h +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/includes/nanmax.h b/2.3-1/src/c/elementaryFunctions/includes/nanmax.h new file mode 100644 index 00000000..bea83f78 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/includes/pmodulo.h b/2.3-1/src/c/elementaryFunctions/includes/pmodulo.h new file mode 100644 index 00000000..d46febc3 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/interfaces/int_ismatrix.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_ismatrix.h index 56dfc856..96352d13 100644 --- a/2.3-1/src/c/elementaryFunctions/interfaces/int_ismatrix.h +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/interfaces/int_isvector.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_isvector.h index 6d943bd3..a4edaea4 100644 --- a/2.3-1/src/c/elementaryFunctions/interfaces/int_isvector.h +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/interfaces/int_nanmax.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_nanmax.h new file mode 100644 index 00000000..dd3df71d --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/interfaces/int_pmodulo.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_pmodulo.h new file mode 100644 index 00000000..72b12770 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/ismatrix/dismatrixs.c b/2.3-1/src/c/elementaryFunctions/ismatrix/dismatrixs.c index f1c99dc4..15edcf22 100644 --- a/2.3-1/src/c/elementaryFunctions/ismatrix/dismatrixs.c +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/ismatrix/gismatrixa.c b/2.3-1/src/c/elementaryFunctions/ismatrix/gismatrixa.c new file mode 100644 index 00000000..f7288145 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/ismatrix/gismatrixs.c b/2.3-1/src/c/elementaryFunctions/ismatrix/gismatrixs.c new file mode 100644 index 00000000..61a3062a --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/ismatrix/sismatrixa.c b/2.3-1/src/c/elementaryFunctions/ismatrix/sismatrixa.c new file mode 100644 index 00000000..44335b81 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/ismatrix/sismatrixs.c b/2.3-1/src/c/elementaryFunctions/ismatrix/sismatrixs.c new file mode 100644 index 00000000..d6c6f233 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/ismatrix/u16ismatrixa.c b/2.3-1/src/c/elementaryFunctions/ismatrix/u16ismatrixa.c new file mode 100644 index 00000000..c16d54c8 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/ismatrix/u16ismatrixs.c b/2.3-1/src/c/elementaryFunctions/ismatrix/u16ismatrixs.c new file mode 100644 index 00000000..64313577 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/ismatrix/zismatrixa.c b/2.3-1/src/c/elementaryFunctions/ismatrix/zismatrixa.c new file mode 100644 index 00000000..32d72605 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/ismatrix/zismatrixs.c b/2.3-1/src/c/elementaryFunctions/ismatrix/zismatrixs.c new file mode 100644 index 00000000..d38592c7 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/isvector/disvectora.c b/2.3-1/src/c/elementaryFunctions/isvector/disvectora.c index 3c41027f..a96485be 100644 --- a/2.3-1/src/c/elementaryFunctions/isvector/disvectora.c +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/isvector/gisvectora.c b/2.3-1/src/c/elementaryFunctions/isvector/gisvectora.c index d2e261e9..758fa879 100644 --- a/2.3-1/src/c/elementaryFunctions/isvector/gisvectora.c +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/isvector/sisvectora.c b/2.3-1/src/c/elementaryFunctions/isvector/sisvectora.c index 09ad6515..d6a4821b 100644 --- a/2.3-1/src/c/elementaryFunctions/isvector/sisvectora.c +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/isvector/zisvectora.c b/2.3-1/src/c/elementaryFunctions/isvector/zisvectora.c index fba78124..0ed64a63 100644 --- a/2.3-1/src/c/elementaryFunctions/isvector/zisvectora.c +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/nanmax/dnanmaxa.c b/2.3-1/src/c/elementaryFunctions/nanmax/dnanmaxa.c new file mode 100644 index 00000000..4ff4a1a8 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/nanmax/dnanmaxcola.c b/2.3-1/src/c/elementaryFunctions/nanmax/dnanmaxcola.c new file mode 100644 index 00000000..9db07423 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/nanmax/dnanmaxrowa.c b/2.3-1/src/c/elementaryFunctions/nanmax/dnanmaxrowa.c new file mode 100644 index 00000000..191fa012 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/nanmax/snanmaxa.c b/2.3-1/src/c/elementaryFunctions/nanmax/snanmaxa.c new file mode 100644 index 00000000..1eab1ac1 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/nanmax/snanmaxcola.c b/2.3-1/src/c/elementaryFunctions/nanmax/snanmaxcola.c new file mode 100644 index 00000000..b4080525 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/nanmax/snanmaxrowa.c b/2.3-1/src/c/elementaryFunctions/nanmax/snanmaxrowa.c new file mode 100644 index 00000000..ab1ce0cb --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/nanmax/znanmaxa.c b/2.3-1/src/c/elementaryFunctions/nanmax/znanmaxa.c new file mode 100644 index 00000000..6283bf16 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/nanmax/znanmaxcola.c b/2.3-1/src/c/elementaryFunctions/nanmax/znanmaxcola.c new file mode 100644 index 00000000..ffb96b20 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/nanmax/znanmaxrowa.c b/2.3-1/src/c/elementaryFunctions/nanmax/znanmaxrowa.c new file mode 100644 index 00000000..e035e778 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/pmodulo/dpmoduloa.c b/2.3-1/src/c/elementaryFunctions/pmodulo/dpmoduloa.c new file mode 100644 index 00000000..0817987a --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/pmodulo/dpmodulos.c b/2.3-1/src/c/elementaryFunctions/pmodulo/dpmodulos.c new file mode 100644 index 00000000..61441777 --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/pmodulo/i16pmoduloa.c b/2.3-1/src/c/elementaryFunctions/pmodulo/i16pmoduloa.c new file mode 100644 index 00000000..bb76d7ff --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/pmodulo/i16pmodulos.c b/2.3-1/src/c/elementaryFunctions/pmodulo/i16pmodulos.c new file mode 100644 index 00000000..f7f86c5b --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/pmodulo/spmoduloa.c b/2.3-1/src/c/elementaryFunctions/pmodulo/spmoduloa.c new file mode 100644 index 00000000..87b2a2fb --- /dev/null +++ b/2.3-1/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/2.3-1/src/c/elementaryFunctions/pmodulo/spmodulos.c b/2.3-1/src/c/elementaryFunctions/pmodulo/spmodulos.c new file mode 100644 index 00000000..9ab6bc49 --- /dev/null +++ b/2.3-1/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)); + + } + +} |