annotate liboctave/LSODE.h @ 1841:fc5667a20dd2

[project @ 1996-02-03 11:44:02 by jwe] Initial revision
author jwe
date Sat, 03 Feb 1996 11:44:02 +0000
parents
children 52e7bca8ce33
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1841
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
1 // LSODE.h -*- C++ -*-
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
2 /*
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
3
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
4 Copyright (C) 1996 John W. Eaton
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
5
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
7
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
10 Free Software Foundation; either version 2, or (at your option) any
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
11 later version.
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
12
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
13 Octave is distributed in the hope that it will be useful, but WITHOUT
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
16 for more details.
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
17
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
19 along with Octave; see the file COPYING. If not, write to the Free
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
21
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
22 */
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
23
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
24 #if !defined (octave_LSODE_h)
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
25 #define octave_LSODE_h 1
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
26
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
27 #if defined (__GNUG__)
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
28 #pragma interface
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
29 #endif
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
30
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
31 #if 0
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
32 class ostream;
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
33 #endif
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
34
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
35 #include "ODE.h"
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
36
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
37 class LSODE_options
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
38 {
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
39 public:
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
40
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
41 LSODE_options (void);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
42 LSODE_options (const LSODE_options& opt);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
43
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
44 LSODE_options& operator = (const LSODE_options& opt);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
45
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
46 ~LSODE_options (void);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
47
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
48 void init (void);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
49 void copy (const LSODE_options& opt);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
50
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
51 void set_default_options (void);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
52
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
53 void set_absolute_tolerance (double);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
54 void set_initial_step_size (double);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
55 void set_maximum_step_size (double);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
56 void set_minimum_step_size (double);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
57 void set_relative_tolerance (double);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
58
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
59 double absolute_tolerance (void);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
60 double initial_step_size (void);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
61 double maximum_step_size (void);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
62 double minimum_step_size (void);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
63 double relative_tolerance (void);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
64
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
65 private:
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
66
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
67 double x_absolute_tolerance;
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
68 double x_initial_step_size;
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
69 double x_maximum_step_size;
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
70 double x_minimum_step_size;
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
71 double x_relative_tolerance;
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
72 };
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
73
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
74 class LSODE : public ODE, public LSODE_options
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
75 {
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
76 public:
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
77
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
78 LSODE (void);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
79
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
80 LSODE (int n);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
81
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
82 LSODE (const ColumnVector& state, double time, const ODEFunc& f);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
83
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
84 ~LSODE (void);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
85
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
86 void force_restart (void);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
87
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
88 void set_stop_time (double t);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
89 void clear_stop_time (void);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
90
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
91 ColumnVector do_integrate (double t);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
92
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
93 Matrix do_integrate (const ColumnVector& tout);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
94
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
95 #if 0
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
96 void integrate (int nsteps, double tstep, ostream& s);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
97 #endif
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
98
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
99 Matrix integrate (const ColumnVector& tout)
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
100 { return do_integrate (tout); }
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
101
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
102 Matrix integrate (const ColumnVector& tout, const ColumnVector& tcrit);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
103
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
104 private:
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
105
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
106 double stop_time;
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
107 int stop_time_set;
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
108
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
109 int n;
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
110 int integration_error;
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
111 int restart;
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
112 int method_flag;
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
113 int *iwork;
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
114 double *rwork;
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
115 int istate;
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
116 int itol;
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
117 int itask;
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
118 int iopt;
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
119 int liw;
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
120 int lrw;
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
121
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
122 friend int lsode_f (int *neq, double *t, double *y, double *ydot);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
123
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
124 friend int lsode_j (int *neq, double *t, double *y, int *ml, int *mu,
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
125 double *pd, int *nrowpd);
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
126 };
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
127
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
128 #endif
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
129
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
130 /*
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
131 ;;; Local Variables: ***
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
132 ;;; mode: C++ ***
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
133 ;;; page-delimiter: "^/\\*" ***
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
134 ;;; End: ***
fc5667a20dd2 [project @ 1996-02-03 11:44:02 by jwe]
jwe
parents:
diff changeset
135 */