summaryrefslogtreecommitdiff
path: root/2.3-1
diff options
context:
space:
mode:
Diffstat (limited to '2.3-1')
-rw-r--r--2.3-1/includes/sci2clib.h5
-rw-r--r--2.3-1/macros/FunctionAnnotation/FA_SZ_LINSPACE_ROW.sci4
-rw-r--r--2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci36
-rw-r--r--2.3-1/macros/findDeps/getAllHeaders.sci1
-rw-r--r--2.3-1/macros/findDeps/getAllInterfaces.sci1
-rw-r--r--2.3-1/macros/findDeps/getAllSources.sci2
-rw-r--r--2.3-1/src/c/elementaryFunctions/includes/linspace.h36
-rw-r--r--2.3-1/src/c/elementaryFunctions/interfaces/int_linspace.h10
-rw-r--r--2.3-1/src/c/elementaryFunctions/linspace/dlinspacea.c39
-rw-r--r--2.3-1/src/c/elementaryFunctions/linspace/dlinspacea.c~39
-rw-r--r--2.3-1/src/c/elementaryFunctions/linspace/dlinspaces.c25
-rw-r--r--2.3-1/src/c/elementaryFunctions/linspace/dlinspaces.c~25
-rw-r--r--2.3-1/src/c/elementaryFunctions/linspace/u8linspacea.c~39
-rw-r--r--2.3-1/src/c/elementaryFunctions/linspace/u8linspaces.c~25
14 files changed, 287 insertions, 0 deletions
diff --git a/2.3-1/includes/sci2clib.h b/2.3-1/includes/sci2clib.h
index a9462b82..4cbcd003 100644
--- a/2.3-1/includes/sci2clib.h
+++ b/2.3-1/includes/sci2clib.h
@@ -212,6 +212,11 @@
#include "int_bitget.h"
+/*interfacing linspace */
+#include "linspace.h"
+#include "int_linspace.h"
+
+
/* IMPLICIT LISTS */
/* interfacing implicitList/OpColon */
#include "implicitList.h"
diff --git a/2.3-1/macros/FunctionAnnotation/FA_SZ_LINSPACE_ROW.sci b/2.3-1/macros/FunctionAnnotation/FA_SZ_LINSPACE_ROW.sci
new file mode 100644
index 00000000..986b5291
--- /dev/null
+++ b/2.3-1/macros/FunctionAnnotation/FA_SZ_LINSPACE_ROW.sci
@@ -0,0 +1,4 @@
+function outsize = FA_SZ_LINSPACE_ROW(insize)
+ in1num = string(eval(insize(1)));
+ outsize = in1num;
+endfunction:
diff --git a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
index 1f07e4ad..2ad8b269 100644
--- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
+++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
@@ -1074,6 +1074,39 @@ INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,E
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+// --------------------
+// --- Class linspace. ---
+// --------------------
+ClassName = 'linspace';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+
+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)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= FA_SZ_LINSPACE_ROW(IN(1).SZ)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(3).VAL',ClassFileName,'file','y');
+
+
+// ---Function List Class.----
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+
+
+PrintStringInfo('d0d0d0'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('d2d2d0'+ArgSeparator+'d2',ClassFileName,'file','y');
+
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'linspace'; // 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);
+
+
//---------------------
//-----Class Rand.------
@@ -3702,6 +3735,7 @@ ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y');
PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y');
PrintStringInfo('c0'+ArgSeparator+'c0',ClassFileName,'file','y');
+
PrintStringInfo('z0'+ArgSeparator+'z0',ClassFileName,'file','y');
PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y');
@@ -3847,6 +3881,7 @@ PrintStringInfo('OUT(1).TP= FA_TP_MAX(IN(1).TP,IN(2).TP)',ClassFileName,'file
PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
PrintStringInfo('OUT(1).SZ(2)= IN(2).VAL',ClassFileName,'file','y');
PrintStringInfo('NIN= 2',ClassFileName,'file','y');
+
PrintStringInfo('NOUT= 2',ClassFileName,'file','y');
PrintStringInfo('OUT(1).TP= FA_TP_MAX(IN(1).TP,IN(2).TP)',ClassFileName,'file','y');
PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
@@ -4806,6 +4841,7 @@ INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,Ex
// // For every sci2c function library class we reported
// // the domains , annotations only for the class-leader
+
// // Example [y1,y2]=Fun(x1,x2,x3) : scilab library function call
// // Domain RxNxSel->{R,R} :the first input element is real number ,the second is integer ,
diff --git a/2.3-1/macros/findDeps/getAllHeaders.sci b/2.3-1/macros/findDeps/getAllHeaders.sci
index 3d67a663..27a67376 100644
--- a/2.3-1/macros/findDeps/getAllHeaders.sci
+++ b/2.3-1/macros/findDeps/getAllHeaders.sci
@@ -94,6 +94,7 @@ function allHeaders = getAllHeaders(Target)
"src/c/elementaryFunctions/includes/bitcmp.h"
"src/c/elementaryFunctions/includes/bitset.h"
"src/c/elementaryFunctions/includes/bitget.h"
+ "src/c/elementaryFunctions/includes/linspace.h"
"src/c/elementaryFunctions/includes/asinh.h"
"src/c/elementaryFunctions/includes/atan2.h"
"src/c/elementaryFunctions/includes/atanh.h"
diff --git a/2.3-1/macros/findDeps/getAllInterfaces.sci b/2.3-1/macros/findDeps/getAllInterfaces.sci
index b8cd6d38..8b60d7c1 100644
--- a/2.3-1/macros/findDeps/getAllInterfaces.sci
+++ b/2.3-1/macros/findDeps/getAllInterfaces.sci
@@ -84,6 +84,7 @@ function allInterfaces = getAllInterfaces(Target)
"src/c/elementaryFunctions/interfaces/int_bitcmp.h"
"src/c/elementaryFunctions/interfaces/int_bitset.h"
"src/c/elementaryFunctions/interfaces/int_bitget.h"
+ "src/c/elementaryFunctions/interfaces/int_linspace.h"
"src/c/elementaryFunctions/interfaces/int_cosh.h"
"src/c/elementaryFunctions/interfaces/int_uint8.h"
"src/c/elementaryFunctions/interfaces/int_int8.h"
diff --git a/2.3-1/macros/findDeps/getAllSources.sci b/2.3-1/macros/findDeps/getAllSources.sci
index 64a4e470..ab4f9a0e 100644
--- a/2.3-1/macros/findDeps/getAllSources.sci
+++ b/2.3-1/macros/findDeps/getAllSources.sci
@@ -620,6 +620,8 @@ function allSources = getAllSources(Target)
"src/c/elementaryFunctions/bitset/u16bitsets.c"
"src/c/elementaryFunctions/bitget/u8bitgets.c"
"src/c/elementaryFunctions/bitget/u16bitgets.c"
+ "src/c/elementaryFunctions/linspace/dlinspaces.c"
+ "src/c/elementaryFunctions/linspace/dlinspacea.c"
"src/c/statisticsFunctions/max/dmaxa.c"
"src/c/statisticsFunctions/max/smaxa.c"
"src/c/statisticsFunctions/max/srowmaxa.c"
diff --git a/2.3-1/src/c/elementaryFunctions/includes/linspace.h b/2.3-1/src/c/elementaryFunctions/includes/linspace.h
new file mode 100644
index 00000000..837d839d
--- /dev/null
+++ b/2.3-1/src/c/elementaryFunctions/includes/linspace.h
@@ -0,0 +1,36 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2007-2008 - INRIA - Bruno JOFRET
+ *
+ * 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
+ *
+ */
+
+#ifndef __LINSPACE_H__
+#define __LINSPACE_H__
+
+#include "dynlib_elementaryfunctions.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+EXTERN_ELEMFUNCT void dlinspaces(double low_limit,double up_limit,double range_num, double* out);
+
+EXTERN_ELEMFUNCT void dlinspacea(double *low_limit,int row,double *up_limit,double range_num, double* out);
+
+
+
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+
+#endif /* !__LINSPACE_H__ */
+
diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_linspace.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_linspace.h
new file mode 100644
index 00000000..4e60b15b
--- /dev/null
+++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_linspace.h
@@ -0,0 +1,10 @@
+/* Scilab2C FOSSEE IITB */
+
+#ifndef __INT_LINSPACE_H__
+#define __INT_LINSPACE_H__
+
+#define d0d0d0linspaced2(in1,in2,in3,out) dlinspaces(in1,in2,in3,out)
+
+#define d2d2d0linspaced2(in1,size1,in2,size2,in3,out) dlinspacea(in1,size1[0],in2,in3,out)
+
+#endif
diff --git a/2.3-1/src/c/elementaryFunctions/linspace/dlinspacea.c b/2.3-1/src/c/elementaryFunctions/linspace/dlinspacea.c
new file mode 100644
index 00000000..f67968d6
--- /dev/null
+++ b/2.3-1/src/c/elementaryFunctions/linspace/dlinspacea.c
@@ -0,0 +1,39 @@
+/*
+ Scilab2C FOSSEE IIT Bombay
+ */
+
+#include "linspace.h"
+void dlinspacea(double *low_limit,int _row,double *up_limit,double range_num,double *out)
+{
+ int i,j,k;
+ double temp;
+ float step_iterate[_row]; // for each row the spacing between two values is different.
+ for(i=0;i<_row;i++)
+ {
+
+ step_iterate[i] = (up_limit[i]-low_limit[i])/(range_num-1);
+
+ }
+ for(j=0;j < _row;j++)
+ {
+ out[j] = low_limit[j]; // For every row first element is the first value of low_limit array
+ temp = low_limit[j];
+ for(k=1;k < (double)range_num;k++ )
+ {
+ out[(_row*k)+j] = temp + step_iterate[j]; /* Output matrix positions for 3 X 5 matrix are [0 3 6 9 12;1 4 7 10 13;2 5 8 11 14] so (_row*k)+j) used*/
+ temp = out[(_row*k)+j];
+ if(k == (double)range_num-1 )
+ {
+ out[(_row*k)+j] = (double)up_limit[j]; // Last value of output is equal to first value of up_limit array
+ }
+
+ }
+
+
+ }
+
+
+
+
+}
+
diff --git a/2.3-1/src/c/elementaryFunctions/linspace/dlinspacea.c~ b/2.3-1/src/c/elementaryFunctions/linspace/dlinspacea.c~
new file mode 100644
index 00000000..f67968d6
--- /dev/null
+++ b/2.3-1/src/c/elementaryFunctions/linspace/dlinspacea.c~
@@ -0,0 +1,39 @@
+/*
+ Scilab2C FOSSEE IIT Bombay
+ */
+
+#include "linspace.h"
+void dlinspacea(double *low_limit,int _row,double *up_limit,double range_num,double *out)
+{
+ int i,j,k;
+ double temp;
+ float step_iterate[_row]; // for each row the spacing between two values is different.
+ for(i=0;i<_row;i++)
+ {
+
+ step_iterate[i] = (up_limit[i]-low_limit[i])/(range_num-1);
+
+ }
+ for(j=0;j < _row;j++)
+ {
+ out[j] = low_limit[j]; // For every row first element is the first value of low_limit array
+ temp = low_limit[j];
+ for(k=1;k < (double)range_num;k++ )
+ {
+ out[(_row*k)+j] = temp + step_iterate[j]; /* Output matrix positions for 3 X 5 matrix are [0 3 6 9 12;1 4 7 10 13;2 5 8 11 14] so (_row*k)+j) used*/
+ temp = out[(_row*k)+j];
+ if(k == (double)range_num-1 )
+ {
+ out[(_row*k)+j] = (double)up_limit[j]; // Last value of output is equal to first value of up_limit array
+ }
+
+ }
+
+
+ }
+
+
+
+
+}
+
diff --git a/2.3-1/src/c/elementaryFunctions/linspace/dlinspaces.c b/2.3-1/src/c/elementaryFunctions/linspace/dlinspaces.c
new file mode 100644
index 00000000..82b88e34
--- /dev/null
+++ b/2.3-1/src/c/elementaryFunctions/linspace/dlinspaces.c
@@ -0,0 +1,25 @@
+/*
+ Scilab2C FOSSEE IIT Bombay
+ */
+
+#include "linspace.h"
+void dlinspaces(double low_limit,double up_limit,double range_num,double *out)
+{
+ int j;
+ double temp = low_limit;
+ float step_iterate = (up_limit-low_limit)/(range_num-1);
+ out[0] = low_limit; //First value of output is equal to low_limit value
+ for(j=1; j<(double)range_num; j++)
+ {
+ out[j] = temp + step_iterate;
+ temp = out[j];
+ if(j == (double)range_num-1 )
+ {
+ out[j] = (double)up_limit; // Last value of output is equal to up_limit value
+ }
+ }
+
+
+
+}
+
diff --git a/2.3-1/src/c/elementaryFunctions/linspace/dlinspaces.c~ b/2.3-1/src/c/elementaryFunctions/linspace/dlinspaces.c~
new file mode 100644
index 00000000..82b88e34
--- /dev/null
+++ b/2.3-1/src/c/elementaryFunctions/linspace/dlinspaces.c~
@@ -0,0 +1,25 @@
+/*
+ Scilab2C FOSSEE IIT Bombay
+ */
+
+#include "linspace.h"
+void dlinspaces(double low_limit,double up_limit,double range_num,double *out)
+{
+ int j;
+ double temp = low_limit;
+ float step_iterate = (up_limit-low_limit)/(range_num-1);
+ out[0] = low_limit; //First value of output is equal to low_limit value
+ for(j=1; j<(double)range_num; j++)
+ {
+ out[j] = temp + step_iterate;
+ temp = out[j];
+ if(j == (double)range_num-1 )
+ {
+ out[j] = (double)up_limit; // Last value of output is equal to up_limit value
+ }
+ }
+
+
+
+}
+
diff --git a/2.3-1/src/c/elementaryFunctions/linspace/u8linspacea.c~ b/2.3-1/src/c/elementaryFunctions/linspace/u8linspacea.c~
new file mode 100644
index 00000000..2e623fa6
--- /dev/null
+++ b/2.3-1/src/c/elementaryFunctions/linspace/u8linspacea.c~
@@ -0,0 +1,39 @@
+/*
+ Scilab2C FOSSEE IIT Bombay
+ */
+
+#include "linspace.h"
+void u8linspacea(uint8 *low_limit,int _row,uint8 *up_limit,double range_num,uint8 *out)
+{
+ int i,j,k;
+ uint8 temp;
+ float step_iterate[_row]; // for each row the spacing between two values is different.
+ for(i=0;i<_row;i++)
+ {
+
+ step_iterate[i] = (up_limit[i]-low_limit[i])/(range_num-1);
+
+ }
+ for(j=0;j < _row;j++)
+ {
+ out[j] = low_limit[j]; // For every row first element is the first value of low_limit array
+ temp = low_limit[j];
+ for(k=1;k < (double)range_num;k++ )
+ {
+ out[(_row*k)+j] = temp + step_iterate[j]; /* Output matrix positions for 3 X 5 matrix are [0 3 6 9 12;1 4 7 10 13;2 5 8 11 14] so (_row*k)+j) used*/
+ temp = out[(_row*k)+j];
+ if(k == (double)range_num-1 )
+ {
+ out[(_row*k)+j] = (uint8)up_limit[j]; // Last value of output is equal to first value of up_limit array
+ }
+
+ }
+
+
+ }
+
+
+
+
+}
+
diff --git a/2.3-1/src/c/elementaryFunctions/linspace/u8linspaces.c~ b/2.3-1/src/c/elementaryFunctions/linspace/u8linspaces.c~
new file mode 100644
index 00000000..0320a276
--- /dev/null
+++ b/2.3-1/src/c/elementaryFunctions/linspace/u8linspaces.c~
@@ -0,0 +1,25 @@
+/*
+ Scilab2C FOSSEE IIT Bombay
+ */
+
+#include "linspace.h"
+void u8linspaces(uint8 low_limit,uint8 up_limit,double range_num,uint8 *out)
+{
+ int j;
+ uint8 temp = low_limit;
+ float step_iterate = (up_limit-low_limit)/(range_num-1);
+ out[0] = low_limit; //First value of output is equal to low_limit value
+ for(j=1; j<(double)range_num; j++)
+ {
+ out[j] = temp + step_iterate;
+ temp = out[j];
+ if(j == (double)range_num-1 )
+ {
+ out[j] = (uint8)up_limit; // Last value of output is equal to up_limit value
+ }
+ }
+
+
+
+}
+