diff options
author | siddhu8990 | 2016-05-27 11:50:04 +0530 |
---|---|---|
committer | siddhu8990 | 2016-05-27 11:50:04 +0530 |
commit | 49003250e69e4e500742614888e47db789bbe451 (patch) | |
tree | 44bdcb9f8a4989789bbab2e10cd43d114fb237b4 | |
parent | 18587a5f0cf86d636ac23a5be567437cd822bbc2 (diff) | |
download | Scilab2C-49003250e69e4e500742614888e47db789bbe451.tar.gz Scilab2C-49003250e69e4e500742614888e47db789bbe451.tar.bz2 Scilab2C-49003250e69e4e500742614888e47db789bbe451.zip |
Support for basic ODE function added
39 files changed, 338 insertions, 171 deletions
diff --git a/2.3-1/includes/sci2clib.h b/2.3-1/includes/sci2clib.h index 3353cf76..aa2cee70 100644 --- a/2.3-1/includes/sci2clib.h +++ b/2.3-1/includes/sci2clib.h @@ -388,8 +388,8 @@ #include "str.h" /*ODE functions*/ -//#include "ode.h" -//#include "int_ode.h" +#include "ode.h" +#include "int_ode.h" /*Scilab-arduino toolbox*/ #ifdef Arduino1 diff --git a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.bin b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.bin Binary files differindex 27c8880b..414942c3 100644 --- a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.bin +++ b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.bin diff --git a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci index b08ab398..41c4cb40 100644 --- a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci +++ b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci @@ -197,14 +197,18 @@ global STACKDEDUG //as it is passed as string to C function. Also enter this function in conversion list also. if(ASTFunName == 'ode') if NInArg == 4 - InArg(4).Scope = 'String'; - ODEFunName = InArg(4).Name; + //InArg(4).Scope = 'String'; + ODEFunName = InArg(4).Name; + InArg(4).Name = 'odefn'+ InArg(4).Name + //To differentiate functions containing differential equations, + //'odefn' is added at the beginning of the function name. + SharedInfo.ODElist($+1) = InArg(4).Name; + //Add ode function in list. this will be used to add corresponding + //header file in main function. end end - [InArg,SharedInfo] = ST_GetInArgInfo(InArg,NInArg,FileInfo,SharedInfo); - if(ASTFunName == 'ode') - disp(InArg(4).Name); - end + [InArg,SharedInfo] = ST_GetInArgInfo(InArg,NInArg,FileInfo,SharedInfo,ASTFunName); + end // #RNU_RES_B @@ -361,11 +365,12 @@ global STACKDEDUG ODE_InArg(1) = InArg(3) ODE_InArg(2) = InArg(1) ODE_OutArg(1) = OutArg(1) - ODE_CFunName = C_GenerateFunName(ODEFunName,ODE_InArg,2,ODE_OutArg,1); - + ODE_CFunName = C_GenerateFunName('odefn'+ODEFunName,ODE_InArg,2,ODE_OutArg,1); + //Functions containing differential equations that are used with 'ode' + //function need to be handled differently. + [FunFound, FunType, FunSize, FunValue, FunFindLike, FunDimension] = ... ST_Get(InArg(4).Name,FileInfo.GlobalVarFileName); - disp(FunFound); //ST_Del(InArg(4).Name,FileInfo.GlobalVarFileName); //ST_Set(ODE_CFunName, FunType, FunSize, FunValue, FunFindLike, FunDimension); end diff --git a/2.3-1/macros/CCodeGeneration/C_FinalizeCode.bin b/2.3-1/macros/CCodeGeneration/C_FinalizeCode.bin Binary files differindex 5cc21487..44c534e5 100644 --- a/2.3-1/macros/CCodeGeneration/C_FinalizeCode.bin +++ b/2.3-1/macros/CCodeGeneration/C_FinalizeCode.bin diff --git a/2.3-1/macros/CCodeGeneration/C_FinalizeCode.sci b/2.3-1/macros/CCodeGeneration/C_FinalizeCode.sci index 69cad558..1f3c6b58 100644 --- a/2.3-1/macros/CCodeGeneration/C_FinalizeCode.sci +++ b/2.3-1/macros/CCodeGeneration/C_FinalizeCode.sci @@ -73,6 +73,24 @@ PrintStringInfo('** ----------------- ',FinalCFileName,'file','y'); PrintStringInfo('*/',FinalCFileName,'file','y'); PrintStringInfo('#include ""'+tmphdrname+tmphdrext+'""',... FinalCFileName,'file','y'); +//If current file is main C file, include header files corresponding to ODE +//functions, if any. +if(SharedInfo.NextSCIFunName == SharedInfo.SCIMainFunName) + if(size(SharedInfo.ODElist) <> 0) //check if list is empty + //If not empty, add those header files here. + for cntlist = 1:size(SharedInfo.ODElist) + PrintStringInfo('#include ""'+SharedInfo.ODElist(cntlist)+'.h""',... + FinalCFileName,'file','y'); + end + + end +end + +//If current function contains ODEs, add gsl/gsl_errno.h. +if (mtlb_strcmp(part(SharedInfo.CurrentFunInfo.CFunctionName,1:5),'odefn') == %T) + PrintStringInfo('#include <gsl/gsl_errno.h>',... + FinalCFileName,'file','y'); +end PrintStringInfo('/*',FinalCFileName,'file','y'); PrintStringInfo('** --------------------- ',FinalCFileName,'file','y'); PrintStringInfo('** --- End Includes. --- ',FinalCFileName,'file','y'); diff --git a/2.3-1/macros/CCodeGeneration/C_Funcall.bin b/2.3-1/macros/CCodeGeneration/C_Funcall.bin Binary files differindex 36823876..f54c0c3d 100644 --- a/2.3-1/macros/CCodeGeneration/C_Funcall.bin +++ b/2.3-1/macros/CCodeGeneration/C_Funcall.bin diff --git a/2.3-1/macros/CCodeGeneration/C_Funcall.sci b/2.3-1/macros/CCodeGeneration/C_Funcall.sci index 3669e54d..eec20c70 100644 --- a/2.3-1/macros/CCodeGeneration/C_Funcall.sci +++ b/2.3-1/macros/CCodeGeneration/C_Funcall.sci @@ -180,6 +180,9 @@ if (FunInfo.CFunctionName == SharedInfo.CMainFunName) else CCall =CCall+'int '; end +elseif (mtlb_strcmp(part(CFunName,1:5),'odefn') == %T) + //Return type of function containing ODEs must be int. + CCall = CCall + 'int '; else if (PosFirstOutScalar >= 1) if (FlagCall == 1) @@ -207,39 +210,84 @@ end PrintStringInfo(' C call after output scalar args check: '+CCall,ReportFileName,'file','y'); // #RNU_RES_E clear counterin -for counterin = 1:NInArg - - if (InArg(counterin).Type == 'g' & InArg(counterin).Scope == 'String') - TmpInArgName = '""'+InArg(counterin).Name+'""'; - elseif (InArg(counterin).Type == 'z' & (InArg(counterin).Scope == 'Number')) - TmpInArgName = 'DoubleComplex('+SCI2Cstring(real(InArg(counterin).Value))+','+SCI2Cstring(imag(InArg(counterin).Value))+')'; - elseif (InArg(counterin).Type == 'c' & (InArg(counterin).Scope == 'Number')) - TmpInArgName = 'FloatComplex('+SCI2Cstring(real(InArg(counterin).Value))+','+SCI2Cstring(imag(InArg(counterin).Value))+')'; - else - TmpInArgName = InArg(counterin).Name; - end +if(mtlb_strcmp(part(CFunName,1:5),'odefn') == %F) + for counterin = 1:NInArg - TmpInArgType = C_Type(InArg(counterin).Type); + if (InArg(counterin).Type == 'g' & InArg(counterin).Scope == 'String') + TmpInArgName = '""'+InArg(counterin).Name+'""'; + elseif (InArg(counterin).Type == 'z' & (InArg(counterin).Scope == 'Number')) + TmpInArgName = 'DoubleComplex('+SCI2Cstring(real(InArg(counterin).Value))+','+SCI2Cstring(imag(InArg(counterin).Value))+')'; + elseif (InArg(counterin).Type == 'c' & (InArg(counterin).Scope == 'Number')) + TmpInArgName = 'FloatComplex('+SCI2Cstring(real(InArg(counterin).Value))+','+SCI2Cstring(imag(InArg(counterin).Value))+')'; + else + TmpInArgName = InArg(counterin).Name; + end - //if (FunctionName == 'OpEqual') - // TmpInArgSizeVar = '__'+OutArg(counterin).Name+'Size'; - // else - TmpInArgSizeVar = '__'+InArg(counterin).Name+'Size'; - //end + TmpInArgType = C_Type(InArg(counterin).Type); - if (InArg(counterin).Dimension == 0) - if (FlagCall == 0) - CCall = CCall+TmpInArgType+' '; - end - CCall = CCall+TmpInArgName+','; - else - if (FlagCall == 0) - CCall = CCall+TmpInArgType+'* '+TmpInArgName+', int* __'+TmpInArgName+'Size,'; + //if (FunctionName == 'OpEqual') + // TmpInArgSizeVar = '__'+OutArg(counterin).Name+'Size'; + // else + TmpInArgSizeVar = '__'+InArg(counterin).Name+'Size'; + //end + + if (InArg(counterin).Dimension == 0) + if (FlagCall == 0) + CCall = CCall+TmpInArgType+' '; + end + CCall = CCall+TmpInArgName+','; else - CCall = CCall+TmpInArgName+', '+TmpInArgSizeVar+','; + if (FlagCall == 0) + CCall = CCall+TmpInArgType+'* '+TmpInArgName+', int* __'+TmpInArgName+'Size,'; + else + CCall = CCall+TmpInArgName+', '+TmpInArgSizeVar+','; + end + end + end +else + //If current function contains 'odefn' at the beginning, then it contains + //differnetial equations and its function call need to be differnt than + //other function call. GSL library being used for solving ODEs, requires + //function containing odes in specific format which is differnt than generated + //above. + for counterin = 1:NInArg + + if(counterin <> 3) //Skip third argument + if (InArg(counterin).Type == 'g' & InArg(counterin).Scope == 'String') + TmpInArgName = '""'+InArg(counterin).Name+'""'; + elseif (InArg(counterin).Type == 'z' & (InArg(counterin).Scope == 'Number')) + TmpInArgName = 'DoubleComplex('+SCI2Cstring(real(InArg(counterin).Value))+','+SCI2Cstring(imag(InArg(counterin).Value))+')'; + elseif (InArg(counterin).Type == 'c' & (InArg(counterin).Scope == 'Number')) + TmpInArgName = 'FloatComplex('+SCI2Cstring(real(InArg(counterin).Value))+','+SCI2Cstring(imag(InArg(counterin).Value))+')'; + else + TmpInArgName = InArg(counterin).Name; + end + + TmpInArgType = C_Type(InArg(counterin).Type); + + //if (FunctionName == 'OpEqual') + // TmpInArgSizeVar = '__'+OutArg(counterin).Name+'Size'; + // else + TmpInArgSizeVar = '__'+InArg(counterin).Name+'Size'; + //end + + if (InArg(counterin).Dimension == 0) + if (FlagCall == 0) + CCall = CCall+TmpInArgType+' '; + end + CCall = CCall+TmpInArgName+','; + else + if (FlagCall == 0) + CCall = CCall+TmpInArgType+'* '+TmpInArgName+', ';//int* __'+TmpInArgName+'Size,'; + else + CCall = CCall+TmpInArgName+', ';//+TmpInArgSizeVar+','; + end + end end end + end + // #RNU_RES_B PrintStringInfo(' C call after input args analysis: '+CCall,ReportFileName,'file','y'); // #RNU_RES_E @@ -308,6 +356,11 @@ if (part(CCall,length(CCall):length(CCall)) == ',') CCall = part(CCall,1:length(CCall)-1); end +//__ysize is added to input arguments at last to comply with form required by GSL +if(mtlb_strcmp(part(CFunName,1:5),'odefn') == %T) + CCall = CCall + ', int* '+TmpInArgSizeVar; +end + CCall = CCall+')'; if (FlagCall == 1) CCall = CCall+';'; @@ -352,8 +405,12 @@ if mtlb_strcmp(FunctionName,'return') PrintStringInfo(' return function of the AST is skipped.',ReportFileName,'file','y'); //RN provo a non skippare e a mettere la return. // #RNU_RES_E + if (SharedInfo.CurrentFunInfo.CFunctionName == SharedInfo.CMainFunName) CCall = CCall+'return(0);'; + elseif (mtlb_strcmp(part(SharedInfo.CurrentFunInfo.CFunctionName,1:5),'odefn') == %T) + //For GSL library, function containing ODEs must return GSL_SUCCESS + CCall = CCall + 'return GSL_SUCCESS;' else if (SharedInfo.CurrentFunInfo.PosFirstOutScalar > 0) CCall = CCall+'return('+SharedInfo.CurrentFunInfo.OutArg(SharedInfo.CurrentFunInfo.PosFirstOutScalar).Name+');' diff --git a/2.3-1/macros/CCodeGeneration/C_GenDeclarations.bin b/2.3-1/macros/CCodeGeneration/C_GenDeclarations.bin Binary files differindex 8bd7257e..1e6c4553 100644 --- a/2.3-1/macros/CCodeGeneration/C_GenDeclarations.bin +++ b/2.3-1/macros/CCodeGeneration/C_GenDeclarations.bin diff --git a/2.3-1/macros/CCodeGeneration/C_GenDeclarations.sci b/2.3-1/macros/CCodeGeneration/C_GenDeclarations.sci index 7a6565ec..eb61723d 100644 --- a/2.3-1/macros/CCodeGeneration/C_GenDeclarations.sci +++ b/2.3-1/macros/CCodeGeneration/C_GenDeclarations.sci @@ -92,24 +92,28 @@ if (ArgStruct.Dimension > 0) Cdeclaration(2) = Cdeclaration(2)+';'; end else - if (FlagExt == 1) - Cdeclaration(1) = 'extern '; + if (ArgStruct.Type == 'f') + //do nothing. This is a function name. Will be declared in header file. else - Cdeclaration(1) = ''; - end - Cdeclaration(1) = Cdeclaration(1)+C_Type(ArgStruct.Type)+' '+ArgStruct.Name; - if (~isnan(ArgStruct.Value) & (FlagExt == 0)) - if isreal(ArgStruct.Value) - Cdeclaration(1) = Cdeclaration(1)+' = '+SCI2Cstring(ArgStruct.Value); + if (FlagExt == 1) + Cdeclaration(1) = 'extern '; else - if (ArgStruct.Type == 'z') - Cdeclaration(1) = Cdeclaration(1)+' = DoubleComplex('+SCI2Cstring(real(ArgStruct.Value))+','+SCI2Cstring(imag(ArgStruct.Value))+')'; + Cdeclaration(1) = ''; + end + Cdeclaration(1) = Cdeclaration(1)+C_Type(ArgStruct.Type)+' '+ArgStruct.Name; + if (~isnan(ArgStruct.Value) & (FlagExt == 0)) + if isreal(ArgStruct.Value) + Cdeclaration(1) = Cdeclaration(1)+' = '+SCI2Cstring(ArgStruct.Value); else - Cdeclaration(1) = Cdeclaration(1)+' = FloatComplex('+SCI2Cstring(real(ArgStruct.Value))+','+SCI2Cstring(imag(ArgStruct.Value))+')'; + if (ArgStruct.Type == 'z') + Cdeclaration(1) = Cdeclaration(1)+' = DoubleComplex('+SCI2Cstring(real(ArgStruct.Value))+','+SCI2Cstring(imag(ArgStruct.Value))+')'; + else + Cdeclaration(1) = Cdeclaration(1)+' = FloatComplex('+SCI2Cstring(real(ArgStruct.Value))+','+SCI2Cstring(imag(ArgStruct.Value))+')'; + end end end + Cdeclaration(1) = Cdeclaration(1)+';'; end - Cdeclaration(1) = Cdeclaration(1)+';'; end diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateFunName.bin b/2.3-1/macros/CCodeGeneration/C_GenerateFunName.bin Binary files differindex 9a4af082..8486a3b2 100644 --- a/2.3-1/macros/CCodeGeneration/C_GenerateFunName.bin +++ b/2.3-1/macros/CCodeGeneration/C_GenerateFunName.bin diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateFunName.sci b/2.3-1/macros/CCodeGeneration/C_GenerateFunName.sci index 54c641f2..d87fb9c1 100644 --- a/2.3-1/macros/CCodeGeneration/C_GenerateFunName.sci +++ b/2.3-1/macros/CCodeGeneration/C_GenerateFunName.sci @@ -23,14 +23,14 @@ function CFunName = C_GenerateFunName(FunctionName,InArg,NInArg,OutArg,NOutArg) // ------------------------------ SCI2CNInArgCheck(argn(2),5,5); CFunName = ''; -if((IsAVRSupportFunction(FunctionName)) | (IsRPISupportFunction(FunctionName))) +if((IsAVRSupportFunction(FunctionName)) | (IsRPISupportFunction(FunctionName)) | ... + (mtlb_strcmp(part(FunctionName,1:5),'odefn') == %T)) //If current function is an AVR or RPi function, then function name can be just //plain function name without any input/output arguments types CFunName = CFunName+FunctionName; else - for tmpcnt = 1:NInArg if (InArg(tmpcnt).Dimension == 1) CFunName = CFunName+InArg(tmpcnt).Type+'2'; @@ -48,5 +48,6 @@ else CFunName = CFunName+OutArg(tmpcnt).Type+SCI2Cstring(OutArg(tmpcnt).Dimension); end end + end endfunction diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.bin b/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.bin Binary files differindex 43de2290..76090baa 100644 --- a/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.bin +++ b/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.bin diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.sci b/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.sci index 4817af1e..fecbf915 100644 --- a/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.sci +++ b/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.sci @@ -75,6 +75,10 @@ else PrintStringInfo('LDFLAGS = -lblas -llapack -lm ',FileInfo.MakefileFilename,'file','y','y'); end end +//If ode function is used, add libgsl. +if(size(SharedInfo.ODElist) <> 0) + PrintStringInfo('LDFLAGS += -lgsl',FileInfo.MakefileFilename,'file','y','y'); +end // Binary definition PrintStringInfo('EXEFILENAME = mytest.exe',FileInfo.MakefileFilename,'file','y','y'); diff --git a/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_COL.bin b/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_COL.bin Binary files differnew file mode 100644 index 00000000..c5a806a2 --- /dev/null +++ b/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_COL.bin diff --git a/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_COL.sci b/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_COL.sci new file mode 100644 index 00000000..de063e60 --- /dev/null +++ b/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_COL.sci @@ -0,0 +1,9 @@ +function outsize=FA_SZ_PERMUTE_COL(insize, val) + +outsize = 4; +//if((val(0) == '1') & (val(1) == '2')) +// outsize = insize(2); +//else +// outsize = insize(1); +//end +endfunction
\ No newline at end of file diff --git a/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_ROW.bin b/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_ROW.bin Binary files differnew file mode 100644 index 00000000..747a31d3 --- /dev/null +++ b/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_ROW.bin diff --git a/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_ROW.sci b/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_ROW.sci new file mode 100644 index 00000000..3dd4e604 --- /dev/null +++ b/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_ROW.sci @@ -0,0 +1,9 @@ +function outsize=FA_SZ_PERMUTE_ROW(insize, val) +disp(size(val)) +outsize = 3; +//if((val(0) == '1') & (val(1) == '2')) +// outsize = insize(1); +//else +// outsize = insize(2); +//end +endfunction
\ No newline at end of file diff --git a/2.3-1/macros/FunctionAnnotation/lib b/2.3-1/macros/FunctionAnnotation/lib Binary files differindex a31bc1a7..81fa5d45 100644 --- a/2.3-1/macros/FunctionAnnotation/lib +++ b/2.3-1/macros/FunctionAnnotation/lib diff --git a/2.3-1/macros/FunctionAnnotation/names b/2.3-1/macros/FunctionAnnotation/names index 4fc53d40..5658291f 100644 --- a/2.3-1/macros/FunctionAnnotation/names +++ b/2.3-1/macros/FunctionAnnotation/names @@ -40,6 +40,8 @@ FA_SZ_OPPLUSA FA_SZ_OPRC FA_SZ_OPSLASH FA_SZ_OPSTAR +FA_SZ_PERMUTE_COL +FA_SZ_PERMUTE_ROW FA_SZ_ROW_COLUMN FA_SZ_ROW_COLUMN_CAT FA_SZ_ROW_DIAG diff --git a/2.3-1/macros/SymbolTable/ST_GetInArgInfo.bin b/2.3-1/macros/SymbolTable/ST_GetInArgInfo.bin Binary files differindex 46c21548..61be39aa 100644 --- a/2.3-1/macros/SymbolTable/ST_GetInArgInfo.bin +++ b/2.3-1/macros/SymbolTable/ST_GetInArgInfo.bin diff --git a/2.3-1/macros/SymbolTable/ST_GetInArgInfo.sci b/2.3-1/macros/SymbolTable/ST_GetInArgInfo.sci index 1fe060a5..5f1a6cfc 100644 --- a/2.3-1/macros/SymbolTable/ST_GetInArgInfo.sci +++ b/2.3-1/macros/SymbolTable/ST_GetInArgInfo.sci @@ -1,4 +1,4 @@ -function [UpdatedInArg,SharedInfo] = ST_GetInArgInfo(InArg,NInArg,FileInfo,SharedInfo)
+function [UpdatedInArg,SharedInfo] = ST_GetInArgInfo(InArg,NInArg,FileInfo,SharedInfo,ASTFunName)
// function UpdatedInArg = ST_GetInArgInfo(InArg,NInArg,FileInfo,SharedInfo)
// -----------------------------------------------------------------
// #RNU_RES_B
@@ -26,7 +26,7 @@ function [UpdatedInArg,SharedInfo] = ST_GetInArgInfo(InArg,NInArg,FileInfo,Share // ------------------------------
// --- Check input arguments. ---
// ------------------------------
-SCI2CNInArgCheck(argn(2),4,4);
+SCI2CNInArgCheck(argn(2),5,5);
// -----------------------
// --- Initialization. ---
@@ -115,7 +115,7 @@ for cntinarg = 1:NInArg UpdatedInArg(cntinarg).Size(2) = string(length(tmpname)+1); //+1 = (\0)
UpdatedInArg(cntinarg).Value = '""'+tmpname+'""';
UpdatedInArg(cntinarg).FindLike = 0;
- UpdatedInArg(cntinarg).Dimension = 2; //NUT: in future releases you can set this field to 1.
+ UpdatedInArg(cntinarg).Dimension = 2; //Keep it zero to avoid extra argument 'funcnameSize'.
UpdatedInArg(cntinarg).Scope = 'Temp';
// #RNU_RES_B
@@ -130,21 +130,36 @@ for cntinarg = 1:NInArg // #RNU_RES_E
[TBFlagfound,TBType,TBSize,TBValue,TBFindLike,TBDimension,TBScope] = ST_GetSymbolInfo(tmpname,FileInfo,SharedInfo);
if (TBFlagfound == 0)
- PrintStringInfo(' ',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: Unknown symbol ""'+tmpname+'"".',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: Be sure to initialize every symbol you are using.',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: Before running the SCI2C translator, remember to run the code you are trying',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: to translate in order to check syntax errors.',ReportFileName,'both','y');
- PrintStringInfo(' ',ReportFileName,'both','y');
- error(9999, 'SCI2CERROR: Unknown symbol ""'+tmpname+'"".');
+ if(ASTFunName == 'ode')
+ if(NInArg == 4 & cntinarg == 4)
+ //incase of 4 arguments, fourth argument is function name
+ UpdatedInArg(cntinarg).Name = tmpname; // Change the name.
+ UpdatedInArg(cntinarg).Type = 'f'; //it is a function name
+ UpdatedInArg(cntinarg).Size(1) = '1';
+ UpdatedInArg(cntinarg).Size(2) = '1'; //+1 = (\0)
+ UpdatedInArg(cntinarg).Value = '&'+tmpname;
+ UpdatedInArg(cntinarg).FindLike = 0;
+ UpdatedInArg(cntinarg).Dimension = 0; //NUT: in future releases you can set this field to 1.
+ UpdatedInArg(cntinarg).Scope = 'Temp';
+ ST_InsOutArg(UpdatedInArg(cntinarg),1,FileInfo,SharedInfo,'all');
+ end
+ else
+ PrintStringInfo(' ',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: Unknown symbol ""'+tmpname+'"".',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: Be sure to initialize every symbol you are using.',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: Before running the SCI2C translator, remember to run the code you are trying',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: to translate in order to check syntax errors.',ReportFileName,'both','y');
+ PrintStringInfo(' ',ReportFileName,'both','y');
+ error(9999, 'SCI2CERROR: Unknown symbol ""'+tmpname+'"".');
+ end
+ else
+ UpdatedInArg(cntinarg).Type = TBType;
+ UpdatedInArg(cntinarg).Size = TBSize;
+ UpdatedInArg(cntinarg).Value = TBValue;
+ UpdatedInArg(cntinarg).FindLike = TBFindLike;
+ UpdatedInArg(cntinarg).Dimension = TBDimension;
+ UpdatedInArg(cntinarg).Scope = TBScope;
end
- UpdatedInArg(cntinarg).Type = TBType;
- UpdatedInArg(cntinarg).Size = TBSize;
- UpdatedInArg(cntinarg).Value = TBValue;
- UpdatedInArg(cntinarg).FindLike = TBFindLike;
- UpdatedInArg(cntinarg).Dimension = TBDimension;
- UpdatedInArg(cntinarg).Scope = TBScope;
-
else
error(9999, 'Unknown scope identifier ""'+tmpscope+'"" for variable ""'+tmpname+'"".');
end
diff --git a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin Binary files differindex 6a319d99..dce28bc5 100644 --- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin +++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin diff --git a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci index caf9e32e..2d6c99c5 100644 --- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci +++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci @@ -4858,7 +4858,7 @@ ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls); PrintStringInfo('d0d0d2g2'+ArgSeparator+'d2',ClassFileName,'file','y');
PrintStringInfo('d0d0d0g2'+ArgSeparator+'d0',ClassFileName,'file','y');
PrintStringInfo('d2d0d2g2'+ArgSeparator+'d2',ClassFileName,'file','y');
-PrintStringInfo('d2d0d0g2'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('d2d0d0f0'+ArgSeparator+'d2',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
FunctionName = 'ode';
@@ -5086,37 +5086,37 @@ INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,Ex //------------------------------------
//---- Class PERMUTE -----------------
//------------------------------------
-ClassName = 'PERMUTE';
+//ClassName = 'PERMUTE';
// --- Class Annotation. ---
-PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
-ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+//PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+//ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
//Arguements specified: initial value, start time, time vector, ode function
-PrintStringInfo('NIN= 2',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(1).SZ(1)',ClassFileName,'file','y');
-PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y');
-
-ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
-PrintStringInfo('d2d2'+ArgSeparator+'d0',ClassFileName,'file','y');
-PrintStringInfo('s0s2'+ArgSeparator+'s0',ClassFileName,'file','y');
-PrintStringInfo('u80u82'+ArgSeparator+'u80',ClassFileName,'file','y');
-PrintStringInfo('i80i82'+ArgSeparator+'i80',ClassFileName,'file','y');
-PrintStringInfo('u160u162'+ArgSeparator+'u160',ClassFileName,'file','y');
-PrintStringInfo('i160i162'+ArgSeparator+'i160',ClassFileName,'file','y');
-PrintStringInfo('s0d2'+ArgSeparator+'s0',ClassFileName,'file','y');
-PrintStringInfo('u80d2'+ArgSeparator+'u80',ClassFileName,'file','y');
-PrintStringInfo('i80d2'+ArgSeparator+'i80',ClassFileName,'file','y');
-PrintStringInfo('u160d2'+ArgSeparator+'u160',ClassFileName,'file','y');
-PrintStringInfo('i160d2'+ArgSeparator+'i160',ClassFileName,'file','y');
+//PrintStringInfo('NIN= 2',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_SZ_PERMUTE_ROW(IN(1).SZ, IN(2).VAL)',ClassFileName,'file','y');
+//PrintStringInfo('OUT(1).SZ(2)= FA_SZ_PERMUTE_COL(IN(1).SZ, IN(2).VAL)',ClassFileName,'file','y');
+
+//ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+//PrintStringInfo('d2d2'+ArgSeparator+'d2',ClassFileName,'file','y');
+//PrintStringInfo('s2s2'+ArgSeparator+'s2',ClassFileName,'file','y');
+//PrintStringInfo('u82u82'+ArgSeparator+'u82',ClassFileName,'file','y');
+//PrintStringInfo('i82i82'+ArgSeparator+'i82',ClassFileName,'file','y');
+//PrintStringInfo('u162u162'+ArgSeparator+'u162',ClassFileName,'file','y');
+//PrintStringInfo('i162i162'+ArgSeparator+'i162',ClassFileName,'file','y');
+//PrintStringInfo('s2d2'+ArgSeparator+'s0',ClassFileName,'file','y');
+//PrintStringInfo('u82d2'+ArgSeparator+'u80',ClassFileName,'file','y');
+//PrintStringInfo('i82d2'+ArgSeparator+'i80',ClassFileName,'file','y');
+//PrintStringInfo('u162d2'+ArgSeparator+'u160',ClassFileName,'file','y');
+//PrintStringInfo('i162d2'+ArgSeparator+'i160',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
-FunctionName = 'permute';
-PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
-INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
-INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+//FunctionName = 'permute';
+//PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+//INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+//INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
// ////////////////////////////////////////////
// /////PARTE INTRODOTTA DA ALBERTO MOREA
diff --git a/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.bin b/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.bin Binary files differindex 8a5667d5..c7182880 100644 --- a/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.bin +++ b/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.bin diff --git a/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.sci b/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.sci index c24d4a1a..bee68d19 100644 --- a/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.sci +++ b/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.sci @@ -126,6 +126,9 @@ SharedInfo.Extension.FuncListClasses = '.lcls'; // Stands for list class // ------------------------
SharedInfo.ResizeApproach = 'NO_RESIZE'; // 'NO_RESIZE', 'RESIZE_ALL', 'RESIZE_TEMP', 'RESIZE_LOCAL', 'RESIZE_GLOBAL', 'REALLOC_ALL_RESIZE_ALL'
-SharedInfo.Target = Target;
+SharedInfo.Target = Target; // Specifies code generation target.
+
+SharedInfo.ODElist = list(); //Maintains list of ode functions being used in code
+ // to add their header files to main function.
endfunction
diff --git a/2.3-1/macros/findDeps/getAllHeaders.bin b/2.3-1/macros/findDeps/getAllHeaders.bin Binary files differindex 9f0ca086..a053d51a 100644 --- a/2.3-1/macros/findDeps/getAllHeaders.bin +++ b/2.3-1/macros/findDeps/getAllHeaders.bin diff --git a/2.3-1/macros/findDeps/getAllHeaders.sci b/2.3-1/macros/findDeps/getAllHeaders.sci index a8c23a15..06ef5487 100644 --- a/2.3-1/macros/findDeps/getAllHeaders.sci +++ b/2.3-1/macros/findDeps/getAllHeaders.sci @@ -141,8 +141,8 @@ function allHeaders = getAllHeaders(Target) "src/c/signalProcessing/includes/dynlib_signalprocessing.h" "src/c/signalProcessing/includes/crossCorr.h" "src/c/implicitList/dynlib_implicitlist.h" - "src/c/implicitList/implicitList.h"]; - //"src/c/differential_calculus/includes/ode.h"]; + "src/c/implicitList/implicitList.h" + "src/c/differential_calculus/includes/ode.h"]; //Header files required for "Arduino" output Arduino_headers = [ diff --git a/2.3-1/macros/findDeps/getAllInterfaces.bin b/2.3-1/macros/findDeps/getAllInterfaces.bin Binary files differindex 0b9ed8c6..53aaebe2 100644 --- a/2.3-1/macros/findDeps/getAllInterfaces.bin +++ b/2.3-1/macros/findDeps/getAllInterfaces.bin diff --git a/2.3-1/macros/findDeps/getAllInterfaces.sci b/2.3-1/macros/findDeps/getAllInterfaces.sci index 7574cc7f..8fd8f8d9 100644 --- a/2.3-1/macros/findDeps/getAllInterfaces.sci +++ b/2.3-1/macros/findDeps/getAllInterfaces.sci @@ -58,6 +58,7 @@ function allInterfaces = getAllInterfaces(Target) "src/c/matrixOperations/interfaces/int_tril.h" "src/c/matrixOperations/interfaces/int_kron.h" "src/c/matrixOperations/interfaces/int_flipdim.h" + "src/c/matrixOperations/interfaces/int_permute.h" "src/c/elementaryFunctions/interfaces/int_asinh.h" "src/c/elementaryFunctions/interfaces/int_atanh.h" "src/c/elementaryFunctions/interfaces/int_sinh.h" @@ -135,8 +136,8 @@ function allInterfaces = getAllInterfaces(Target) "src/c/signalProcessing/interfaces/int_fftshift.h" "src/c/signalProcessing/interfaces/int_fft.h" "src/c/signalProcessing/interfaces/int_lev.h" - "src/c/implicitList/int_OpColon.h"]; - //"src/c/differential_calculus/interfaces/int_ode.h"]; + "src/c/implicitList/int_OpColon.h" + "src/c/differential_calculus/interfaces/int_ode.h"]; //Interface files required for "Arduino" output Arduino_interfaces = [ diff --git a/2.3-1/macros/findDeps/getAllSources.bin b/2.3-1/macros/findDeps/getAllSources.bin Binary files differindex 75c2b579..5a7dc92e 100644 --- a/2.3-1/macros/findDeps/getAllSources.bin +++ b/2.3-1/macros/findDeps/getAllSources.bin diff --git a/2.3-1/macros/findDeps/getAllSources.sci b/2.3-1/macros/findDeps/getAllSources.sci index d8730781..5cac7bde 100644 --- a/2.3-1/macros/findDeps/getAllSources.sci +++ b/2.3-1/macros/findDeps/getAllSources.sci @@ -953,9 +953,9 @@ function allSources = getAllSources(Target) "src/c/implicitList/zimplicitLists.c" "src/c/implicitList/dimplicitLists.c" "src/c/implicitList/cimplicitLists.c" - "src/c/implicitList/simplicitLists.c"]; - //"src/c/differential_calculus/ode/dodes.c" - //"src/c/differential_calculus/ode/doded.c"]; + "src/c/implicitList/simplicitLists.c" + "src/c/differential_calculus/ode/dodes.c" + "src/c/differential_calculus/ode/dodea.c"]; //Files to be inserted only if output format selected is 'Arduino'. Arduino_files = ["src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c" diff --git a/2.3-1/macros/runsci2c.bin b/2.3-1/macros/runsci2c.bin Binary files differindex f5b80872..0adbe899 100644 --- a/2.3-1/macros/runsci2c.bin +++ b/2.3-1/macros/runsci2c.bin diff --git a/2.3-1/macros/runsci2c.sci b/2.3-1/macros/runsci2c.sci index 206a362f..da2ba4d3 100644 --- a/2.3-1/macros/runsci2c.sci +++ b/2.3-1/macros/runsci2c.sci @@ -74,7 +74,7 @@ INIT_LoadLibraries(FileInfoDatFile); // ----------------------------------
// --- Perform SCI2C Translation. ---
// ----------------------------------
-if (RunMode == 'All' | RunMode == 'Translate' | RunMode == "FunCall")
+if (RunMode == 'All' | RunMode == 'Translate')
FlagContinueTranslation = 1;
while(FlagContinueTranslation == 1)
UpdateSCI2CInfo(FileInfoDatFile);
@@ -85,12 +85,11 @@ if (RunMode == 'All' | RunMode == 'Translate' | RunMode == "FunCall") end
end
-
-
+load(SharedInfoDatFile,'SharedInfo');
// ---------------------------
// --- Copy library files. ---
// ---------------------------
-if (RunMode <> 'FunCall')
+
global SCI2CHOME
allSources = SCI2CHOME + "/" + getAllSources(Target);
@@ -176,7 +175,7 @@ end // FIXME : Give the user the ability to set this prefix
FunctionPrefix = "SCI2C";
C_GenerateSCI2CHeader(SCI2COutputPath+"/includes/", FunctionPrefix);
-end
+
// -----------------
// --- Epilogue. ---
// -----------------
diff --git a/2.3-1/src/c/differential_calculus/includes/ode.h b/2.3-1/src/c/differential_calculus/includes/ode.h index f08909ce..0a870201 100644 --- a/2.3-1/src/c/differential_calculus/includes/ode.h +++ b/2.3-1/src/c/differential_calculus/includes/ode.h @@ -1,14 +1,15 @@ -// 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: Siddhesh Wani -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + #ifndef __ODE_H__ #define __ODE_H__ @@ -16,8 +17,8 @@ double dodes(double initial_value, double start_time, double end_time, \ char *ode_function, double nequs, double eps_abs, double eps_rel, \ double step_size); -void doded(double *initial_value, double start_time, double end_time, \ +void dodea(double *initial_value, double start_time, double end_time, \ char *ode_function, double nequs, double eps_abs, double eps_rel, \ - double step_size, double *out); + double step_size, int *params, double *out); #endif /*__ODE_H__*/
\ No newline at end of file diff --git a/2.3-1/src/c/differential_calculus/interfaces/int_ode.h b/2.3-1/src/c/differential_calculus/interfaces/int_ode.h index a27acbad..1cb64497 100644 --- a/2.3-1/src/c/differential_calculus/interfaces/int_ode.h +++ b/2.3-1/src/c/differential_calculus/interfaces/int_ode.h @@ -1,13 +1,14 @@ -// 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: Siddhesh Wani -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ #ifndef __INT_ODE_H__ #define __INT_ODE_H__ @@ -19,8 +20,8 @@ extern "C" { #define d0d0d0g2oded0(in1, in2, in3, in4) dodes(in1, in2, in3, in4, 1, 1.0e-2,\ 1.0e-2, 1.0e-6) -#define d2d0d0g2oded2(in1, size1, in2, in3, func_name, strsize, out) doded(in1, in2, in3, func_name \ - 1, 1.0e-2, 1.0e-2, 1.0e-6, out) +#define d2d0d0f0oded2(in1, size1, in2, in3, func_name, out) dodea(in1, in2, in3, func_name, \ + size1[1], 1.0e-2, 1.0e-2, 1.0e-6, size1, out) #ifdef __cplusplus } /* extern "C" */ diff --git a/2.3-1/src/c/differential_calculus/ode/dodea.c b/2.3-1/src/c/differential_calculus/ode/dodea.c new file mode 100644 index 00000000..ff3cbdec --- /dev/null +++ b/2.3-1/src/c/differential_calculus/ode/dodea.c @@ -0,0 +1,49 @@ +/* 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: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +//Function for solving ODEs using GSL library + +#include "ode.h" +#include "types.h" +#include <gsl/gsl_errno.h> +#include <gsl/gsl_matrix.h> +#include <gsl/gsl_odeiv2.h> + + +void dodea(double *initial_value, double start_time, double end_time, \ + char *ode_function, double nequs, double eps_abs, double eps_rel, \ + double step_size, int *params, double *out) +{ + double t = start_time; + //Initialise output to initial state + int counter = 0; + for (counter = 0; counter<nequs;counter++) + { + out[counter] = initial_value[counter]; + } + + //Setup ODE related parameters + gsl_odeiv2_system sys = {ode_function, NULL, 2, params}; + + gsl_odeiv2_step *s = gsl_odeiv2_step_alloc (gsl_odeiv2_step_rkf45, nequs); + gsl_odeiv2_control *c = gsl_odeiv2_control_y_new (eps_abs, eps_rel); + gsl_odeiv2_evolve *e = gsl_odeiv2_evolve_alloc (nequs); + + while(t < end_time) + { + gsl_odeiv2_evolve_apply_fixed_step (e, c, s, &sys, &t, step_size, out); + } + + gsl_odeiv2_evolve_free (e); + gsl_odeiv2_control_free (c); + gsl_odeiv2_step_free (s); +} diff --git a/2.3-1/src/c/differential_calculus/ode/doded.c b/2.3-1/src/c/differential_calculus/ode/doded.c deleted file mode 100644 index b544c422..00000000 --- a/2.3-1/src/c/differential_calculus/ode/doded.c +++ /dev/null @@ -1,39 +0,0 @@ -// 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: Siddhesh Wani -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - -#include "ode.h" -#include "types.h" -#include <gsl/gsl_errno.h> -#include <gsl/gsl_matrix.h> -#include <gsl/gsl_odeiv2.h> - - -void doded(double *initial_value, double start_time, double end_time, \ - char *ode_function, double nequs, double eps_abs, double eps_rel, \ - double step_size, double *out) -{ - double t = start_time; - //Setup ODE related parameters - gsl_odeiv2_system sys = {ode_function, NULL, 2, NULL}; - - gsl_odeiv2_step *s = gsl_odeiv2_step_alloc (gsl_odeiv2_step_rkf45, nequs); - gsl_odeiv2_control *c = gsl_odeiv2_control_y_new (eps_abs, eps_rel); - gsl_odeiv2_evolve *e = gsl_odeiv2_evolve_alloc (nequs); - - while(t < end_time) - { - gsl_odeiv2_evolve_apply_fixed_step (e, c, s, &sys, &t, step_size, &out); - } - - gsl_odeiv2_evolve_free (e); - gsl_odeiv2_control_free (c); - gsl_odeiv2_step_free (s); -} diff --git a/2.3-1/src/c/matrixOperations/interfaces/int_permute.h b/2.3-1/src/c/matrixOperations/interfaces/int_permute.h new file mode 100644 index 00000000..5f2bea58 --- /dev/null +++ b/2.3-1/src/c/matrixOperations/interfaces/int_permute.h @@ -0,0 +1,28 @@ +// 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: Siddhesh Wani +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + + +#ifndef __INT_PERMUTE_H__ +#define __INT_PERMUTE_H__ + + +#ifdef __cplusplus +#extern "C" { +#endif + +#define d2d2permuted2(in1, size1, in2, size2, out) (if(in2[0]==1)?in1: \ + dtransposea(in1, size1[0],size1[1],out)) + +#ifdef __cplusplus +#} /* extern "C" */ +#endif + +#endif /*__INT_FLIPDIM_H__*/ diff --git a/2.3-1/src/c/type/types.h b/2.3-1/src/c/type/types.h index d8cb523c..a76bf303 100644 --- a/2.3-1/src/c/type/types.h +++ b/2.3-1/src/c/type/types.h @@ -14,4 +14,4 @@ typedef signed char int8; typedef signed short int16; typedef signed int int32; -#endif //_TYPES_H +#endif /*_TYPES_H*/ |