diff options
author | nutricato | 2007-04-06 07:17:51 +0000 |
---|---|---|
committer | nutricato | 2007-04-06 07:17:51 +0000 |
commit | 0542206e14aa3bb3dc3e6bbd3690bd9901788127 (patch) | |
tree | b92d17777f0779aa89a821fcf91b08f8dc8ba56f | |
parent | c3062b0b671fc9bbd05b53e21d1107364a9a398b (diff) | |
download | scilab2c-0542206e14aa3bb3dc3e6bbd3690bd9901788127.tar.gz scilab2c-0542206e14aa3bb3dc3e6bbd3690bd9901788127.tar.bz2 scilab2c-0542206e14aa3bb3dc3e6bbd3690bd9901788127.zip |
7 files changed, 368 insertions, 374 deletions
diff --git a/src/Scilab2C/FunctionTableManagement/AddBranch.sci b/src/Scilab2C/FunctionTableManagement/AddBranch.sci index e5f2da7b..a03e7193 100644 --- a/src/Scilab2C/FunctionTableManagement/AddBranch.sci +++ b/src/Scilab2C/FunctionTableManagement/AddBranch.sci @@ -3,13 +3,13 @@ function TreeBase = AddBranch(TreeBase, Branch, CINFO ) // To understand how this software works the steps are:
//
// 1. check if "fn" is stored in the USER2CLib;
-// a. if "fn" there is, we have to check if "fn.S" there is
-// i. if "fn.S" there is, we have to check if "fn.S.R" there is
-// ii. if "fn.S" there isn't, we can store the Branch
+// a. if "fn" exists, we have to check if "fn.S" exists
+// i. if "fn.S" exists, we have to check if "fn.S.R" exists
+// ii. if "fn.S" doesn't exist, we can store the Branch
// ...
// and in the same way for the other case.
//
-// b. if "fn" there isn't, we can store all the Branch
+// b. if "fn" doesn't exist, we can store the whole Branch
getf("SearchFunctionName.sci");
@@ -107,7 +107,7 @@ function TreeBase = AddBranch(TreeBase, Branch, CINFO ) if dimension(1) == 1 then
//
-// If I point to a leaf, I construct a temporany tree before to append the leaf
+// If I point to a leaf, I construct a temporary tree before to append the leaf
//
TempTreeBase = tlist( ["TempTreeBase", TempLeaf], "ERROR" );
diff --git a/src/Scilab2C/FunctionTableManagement/AddElementaryFunction.sci b/src/Scilab2C/FunctionTableManagement/AddElementaryFunction.sci new file mode 100644 index 00000000..3507ad0d --- /dev/null +++ b/src/Scilab2C/FunctionTableManagement/AddElementaryFunction.sci @@ -0,0 +1,16 @@ +function TreeOut = AddElementaryFunction(FunctionName,TreeIn) +// This function returns a tree starting obtained from the input
+// tree (TreeIn) to which the elementary function "FunctionName" has
+// been added.
+
+getf("GenerateLeafElementary.sci");
+
+disp([' --> Adding the elementary function: ',FunctionName]);
+[FuncStruct, CINFO, NumFunc] = GenerateLeafElementary(FunctionName);
+
+TreeOut = TreeIn;
+for ind = 1 : NumFunc,
+ TreeOut = AddBranch(TreeOut, FuncStruct(ind), CINFO(ind) );
+end
+
+endfunction
diff --git a/src/Scilab2C/FunctionTableManagement/AddLeafElementary.sci b/src/Scilab2C/FunctionTableManagement/AddLeafElementary.sci deleted file mode 100644 index 6e6a898c..00000000 --- a/src/Scilab2C/FunctionTableManagement/AddLeafElementary.sci +++ /dev/null @@ -1,84 +0,0 @@ -function [FuncStruct, CINFO, NumFunc] = AddLeafElementary(FunctionName) -
- NumFunc = 0;
-
- NumFunc = NumFunc + 1;
-
- FuncStruct(NumFunc) = FunctionName + ".S.R.F.CINFO"; - CINFO(NumFunc).CPROT = "y=SRF" + FunctionName + "SRF(x)"; - CINFO(NumFunc).SIZE = "S"; - CINFO(NumFunc).TYPE = "R"; - CINFO(NumFunc).PREC = "F";
- CINFO(NumFunc).DIM = "O1Sz = I1Sz";
- CINFO(NumFunc).NOut = 1; -
- NumFunc = NumFunc + 1;
-
- FuncStruct(NumFunc) = FunctionName + ".S.R.D.CINFO";
- CINFO(NumFunc).CPROT = "y=SRD" + FunctionName + "SRD(x)"; - CINFO(NumFunc).SIZE = "S"; - CINFO(NumFunc).TYPE = "R"; - CINFO(NumFunc).PREC = "D";
- CINFO(NumFunc).DIM = "O1Sz = I1Sz";
- CINFO(NumFunc).NOut = 1; -
- NumFunc = NumFunc + 1;
-
- FuncStruct(NumFunc) = FunctionName + ".S.C.F.CINFO";
- CINFO(NumFunc).CPROT = "y=SCF" + FunctionName + "SCF(x)"; - CINFO(NumFunc).SIZE = "S"; - CINFO(NumFunc).TYPE = "C"; - CINFO(NumFunc).PREC = "F"; - CINFO(NumFunc).DIM = "O1Sz = I1Sz";
- CINFO(NumFunc).NOut = 1;
-
- NumFunc = NumFunc + 1;
-
- FuncStruct(NumFunc) = FunctionName + ".S.C.D.CINFO";
- CINFO(NumFunc).CPROT = "y=SCD" + FunctionName + "SCD(x)"; - CINFO(NumFunc).SIZE = "S"; - CINFO(NumFunc).TYPE = "C"; - CINFO(NumFunc).PREC = "D"; - CINFO(NumFunc).DIM = "O1Sz = I1Sz";
- CINFO(NumFunc).NOut = 1;
-
- NumFunc = NumFunc + 1;
-
- FuncStruct(NumFunc) = FunctionName + ".M.R.F.CINFO";
- CINFO(NumFunc).CPROT = "MRF" + FunctionName + "MRF(*X, strideX, *Y, strideY, Nelements)"; - CINFO(NumFunc).SIZE = "M"; - CINFO(NumFunc).TYPE = "R"; - CINFO(NumFunc).PREC = "F";
- CINFO(NumFunc).DIM = "O1Sz = I1Sz";
- CINFO(NumFunc).NOut = 1; -
- NumFunc = NumFunc + 1;
-
- FuncStruct(NumFunc) = FunctionName + ".M.R.D.CINFO";
- CINFO(NumFunc).CPROT = "MRD" + FunctionName + "MRD(*X, strideX, *Y, strideY, Nelements)"; - CINFO(NumFunc).SIZE = "M"; - CINFO(NumFunc).TYPE = "R"; - CINFO(NumFunc).PREC = "D";
- CINFO(NumFunc).DIM = "O1Sz = I1Sz";
- CINFO(NumFunc).NOut = 1; -
- NumFunc = NumFunc + 1;
-
- FuncStruct(NumFunc) = FunctionName + ".M.C.F.CINFO";
- CINFO(NumFunc).CPROT = "MCF" + FunctionName + "MCF(*X, strideX, *Y, strideY, Nelements)"; - CINFO(NumFunc).SIZE = "M"; - CINFO(NumFunc).TYPE = "C"; - CINFO(NumFunc).PREC = "F";
- CINFO(NumFunc).DIM = "O1Sz = I1Sz";
- CINFO(NumFunc).NOut = 1; -
- NumFunc = NumFunc + 1;
-
- FuncStruct(NumFunc) = FunctionName + ".M.C.D.CINFO";
- CINFO(NumFunc).CPROT = "MCD" + FunctionName + "MCD(*X, strideX, *Y, strideY, Nelements)"; - CINFO(NumFunc).SIZE = "M"; - CINFO(NumFunc).TYPE = "C"; - CINFO(NumFunc).PREC = "D";
- CINFO(NumFunc).DIM = "O1Sz = I1Sz";
- CINFO(NumFunc).NOut = 1;
-endfunction diff --git a/src/Scilab2C/FunctionTableManagement/Example.sce b/src/Scilab2C/FunctionTableManagement/Example.sce index dde9e9c2..4d69b601 100644 --- a/src/Scilab2C/FunctionTableManagement/Example.sce +++ b/src/Scilab2C/FunctionTableManagement/Example.sce @@ -1,44 +1,93 @@ -// in the following you can find some examples that help you to use the biuild in functions.
+// In this script you can find some examples that show how to work with the
+// SCI2C and USER libraries.
-// the first operation is to find the path where the files are stored
-// cd <path>
+// Run the following code lines in the directory where the main.sci file is stored.
+// cd <path_of_main.sci_file>
- clear;
- clc;
+clear;
+clc;
- getf("main.sci");
- [SCI2CLib, USER2CLib] = main();
-
-//
-// I add the same function with two inputs
-//
-// Branch=FunctionStructure;
-// TreeBase=USER2CLib;
-//
- getf("SearchFunctionName.sci");
- getf("AddBranch.sci");
+getf("InitializeLibraries.sci");
+[SCI2CLib, USER2CLib] = InitializeLibraries();
- FunctionStructure = "fn.S.R.D.S.R.D.CINFO";
-
- clear CINFO;
-
- CINFO.CPROT = "y=SRDSRDfnSRD";
- CINFO.SIZE = "S";
- CINFO.TYPE = "R";
- CINFO.PREC = "D";
+// ------------------
+// --- Example 1. ---
+// ------------------
+// In this example it is shown how to get the
+// C function info from a given Scilab function.
+// The user prepares a string (FunctionStructure) where
+// all the Scilab function info are stored.
+// Let's consider the following example:
+// Scilab function: tan
+// Input size: scalar (S)
+// Input type: real (R)
+// Input precision: double (D)
+// In this case the user prepares the following string:
+FunctionStructure = "tan.S.R.D.CINFO";
+// And executes the following command:
+getf("SearchFunctionName.sci");
+[Cprototype, FlagFind] = SearchFunctionName(FunctionStructure, "SCI2CLib");
- [Cprototype, FlagFind] = SearchFunctionName(FunctionStructure, "SCI2CLib");
+
+// ------------------
+// --- Example 2. ---
+// ------------------
+// In this example it is shown what happens when
+// the user searches for a function that is not
+// stored neither in the SCI2CLib nor in the USER2CLib.
+// Let's suppose that the user is searching for the
+// foo function having two inputs:
+FunctionStructure = "foo.S.R.D.S.R.D.CINFO";
+
+// In this case if the user launches the following command:
+// getf("SearchFunctionName.sci");
+// [Cprototype, FlagFind] = SearchFunctionName(FunctionStructure, "SCI2CLib");
+// he/she will get FlagFind = F!
+
+// The problem is solved in the following way:
+
+[Cprototype, FlagFind] = SearchFunctionName(FunctionStructure, "SCI2CLib");
+if FlagFind==%F then
+ // We try to search the function in the USER2CLib.
+ [Cprototype, FlagFind] = SearchFunctionName(FunctionStructure, "USER2CLib");
if FlagFind==%F then
+ // If the function is not stored in the USER2CLib function,
+ // the tool will search for the file containing the function and will
+ // try to extract from that file the following info:
+ // CINFO.SIZE, CINFO.TYPE, CINFO.PREC
+
+ // Suppose the following CINFO have been retrieved:
+ // CINFO.SIZE = "S";
+ // CINFO.TYPE = "R";
+ // CINFO.PREC = "D";
+
+ // Once CINFO have been retrieved it is possible to insert the new function
+ // into the USER2CLib by using the following approach:
+ clear CINFO;
+ CINFO.CPROT = "y=SRDSRDfooSRD";
+ CINFO.SIZE = "S";
+ CINFO.TYPE = "R";
+ CINFO.PREC = "D";
+
+ USER2CLib = AddBranch( USER2CLib, FunctionStructure, CINFO );
[Cprototype, FlagFind] = SearchFunctionName(FunctionStructure, "USER2CLib");
-
- if FlagFind==%F then
- USER2CLib = AddBranch( USER2CLib, FunctionStructure, CINFO );
- end
-
end
-
- eval("USER2CLib." + FunctionStructure)
+end
+// eval("USER2CLib." + FunctionStructure);
+
+
+
+
+
+
+
+
+
+
+
+
+
//
// now I change one output type
diff --git a/src/Scilab2C/FunctionTableManagement/GenerateLeafElementary.sci b/src/Scilab2C/FunctionTableManagement/GenerateLeafElementary.sci new file mode 100644 index 00000000..f9c39345 --- /dev/null +++ b/src/Scilab2C/FunctionTableManagement/GenerateLeafElementary.sci @@ -0,0 +1,86 @@ +function [FuncStruct, CINFO, NumFunc] = GenerateLeafElementary(FunctionName) +// This function generates the leaf for the
+// "FunctionName" elementary function.
+
+NumFunc = 0;
+
+NumFunc = NumFunc + 1;
+
+FuncStruct(NumFunc) = FunctionName + ".S.R.F.CINFO"; +CINFO(NumFunc).CPROT = "y=SRF" + FunctionName + "SRF(x)"; +CINFO(NumFunc).SIZE = "S"; +CINFO(NumFunc).TYPE = "R"; +CINFO(NumFunc).PREC = "F";
+CINFO(NumFunc).DIM = "O1Sz = I1Sz";
+CINFO(NumFunc).NOut = 1; +
+NumFunc = NumFunc + 1;
+
+FuncStruct(NumFunc) = FunctionName + ".S.R.D.CINFO";
+CINFO(NumFunc).CPROT = "y=SRD" + FunctionName + "SRD(x)"; +CINFO(NumFunc).SIZE = "S"; +CINFO(NumFunc).TYPE = "R"; +CINFO(NumFunc).PREC = "D";
+CINFO(NumFunc).DIM = "O1Sz = I1Sz";
+CINFO(NumFunc).NOut = 1; +
+NumFunc = NumFunc + 1;
+
+FuncStruct(NumFunc) = FunctionName + ".S.C.F.CINFO";
+CINFO(NumFunc).CPROT = "y=SCF" + FunctionName + "SCF(x)"; +CINFO(NumFunc).SIZE = "S"; +CINFO(NumFunc).TYPE = "C"; +CINFO(NumFunc).PREC = "F"; +CINFO(NumFunc).DIM = "O1Sz = I1Sz";
+CINFO(NumFunc).NOut = 1;
+
+NumFunc = NumFunc + 1;
+
+FuncStruct(NumFunc) = FunctionName + ".S.C.D.CINFO";
+CINFO(NumFunc).CPROT = "y=SCD" + FunctionName + "SCD(x)"; +CINFO(NumFunc).SIZE = "S"; +CINFO(NumFunc).TYPE = "C"; +CINFO(NumFunc).PREC = "D"; +CINFO(NumFunc).DIM = "O1Sz = I1Sz";
+CINFO(NumFunc).NOut = 1;
+
+NumFunc = NumFunc + 1;
+
+FuncStruct(NumFunc) = FunctionName + ".M.R.F.CINFO";
+CINFO(NumFunc).CPROT = "MRF" + FunctionName + "MRF(*X, strideX, *Y, strideY, Nelements)"; +CINFO(NumFunc).SIZE = "M"; +CINFO(NumFunc).TYPE = "R"; +CINFO(NumFunc).PREC = "F";
+CINFO(NumFunc).DIM = "O1Sz = I1Sz";
+CINFO(NumFunc).NOut = 1; +
+NumFunc = NumFunc + 1;
+
+FuncStruct(NumFunc) = FunctionName + ".M.R.D.CINFO";
+CINFO(NumFunc).CPROT = "MRD" + FunctionName + "MRD(*X, strideX, *Y, strideY, Nelements)"; +CINFO(NumFunc).SIZE = "M"; +CINFO(NumFunc).TYPE = "R"; +CINFO(NumFunc).PREC = "D";
+CINFO(NumFunc).DIM = "O1Sz = I1Sz";
+CINFO(NumFunc).NOut = 1; +
+NumFunc = NumFunc + 1;
+
+FuncStruct(NumFunc) = FunctionName + ".M.C.F.CINFO";
+CINFO(NumFunc).CPROT = "MCF" + FunctionName + "MCF(*X, strideX, *Y, strideY, Nelements)"; +CINFO(NumFunc).SIZE = "M"; +CINFO(NumFunc).TYPE = "C"; +CINFO(NumFunc).PREC = "F";
+CINFO(NumFunc).DIM = "O1Sz = I1Sz";
+CINFO(NumFunc).NOut = 1; +
+NumFunc = NumFunc + 1;
+
+FuncStruct(NumFunc) = FunctionName + ".M.C.D.CINFO";
+CINFO(NumFunc).CPROT = "MCD" + FunctionName + "MCD(*X, strideX, *Y, strideY, Nelements)"; +CINFO(NumFunc).SIZE = "M"; +CINFO(NumFunc).TYPE = "C"; +CINFO(NumFunc).PREC = "D";
+CINFO(NumFunc).DIM = "O1Sz = I1Sz";
+CINFO(NumFunc).NOut = 1;
+endfunction diff --git a/src/Scilab2C/FunctionTableManagement/InitializeLibraries.sci b/src/Scilab2C/FunctionTableManagement/InitializeLibraries.sci new file mode 100644 index 00000000..a2a71fab --- /dev/null +++ b/src/Scilab2C/FunctionTableManagement/InitializeLibraries.sci @@ -0,0 +1,180 @@ +function [SCI2CLib, USER2CLib] = InitializeLibraries()
+// This function generates the trees for the SCI2C and USER libraries.
+//
+// For each Scilab function a set of corresponding C functions are inserted into
+// the tree.
+// For each C function a CINFO leaf is insterted into the tree.
+// The CINFO leaf is a structure with many fields each of them
+// containing information on the input and output arguments of the function.
+// Dim is the expression that returns the size of the output(s)
+// Example:
+// Let's consider the sin function
+// and a scalar input variable (I1Sz = 1;)
+// It is possible to get the size of the output argument by using
+// the Dim field: Dim = "O1Sz = I1Sz"
+// and the following Scilab command:
+// eval(Dim);
+//
+// NOut is the number of the output(s).
+
+clear;
+clc;
+
+getf("AddBranch.sci");
+
+// Implement the SCI2C library tree as a tlist.
+SCI2CLib = tlist(["SCI2CLib"]);
+
+// Implement the USER libary tree as a tlist.
+USER2CLib = tlist(["USER2CLib"]);
+
+// ---------------------------------------------------------------
+// --- Add the elementary functions to the SCI2C library tree. ---
+// ---------------------------------------------------------------
+disp('--> Adding the elementary functions to the SCI2C library tree.');
+
+getf("AddElementaryFunction.sci");
+SCI2CLib = AddElementaryFunction("sin",SCI2CLib);
+SCI2CLib = AddElementaryFunction("cos",SCI2CLib);
+SCI2CLib = AddElementaryFunction("tan",SCI2CLib);
+SCI2CLib = AddElementaryFunction("cotg",SCI2CLib);
+SCI2CLib = AddElementaryFunction("asin",SCI2CLib);
+SCI2CLib = AddElementaryFunction("acos",SCI2CLib);
+SCI2CLib = AddElementaryFunction("sinh",SCI2CLib);
+SCI2CLib = AddElementaryFunction("cosh",SCI2CLib);
+SCI2CLib = AddElementaryFunction("tanh",SCI2CLib);
+SCI2CLib = AddElementaryFunction("asinh",SCI2CLib);
+SCI2CLib = AddElementaryFunction("acosh",SCI2CLib);
+SCI2CLib = AddElementaryFunction("atanh",SCI2CLib);
+SCI2CLib = AddElementaryFunction("exp",SCI2CLib);
+SCI2CLib = AddElementaryFunction("log",SCI2CLib);
+SCI2CLib = AddElementaryFunction("log10",SCI2CLib);
+SCI2CLib = AddElementaryFunction("abs",SCI2CLib);
+SCI2CLib = AddElementaryFunction("inv",SCI2CLib);
+SCI2CLib = AddElementaryFunction("sqrtR",SCI2CLib);
+// -------------------------------------------------------------------
+// --- End add the elementary functions to the SCI2C library tree. ---
+// -------------------------------------------------------------------
+
+
+
+
+
+if (1==2)
+// determinant function
+
+ getf("AddLeafDet.sci");
+
+ [FuncStruct, CINFO, NumFunc] = AddLeafDet("det");
+
+ for ind = 1 : NumFunc,
+ SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
+ end
+
+// sqrt function
+
+ getf("AddLeafSqrt.sci");
+
+ [FuncStruct, CINFO, NumFunc] = AddLeafSqrt("sqrt");
+
+ for ind = 1 : NumFunc,
+ SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
+ end
+
+// I add the function with 2 Input
+
+// dot function
+
+ getf("AddLeafDotOp.sci");
+
+ [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("DotAdd");
+
+ for ind = 1 : NumFunc,
+ SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
+ end
+
+ [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("DotSub");
+
+ for ind = 1 : NumFunc,
+ SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
+ end
+
+ [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("DotMul");
+
+ for ind = 1 : NumFunc,
+ SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
+ end
+
+ [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("DotDiv");
+
+ for ind = 1 : NumFunc,
+ SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
+ end
+
+// op function
+
+ [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("OpAdd");
+
+ for ind = 1 : NumFunc,
+ SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
+ end
+
+ [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("OpSub");
+
+ for ind = 1 : NumFunc,
+ SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
+ end
+
+ [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("OpMul");
+
+ for ind = 1 : NumFunc,
+ SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
+ end
+
+ [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("OpDiv");
+
+ for ind = 1 : NumFunc,
+ SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
+ end
+
+// atan function
+
+ getf("AddLeafAtan.sci");
+
+ [FuncStruct, CINFO, NumFunc] = AddLeafAtan("atan");
+
+ for ind = 1 : NumFunc,
+ SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
+ end
+
+// convol function
+
+ getf("AddLeafConvol.sci");
+
+ [FuncStruct, CINFO, NumFunc] = AddLeafConvol("convol");
+
+ for ind = 1 : NumFunc,
+ SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
+ end
+
+// fft function
+
+ getf("AddLeafFFT.sci");
+
+ [FuncStruct, CINFO, NumFunc] = AddLeafFFT("fft");
+
+ for ind = 1 : NumFunc,
+ SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
+ end
+
+// ifft function
+
+ getf("AddLeafIFFT.sci");
+
+ [FuncStruct, CINFO, NumFunc] = AddLeafIFFT("ifft");
+
+ for ind = 1 : NumFunc,
+ SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
+ end
+end // end if (1==2)
+endfunction
diff --git a/src/Scilab2C/FunctionTableManagement/main.sci b/src/Scilab2C/FunctionTableManagement/main.sci deleted file mode 100644 index b28c1111..00000000 --- a/src/Scilab2C/FunctionTableManagement/main.sci +++ /dev/null @@ -1,253 +0,0 @@ -function [SCI2CLib, USER2CLib] = main()
-//
-// Dim is the expression that returns the size of the output(s)
-// Example:
-// if I want to calculate the size of the output sin than
-// x is Scalar
-// I1Sz = 1;
-//
-// Dim = "O1Sz = I1Sz"
-// eval(Dim);
-//
-// NOut is the number of the output(s).
-// Example: if I have 1 output then NOut = 1
-// if I have 2 outputs then NOut = 2
-//
- clear;
- clc;
-
- getf("AddBranch.sci");
-
- SCI2CLib = tlist(["SCI2CLib"]);
-
- USER2CLib = tlist(["USER2CLib"]);
-
-// I create the library for the elementary function
-
- getf("AddLeafElementary.sci");
-
- [FuncStruct, CINFO, NumFunc] = AddLeafElementary("sin");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafElementary("cos");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafElementary("tan");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafElementary("cotg");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafElementary("asin");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafElementary("acos");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafElementary("sinh");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafElementary("cosh");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafElementary("tanh");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafElementary("asinh");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafElementary("acosh");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafElementary("atanh");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafElementary("exp");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafElementary("log");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafElementary("log10");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafElementary("abs");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafElementary("inv");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafElementary("sqrtR");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
-// determinant function
-
- getf("AddLeafDet.sci");
-
- [FuncStruct, CINFO, NumFunc] = AddLeafDet("det");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
-// sqrt function
-
- getf("AddLeafSqrt.sci");
-
- [FuncStruct, CINFO, NumFunc] = AddLeafSqrt("sqrt");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
-// I add the function with 2 Input
-
-// dot function
-
- getf("AddLeafDotOp.sci");
-
- [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("DotAdd");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("DotSub");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("DotMul");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("DotDiv");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
-// op function
-
- [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("OpAdd");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("OpSub");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("OpMul");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
- [FuncStruct, CINFO, NumFunc] = AddLeafDotOp("OpDiv");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
-// atan function
-
- getf("AddLeafAtan.sci");
-
- [FuncStruct, CINFO, NumFunc] = AddLeafAtan("atan");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
-// convol function
-
- getf("AddLeafConvol.sci");
-
- [FuncStruct, CINFO, NumFunc] = AddLeafConvol("convol");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
-// fft function
-
- getf("AddLeafFFT.sci");
-
- [FuncStruct, CINFO, NumFunc] = AddLeafFFT("fft");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
-// ifft function
-
- getf("AddLeafIFFT.sci");
-
- [FuncStruct, CINFO, NumFunc] = AddLeafIFFT("ifft");
-
- for ind = 1 : NumFunc,
- SCI2CLib = AddBranch(SCI2CLib, FuncStruct(ind), CINFO(ind) );
- end
-
-endfunction
|