Update of the localization templates
[scilab.git] / scilab / modules / differential_equations / macros / dae.sci
1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C) 2008 - INRIA - Sabine GAUZERE
3 // 
4 // This file must be used under the terms of the CeCILL.
5 // This source file is licensed as described in the file COPYING, which
6 // you should have received as part of this distribution.  The terms
7 // are also available at    
8 // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
9
10
11 function [varargout]=dae(varargin)
12   [lhs,rhs]=argn();
13   if (isdef('%DAEOPTIONS')==%F),
14     %DAEOPTIONS=list ([],0,[],[],[],0,0);
15   end
16   if (size(varargin) == 0),
17         error(sprintf(gettext("%s: Wrong number of input argument(s): %d or %d expected.\n"), "dae",3,8));
18   end
19   if (type(varargin(1))==1), //standard case (dassl)
20     
21         if (rhs==4), //call without optional arguments
22            [x0,t0,t,res]=varargin(:)
23            if (lhs==2),
24             [y,hd]=dassl(x0,t0,t,res,%DAEOPTIONS);
25            elseif (lhs==1),
26             [y]=dassl(x0,t0,t,res,%DAEOPTIONS);
27            else,
28             error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",1,2));
29            end
30
31         elseif (rhs==8), // call with all the optional arguments
32            [x0,t0,t,rtol,atol,res,jac,hd]=varargin(:)
33            if (lhs==2),
34             [y,hd]=dassl(x0,t0,t,atol,rtol,res,jac,%DAEOPTIONS,hd);
35            elseif (lhs==1),
36             [y]=dassl(x0,t0,t,atol,rtol,res,jac,%DAEOPTIONS,hd);
37            else,
38             error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",1,2));
39            end
40
41         elseif (rhs==5),
42
43             if (type(varargin(4))==1),
44               [x0,t0,t,atol,res]=varargin(:)
45               if (lhs==2),
46                [y,hd]=dassl(x0,t0,t,atol,res,%DAEOPTIONS);
47               elseif (lhs==1),
48                [y]=dassl(x0,t0,t,atol,res,%DAEOPTIONS);
49               else,
50                error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",1,2));
51               end
52
53             else,
54
55               if (type(varargin(5))==1),
56                 [x0,t0,t,res,hd]=varargin(:)
57                 if (lhs==2),
58                  [y,hd]=dassl(x0,t0,t,res,%DAEOPTIONS,hd);
59                 elseif (lhs==1),
60                  [y]=dassl(x0,t0,t,res,%DAEOPTIONS,hd);
61                 else,
62                  error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",1,2));
63                 end
64              
65               else,
66                 [x0,t0,t,res,jac]=varargin(:)
67                 if (lhs==2),
68                  [y,hd]=dassl(x0,t0,t,res,jac,%DAEOPTIONS);
69                 elseif (lhs==1),
70                  [y]=dassl(x0,t0,t,res,jac,%DAEOPTIONS); 
71                 else,
72                  error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",1,2));
73                 end
74
75               end
76
77             end
78
79           elseif(rhs==6),
80
81             if (type(varargin(4))==1),
82
83               if(type(varargin(5))==1),
84                 [x0,t0,t,rtol,atol,res]=varargin(:)
85                 if (lhs==2),
86                  [y,hd]=dassl(x0,t0,t,atol,rtol,res,%DAEOPTIONS);
87                 elseif (lhs==1),
88                  [y]=dassl(x0,t0,t,atol,rtol,res,%DAEOPTIONS); 
89                 else,
90                  error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",1,2));
91                 end
92
93               else,
94
95                 if (type(varargin(6))==1),
96                  [x0,t0,t,atol,res,hd]=varargin(:)
97                  if (lhs==2),
98                   [y,hd]=dassl(x0,t0,t,atol,res,%DAEOPTIONS,hd);
99                  elseif (lhs==1),
100                   [y]=dassl(x0,t0,t,atol,res,%DAEOPTIONS,hd); 
101                  else,
102                    error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",1,2));
103                  end
104
105                 else,
106                  [x0,t0,t,atol,res,jac]=varargin(:)
107                  if (lhs==2),
108                   [y,hd]=dassl(x0,t0,t,atol,res,jac,%DAEOPTIONS);
109                  elseif (lhs==1),
110                   [y]=dassl(x0,t0,t,atol,res,jac,%DAEOPTIONS); 
111                  else,
112                   error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",1,2));
113                  end
114
115                 end
116               end
117
118             else,
119               [x0,t0,t,res,jac,hd]=varargin(:)
120               if (lhs==2),
121                [y,hd]=dassl(x0,t0,t,res,jac,%DAEOPTIONS,hd);
122               elseif (lhs==1),
123                [y]=dassl(x0,t0,t,res,jac,%DAEOPTIONS,hd); 
124               else,
125                error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",1,2));
126              end
127
128             end
129
130         elseif (rhs==7),
131
132             if(type(varargin(5))==1),
133
134               if (type(varargin(7))==1),
135                 [x0,t0,t,rtol,atol,res,hd]=varargin(:)
136                 if (lhs==2),
137                  [y,hd]=dassl(x0,t0,t,atol,rtol,res,%DAEOPTIONS,hd);
138                 elseif (lhs==1),
139                  [y]=dassl(x0,t0,t,atol,rtol,res,%DAEOPTIONS,hd); 
140                 else,
141                  error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",1,2));
142                 end
143               
144               else,
145                 [x0,t0,t,rtol,atol,res,jac]=varargin(:)
146                 if (lhs==2),
147                  [y,hd]=dassl(x0,t0,t,atol,rtol,res,jac,%DAEOPTIONS);
148                 elseif (lhs==1),
149                  [y]=dassl(x0,t0,t,atol,rtol,res,jac,%DAEOPTIONS); 
150                 else,
151                  error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",1,2));
152                 end
153
154               end
155
156             else,
157               [x0,t0,t,atol,res,jac,hd]=varargin(:)
158               if (lhs==2),
159                [y,hd]=dassl(x0,t0,t,atol,res,jac,%DAEOPTIONS,hd);
160               elseif (lhs==1),
161                [y]=dassl(x0,t0,t,atol,res,jac,%DAEOPTIONS,hd); 
162               else,
163                error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",1,2));
164               end
165             end
166
167         else,
168           error(sprintf(gettext("%s: %s: Wrong number of input argument(s): %d to %d expected.\n"), "dae",4,8));
169         end
170         
171      if (%DAEOPTIONS(2)==0),   
172         [r,c]=size(y);
173         y=y([2:1:r],:);
174      end
175      if (lhs==2),
176         varargout=list(y,hd);
177      elseif (lhs==1),
178         varargout=list(y);
179      else,
180         error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",1,2));
181      end       
182    
183       elseif (varargin(1)=="root"), // Case root (dasrt)
184         [lhs,rhs]=argn();
185
186         if (rhs==7),// Call without optional arguments
187           [typ,x0,t0,t,res,ng,surface]=varargin(:)
188           if (lhs==2),
189            [y,nn]=dasrt(x0,t0,t,res,ng,surface,%DAEOPTIONS);
190           elseif (lhs==3),
191            [y,nn,hd]=dasrt(x0,t0,t,res,ng,surface,%DAEOPTIONS); 
192           else,
193            error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",2,3));
194           end
195
196         elseif (rhs==11),// Call with all the optional arguments
197            [typ,x0,t0,t,rtol,atol,res,jac,ng,surface,hd]=varargin(:)
198            if (lhs==2),
199             [y,nn]=dasrt(x0,t0,t,atol,rtol,res,jac,ng,surface,%DAEOPTIONS,hd);
200            elseif (lhs==3),
201             [y,nn,hd]=dasrt(x0,t0,t,atol,rtol,res,jac,ng,surface,%DAEOPTIONS,hd); 
202            else,
203             error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",2,3));
204            end
205
206         elseif (rhs==8),
207
208           if (type(varargin(5))==1),
209            [typ,x0,t0,t,atol,res,ng,surface]=varargin(:)
210            if (lhs==2),
211             [y,nn]=dasrt(x0,t0,t,atol,res,ng,surface,%DAEOPTIONS);
212            elseif (lhs==3),
213             [y,nn,hd]=dasrt(x0,t0,t,atol,res,ng,surface,%DAEOPTIONS);
214            else,
215             error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",2,3));
216            end
217
218           else,
219
220             if (type(varargin(8))==1),
221              [typ,x0,t0,t,res,ng,surface,hd]=varargin(:)
222              if (lhs==2),
223               [y,nn]=dasrt(x0,t0,t,res,ng,surface,%DAEOPTIONS,hd);
224              elseif (lhs==3),
225               [y,nn,hd]=dasrt(x0,t0,t,res,ng,surface,%DAEOPTIONS,hd); 
226              else,
227               error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",2,3));
228              end
229            
230             else,
231              [typ,x0,t0,t,res,jac,ng,surface]=varargin(:)
232              if (lhs==2),
233               [y,nn]=dasrt(x0,t0,t,res,jac,ng,surface,%DAEOPTIONS);
234              elseif (lhs==3),
235               [y,nn,hd]=dasrt(x0,t0,t,res,jac,ng,surface,%DAEOPTIONS);
236              else,
237               error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",2,3));
238              end
239
240             end
241
242           end
243      
244         elseif (rhs==9),
245
246           if (type(varargin(5))==1),
247
248             if (type(varargin(6))==1),
249              [typ,x0,t0,t,rtol,atol,res,ng,surface]=varargin(:)
250              if (lhs==2),
251               [y,nn]=dasrt(x0,t0,t,atol,rtol,res,ng,surface,%DAEOPTIONS);
252              elseif (lhs==3),
253               [y,nn,hd]=dasrt(x0,t0,t,atol,rtol,res,ng,surface,%DAEOPTIONS); 
254              else
255               error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",2,3));
256              end
257
258             else,
259
260                 if (type(varargin(9))==1),
261                  [typ,x0,t0,t,atol,res,ng,surface,hd]=varargin(:)
262                  if (lhs==2),
263                   [y,nn]=dasrt(x0,t0,t,atol,res,ng,surface,%DAEOPTIONS,hd);
264                  elseif (lhs==3),
265                   [y,nn,hd]=dasrt(x0,t0,t,atol,res,ng,surface,%DAEOPTIONS,hd); 
266                  else
267                   error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",2,3));
268                  end
269
270                 else,
271                  [typ,x0,t0,t,atol,res,jac,ng,surface]=varargin(:)
272                  if (lhs==2),
273                   [y,nn]=dasrt(x0,t0,t,atol,res,jac,ng,surface,%DAEOPTIONS);
274                  elseif (lhs==3),
275                   [y,nn,hd]=dasrt(x0,t0,t,atol,res,jac,ng,surface,%DAEOPTIONS); 
276                  else
277                   error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",2,3));
278                  end
279
280                 end
281               end
282
283           else,
284                [typ,x0,t0,t,res,jac,ng,surface,hd]=varargin(:)
285                if (lhs==2),
286                 [y,nn]=dasrt(x0,t0,t,res,jac,ng,surface,%DAEOPTIONS,hd);
287                elseif (lhs==3),
288                 [y,nn,hd]=dasrt(x0,t0,t,res,jac,ng,surface,%DAEOPTIONS,hd);
289                else
290                 error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",2,3));
291                end
292          end
293
294         elseif (rhs==10),
295
296           if (type(varargin(5))==1),
297
298             if (type(varargin(6))==1),
299
300                 if (type(varargin(10))==1),
301                  [typ,x0,t0,t,rtol,atol,res,ng,surface,hd]=varargin(:)
302                  if (lhs==2),
303                   [y,nn]=dasrt(x0,t0,t,atol,rtol,res,ng,surface,%DAEOPTIONS,hd);
304                  elseif (lhs==3),
305                   [y,nn,hd]=dasrt(x0,t0,t,atol,rtol,res,ng,surface,%DAEOPTIONS,hd); 
306                  else
307                   error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",2,3));
308                  end
309
310                 else,
311                   [typ,x0,t0,t,rtol,atol,res,jac,ng,surface]=varargin(:)
312                   if (lhs==2),
313                     [y,nn]=dasrt(x0,t0,t,atol,rtol,res,jac,ng,surface,%DAEOPTIONS);
314                   elseif (lhs==3),
315                     [y,nn,hd]=dasrt(x0,t0,t,atol,rtol,res,jac,ng,surface,%DAEOPTIONS);
316                   else
317                     error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",2,3));
318                   end
319                end
320
321             else,
322                  [typ,x0,t0,t,atol,res,jac,ng,surface,hd]=varargin(:)
323                  if (lhs==2),
324                   [y,nn]=dasrt(x0,t0,t,atol,res,jac,ng,surface,%DAEOPTIONS,hd);
325                  elseif (lhs==3),
326                   [y,nn,hd]=dasrt(x0,t0,t,atol,res,jac,ng,surface,%DAEOPTIONS,hd); 
327                  else
328                   error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",2,3));
329                  end
330  
331               end
332    
333          else,
334            [typ,x0,t0,t,res,jac,ng,surface,hd]=varargin(:)
335            if (lhs==2),
336             [y,nn]=dasrt(x0,t0,t,res,jac,ng,surface,%DAEOPTIONS,hd); 
337            elseif (lhs==3),
338             [y,nn,hd]=dasrt(x0,t0,t,res,jac,ng,surface,%DAEOPTIONS,hd); 
339            else
340             error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",2,3));
341            end
342          end
343
344        else,
345          error(sprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "dae",7,11));
346      end
347      
348      if (%DAEOPTIONS(2)==0),
349         [r,c]=size(y);
350         y=y([2:1:r],:);
351      end
352      if (lhs==2),
353         varargout=list(y,nn);
354      elseif (lhs==3),
355         varargout=list(y,nn,hd);
356      else,
357         error(sprintf(gettext("%s: Wrong number of output argument(s): %d or %d expected.\n"), "dae",2,3));
358      end       
359      else
360         error(sprintf(gettext("%s: Invalid option %s: real matrix expected.\n"),"dae","root"));
361      end
362      
363 endfunction