1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
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
|