From 6c064ab15d76329ac3dfbee127e6b448a4c6f458 Mon Sep 17 00:00:00 2001 From: Abhinav Dronamraju Date: Fri, 7 Jul 2017 14:28:14 +0530 Subject: matrix function added --- includes/sci2clib.h | 5 ++- jar/scilab_en_US_help.jar | Bin 11210 -> 11210 bytes .../ToolInitialization/INIT_FillSCI2LibCDirs.sci | 45 +++++++++++++++++++++ macros/findDeps/getAllHeaders.sci | 1 + macros/findDeps/getAllInterfaces.sci | 1 + macros/findDeps/getAllSources.sci | 6 ++- src/c/matrixOperations/includes/matrix.h | 31 ++++++++++++++ src/c/matrixOperations/interfaces/int_matrix.h | 37 +++++++++++++++++ src/c/matrixOperations/matrix/dmatrixa.c | 33 +++++++++++++++ src/c/matrixOperations/matrix/smatrixa.c | 33 +++++++++++++++ 10 files changed, 189 insertions(+), 3 deletions(-) create mode 100644 src/c/matrixOperations/includes/matrix.h create mode 100644 src/c/matrixOperations/interfaces/int_matrix.h create mode 100644 src/c/matrixOperations/matrix/dmatrixa.c create mode 100644 src/c/matrixOperations/matrix/smatrixa.c diff --git a/includes/sci2clib.h b/includes/sci2clib.h index 2996191..8dc15ec 100644 --- a/includes/sci2clib.h +++ b/includes/sci2clib.h @@ -327,7 +327,7 @@ extern "C" { #include "int_secd.h" /*interfacing float*/ -#include "float.h" +#include "get_float.h" #include "int_float.h" /*interfacing factorial*/ @@ -439,6 +439,9 @@ extern "C" { /*interfacing cumsum*/ #include "int_cumsum.h" #include "cumsum.h" +/*interfacing matrix*/ +#include "int_matrix.h" +#include "matrix.h" /*interfacing cumprod*/ #include "int_cumprod.h" #include "cumprod.h" diff --git a/jar/scilab_en_US_help.jar b/jar/scilab_en_US_help.jar index ed83054..4926996 100644 Binary files a/jar/scilab_en_US_help.jar and b/jar/scilab_en_US_help.jar differ diff --git a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci index 81c34c4..910d0c0 100644 --- a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci +++ b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci @@ -6889,6 +6889,51 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file', INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); +//------------------------------------ +//---- Class MATRIX--------------------- +//------------------------------------ +ClassName = 'MATRIX'; + +// --- 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)= IN(2).VAL',ClassFileName,'file','y'); +PrintStringInfo('OUT(1).SZ(2)= IN(3).VAL',ClassFileName,'file','y'); + +// --- Function List Class. --- +ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); +PrintStringInfo('d2d0d0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d2s0s0'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d2u160u160'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('d2u80u80'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('u160'+ArgSeparator+'u160',ClassFileName,'file','y'); +PrintStringInfo('i160'+ArgSeparator+'i160',ClassFileName,'file','y'); + +PrintStringInfo('s2d0d0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s2s0s0'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s2u160u160'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('s2u80u80'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('u162'+ArgSeparator+'u162',ClassFileName,'file','y'); +PrintStringInfo('i162'+ArgSeparator+'i162',ClassFileName,'file','y'); + +PrintStringInfo('d2g2'+ArgSeparator+'d2',ClassFileName,'file','y'); +PrintStringInfo('s2g2'+ArgSeparator+'s2',ClassFileName,'file','y'); +PrintStringInfo('u82g2'+ArgSeparator+'u82',ClassFileName,'file','y'); +PrintStringInfo('i82g2'+ArgSeparator+'i82',ClassFileName,'file','y'); +PrintStringInfo('u162g2'+ArgSeparator+'u162',ClassFileName,'file','y'); +PrintStringInfo('i162g2'+ArgSeparator+'i162',ClassFileName,'file','y'); +// --- Annotation Function And Function List Function. --- +FunctionName = 'matrix'; +PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y'); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun); +INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun); + + //------------------------------------ //---- Class TRIU --------------------- //------------------------------------ diff --git a/macros/findDeps/getAllHeaders.sci b/macros/findDeps/getAllHeaders.sci index 021b7e4..5dd7d82 100644 --- a/macros/findDeps/getAllHeaders.sci +++ b/macros/findDeps/getAllHeaders.sci @@ -66,6 +66,7 @@ function allHeaders = getAllHeaders(SharedInfo) "src/c/matrixOperations/includes/matrixMultiplication.h" "src/c/matrixOperations/includes/diag.h" "src/c/matrixOperations/includes/cumsum.h" + "src/c/matrixOperations/includes/matrix.h" "src/c/matrixOperations/includes/cumprod.h" "src/c/matrixOperations/includes/triu.h" "src/c/matrixOperations/includes/tril.h" diff --git a/macros/findDeps/getAllInterfaces.sci b/macros/findDeps/getAllInterfaces.sci index 27ae65d..84f3cdd 100644 --- a/macros/findDeps/getAllInterfaces.sci +++ b/macros/findDeps/getAllInterfaces.sci @@ -54,6 +54,7 @@ function allInterfaces = getAllInterfaces(SharedInfo) "src/c/matrixOperations/interfaces/int_expm.h" "src/c/matrixOperations/interfaces/int_diag.h" "src/c/matrixOperations/interfaces/int_cumsum.h" + "src/c/matrixOperations/interfaces/int_matrix.h" "src/c/matrixOperations/interfaces/int_cumprod.h" "src/c/matrixOperations/interfaces/int_triu.h" "src/c/matrixOperations/interfaces/int_tril.h" diff --git a/macros/findDeps/getAllSources.sci b/macros/findDeps/getAllSources.sci index 17e35c2..cc22739 100644 --- a/macros/findDeps/getAllSources.sci +++ b/macros/findDeps/getAllSources.sci @@ -312,6 +312,8 @@ function allSources = getAllSources(SharedInfo) "src/c/matrixOperations/cumprod/i16cumproda.c" "src/c/matrixOperations/cumprod/i16rowcumproda.c" "src/c/matrixOperations/cumprod/i16columncumproda.c" + "src/c/matrixOperations/matrix/dmatrixa.c" + "src/c/matrixOperations/matrix/smatrixa.c" "src/c/matrixOperations/triu/dtriua.c" "src/c/matrixOperations/triu/striua.c" "src/c/matrixOperations/triu/u8triua.c" @@ -624,9 +626,9 @@ function allSources = getAllSources(SharedInfo) "src/c/elementaryFunctions/lnp1m1/slnp1m1s.c" "src/c/elementaryFunctions/lnp1m1/dlnp1m1s.c" - "src/c/elementaryFunctions/float/dfloats.c" + "src/c/elementaryFunctions/float/dfloats.c" "src/c/elementaryFunctions/float/dfloata.c" - "src/c/elementaryFunctions/float/sfloats.c" + "src/c/elementaryFunctions/float/sfloats.c" "src/c/elementaryFunctions/float/sfloata.c" "src/c/elementaryFunctions/float/u8floats.c" "src/c/elementaryFunctions/float/u8floata.c" diff --git a/src/c/matrixOperations/includes/matrix.h b/src/c/matrixOperations/includes/matrix.h new file mode 100644 index 0000000..e47afa5 --- /dev/null +++ b/src/c/matrixOperations/includes/matrix.h @@ -0,0 +1,31 @@ +/* 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 __MATRIX_H__ +#define __MATRIX_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dmatrixa(double* , int , int , int , int , double*); +void smatrixa( float* , int , int , int , int , float*); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__MATRIX_H__*/ diff --git a/src/c/matrixOperations/interfaces/int_matrix.h b/src/c/matrixOperations/interfaces/int_matrix.h new file mode 100644 index 0000000..92d9ae1 --- /dev/null +++ b/src/c/matrixOperations/interfaces/int_matrix.h @@ -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 +*/ + +#ifndef __INT_MATRIX_H__ +#define __INT_MATRIX_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define d2d0d0matrixd2(in1, size, in2, in3, out ) dmatrixa(in1, size[0], size[1], in2, in3, out) +#define d2s0s0matrixd2(in1, size, in2, in3, out ) dmatrixa(in1, size[0], size[1], in2, in3, out) +#define d2u160u160matrixd2(in1, size, in2, in3, out ) dmatrixa(in1, size[0], size[1], in2, in3, out) +#define d2u80u80matrixd2(in1, size, in2, in3, out ) dmatrixa(in1, size[0], size[1], in2, in3, 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) + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_CUMSUM_H__*/ diff --git a/src/c/matrixOperations/matrix/dmatrixa.c b/src/c/matrixOperations/matrix/dmatrixa.c new file mode 100644 index 0000000..649dbc3 --- /dev/null +++ b/src/c/matrixOperations/matrix/dmatrixa.c @@ -0,0 +1,33 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Abhinav Dronamraju + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/*Function returns cumulative sum of members of array/matrix*/ + +#include "matrix.h" +#include "types.h" +#include "uint16.h" + +void dmatrixa(double *in, int irow, int icolumn, int orow, int ocolumn ,double *out) +{ + int i; + if(irow*icolumn==orow*ocolumn) + { + for(i=0;i