summaryrefslogtreecommitdiff
path: root/src/c
diff options
context:
space:
mode:
authorAbhinav Dronamraju2017-09-11 17:00:59 +0530
committerAbhinav Dronamraju2017-09-11 17:00:59 +0530
commitd229093eac4cd1963e336959fe663f7332efafea (patch)
treebe49670052e565231fbb0f95f03929d784114d1d /src/c
parentfe525aa0b13baa3113ec22fe4f2d373db6e093d8 (diff)
parent3aa26bd48e9d42e4f97fcafee4c761f36ea766bc (diff)
downloadScilab2C_fossee_old-d229093eac4cd1963e336959fe663f7332efafea.tar.gz
Scilab2C_fossee_old-d229093eac4cd1963e336959fe663f7332efafea.tar.bz2
Scilab2C_fossee_old-d229093eac4cd1963e336959fe663f7332efafea.zip
mvcorrel and strange functions added
Diffstat (limited to 'src/c')
-rw-r--r--src/c/elementaryFunctions/includes/log2.h39
-rw-r--r--src/c/elementaryFunctions/interfaces/int_log2.h33
-rw-r--r--src/c/elementaryFunctions/log2/dlog2a.c20
-rw-r--r--src/c/elementaryFunctions/log2/dlog2s.c21
-rw-r--r--src/c/elementaryFunctions/log2/slog2a.c21
-rw-r--r--src/c/elementaryFunctions/log2/slog2s.c20
-rw-r--r--src/c/elementaryFunctions/log2/zlog2a.c20
-rw-r--r--src/c/elementaryFunctions/log2/zlog2s.c22
-rw-r--r--src/c/graphics/transforms/includes/scaling.h36
-rw-r--r--src/c/graphics/transforms/interfaces/int_scaling.h35
-rw-r--r--src/c/graphics/transforms/scaling/dscalinga.c34
-rw-r--r--src/c/graphics/transforms/scaling/sscalinga.c34
-rw-r--r--src/c/graphics/transforms/scaling/zscalinga.c38
-rw-r--r--src/c/linearAlgebra/includes/lu.h33
-rw-r--r--src/c/linearAlgebra/interfaces/int_lu.h26
-rw-r--r--src/c/linearAlgebra/lu/dlua.c55
-rw-r--r--src/c/signalProcessing/hank/dhanka.c4
-rw-r--r--src/c/signalProcessing/includes/kalm.h3
-rw-r--r--src/c/signalProcessing/includes/wiener.h30
-rw-r--r--src/c/signalProcessing/interfaces/int_kalm.h5
-rw-r--r--src/c/signalProcessing/interfaces/int_weiner.h20
-rw-r--r--src/c/signalProcessing/interfaces/int_wiener.h20
-rw-r--r--src/c/signalProcessing/kalm/zkalma.c119
-rw-r--r--src/c/signalProcessing/wiener/dwienera.c166
-rw-r--r--src/c/statisticsFunctions/includes/mvcorrel.h6
-rw-r--r--src/c/statisticsFunctions/includes/strange.h43
-rw-r--r--src/c/statisticsFunctions/interfaces/int_mvcorrel.h5
-rw-r--r--src/c/statisticsFunctions/interfaces/int_strange.h26
-rw-r--r--src/c/statisticsFunctions/mvcorrel/dmvcorrel1a.c34
-rw-r--r--src/c/statisticsFunctions/mvcorrel/dmvcorrela.c48
-rw-r--r--src/c/statisticsFunctions/mvcorrel/smvcorrel1a.c34
-rw-r--r--src/c/statisticsFunctions/mvcorrel/smvcorrela.c87
-rw-r--r--src/c/statisticsFunctions/strange/dstrangea.c60
-rw-r--r--src/c/statisticsFunctions/strange/dstrangecola.c37
-rw-r--r--src/c/statisticsFunctions/strange/dstrangerowa.c35
-rw-r--r--src/c/statisticsFunctions/strange/sstrangea.c60
-rw-r--r--src/c/statisticsFunctions/strange/sstrangecola.c37
-rw-r--r--src/c/statisticsFunctions/strange/sstrangerowa.c35
-rw-r--r--src/c/statisticsFunctions/strange/u16strangea.c60
-rw-r--r--src/c/statisticsFunctions/strange/u16strangecola.c37
-rw-r--r--src/c/statisticsFunctions/strange/u16strangerowa.c35
41 files changed, 1388 insertions, 145 deletions
diff --git a/src/c/elementaryFunctions/includes/log2.h b/src/c/elementaryFunctions/includes/log2.h
new file mode 100644
index 0000000..e7b2aff
--- /dev/null
+++ b/src/c/elementaryFunctions/includes/log2.h
@@ -0,0 +1,39 @@
+ /* 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+
+#ifndef __LOG2_H__
+#define __LOG2_H__
+
+#include "dynlib_elementaryfunctions.h"
+#include "floatComplex.h"
+#include "doubleComplex.h"
+#include "types.h"
+#include "log.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+double dlog2s(double inp);
+float slog2s(float inp);
+doubleComplex zlog2s(doubleComplex inp);
+void dlog2a(double* inp,int size, double* out);
+void slog2a(float* inp,int size, float* out);
+void zlog2a(doubleComplex* inp,int size, doubleComplex* out);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+
+#endif /* !__LOG2_H__ */
+
diff --git a/src/c/elementaryFunctions/interfaces/int_log2.h b/src/c/elementaryFunctions/interfaces/int_log2.h
new file mode 100644
index 0000000..370503c
--- /dev/null
+++ b/src/c/elementaryFunctions/interfaces/int_log2.h
@@ -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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_LOG2_H__
+#define __INT_LOG2_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define d0log2d0(in1) dlog2s(in1)
+#define d2log2d2(in1, size1, out) dlog2a(in1,size1[0]*size1[1], out)
+#define s0log2s0(in1) slog2s(in1, in2)
+#define s2log2s2(in1, size1, out) slog2a(in1,size1[0]*size1[1], out)
+#define z0log2z0(in1) zlog2s(in1, in2)
+#define z2log2z2(in1, size1, out) zlog2a(in1,size1[0]*size1[1], out)
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_LOG2_H__*/
diff --git a/src/c/elementaryFunctions/log2/dlog2a.c b/src/c/elementaryFunctions/log2/dlog2a.c
new file mode 100644
index 0000000..79047de
--- /dev/null
+++ b/src/c/elementaryFunctions/log2/dlog2a.c
@@ -0,0 +1,20 @@
+/* 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: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <math.h>
+#include "log2.h"
+
+void dlog2a(double* inp,int size, double* out)
+{
+ for(int i = 0; i<size; i++)
+ out[i] = dlog2s(inp[i]);
+}
diff --git a/src/c/elementaryFunctions/log2/dlog2s.c b/src/c/elementaryFunctions/log2/dlog2s.c
new file mode 100644
index 0000000..9d2f8ab
--- /dev/null
+++ b/src/c/elementaryFunctions/log2/dlog2s.c
@@ -0,0 +1,21 @@
+/* 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <math.h>
+#include "log2.h"
+
+double dlog2s(double inp)
+{
+ return log(inp)/log(2);
+}
+
+
diff --git a/src/c/elementaryFunctions/log2/slog2a.c b/src/c/elementaryFunctions/log2/slog2a.c
new file mode 100644
index 0000000..0472307
--- /dev/null
+++ b/src/c/elementaryFunctions/log2/slog2a.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
+ Organization: FOSSEE, IIT Bombay
+ Author: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <math.h>
+#include "factorial.h"
+#include "log2.h"
+
+void slog2a(float* inp,int size, float* out)
+{
+ for(int i = 0; i<size; i++)
+ out[i] = slog2s(inp[i]);
+}
diff --git a/src/c/elementaryFunctions/log2/slog2s.c b/src/c/elementaryFunctions/log2/slog2s.c
new file mode 100644
index 0000000..d162248
--- /dev/null
+++ b/src/c/elementaryFunctions/log2/slog2s.c
@@ -0,0 +1,20 @@
+/* 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: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <math.h>
+#include "factorial.h"
+#include "log2.h"
+
+float slog2s(float inp)
+{
+ return log(inp)/log(2);
+}
diff --git a/src/c/elementaryFunctions/log2/zlog2a.c b/src/c/elementaryFunctions/log2/zlog2a.c
new file mode 100644
index 0000000..4cd0b33
--- /dev/null
+++ b/src/c/elementaryFunctions/log2/zlog2a.c
@@ -0,0 +1,20 @@
+/* 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: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <math.h>
+#include "log2.h"
+
+void zlog2a(doubleComplex* inp,int size, doubleComplex* out)
+{
+ for(int i = 0; i<size; i++)
+ out[i] = zlog2s(inp[i]);
+}
diff --git a/src/c/elementaryFunctions/log2/zlog2s.c b/src/c/elementaryFunctions/log2/zlog2s.c
new file mode 100644
index 0000000..8447c9e
--- /dev/null
+++ b/src/c/elementaryFunctions/log2/zlog2s.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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <math.h>
+#include "log2.h"
+#include "log.h"
+
+doubleComplex zlog2s(doubleComplex inp)
+{
+ return zlogs(inp)/zlogs(2);
+}
+
+
diff --git a/src/c/graphics/transforms/includes/scaling.h b/src/c/graphics/transforms/includes/scaling.h
new file mode 100644
index 0000000..35d9f24
--- /dev/null
+++ b/src/c/graphics/transforms/includes/scaling.h
@@ -0,0 +1,36 @@
+ /* 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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __SCALING_H__
+#define __SCALING_H__
+#include "types.h"
+#include "floatComplex.h"
+#include "doubleComplex.h"
+#include "uint8.h"
+#include "uint16.h"
+#include "int16.h"
+#include "factorial.h"
+#include "ones.h"
+#include "matrixMultiplication.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void dscalinga (double* inp1, int row, int col, double inp2, double* inp3, int size3, double* out);
+void sscalinga (float* inp1, int row, int col, double inp2, float* inp3, int size3, float* out);
+void zscalinga (doubleComplex* inp1, int row, int col, doubleComplex inp2, doubleComplex* inp3, int size3, doubleComplex* out);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__SCALING_H__*/
diff --git a/src/c/graphics/transforms/interfaces/int_scaling.h b/src/c/graphics/transforms/interfaces/int_scaling.h
new file mode 100644
index 0000000..61cb5ab
--- /dev/null
+++ b/src/c/graphics/transforms/interfaces/int_scaling.h
@@ -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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_SCALING_H__
+#define __INT_SCALING_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define d2d0d2scalingd2(in1, size1, in2, in3, size2, out) dscalinga(in1, size1[0], size1[1], in2, in3, size2[0]*size2[1], out)
+#define s2s0s2scalings2(in1, size1, in2, in3, size2, out) sscalinga(in1, size1[0], size1[1], in2, in3, size2[0]*size2[1], out)
+#define s2d0s2scalings2(in1, size1, in2, in3, size2, out) sscalinga(in1, size1[0], size1[1], in2, in3, size2[0]*size2[1], out)
+#define z2z0z2scalingz2(in1, size1, in2, in3, size2, out) zscalinga(in1, size1[0], size1[1], in2, in3, size2[0]*size2[1], out)
+#define z2d0d2scalingz2(in1, size1, in2, in3, size2, out) zscalinga(in1, size1[0], size1[1], in2, in3, size2[0]*size2[1], out)
+#define z2z0d2scalingz2(in1, size1, in2, in3, size2, out) zscalinga(in1, size1[0], size1[1], in2, in3, size2[0]*size2[1], out)
+#define z2d0z2scalingz2(in1, size1, in2, in3, size2, out) zscalinga(in1, size1[0], size1[1], in2, in3, size2[0]*size2[1], out)
+
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_SCALING_H__*/
diff --git a/src/c/graphics/transforms/scaling/dscalinga.c b/src/c/graphics/transforms/scaling/dscalinga.c
new file mode 100644
index 0000000..24d4573
--- /dev/null
+++ b/src/c/graphics/transforms/scaling/dscalinga.c
@@ -0,0 +1,34 @@
+/* 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: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <math.h>
+#include "scaling.h"
+#include "ones.h"
+#include "matrixMultiplication.h"
+
+void dscalinga (double* inp1, int row, int col, double inp2, double* inp3, int size3, double* out)
+{
+ double temp[row*col], one[col], prod[row*col], diff[row*col];
+
+ for(int i = 0; i < row*col; i++)
+ temp[i] = inp1[i];
+
+ donesa(one, 1, col);
+
+ dmulma(inp3, 2, 1, one, 1, col, prod);
+
+ for(int i = 0; i < row*col; i++)
+ diff[i] = inp1[i] - prod[i];
+
+ for(int i = 0; i < row*col; i++)
+ out[i] = (inp2 * diff[i]) + prod[i];
+}
diff --git a/src/c/graphics/transforms/scaling/sscalinga.c b/src/c/graphics/transforms/scaling/sscalinga.c
new file mode 100644
index 0000000..1adfcf3
--- /dev/null
+++ b/src/c/graphics/transforms/scaling/sscalinga.c
@@ -0,0 +1,34 @@
+/* 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: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <math.h>
+#include "scaling.h"
+#include "ones.h"
+#include "matrixMultiplication.h"
+
+void sscalinga (float* inp1, int row, int col, double inp2, float* inp3, int size3, float* out)
+{
+ float temp[row*col], one[col], prod[row*col], diff[row*col];
+
+ for(int i = 0; i < row*col; i++)
+ temp[i] = inp1[i];
+
+ sonesa(one, 1, col);
+
+ smulma(inp3, 2, 1, one, 1, col, prod);
+
+ for(int i = 0; i < row*col; i++)
+ diff[i] = inp1[i] - prod[i];
+
+ for(int i = 0; i < row*col; i++)
+ out[i] = (inp2 * diff[i]) + prod[i];
+}
diff --git a/src/c/graphics/transforms/scaling/zscalinga.c b/src/c/graphics/transforms/scaling/zscalinga.c
new file mode 100644
index 0000000..fb71a77
--- /dev/null
+++ b/src/c/graphics/transforms/scaling/zscalinga.c
@@ -0,0 +1,38 @@
+/* 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: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <math.h>
+#include "scaling.h"
+#include "ones.h"
+#include "matrixMultiplication.h"
+#include "doubleComplex.h"
+#include "subtraction.h"
+#include "addition.h"
+#include "multiplication.h"
+
+void zscalinga (doubleComplex* inp1, int row, int col, doubleComplex inp2, doubleComplex* inp3, int size3, doubleComplex* out)
+{
+ doubleComplex temp[row*col], one[col], prod[row*col], diff[row*col];
+
+ for(int i = 0; i < row*col; i++)
+ temp[i] = inp1[i];
+
+ zonesa(one, 1, col);
+
+ zmulma(inp3, 2, 1, one, 1, col, prod);
+
+ for(int i = 0; i < row*col; i++)
+ diff[i] = zdiffs(inp1[i], prod[i]);
+
+ for(int i = 0; i < row*col; i++)
+ out[i] = zadds(zmuls(inp2, diff[i]), prod[i]);
+}
diff --git a/src/c/linearAlgebra/includes/lu.h b/src/c/linearAlgebra/includes/lu.h
new file mode 100644
index 0000000..08f4663
--- /dev/null
+++ b/src/c/linearAlgebra/includes/lu.h
@@ -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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __LU_H__
+#define __LU_H__
+#include "types.h"
+#include "doubleComplex.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "lapack.h"
+#include "string.h"
+#include "matrixTranspose.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void dlua(double*inp1, int size, double* out1, double* out2);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__LU_H__*/
diff --git a/src/c/linearAlgebra/interfaces/int_lu.h b/src/c/linearAlgebra/interfaces/int_lu.h
new file mode 100644
index 0000000..44c258a
--- /dev/null
+++ b/src/c/linearAlgebra/interfaces/int_lu.h
@@ -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: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+
+#ifndef __INT_LU_H__
+#define __INT_LU_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define d2lud2d2(in1,size1, out1,out2) dlua(in1,size1[0]*size1[1],out1,out2)
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_LU_H__*/
diff --git a/src/c/linearAlgebra/lu/dlua.c b/src/c/linearAlgebra/lu/dlua.c
new file mode 100644
index 0000000..d3cf6d1
--- /dev/null
+++ b/src/c/linearAlgebra/lu/dlua.c
@@ -0,0 +1,55 @@
+/* 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: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "lu.h"
+#include "lapack.h"
+#include "string.h"
+#include "matrixTranspose.h"
+
+extern double dgetrf_ (int* , int* , double* , int* , int* , int* );
+
+void dlua(double*inp1, int size, double* out1, double* out2)
+{
+ char TRANS = 'N';
+ int INFO=3;
+ int LDA = 3;
+ int LDB = 3;
+ int N = 3;
+ int NRHS = 1;
+ int IPIV[2] ;
+
+ /*double A[9] =
+ {
+ 1, 2, 3,
+ 2, 3, 4,
+ 3, 4, 1
+ };*/
+
+ //void LAPACK_dgetrf( lapack_int* m, lapack_int* n, double* a, lapack_int* lda, lapack_int* ipiv, lapack_int *info );
+// dgetrf_(&N,&N,inp1,&LDA,IPIV,&INFO);
+
+ dgetrf_(6,2,inp1,6,IPIV,&INFO);
+
+ // checks INFO, if INFO != 0 something goes wrong, for more information see the MAN page of dgetrf.
+ for(int i = 0; i < 3*3; i++)
+ printf("%lf \n ", inp1[i]);
+
+ printf("PIVOTTTTTT \n ");
+
+ for(int i = 0; i < 2; i++)
+ printf("%d \n ", IPIV[i]);
+
+
+}
+
diff --git a/src/c/signalProcessing/hank/dhanka.c b/src/c/signalProcessing/hank/dhanka.c
index 37008fd..5cef7f3 100644
--- a/src/c/signalProcessing/hank/dhanka.c
+++ b/src/c/signalProcessing/hank/dhanka.c
@@ -43,7 +43,7 @@ for(int i=1; i< mr+1; i= i+row)
{
temp1[j]=i;
j++;
- printf("%d", i);
+ //printf("%d", i);
}
for(int j=0;j< nr; j++)
temp2[j]=j;
@@ -65,7 +65,7 @@ for(int i=0; i< m*nr; i++)
}
}
-
+//Debug Only
/*
printf("ones1\n");
for(int k=0; k<1*nr; k++)
diff --git a/src/c/signalProcessing/includes/kalm.h b/src/c/signalProcessing/includes/kalm.h
index 7cd5a55..6f73ac1 100644
--- a/src/c/signalProcessing/includes/kalm.h
+++ b/src/c/signalProcessing/includes/kalm.h
@@ -21,9 +21,6 @@ extern "C" {
void dkalma(double* y, int y_row, int y_col, double* x0, int x0_row, int x0_col, double* p0, int p0_row, int p0_col, double* f, int f_row, int f_col, double* g, int g_row, int g_col, double* h, int h_row, int h_col, double* q, int q_row, int q_col, double* r, int r_row, int r_col, double* x1, double* p1, double* x, double* p);
-void zkalma(doubleComplex* y, int y_row, int y_col, doubleComplex* x0, int x0_row, int x0_col,doubleComplex* p0, int p0_row, int p0_col, doubleComplex* f, int f_row, int f_col, doubleComplex* g, int g_row, int g_col, doubleComplex* h, int h_row, int h_col, doubleComplex* q, int q_row, int q_col, doubleComplex* r, int r_row, int r_col, doubleComplex* x1, doubleComplex* p1, doubleComplex* x, doubleComplex* p);
-
-
#ifdef __cplusplus
} /* extern "C" */
diff --git a/src/c/signalProcessing/includes/wiener.h b/src/c/signalProcessing/includes/wiener.h
new file mode 100644
index 0000000..ba77526
--- /dev/null
+++ b/src/c/signalProcessing/includes/wiener.h
@@ -0,0 +1,30 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+
+#ifndef __WEINER_H__
+#define __WEINER_H__
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void dwienera(double* y, int y_row, int y_col, double* x0, int x0_row, int x0_col, double* p0, int p0_row, int p0_col, double* f, int f_row, int f_col, double* g, int g_row, int g_col, double* h, int h_row, int h_col, double* q, int q_row, int q_col, double* r, int r_row, int r_col, double* xs, double* ps, double* xf, double* pf);
+
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __WEINER_H__ */
+
diff --git a/src/c/signalProcessing/interfaces/int_kalm.h b/src/c/signalProcessing/interfaces/int_kalm.h
index b03977d..b4369c9 100644
--- a/src/c/signalProcessing/interfaces/int_kalm.h
+++ b/src/c/signalProcessing/interfaces/int_kalm.h
@@ -17,9 +17,4 @@
dkalma(in1, size1[0], size1[1],in2, size2[0], size2[1],in3, size3[0], size3[1],in4, size4[0], size4[1],in5, size5[0], size5[1] ,\
in6, size6[0], size6[1],in7, size7[0], size7[1],in8, size8[0], size8[1], out1, out2, out3, out4)
-
-#define z2z2z2z2z2z2z2z2kalmz2z2z2z2(in1, size1, in2, size2, in3, size3, in4, size4, in5, size5, in6, size6, in7, size7, in8, size8, out1, out2, out3, out4) \
- zkalma(in1, size1[0], size1[1],in2, size2[0], size2[1],in3, size3[0], size3[1],in4, size4[0], size4[1],in5, size5[0], size5[1] ,\
- in6, size6[0], size6[1],in7, size7[0], size7[1],in8, size8[0], size8[1], out1, out2, out3, out4)
-
#endif /* !INT_KALM_H__! */
diff --git a/src/c/signalProcessing/interfaces/int_weiner.h b/src/c/signalProcessing/interfaces/int_weiner.h
new file mode 100644
index 0000000..daefcf0
--- /dev/null
+++ b/src/c/signalProcessing/interfaces/int_weiner.h
@@ -0,0 +1,20 @@
+/* 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_WIENER_H__
+#define __INT_WIENER_H__
+
+#define d2d2d2d2d2d2d2d2wienerd2d2d2d2(in1, size1, in2, size2, in3, size3, in4, size4, in5, size5, in6, size6, in7, size7, in8, size8, out1, out2, out3, out4) \
+ dwienera(in1, size1[0], size1[1],in2, size2[0], size2[1],in3, size3[0], size3[1],in4, size4[0], size4[1],in5, size5[0], size5[1] ,\
+ in6, size6[0], size6[1],in7, size7[0], size7[1],in8, size8[0], size8[1], out1, out2, out3, out4)
+
+#endif /* !INT_WEINER_H__! */
diff --git a/src/c/signalProcessing/interfaces/int_wiener.h b/src/c/signalProcessing/interfaces/int_wiener.h
new file mode 100644
index 0000000..daefcf0
--- /dev/null
+++ b/src/c/signalProcessing/interfaces/int_wiener.h
@@ -0,0 +1,20 @@
+/* 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_WIENER_H__
+#define __INT_WIENER_H__
+
+#define d2d2d2d2d2d2d2d2wienerd2d2d2d2(in1, size1, in2, size2, in3, size3, in4, size4, in5, size5, in6, size6, in7, size7, in8, size8, out1, out2, out3, out4) \
+ dwienera(in1, size1[0], size1[1],in2, size2[0], size2[1],in3, size3[0], size3[1],in4, size4[0], size4[1],in5, size5[0], size5[1] ,\
+ in6, size6[0], size6[1],in7, size7[0], size7[1],in8, size8[0], size8[1], out1, out2, out3, out4)
+
+#endif /* !INT_WEINER_H__! */
diff --git a/src/c/signalProcessing/kalm/zkalma.c b/src/c/signalProcessing/kalm/zkalma.c
deleted file mode 100644
index f47e01e..0000000
--- a/src/c/signalProcessing/kalm/zkalma.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/* 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: Abhinav Dronamraju
- Organization: FOSSEE, IIT Bombay
- Email: toolbox@scilab.in
- */
-
-/*Function to find kalm */
-
-#include "lapack.h"
-#include "stdlib.h"
-#include "doubleComplex.h"
-#include "stdio.h"
-#include "string.h"
-#include "kalm.h"
-#include "matrixTranspose.h"
-#include "matrixMultiplication.h"
-#include "matrixInversion.h"
-#include "addition.h"
-#include "subtraction.h"
-#include "eye.h"
-
-void zkalma(doubleComplex* y, int y_row, int y_col, doubleComplex* x0, int x0_row, int x0_col,doubleComplex* p0, int p0_row, int p0_col, doubleComplex* f, int f_row, int f_col, doubleComplex* g, int g_row, int g_col, doubleComplex* h, int h_row, int h_col, doubleComplex* q, int q_row, int q_col, doubleComplex* r, int r_row, int r_col, doubleComplex* x1, doubleComplex* p1, doubleComplex* x, doubleComplex* p)
-
-{
- doubleComplex k[p0_row*h_row];
- doubleComplex h_trans[h_col*h_row];
- doubleComplex temp1[p0_row*h_row];
- doubleComplex temp2[h_row*p0_col];
- doubleComplex temp3[h_row*h_row];
- doubleComplex temp4[h_row*h_row];
- doubleComplex temp5[h_row*h_row];
- doubleComplex temp6[p0_row*p0_col];
- doubleComplex temp7[p0_row*h_col];
- doubleComplex temp8[p0_row*p0_col];
- doubleComplex f_trans[f_col*f_row];
- doubleComplex g_trans[g_col*g_row];
- doubleComplex temp9 [f_row*p0_col];
- doubleComplex temp10[f_row*f_row];
- doubleComplex temp11 [g_row*q_col];
- doubleComplex temp12[g_row*g_row];
- doubleComplex temp13[h_row*x0_col];
- doubleComplex temp14[h_row*x0_col];
- doubleComplex temp15[p0_row*x0_col];
-
-
-
- ztransposea(h, h_row, h_col, h_trans);
- zmulma(p0, p0_row, p0_col, h_trans, h_col, h_row, temp1); //temp1= p0*h'
- zmulma(h, h_row, h_col, p0, p0_row, p0_col, temp2); //temp2= h*p0
- zmulma(temp2, h_row, p0_col, h_trans, h_col, h_row, temp3); //temp3= h*p0*h'
- zadda(temp3, h_row*h_row, r, r_row*r_col, temp4); //temp4= h*p0*h'+r
-
-/*//Debug Only*/
-/* for(int i=0; i< h_row*h_row; i++)*/
-/* printf("temp4[%d] = %lf + i %lf\t",i, zreals(temp4[i]) , zimags(temp4[i]));*/
-/* printf("\n");*/
-
- zinverma(temp4, temp5, h_row); //temp5= (h*p0*h'+r)**(-1)
-
- zmulma(temp1, p0_row, h_row, temp5, h_row, h_row, k); //k=p0*h'*(h*p0*h'+r)**(-1)
-
-/*//Debug Only*/
-/* for(int i=0; i< p0_row*h_row; i++)*/
-/* printf("k[%d] = %lf \t",i, k[i]);*/
-/* printf("\n");*/
-
-
- zeyea(temp6, p0_row, p0_col); //temp6 = eye(p0)
- zmulma(k, p0_row, h_row, h, h_row, h_col, temp7); //temp7 = k*h
- zdiffa(temp6, p0_row*p0_col, temp7, p0_row*h_col, temp8); //temp8= eye(p0)- k*h
- zmulma(temp8, p0_row, p0_col, p0, p0_row, p0_col, p); //p=(eye(p0)-k*h)*p0
-
-/*//Debug Only*/
-/* for(int i=0; i< p0_row*p0_col; i++)*/
-/* printf("p[%d] = %lf \t",i, p[i]);*/
-/* printf("\n");*/
-
-
- ztransposea(g, g_row, g_col, g_trans);
- ztransposea(f, f_row, f_col, f_trans);
- zmulma(f, f_row, f_col, p, p0_row, p0_col, temp9); //temp9= f*p
- zmulma(temp9, f_row, p0_col, f_trans, f_col, f_row, temp10); //temp10= f*p*f'
- zmulma(g, g_row, g_col, q, q_row, q_col, temp11); //temp11= g*q
- zmulma(temp11, g_row, q_col, g_trans, g_col, g_row, temp12); //temp12= g*q*g'
- zadda(temp10, f_row*f_row, temp12, g_row*g_row, p1); //p1=f*p*f'+g*q*g'
-
-/* //Debug Only*/
-/* for(int i=0; i< f_row*f_row; i++)*/
-/* printf("p1[%d] = %lf \t",i, p1[i]);*/
-/* printf("\n");*/
-
-
- zmulma(h, h_row, h_col, x0, x0_row, x0_col, temp13); //temp13= h*x0
- zdiffa(y, y_row*y_col, temp13, h_row*x0_col, temp14); //temp14= y-h*x0
- zmulma(k, p0_row, h_row, temp14, h_row, x0_col, temp15); //temp15= k*(y-h*x0)
- zadda(x0, x0_row*x0_col, temp15, p0_row*x0_col, x); //x=x0+k*(y-h*x0)
-
-/* //Debug Only*/
-/* for(int i=0; i< x0_row*x0_col; i++)*/
-/* printf("x[%d] = %lf \t",i, x[i]);*/
-/* printf("\n");*/
-
-
- zmulma(f, f_row, f_col, x, x0_row, x0_col, x1) ; //x1= f*x
-
-/* //Debug Only*/
-/* for(int i=0; i< f_row*x0_col; i++)*/
-/* printf("x1[%d] = %lf \t",i, x1[i]);*/
-/* printf("\n");*/
-
-
-
-}
diff --git a/src/c/signalProcessing/wiener/dwienera.c b/src/c/signalProcessing/wiener/dwienera.c
new file mode 100644
index 0000000..18f49bc
--- /dev/null
+++ b/src/c/signalProcessing/wiener/dwienera.c
@@ -0,0 +1,166 @@
+/* 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: Abhinav Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+
+/*Function to find kalm */
+
+#include "lapack.h"
+#include "stdlib.h"
+#include "stdio.h"
+#include "string.h"
+#include "wiener.h"
+#include "kalm.h"
+#include "matrixTranspose.h"
+#include "matrixMultiplication.h"
+#include "matrixInversion.h"
+#include "addition.h"
+#include "subtraction.h"
+#include "eye.h"
+
+void dwienera(double* y, int y_row, int y_col, double* x0, int x0_row, int x0_col, double* p0, int p0_row, int p0_col, double* f, int f_row, int f_col, double* g, int g_row, int g_col, double* h, int h_row, int h_col, double* q, int q_row, int q_col, double* r, int r_row, int r_col, double* xs, double* ps, double* xf, double* pf)
+
+{
+
+/* dtransposea(h, h_row, h_col, h_trans);*/
+/* dmulma(p0, p0_row, p0_col, h_trans, h_col, h_row, temp1); //temp1= p0*h'*/
+/* dmulma(h, h_row, h_col, p0, p0_row, p0_col, temp2); //temp2= h*p0*/
+/* dmulma(temp2, h_row, p0_col, h_trans, h_col, h_row, temp3); //temp3= h*p0*h'*/
+/* dadda(temp3, h_row*h_row, r, r_row*r_col, temp4); //temp4= h*p0*h'+r*/
+
+ int n= x0_row, x0j= x0_col, m= y_row, tf= y_col, to=1, k;
+ double ind_nk[n];
+ double ind_mk[m];
+ double xf1[x0_row*x0_col];
+ double pf1[p0_row*p0_col];
+ double yk[y_row*1];
+ double fk[f_row*n];
+ double gk[g_row*n];
+ double hk[h_row*n];
+ double qk[q_row*n];
+ double rk[r_row*m];
+ double x1[f_row*x0_col];
+ double p1[f_row*f_row];
+ double x[x0_row*x0_col];
+ double p[p0_row*p0_col];
+
+
+for(int i=0; i< x0_row*x0_col; i++)
+ xf1[i]= x0[i];
+
+for(int i=0; i< p0_row*p0_col; i++)
+ pf1[i]= p0[i];
+
+for(k=t0; k<=tf; k++)
+{
+ int j=0;
+ for(int i=1+(k-1)*n; i<= k*n; i++)
+ {
+ ind_nk[j]= i;
+ j++;
+ }
+
+ int j=0;
+ for(int i=1+(k-1)*m; i<= k*m; i++)
+ {
+ ind_mk[j]= i;
+ j++;
+ }
+
+ for(int i=0; i< y_row; y++)
+ {
+ int j=k-1;
+
+ yk[i]= y[i+j*y_row];
+
+ }
+int l=0;
+ for(int i=0; i<n; i++)
+ {
+ for(int j=0; j< f_row; j++)
+ {
+ int k=ind_nk[i]-1;
+
+ fk[l]= f[j+k*y_row];
+ l++;
+ }
+
+
+ }
+
+int l=0;
+ for(int i=0; i<n; i++)
+ {
+ for(int j=0; j< g_row; j++)
+ {
+ int k=ind_nk[i]-1;
+
+ gk[l]= g[j+k*y_row];
+ l++;
+ }
+
+
+ }
+
+int l=0;
+ for(int i=0; i<n; i++)
+ {
+ for(int j=0; j< h_row; j++)
+ {
+ int k=ind_nk[i]-1;
+
+ hk[l]= h[j+k*y_row];
+ l++;
+ }
+
+
+ }
+
+int l=0;
+ for(int i=0; i<n; i++)
+ {
+ for(int j=0; j< q_row; j++)
+ {
+ int k=ind_nk[i]-1;
+
+ qk[l]= q[j+k*y_row];
+ l++;
+ }
+
+
+ }
+
+int l=0;
+ for(int i=0; i<m; i++)
+ {
+ for(int j=0; j< r_row; j++)
+ {
+ int k=ind_mk[i]-1;
+
+ rk[l]= r[j+k*y_row];
+ l++;
+ }
+
+
+ }
+
+
+dkalma(yk, y_row, 1, x0, x0_row, x0_col, p0, p0_row, p0_col, fk, f_row, n, gk, g_row, n, hk, h_row, n, qk, q_row, n, rk, r_row, m, x1, p1, x, p);
+
+
+
+
+}
+
+
+
+
+
+}
diff --git a/src/c/statisticsFunctions/includes/mvcorrel.h b/src/c/statisticsFunctions/includes/mvcorrel.h
index 857bfd6..f1ed94c 100644
--- a/src/c/statisticsFunctions/includes/mvcorrel.h
+++ b/src/c/statisticsFunctions/includes/mvcorrel.h
@@ -22,7 +22,11 @@
extern "C" {
#endif
-void dmvcorrela(double* , int, int, double* );
+void dmvcorrela(double* , int, int, double* );
+double dmvcorrel1a( int, int);
+
+void smvcorrela(float* , int, int, float* );
+float smvcorrel1a( int, int);
diff --git a/src/c/statisticsFunctions/includes/strange.h b/src/c/statisticsFunctions/includes/strange.h
new file mode 100644
index 0000000..0c783ad
--- /dev/null
+++ b/src/c/statisticsFunctions/includes/strange.h
@@ -0,0 +1,43 @@
+/* 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 __STRANGE_H__
+#define __STRANGE_H__
+
+
+#include "types.h"
+#include "doubleComplex.h"
+#include "floatComplex.h"
+#include "uint16.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+double dstrangea (double* , int);
+void dstrangerowa (double*, int , int, double*);
+void dstrangecola (double*, int , int, double*);
+
+float sstrangea (float* , int);
+void sstrangerowa (float*, int , int, float*);
+void sstrangecola (float*, int , int, float*);
+
+uint16 u16strangea (uint16* , int);
+void u16strangerowa (uint16*, int , int, uint16*);
+void u16strangecola (uint16*, int , int, uint16*);
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif
diff --git a/src/c/statisticsFunctions/interfaces/int_mvcorrel.h b/src/c/statisticsFunctions/interfaces/int_mvcorrel.h
index 361687b..481841f 100644
--- a/src/c/statisticsFunctions/interfaces/int_mvcorrel.h
+++ b/src/c/statisticsFunctions/interfaces/int_mvcorrel.h
@@ -19,7 +19,12 @@ extern "C" {
#endif
#define d2mvcorreld2(in1, size, out) dmvcorrela(in1, size[0] ,size[1], out)
+#define d2mvcorreld0(in1, size) dmvcorrel1a( size[0], size[1] )
+#define d0mvcorreld0(in1) dmvcorrel1a( 1,1 )
+#define s2mvcorrels2(in1, size, out) smvcorrela(in1, size[0] ,size[1], out)
+#define s2mvcorrels0(in1, size) smvcorrel1a( size[0], size[1] )
+#define s0mvcorrels0(in1) smvcorrel1a( 1,1 )
#ifdef __cplusplus
} /* extern "C" */
diff --git a/src/c/statisticsFunctions/interfaces/int_strange.h b/src/c/statisticsFunctions/interfaces/int_strange.h
new file mode 100644
index 0000000..133ec2b
--- /dev/null
+++ b/src/c/statisticsFunctions/interfaces/int_strange.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_STRANGE_H__
+#define __INT_STRANGE_H__
+
+#define d2stranged0(in1, size) dstrangea(in1,size[0]* size[1])
+#define d2g2stranged2(in1, size1, in2, size2, out) (in2[0]=='r') ? dstrangerowa(in1, size1[0], size1[1], out) : dstrangecola(in1, size1[0] , size1[1], out)
+
+#define s2stranges0(in1, size) sstrangea(in1,size[0]* size[1])
+#define s2g2stranges2(in1, size1, in2, size2, out) (in2[0]=='r') ? sstrangerowa(in1, size1[0], size1[1], out) : sstrangecola(in1, size1[0] , size1[1], out)
+
+#define u162strangeu160(in1, size) u16strangea(in1,size[0]* size[1])
+#define u162g2strangeu162(in1, size1, in2, size2, out) (in2[0]=='r') ? u16strangerowa(in1, size1[0], size1[1], out) : u16strangecola(in1, size1[0] , size1[1], out)
+
+
+#endif
diff --git a/src/c/statisticsFunctions/mvcorrel/dmvcorrel1a.c b/src/c/statisticsFunctions/mvcorrel/dmvcorrel1a.c
new file mode 100644
index 0000000..9971e0f
--- /dev/null
+++ b/src/c/statisticsFunctions/mvcorrel/dmvcorrel1a.c
@@ -0,0 +1,34 @@
+/* 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 "mvcorrel.h"
+#include "stdlib.h"
+#include "stdio.h"
+#include "types.h"
+#include "uint16.h"
+#include "zeros.h"
+#include "sum.h"
+#include "ones.h"
+#include "matrixMultiplication.h"
+#include "matrixTranspose.h"
+#include "subtraction.h"
+#include "division.h"
+
+double dmvcorrel1a(int lx, int cx)
+{
+ if(lx==1 && cx==1)
+ return 0;
+
+ else
+ return 1;
+}
diff --git a/src/c/statisticsFunctions/mvcorrel/dmvcorrela.c b/src/c/statisticsFunctions/mvcorrel/dmvcorrela.c
index 646e3db..a1bacfd 100644
--- a/src/c/statisticsFunctions/mvcorrel/dmvcorrela.c
+++ b/src/c/statisticsFunctions/mvcorrel/dmvcorrela.c
@@ -12,30 +12,40 @@
#include "mvcorrel.h"
+#include "stdlib.h"
#include "stdio.h"
+#include "pow.h"
+#include "division.h"
#include "types.h"
#include "uint16.h"
#include "zeros.h"
#include "sum.h"
#include "ones.h"
#include "matrixMultiplication.h"
+#include "matrixTranspose.h"
#include "subtraction.h"
+#include "division.h"
-void dmvcorrela(double *in, int lx, int cx, double* out)
+void dmvcorrela(double *in, int lx, int cx, double* r)
{
double temp1[1* cx];
double xbar[1* cx];
double temp2[lx*1];
double temp3[lx*cx];
double temp4[lx*cx];
+ double temp4_trans[cx*lx];
double temp5[1* cx];
+ double temp6[lx*cx];
double std[1*cx];
+ double std_trans[cx*1];
+ double temp7[cx*cx];
+ double temp8[cx*cx];
donesa ( temp2 , lx , 1 ); //temp2= ones(lx,1)
if(lx==1)
{
- dzerosa ( out , lx ,cx ); //out= zeros(lx,cx)
+ dzerosa ( r , cx ,cx ); //out= zeros(lx,cx)
}
@@ -45,23 +55,31 @@ void dmvcorrela(double *in, int lx, int cx, double* out)
drowsuma(in, lx, cx, temp1); //temp1= sum(x, "r")
for(int i=0; i< 1*cx; i++)
- xbar[i]= temp1[i]/ lx; // xbar= sum(x, "r")/ lx
- //Debug Only
- for(int i= 0; i< 1*cx; i++)
- printf("xbar[%d]= %lf", i, xbar[i]);
- printf("\n");
+ xbar[i]= drdivs(temp1[i], lx); // xbar= sum(x, "r")/ lx
+/* //Debug Only*/
+/* for(int i= 0; i< 1*cx; i++)*/
+/* printf("xbar[%d]= %lf\t", i, xbar[i]);*/
+/* printf("\n");*/
dmulma(temp2, lx,1, xbar, 1, cx, temp3 ); //temp3= ones(lx,1)*xbar
- ddiffa(in, lx*cx, temp3, lx*cx, temp4); //temp4= x-ones(lx,1)*xbar
+ ddiffa(in, lx*cx, temp3, lx*cx, temp4); //temp4= r= x-ones(lx,1)*xbar
for(int i=0; i< lx*cx; i++)
- temp4[i]= pow(temp4[i], 2);
- drowsuma(temp4, lx, cx, temp5); //temp5= sum(r.^2, "r")
+ temp6[i]= dpows(temp4[i], 2); //temp6= r.^2
+ drowsuma(temp6, lx, cx, temp5); //temp5= sum(r.^2, "r")
for(int i=0; i< 1*cx; i++)
- std[i]= pow(temp5[i], 0.5);
- //Debug Only
- for(int i= 0; i< 1*cx; i++)
- printf("std[%d]= %lf", i, std[i]);
- printf("\n");
+ std[i]= dpows(temp5[i], 0.5); //std=(sum(r .^2,"r")) .^ (0.5)
+/* //Debug Only*/
+/* for(int i= 0; i< 1*cx; i++)*/
+/* printf("std[%d]= %lf\t", i, std[i]);*/
+/* printf("\n"); */
+ dtransposea ( temp4 , lx , cx, temp4_trans); //temp4_trans= r'
+ dtransposea ( std , 1 , cx, std_trans); //std_trans= std'
+ dmulma(temp4_trans, cx,lx, temp4, lx, cx, temp7 ); //temp7= r'*r
+ dmulma(std_trans, cx, 1, std, 1,cx, temp8); //temp8= std'*std
+
+ drdiva (temp7, temp8, cx*cx, r); // r=(r'*r) ./ (std'*std)
+
+
}
diff --git a/src/c/statisticsFunctions/mvcorrel/smvcorrel1a.c b/src/c/statisticsFunctions/mvcorrel/smvcorrel1a.c
new file mode 100644
index 0000000..345ce60
--- /dev/null
+++ b/src/c/statisticsFunctions/mvcorrel/smvcorrel1a.c
@@ -0,0 +1,34 @@
+/* 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 "mvcorrel.h"
+#include "stdlib.h"
+#include "stdio.h"
+#include "types.h"
+#include "uint16.h"
+#include "zeros.h"
+#include "sum.h"
+#include "ones.h"
+#include "matrixMultiplication.h"
+#include "matrixTranspose.h"
+#include "subtraction.h"
+#include "division.h"
+
+float smvcorrel1a(int lx, int cx)
+{
+ if(lx==1 && cx==1)
+ return 0;
+
+ else
+ return 1;
+}
diff --git a/src/c/statisticsFunctions/mvcorrel/smvcorrela.c b/src/c/statisticsFunctions/mvcorrel/smvcorrela.c
new file mode 100644
index 0000000..8894cee
--- /dev/null
+++ b/src/c/statisticsFunctions/mvcorrel/smvcorrela.c
@@ -0,0 +1,87 @@
+/* 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 "mvcorrel.h"
+#include "stdlib.h"
+#include "stdio.h"
+#include "types.h"
+#include "pow.h"
+#include "uint16.h"
+#include "zeros.h"
+#include "sum.h"
+#include "ones.h"
+#include "matrixMultiplication.h"
+#include "division.h"
+#include "matrixTranspose.h"
+#include "subtraction.h"
+#include "division.h"
+
+void smvcorrela(float *in, int lx, int cx, float* r)
+{
+ float temp1[1* cx];
+ float xbar[1* cx];
+ float temp2[lx*1];
+ float temp3[lx*cx];
+ float temp4[lx*cx];
+ float temp4_trans[cx*lx];
+ float temp5[1* cx];
+ float temp6[lx*cx];
+ float std[1*cx];
+ float std_trans[cx*1];
+ float temp7[cx*cx];
+ float temp8[cx*cx];
+
+ sonesa ( temp2 , lx , 1 ); //temp2= ones(lx,1)
+
+ if(lx==1)
+ {
+ szerosa ( r , cx ,cx ); //out= zeros(lx,cx)
+
+ }
+
+ else
+ {
+
+ srowsuma(in, lx, cx, temp1); //temp1= sum(x, "r")
+
+ for(int i=0; i< 1*cx; i++)
+ xbar[i]= srdivs(temp1[i], lx); // xbar= sum(x, "r")/ lx
+/* //Debug Only*/
+/* for(int i= 0; i< 1*cx; i++)*/
+/* printf("xbar[%d]= %lf\t", i, xbar[i]);*/
+/* printf("\n");*/
+
+ smulma(temp2, lx,1, xbar, 1, cx, temp3 ); //temp3= ones(lx,1)*xbar
+ sdiffa(in, lx*cx, temp3, lx*cx, temp4); //temp4= r= x-ones(lx,1)*xbar
+ for(int i=0; i< lx*cx; i++)
+ temp6[i]= spows(temp4[i], 2); //temp6= r.^2
+ srowsuma(temp6, lx, cx, temp5); //temp5= sum(r.^2, "r")
+ for(int i=0; i< 1*cx; i++)
+ std[i]= spows(temp5[i], 0.5); //std=(sum(r .^2,"r")) .^ (0.5)
+/* //Debug Only*/
+/* for(int i= 0; i< 1*cx; i++)*/
+/* printf("std[%d]= %lf\t", i, std[i]);*/
+/* printf("\n"); */
+ stransposea ( temp4 , lx , cx, temp4_trans); //temp4_trans= r'
+ stransposea ( std , 1 , cx, std_trans); //std_trans= std'
+ smulma(temp4_trans, cx,lx, temp4, lx, cx, temp7 ); //temp7= r'*r
+ smulma(std_trans, cx, 1, std, 1,cx, temp8); //temp8= std'*std
+
+ srdiva (temp7, temp8, cx*cx, r); // r=(r'*r) ./ (std'*std)
+
+
+ }
+
+
+
+}
diff --git a/src/c/statisticsFunctions/strange/dstrangea.c b/src/c/statisticsFunctions/strange/dstrangea.c
new file mode 100644
index 0000000..9dc94fe
--- /dev/null
+++ b/src/c/statisticsFunctions/strange/dstrangea.c
@@ -0,0 +1,60 @@
+/* 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 "strange.h"
+#include "types.h"
+#include "uint16.h"
+#include "subtraction.h"
+
+double dstrangea(double *in, int size)
+{
+ double a; double in_copy[size];
+
+ for(int i=0; i< size; i++)
+
+ {
+ in_copy[i]= in[i];
+
+ }
+
+
+
+ for (int i = 0; i < size; ++i)
+
+ {
+
+ for (int j = i + 1; j < size; ++j)
+
+ {
+
+ if (in_copy[i] > in_copy[j])
+
+ {
+
+ a = in_copy[i];
+
+ in_copy[i] = in_copy[j];
+
+ in_copy[j] = a;
+
+ }
+
+ }
+
+ }
+
+
+
+return ddiffs(in_copy[size-1],in_copy[0]);
+
+}
diff --git a/src/c/statisticsFunctions/strange/dstrangecola.c b/src/c/statisticsFunctions/strange/dstrangecola.c
new file mode 100644
index 0000000..d6a11e3
--- /dev/null
+++ b/src/c/statisticsFunctions/strange/dstrangecola.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 "strange.h"
+#include "types.h"
+#include "uint16.h"
+#include "stdio.h"
+
+void dstrangecola(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]= dstrangea(inter, col);
+
+ }
+
+
+}
diff --git a/src/c/statisticsFunctions/strange/dstrangerowa.c b/src/c/statisticsFunctions/strange/dstrangerowa.c
new file mode 100644
index 0000000..f63df35
--- /dev/null
+++ b/src/c/statisticsFunctions/strange/dstrangerowa.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 "strange.h"
+#include "types.h"
+#include "uint16.h"
+
+void dstrangerowa(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]= dstrangea(inter, row);
+ }
+
+
+}
diff --git a/src/c/statisticsFunctions/strange/sstrangea.c b/src/c/statisticsFunctions/strange/sstrangea.c
new file mode 100644
index 0000000..f79b00a
--- /dev/null
+++ b/src/c/statisticsFunctions/strange/sstrangea.c
@@ -0,0 +1,60 @@
+/* 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 "strange.h"
+#include "types.h"
+#include "uint16.h"
+#include "subtraction.h"
+
+float sstrangea(float *in, int size)
+{
+ float a; float in_copy[size];
+
+ for(int i=0; i< size; i++)
+
+ {
+ in_copy[i]= in[i];
+
+ }
+
+
+
+ for (int i = 0; i < size; ++i)
+
+ {
+
+ for (int j = i + 1; j < size; ++j)
+
+ {
+
+ if (in_copy[i] > in_copy[j])
+
+ {
+
+ a = in_copy[i];
+
+ in_copy[i] = in_copy[j];
+
+ in_copy[j] = a;
+
+ }
+
+ }
+
+ }
+
+
+
+return sdiffs(in_copy[size-1],in_copy[0]);
+
+}
diff --git a/src/c/statisticsFunctions/strange/sstrangecola.c b/src/c/statisticsFunctions/strange/sstrangecola.c
new file mode 100644
index 0000000..4c8e90a
--- /dev/null
+++ b/src/c/statisticsFunctions/strange/sstrangecola.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 "strange.h"
+#include "types.h"
+#include "uint16.h"
+#include "stdio.h"
+
+void sstrangecola(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]= sstrangea(inter, col);
+
+ }
+
+
+}
diff --git a/src/c/statisticsFunctions/strange/sstrangerowa.c b/src/c/statisticsFunctions/strange/sstrangerowa.c
new file mode 100644
index 0000000..50c1165
--- /dev/null
+++ b/src/c/statisticsFunctions/strange/sstrangerowa.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 "strange.h"
+#include "types.h"
+#include "uint16.h"
+
+void sstrangerowa(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]= sstrangea(inter, row);
+ }
+
+
+}
diff --git a/src/c/statisticsFunctions/strange/u16strangea.c b/src/c/statisticsFunctions/strange/u16strangea.c
new file mode 100644
index 0000000..66b31fb
--- /dev/null
+++ b/src/c/statisticsFunctions/strange/u16strangea.c
@@ -0,0 +1,60 @@
+/* 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 "strange.h"
+#include "types.h"
+#include "uint16.h"
+#include "subtraction.h"
+
+uint16 u16strangea(uint16 *in, int size)
+{
+ uint16 a; uint16 in_copy[size];
+
+ for(int i=0; i< size; i++)
+
+ {
+ in_copy[i]= in[i];
+
+ }
+
+
+
+ for (int i = 0; i < size; ++i)
+
+ {
+
+ for (int j = i + 1; j < size; ++j)
+
+ {
+
+ if (in_copy[i] > in_copy[j])
+
+ {
+
+ a = in_copy[i];
+
+ in_copy[i] = in_copy[j];
+
+ in_copy[j] = a;
+
+ }
+
+ }
+
+ }
+
+
+
+return u16diffs(in_copy[size-1],in_copy[0]);
+
+}
diff --git a/src/c/statisticsFunctions/strange/u16strangecola.c b/src/c/statisticsFunctions/strange/u16strangecola.c
new file mode 100644
index 0000000..6978360
--- /dev/null
+++ b/src/c/statisticsFunctions/strange/u16strangecola.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 "strange.h"
+#include "types.h"
+#include "uint16.h"
+#include "stdio.h"
+
+void u16strangecola(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]= u16strangea(inter, col);
+
+ }
+
+
+}
diff --git a/src/c/statisticsFunctions/strange/u16strangerowa.c b/src/c/statisticsFunctions/strange/u16strangerowa.c
new file mode 100644
index 0000000..b7f878d
--- /dev/null
+++ b/src/c/statisticsFunctions/strange/u16strangerowa.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 "strange.h"
+#include "types.h"
+#include "uint16.h"
+
+void u16strangerowa(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]= u16strangea(inter, row);
+ }
+
+
+}