summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/sci2clib.h3
-rw-r--r--jar/scilab_en_US_help.jarbin11210 -> 11210 bytes
-rw-r--r--macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci5
-rw-r--r--macros/findDeps/getAllHeaders.sci1
-rw-r--r--macros/findDeps/getAllInterfaces.sci1
-rw-r--r--macros/findDeps/getAllSources.sci12
-rw-r--r--src/c/auxiliaryFunctions/abs/zabss.c1
-rw-r--r--src/c/matrixOperations/includes/matrix.h2
-rw-r--r--src/c/matrixOperations/interfaces/int_matrix.h2
-rw-r--r--src/c/operations/addition/zadds.c1
-rw-r--r--src/c/statisticsFunctions/includes/median.h46
-rw-r--r--src/c/statisticsFunctions/interfaces/int_median.h57
-rw-r--r--src/c/statisticsFunctions/median/dmediana.c58
-rw-r--r--src/c/statisticsFunctions/median/dmediancola.c35
-rw-r--r--src/c/statisticsFunctions/median/dmedianrowa.c36
-rw-r--r--src/c/statisticsFunctions/median/smediana.c57
-rw-r--r--src/c/statisticsFunctions/median/smediancola.c35
-rw-r--r--src/c/statisticsFunctions/median/smedianrowa.c36
-rw-r--r--src/c/statisticsFunctions/median/u16mediana.c57
-rw-r--r--src/c/statisticsFunctions/median/u16mediancola.c35
-rw-r--r--src/c/statisticsFunctions/median/u16medianrowa.c36
-rw-r--r--src/c/statisticsFunctions/median/zmediana.c64
-rw-r--r--src/c/statisticsFunctions/median/zmediancola.c36
-rw-r--r--src/c/statisticsFunctions/median/zmedianrowa.c37
24 files changed, 652 insertions, 1 deletions
diff --git a/includes/sci2clib.h b/includes/sci2clib.h
index 47bf1c7..b57fa97 100644
--- a/includes/sci2clib.h
+++ b/includes/sci2clib.h
@@ -587,6 +587,9 @@ extern "C" {
/* interfacing mean */
#include "mean.h"
#include "int_mean.h"
+/* interfacing median */
+#include "median.h"
+#include "int_median.h"
/* interfacing stdevf */
#include "stdevf.h"
#include "int_stdevf.h"
diff --git a/jar/scilab_en_US_help.jar b/jar/scilab_en_US_help.jar
index beb9c10..ccb9961 100644
--- a/jar/scilab_en_US_help.jar
+++ b/jar/scilab_en_US_help.jar
Binary files differ
diff --git a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
index 2af6140..82b2cd1 100644
--- a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
+++ b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
@@ -1944,6 +1944,11 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file',
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+FunctionName = 'median'; // BJ : Done AS : Float_Done
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
FunctionName = 'st_deviation'; // BJ : Not implemented
PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
diff --git a/macros/findDeps/getAllHeaders.sci b/macros/findDeps/getAllHeaders.sci
index 986829e..cd2d1a3 100644
--- a/macros/findDeps/getAllHeaders.sci
+++ b/macros/findDeps/getAllHeaders.sci
@@ -142,6 +142,7 @@ function allHeaders = getAllHeaders(SharedInfo)
"src/c/statisticsFunctions/includes/variance.h"
"src/c/statisticsFunctions/includes/sum.h"
"src/c/statisticsFunctions/includes/mean.h"
+ "src/c/statisticsFunctions/includes/median.h"
"src/c/statisticsFunctions/includes/meanf.h"
"src/c/statisticsFunctions/includes/stdevf.h"
"src/c/statisticsFunctions/includes/prod.h"
diff --git a/macros/findDeps/getAllInterfaces.sci b/macros/findDeps/getAllInterfaces.sci
index 02c671f..0b1d8c6 100644
--- a/macros/findDeps/getAllInterfaces.sci
+++ b/macros/findDeps/getAllInterfaces.sci
@@ -131,6 +131,7 @@ function allInterfaces = getAllInterfaces(SharedInfo)
"src/c/elementaryFunctions/interfaces/int_gcd.h"
"src/c/elementaryFunctions/interfaces/int_lcm.h"
"src/c/statisticsFunctions/interfaces/int_mean.h"
+ "src/c/statisticsFunctions/interfaces/int_median.h"
"src/c/statisticsFunctions/interfaces/int_meanf.h"
"src/c/statisticsFunctions/interfaces/int_stdevf.h"
"src/c/statisticsFunctions/interfaces/int_prod.h"
diff --git a/macros/findDeps/getAllSources.sci b/macros/findDeps/getAllSources.sci
index 6b2495d..fc8cd08 100644
--- a/macros/findDeps/getAllSources.sci
+++ b/macros/findDeps/getAllSources.sci
@@ -920,6 +920,18 @@ function allSources = getAllSources(SharedInfo,BuildTool)
"src/c/statisticsFunctions/meanf/zmeanfdz.c"
"src/c/statisticsFunctions/meanf/cmeanfsc.c"
"src/c/statisticsFunctions/meanf/zcolumnmeanfa.c"
+"src/c/statisticsFunctions/median/dmediana.c"
+"src/c/statisticsFunctions/median/dmedianrowa.c"
+"src/c/statisticsFunctions/median/dmediancola.c"
+"src/c/statisticsFunctions/median/smediana.c"
+"src/c/statisticsFunctions/median/smedianrowa.c"
+"src/c/statisticsFunctions/median/smediancola.c"
+"src/c/statisticsFunctions/median/u16mediana.c"
+"src/c/statisticsFunctions/median/u16medianrowa.c"
+"src/c/statisticsFunctions/median/u16mediancola.c"
+"src/c/statisticsFunctions/median/zmediana.c"
+"src/c/statisticsFunctions/median/zmediancola.c"
+"src/c/statisticsFunctions/median/zmedianrowa.c"
"src/c/statisticsFunctions/prod/srowproda.c"
"src/c/statisticsFunctions/prod/drowproda.c"
"src/c/statisticsFunctions/prod/dproda.c"
diff --git a/src/c/auxiliaryFunctions/abs/zabss.c b/src/c/auxiliaryFunctions/abs/zabss.c
index 4e7b4dd..7ada57d 100644
--- a/src/c/auxiliaryFunctions/abs/zabss.c
+++ b/src/c/auxiliaryFunctions/abs/zabss.c
@@ -16,6 +16,7 @@
#include "sqrt.h"
#include "max.h"
#include "min.h"
+#include "doubleComplex.h"
double zabss(doubleComplex in) {
double real = dabss(zreals(in));
diff --git a/src/c/matrixOperations/includes/matrix.h b/src/c/matrixOperations/includes/matrix.h
index dbb0e22..582fd22 100644
--- a/src/c/matrixOperations/includes/matrix.h
+++ b/src/c/matrixOperations/includes/matrix.h
@@ -16,6 +16,8 @@
#include "types.h"
#include "doubleComplex.h"
+#include "uint16.h"
+
#ifdef __cplusplus
extern "C" {
diff --git a/src/c/matrixOperations/interfaces/int_matrix.h b/src/c/matrixOperations/interfaces/int_matrix.h
index f69ba11..5935f4a 100644
--- a/src/c/matrixOperations/interfaces/int_matrix.h
+++ b/src/c/matrixOperations/interfaces/int_matrix.h
@@ -46,4 +46,4 @@ extern "C" {
} /* extern "C" */
#endif
-#endif /*__INT_CUMSUM_H__*/
+#endif /*__INT_MATRIX_H__*/
diff --git a/src/c/operations/addition/zadds.c b/src/c/operations/addition/zadds.c
index d4a94dc..768faf3 100644
--- a/src/c/operations/addition/zadds.c
+++ b/src/c/operations/addition/zadds.c
@@ -11,6 +11,7 @@
*/
#include "addition.h"
+#include "doubleComplex.h"
doubleComplex zadds(doubleComplex z1, doubleComplex z2) {
return DoubleComplex(zreals(z1) + zreals(z2),
diff --git a/src/c/statisticsFunctions/includes/median.h b/src/c/statisticsFunctions/includes/median.h
new file mode 100644
index 0000000..accb5df
--- /dev/null
+++ b/src/c/statisticsFunctions/includes/median.h
@@ -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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#ifndef __MEDIAN_H__
+#define __MEDIAN_H__
+
+#include "types.h"
+#include "doubleComplex.h"
+#include "uint16.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+double dmediana(double* , int );
+void dmedianrowa(double*, int, int, double*);
+void dmediancola(double*, int, int, double*);
+
+float smediana(float* , int );
+void smedianrowa(float*, int, int, float*);
+void smediancola(float*, int, int, float*);
+
+uint16 u16mediana(uint16* , int );
+void u16medianrowa(uint16*, int, int, uint16*);
+void u16mediancola(uint16*, int, int, uint16*);
+
+doubleComplex zmediana(doubleComplex* , int );
+void zmedianrowa(doubleComplex*, int, int, doubleComplex*);
+void zmediancola(doubleComplex*, int, int, doubleComplex*);
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__MATRIX_H__*/
diff --git a/src/c/statisticsFunctions/interfaces/int_median.h b/src/c/statisticsFunctions/interfaces/int_median.h
new file mode 100644
index 0000000..2a21987
--- /dev/null
+++ b/src/c/statisticsFunctions/interfaces/int_median.h
@@ -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
+*/
+
+#ifndef __INT_MEDIAN_H__
+#define __INT_MEDIAN_H__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define d2mediand0(in1, size) dmediana(in1, size[0]* size[1])
+#define d2g2mediand2(in1, size1, in2, size2, out) (in2[0]== 'r') ? dmedianrowa(in1, size1[0], size1[1], out) :dmediancola(in1, size1[0], size1[1], out)
+
+#define s2medians0(in1, size) smediana(in1, size[0]* size[1])
+#define s2g2medians2(in1, size1, in2, size2, out) (in2[0]== 'r') ? smedianrowa(in1, size1[0], size1[1], out) :smediancola(in1, size1[0], size1[1], out)
+
+#define u162medianu160(in1, size) u16mediana(in1, size[0]* size[1])
+#define u162g2medianu162(in1, size1, in2, size2, out) (in2[0]== 'r') ? u16medianrowa(in1, size1[0], size1[1], out) :u16mediancola(in1, size1[0], size1[1], out)
+
+#define z2medianz0(in1, size) zmediana(in1, size[0]* size[1])
+#define z2g2medianz2(in1, size1, in2, size2, out) (in2[0]== 'r') ? zmedianrowa(in1, size1[0], size1[1], out) :zmediancola(in1, size1[0], size1[1], out)
+
+
+#define s2d0d0matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out)
+#define s2s0s0matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out)
+//#define s2u160u160matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out)
+//#define s2u80u80matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out)
+
+#define u162d0d0matrixu162(in1, size, in2, in3, out ) u16matrixa(in1, size[0], size[1], in2, in3, out)
+#define u162s0s0matrixu162(in1, size, in2, in3, out ) u16matrixa(in1, size[0], size[1], in2, in3, out)
+//#define s2u160u160matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out)
+//#define s2u80u80matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out)
+
+#define z2d0d0matrixz2(in1, size, in2, in3, out ) zmatrixa(in1, size[0], size[1], in2, in3, out)
+#define z2s0s0matrixz2(in1, size, in2, in3, out ) zmatrixa(in1, size[0], size[1], in2, in3, out)
+//#define s2u160u160matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out)
+//#define s2u80u80matrixs2(in1, size, in2, in3, out ) smatrixa(in1, size[0], size[1], in2, in3, out)
+
+
+
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_MATRIX_H__*/
diff --git a/src/c/statisticsFunctions/median/dmediana.c b/src/c/statisticsFunctions/median/dmediana.c
new file mode 100644
index 0000000..cb2463c
--- /dev/null
+++ b/src/c/statisticsFunctions/median/dmediana.c
@@ -0,0 +1,58 @@
+/* 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 "median.h"
+#include "types.h"
+#include "uint16.h"
+
+double dmediana(double *in, int size)
+{
+ double a; double fin;
+
+
+ for (int i = 0; i < size; ++i)
+
+ {
+
+ for (int j = i + 1; j < size; ++j)
+
+ {
+
+ if (in[i] > in[j])
+
+ {
+
+ a = in[i];
+
+ in[i] = in[j];
+
+ in[j] = a;
+
+ }
+
+ }
+
+ }
+
+
+ if(size%2 ==0)
+ {
+ fin= (in[size/2]+ in[(size/2)-1])/2;
+ }
+ else
+ {
+ fin= in[(size-1)/2];
+ }
+
+ return fin;
+}
diff --git a/src/c/statisticsFunctions/median/dmediancola.c b/src/c/statisticsFunctions/median/dmediancola.c
new file mode 100644
index 0000000..b3ff4fb
--- /dev/null
+++ b/src/c/statisticsFunctions/median/dmediancola.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 "median.h"
+#include "types.h"
+#include "uint16.h"
+
+void dmediancola(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]= dmediana( inter, col);
+
+ }
+
+
+}
diff --git a/src/c/statisticsFunctions/median/dmedianrowa.c b/src/c/statisticsFunctions/median/dmedianrowa.c
new file mode 100644
index 0000000..4b5879c
--- /dev/null
+++ b/src/c/statisticsFunctions/median/dmedianrowa.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 "median.h"
+#include "types.h"
+#include "uint16.h"
+
+void dmedianrowa(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]= dmediana( inter, row);
+
+ }
+
+
+}
diff --git a/src/c/statisticsFunctions/median/smediana.c b/src/c/statisticsFunctions/median/smediana.c
new file mode 100644
index 0000000..9e86b77
--- /dev/null
+++ b/src/c/statisticsFunctions/median/smediana.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 "median.h"
+#include "types.h"
+#include "uint16.h"
+
+float smediana(float *in, int size)
+{
+ float a; float fin;
+
+
+ for (int i = 0; i < size; ++i)
+
+ {
+
+ for (int j = i + 1; j < size; ++j)
+
+ {
+
+ if (in[i] > in[j])
+
+ {
+
+ a = in[i];
+
+ in[i] = in[j];
+
+ in[j] = a;
+
+ }
+
+ }
+
+ }
+
+ if(size%2 ==0)
+ {
+ fin= (in[size/2]+ in[(size/2)-1])/2;
+ }
+ else
+ {
+ fin= in[(size-1)/2];
+ }
+
+ return fin;
+}
diff --git a/src/c/statisticsFunctions/median/smediancola.c b/src/c/statisticsFunctions/median/smediancola.c
new file mode 100644
index 0000000..2fc4eaf
--- /dev/null
+++ b/src/c/statisticsFunctions/median/smediancola.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 "median.h"
+#include "types.h"
+#include "uint16.h"
+
+void smediancola(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]= smediana( inter, col);
+
+ }
+
+
+}
diff --git a/src/c/statisticsFunctions/median/smedianrowa.c b/src/c/statisticsFunctions/median/smedianrowa.c
new file mode 100644
index 0000000..aab5938
--- /dev/null
+++ b/src/c/statisticsFunctions/median/smedianrowa.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 "median.h"
+#include "types.h"
+#include "uint16.h"
+
+void smedianrowa(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]= smediana( inter, row);
+
+ }
+
+
+}
diff --git a/src/c/statisticsFunctions/median/u16mediana.c b/src/c/statisticsFunctions/median/u16mediana.c
new file mode 100644
index 0000000..b45c530
--- /dev/null
+++ b/src/c/statisticsFunctions/median/u16mediana.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 "median.h"
+#include "types.h"
+#include "uint16.h"
+
+uint16 u16mediana(uint16 *in, int size)
+{
+ uint16 a; uint16 fin;
+
+
+ for (int i = 0; i < size; ++i)
+
+ {
+
+ for (int j = i + 1; j < size; ++j)
+
+ {
+
+ if (in[i] > in[j])
+
+ {
+
+ a = in[i];
+
+ in[i] = in[j];
+
+ in[j] = a;
+
+ }
+
+ }
+
+ }
+
+ if(size%2 ==0)
+ {
+ fin= (in[size/2]+ in[(size/2)-1])/2;
+ }
+ else
+ {
+ fin= in[(size-1)/2];
+ }
+
+ return fin;
+}
diff --git a/src/c/statisticsFunctions/median/u16mediancola.c b/src/c/statisticsFunctions/median/u16mediancola.c
new file mode 100644
index 0000000..77952a3
--- /dev/null
+++ b/src/c/statisticsFunctions/median/u16mediancola.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 "median.h"
+#include "types.h"
+#include "uint16.h"
+
+void u16mediancola(uint16 *in, int row, int col, uint16* out)
+{
+ uint16 inter[col];
+
+
+for(int i=0; i< row; i++)
+ {
+ for(int j=0 ; j< col; j++)
+ {
+ inter[j]= in[i+ (j*row)];
+
+ }
+ out[i]= u16mediana( inter, col);
+
+ }
+
+
+}
diff --git a/src/c/statisticsFunctions/median/u16medianrowa.c b/src/c/statisticsFunctions/median/u16medianrowa.c
new file mode 100644
index 0000000..8e5b98e
--- /dev/null
+++ b/src/c/statisticsFunctions/median/u16medianrowa.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 "median.h"
+#include "types.h"
+#include "uint16.h"
+
+void u16medianrowa(uint16 *in, int row, int col, uint16* out)
+{
+ uint16 inter[row];
+
+
+
+for(int i=0; i< col; i++)
+ {
+ for(int j=0 ; j< row; j++)
+ {
+ inter[j]= in[j+ (i*row)];
+
+ }
+ out[i]= u16mediana( inter, row);
+
+ }
+
+
+}
diff --git a/src/c/statisticsFunctions/median/zmediana.c b/src/c/statisticsFunctions/median/zmediana.c
new file mode 100644
index 0000000..32726e7
--- /dev/null
+++ b/src/c/statisticsFunctions/median/zmediana.c
@@ -0,0 +1,64 @@
+/* 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 "median.h"
+#include "types.h"
+#include "uint16.h"
+#include "doubleComplex.h"
+#include "addition.h"
+#include "division.h"
+#include "abs.h"
+
+doubleComplex zmediana(doubleComplex *in, int size)
+{
+ doubleComplex a; doubleComplex fin; doubleComplex middle;
+
+
+ for (int i = 0; i < size; ++i)
+
+ {
+
+ for (int j = i + 1; j < size; ++j)
+
+ {
+
+ if (zabss(in[i]) > zabss(in[j]))
+
+ {
+
+ a = in[i];
+
+ in[i] = in[j];
+
+ in[j] = a;
+
+ }
+
+ }
+
+ }
+
+
+
+ if(size%2 ==0)
+ {
+ middle= zadds(in[size/2], in[(size/2)-1]);
+ fin= zrdivs(middle, DoubleComplex(2,0));
+ }
+ else
+ {
+ fin= in[(size-1)/2];
+ }
+
+ return fin;
+}
diff --git a/src/c/statisticsFunctions/median/zmediancola.c b/src/c/statisticsFunctions/median/zmediancola.c
new file mode 100644
index 0000000..d709d98
--- /dev/null
+++ b/src/c/statisticsFunctions/median/zmediancola.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 "median.h"
+#include "types.h"
+#include "uint16.h"
+#include "doubleComplex.h"
+
+void zmediancola(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]= zmediana( inter, col);
+
+ }
+
+
+}
diff --git a/src/c/statisticsFunctions/median/zmedianrowa.c b/src/c/statisticsFunctions/median/zmedianrowa.c
new file mode 100644
index 0000000..ab2e0d4
--- /dev/null
+++ b/src/c/statisticsFunctions/median/zmedianrowa.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 "median.h"
+#include "types.h"
+#include "uint16.h"
+#include "doubleComplex.h"
+
+void zmedianrowa(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]= zmediana( inter, row);
+
+ }
+
+
+}