summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhinav Dronamraju2017-08-03 21:55:47 +0530
committerAbhinav Dronamraju2017-08-03 21:55:47 +0530
commitcdd9b1eb4471ee2d4bf14b020ae97803ffc29702 (patch)
tree675c4a3ff180d9674342c41eedeafc2518524554
parentc73be8f2ad1c7c11f67ba31817f9d051bfa29fa1 (diff)
downloadScilab2C_fossee_old-cdd9b1eb4471ee2d4bf14b020ae97803ffc29702.tar.gz
Scilab2C_fossee_old-cdd9b1eb4471ee2d4bf14b020ae97803ffc29702.tar.bz2
Scilab2C_fossee_old-cdd9b1eb4471ee2d4bf14b020ae97803ffc29702.zip
Hank ADDED
-rw-r--r--demos/Abhinav_Demos/test_hank.sci21
-rw-r--r--includes/sci2clib.h3
-rw-r--r--jar/scilab_en_US_help.jarbin18123 -> 11210 bytes
-rw-r--r--macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci26
-rw-r--r--macros/findDeps/getAllHeaders.sci1
-rw-r--r--macros/findDeps/getAllInterfaces.sci1
-rw-r--r--macros/findDeps/getAllSources.sci4
-rw-r--r--src/c/signalProcessing/hank/dhanka.c110
-rw-r--r--src/c/signalProcessing/hank/shanka.c110
-rw-r--r--src/c/signalProcessing/includes/hank.h33
-rw-r--r--src/c/signalProcessing/interfaces/int_hank.h21
11 files changed, 330 insertions, 0 deletions
diff --git a/demos/Abhinav_Demos/test_hank.sci b/demos/Abhinav_Demos/test_hank.sci
new file mode 100644
index 0000000..b55cbc8
--- /dev/null
+++ b/demos/Abhinav_Demos/test_hank.sci
@@ -0,0 +1,21 @@
+// Test file for "Column" function for the data types double, float, double complex, string , uint16.
+// All the below statements are added to initialize variables in different data types
+//The function written doesn't work for string or character scalar as of now.
+
+
+function test_hank()
+ seq= [1 21 123 12;11 4 5 6]
+ final= hank(2,1,seq);
+ //disp(seq)
+ disp('')
+ disp(final)
+ disp('')
+ seq1= float([21 1231 1 12; 1231 12 21 2])
+ a=float(2)
+ b=float(1)
+ final1 = hank(a,b, seq1)
+ disp('')
+ disp(final1)
+ disp('')
+
+endfunction
diff --git a/includes/sci2clib.h b/includes/sci2clib.h
index 4b038ad..4a986c6 100644
--- a/includes/sci2clib.h
+++ b/includes/sci2clib.h
@@ -543,6 +543,9 @@ extern "C" {
/* interfacing dct */
#include "dct.h"
#include "int_dct.h"
+/* interfacing hank */
+#include "hank.h"
+#include "int_hank.h"
/* interfacing convol */
#include "conv.h"
diff --git a/jar/scilab_en_US_help.jar b/jar/scilab_en_US_help.jar
index 0217990..c78f0c2 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 5539dda..4e7dd67 100644
--- a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
+++ b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
@@ -7761,6 +7761,32 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file',
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+//------------------------------------
+//---- Class HANK --------------------
+//------------------------------------
+ClassName = 'HANK';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+
+//Arguements specified: initial value, start time, time vector, ode function
+PrintStringInfo('NIN= 3',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= FA_MUL(IN(1).VAL,IN(3).SZ(1))',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= FA_MUL(IN(2).VAL,IN(3).SZ(1))',ClassFileName,'file','y');
+
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d0d0d2'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('s0s0s2'+ArgSeparator+'s2',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'hank';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
//------------------------------------
//---- Class FLIPDIM -----------------
//------------------------------------
diff --git a/macros/findDeps/getAllHeaders.sci b/macros/findDeps/getAllHeaders.sci
index 83a86b7..c3376e3 100644
--- a/macros/findDeps/getAllHeaders.sci
+++ b/macros/findDeps/getAllHeaders.sci
@@ -170,6 +170,7 @@ function allHeaders = getAllHeaders(SharedInfo)
"src/c/string/includes/disp.h"
"src/c/string/includes/str.h"
"src/c/signalProcessing/includes/modk.h"
+ "src/c/signalProcessing/includes/hank.h"
"src/c/signalProcessing/includes/idct.h"
"src/c/signalProcessing/includes/dct.h"
"src/c/signalProcessing/fft/fft_internal.h"
diff --git a/macros/findDeps/getAllInterfaces.sci b/macros/findDeps/getAllInterfaces.sci
index d0bc1ca..d16aadb 100644
--- a/macros/findDeps/getAllInterfaces.sci
+++ b/macros/findDeps/getAllInterfaces.sci
@@ -172,6 +172,7 @@ function allInterfaces = getAllInterfaces(SharedInfo)
"src/c/string/interfaces/int_disp.h"
"src/c/string/interfaces/int_string.h"
"src/c/signalProcessing/interfaces/int_modk.h"
+ "src/c/signalProcessing/interfaces/int_hank.h"
"src/c/signalProcessing/interfaces/int_idct.h"
"src/c/signalProcessing/interfaces/int_dct.h"
"src/c/signalProcessing/interfaces/int_ifft.h"
diff --git a/macros/findDeps/getAllSources.sci b/macros/findDeps/getAllSources.sci
index 5cdcd94..dc27e0a 100644
--- a/macros/findDeps/getAllSources.sci
+++ b/macros/findDeps/getAllSources.sci
@@ -1221,6 +1221,10 @@ function allSources = getAllSources(SharedInfo,BuildTool)
"src/c/signalProcessing/conv/sconva.c"
"src/c/signalProcessing/conv/zconva.c"
"src/c/signalProcessing/conv/cconva.c"
+ "src/c/signalProcessing/hank/dhanka.c"
+ "src/c/signalProcessing/hank/shanka.c"
+ //"src/c/signalProcessing/conv/zconva.c"
+ //"src/c/signalProcessing/conv/cconva.c"
"src/c/signalProcessing/ifft/difftbi.c"
"src/c/signalProcessing/ifft/difftma.c"
"src/c/signalProcessing/ifft/difftmx.c"
diff --git a/src/c/signalProcessing/hank/dhanka.c b/src/c/signalProcessing/hank/dhanka.c
new file mode 100644
index 0000000..1857cc2
--- /dev/null
+++ b/src/c/signalProcessing/hank/dhanka.c
@@ -0,0 +1,110 @@
+/* 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 "hank.h"
+#include "types.h"
+#include "ones.h"
+#include "kron.h"
+#include "addition.h"
+#include "matrix.h"
+
+void dhanka(int m, int n, double*seq_conv, int row, int col, double*out)
+{
+ int mr, nr;
+ mr= m* row;
+ nr= n* row;
+ double ones1[1*nr];
+ double ones2[m*1];
+ double temp1[mr*1];
+ double temp2[1*nr];
+ double middle1[m*nr];
+ double middle2[m*nr];
+ double index[m*nr];
+ double final[row*m*nr];
+
+
+ donesa(ones1, 1 , nr);
+ donesa(ones2, m , 1);
+int j=0;
+for(int i=1; i< mr+1; i= i+row)
+ {
+ temp1[j]=i;
+ j++;
+ printf("%d", i);
+ }
+for(int j=0;j< nr; j++)
+ temp2[j]=j;
+
+ dkrona(ones1, 1 , nr, temp1, m , 1 , middle1);
+ dkrona(temp2, 1 , nr, ones2, m , 1 , middle2);
+
+ dadda(middle1, m*nr, middle2, m*nr, index);
+
+
+for(int i=0; i< m*nr; i++)
+ {
+
+ for(int j=0; j<row; j++)
+ {
+ int rank=index[i];
+ final[(i*row)+j]= seq_conv[ j+(rank-1)*row];
+
+ }
+
+ }
+
+/*
+printf("ones1\n");
+for(int k=0; k<1*nr; k++)
+ printf("%lf\t", ones1[k]);
+printf("\n");
+
+printf("ones2\n");
+for(int k=0; k<m*1; k++)
+ printf("%lf\t", ones2[k]);
+printf("\n");
+
+printf("temp1\n");
+for(int k=0; k<m*1; k++)
+ printf("%lf\t", temp1[k]);
+printf("\n");
+
+printf("temp2\n");
+for(int k=0; k<nr*1; k++)
+ printf("%lf\t", temp2[k]);
+printf("\n");
+
+printf("middle1\n");
+for(int k=0; k<m*nr; k++)
+ printf("%lf\t", middle1[k]);
+printf("\n");
+
+printf("middle2\n");
+for(int k=0; k<m*nr; k++)
+ printf("%lf\t", middle2[k]);
+printf("\n");
+
+printf("index\n");
+for(int k=0; k<m*nr; k++)
+ printf("%lf\t", index[k]);
+printf("\n");
+
+printf("final\n");
+for(int k=0; k<row*m*nr; k++)
+ printf("%lf\t", final[k]);
+printf("\n");
+*/
+
+ dmatrixa(final, row, m*nr, mr, (row*m*nr)/mr, out);
+
+}
diff --git a/src/c/signalProcessing/hank/shanka.c b/src/c/signalProcessing/hank/shanka.c
new file mode 100644
index 0000000..1c8f018
--- /dev/null
+++ b/src/c/signalProcessing/hank/shanka.c
@@ -0,0 +1,110 @@
+/* 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 "hank.h"
+#include "types.h"
+#include "ones.h"
+#include "kron.h"
+#include "addition.h"
+#include "matrix.h"
+
+void shanka(int m, int n, float*seq_conv, int row, int col, float*out)
+{
+ int mr, nr;
+ mr= m* row;
+ nr= n* row;
+ float ones1[1*nr];
+ float ones2[m*1];
+ float temp1[mr*1];
+ float temp2[1*nr];
+ float middle1[m*nr];
+ float middle2[m*nr];
+ float index[m*nr];
+ float final[row*m*nr];
+
+
+ sonesa(ones1, 1 , nr);
+ sonesa(ones2, m , 1);
+int j=0;
+for(int i=1; i< mr+1; i= i+row)
+ {
+ temp1[j]=i;
+ j++;
+ //printf("%d", i);
+ }
+for(int j=0;j< nr; j++)
+ temp2[j]=j;
+
+ skrona(ones1, 1 , nr, temp1, m , 1 , middle1);
+ skrona(temp2, 1 , nr, ones2, m , 1 , middle2);
+
+ sadda(middle1, m*nr, middle2, m*nr, index);
+
+
+for(int i=0; i< m*nr; i++)
+ {
+
+ for(int j=0; j<row; j++)
+ {
+ int rank=index[i];
+ final[(i*row)+j]= seq_conv[ j+(rank-1)*row];
+
+ }
+
+ }
+
+/*
+printf("ones1\n");
+for(int k=0; k<1*nr; k++)
+ printf("%f\t", ones1[k]);
+printf("\n");
+
+printf("ones2\n");
+for(int k=0; k<m*1; k++)
+ printf("%f\t", ones2[k]);
+printf("\n");
+
+printf("temp1\n");
+for(int k=0; k<m*1; k++)
+ printf("%f\t", temp1[k]);
+printf("\n");
+
+printf("temp2\n");
+for(int k=0; k<nr*1; k++)
+ printf("%f\t", temp2[k]);
+printf("\n");
+
+printf("middle1\n");
+for(int k=0; k<m*nr; k++)
+ printf("%f\t", middle1[k]);
+printf("\n");
+
+printf("middle2\n");
+for(int k=0; k<m*nr; k++)
+ printf("%f\t", middle2[k]);
+printf("\n");
+
+printf("index\n");
+for(int k=0; k<m*nr; k++)
+ printf("%f\t", index[k]);
+printf("\n");
+
+printf("final\n");
+for(int k=0; k<row*m*nr; k++)
+ printf("%f\t", final[k]);
+printf("\n");
+*/
+
+ smatrixa(final, row, m*nr, mr, (row*m*nr)/mr, out);
+
+}
diff --git a/src/c/signalProcessing/includes/hank.h b/src/c/signalProcessing/includes/hank.h
new file mode 100644
index 0000000..1b661ec
--- /dev/null
+++ b/src/c/signalProcessing/includes/hank.h
@@ -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
+ */
+
+#ifndef __HANK_H__
+#define __HANK_H__
+#include "types.h"
+#include "doubleComplex.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void dhanka(int m, int n, double*seq_conv, int row, int col, double*out);
+
+void shanka(int m, int n, float*seq_conv, int row, int col, float*out);
+
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __HANK_H__ */
+
diff --git a/src/c/signalProcessing/interfaces/int_hank.h b/src/c/signalProcessing/interfaces/int_hank.h
new file mode 100644
index 0000000..45ab9b6
--- /dev/null
+++ b/src/c/signalProcessing/interfaces/int_hank.h
@@ -0,0 +1,21 @@
+/* Copyright (C) 2017 - IIT Bombay - FOSSEE
+
+ This file must be used under the terms of the CeCILL.
+ This source file is licensed as described in the file COPYING, which
+ you should have received as part of this distribution. The terms
+ are also available at
+ http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ Author: ABHINAV Dronamraju
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+
+#ifndef __INT_HANK_H__
+#define __INT_HANK_H__
+
+#define d0d0d2hankd2( in1, in2, in3, size1, out) dhanka(in1, in2, in3, size1[0], size1[1], out)
+
+#define s0s0s2hanks2( in1, in2, in3, size1, out) shanka(in1, in2, in3, size1[0], size1[1], out)
+
+#endif /* !INT_HANK_! */
+