annotate liboctave/numeric/Quad.cc @ 31249:de6fc38c78c6

Make Jacobian types offered by dlsode.f accessible by lsode (bug #31626). * liboctave/numeric/LSODE-opts.in: Add options "jacobian type", "lower jacobian subdiagonals", and "upper jacobian subdiagonals". * liboctave/numeric/LSODE.cc (file scope, lsode_j, LSODE::do_integrate (double)): Handle new configurable Jacobian types. * build-aux/mk-opts.pl: Don't implicitly convert to integer in condition.
author Olaf Till <olaf.till@uni-jena.de>
date Fri, 12 Nov 2010 08:53:05 +0100
parents 796f54d4ddbf
children 597f3ee61a48
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 30394
diff changeset
3 // Copyright (C) 1993-2022 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
25
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
26 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21202
diff changeset
27 # include "config.h"
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
28 #endif
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
29
23475
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
30 #include <cassert>
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
31
d691ed308237 maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents: 23220
diff changeset
32 #include "Array.h"
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
33 #include "Quad.h"
1847
2ffe49eb95a5 [project @ 1996-02-03 12:47:55 by jwe]
jwe
parents: 1546
diff changeset
34 #include "f77-fcn.h"
2292
a265f5e924e3 [project @ 1996-06-06 14:59:05 by jwe]
jwe
parents: 1993
diff changeset
35 #include "lo-error.h"
4180
84fe3ca3a246 [project @ 2002-11-15 04:47:01 by jwe]
jwe
parents: 4066
diff changeset
36 #include "quit.h"
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
37
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
38 static integrand_fcn user_fcn;
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
39 static float_integrand_fcn float_user_fcn;
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
40
25681
bef21ac72618 eliminate unnecessary sun-utils.h header file
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
41 typedef F77_INT (*quad_fcn_ptr) (const double&, int&, double&);
bef21ac72618 eliminate unnecessary sun-utils.h header file
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
42 typedef F77_INT (*quad_float_fcn_ptr) (const float&, int&, float&);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
43
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
44 extern "C"
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4192
diff changeset
45 {
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4192
diff changeset
46 F77_RET_T
22133
59cadee1c74b new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
47 F77_FUNC (dqagp, DQAGP) (quad_fcn_ptr, const F77_DBLE&, const F77_DBLE&,
30394
f3f3e3793fb5 maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30101
diff changeset
48 const F77_INT&, const F77_DBLE *,
22133
59cadee1c74b new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
49 const F77_DBLE&, const F77_DBLE&, F77_DBLE&,
59cadee1c74b new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
50 F77_DBLE&, F77_INT&, F77_INT&,
59cadee1c74b new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
51 const F77_INT&, const F77_INT&,
30394
f3f3e3793fb5 maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30101
diff changeset
52 F77_INT&, F77_INT *, F77_DBLE *);
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
53
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4192
diff changeset
54 F77_RET_T
22133
59cadee1c74b new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
55 F77_FUNC (dqagi, DQAGI) (quad_fcn_ptr, const F77_DBLE&,
59cadee1c74b new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
56 const F77_INT&, const F77_DBLE&,
59cadee1c74b new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
57 const F77_DBLE&, F77_DBLE&, F77_DBLE&,
59cadee1c74b new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
58 F77_INT&, F77_INT&,
59cadee1c74b new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
59 const F77_INT&, const F77_INT&,
30394
f3f3e3793fb5 maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30101
diff changeset
60 F77_INT&, F77_INT *, F77_DBLE *);
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
61
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
62 F77_RET_T
22133
59cadee1c74b new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
63 F77_FUNC (qagp, QAGP) (quad_float_fcn_ptr, const F77_REAL&, const F77_REAL&,
30394
f3f3e3793fb5 maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30101
diff changeset
64 const F77_INT&, const F77_REAL *, const F77_REAL&,
22133
59cadee1c74b new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
65 const F77_REAL&, F77_REAL&, F77_REAL&, F77_INT&,
59cadee1c74b new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
66 F77_INT&, const F77_INT&,
59cadee1c74b new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
67 const F77_INT&, F77_INT&,
30394
f3f3e3793fb5 maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30101
diff changeset
68 F77_INT *, F77_REAL *);
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
69
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
70 F77_RET_T
22133
59cadee1c74b new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
71 F77_FUNC (qagi, QAGI) (quad_float_fcn_ptr, const F77_REAL&,
59cadee1c74b new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
72 const F77_INT&, const F77_REAL&,
59cadee1c74b new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
73 const F77_REAL&, F77_REAL&, F77_REAL&, F77_INT&,
59cadee1c74b new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
74 F77_INT&, const F77_INT&,
59cadee1c74b new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
75 const F77_INT&, F77_INT&,
30394
f3f3e3793fb5 maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30101
diff changeset
76 F77_INT *, F77_REAL *);
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4192
diff changeset
77 }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
78
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
79 static F77_INT
27109
c3d5afa00588 eliminate obsolete global variable
John W. Eaton <jwe@octave.org>
parents: 27108
diff changeset
80 user_function (const double& x, int&, double& result)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
81 {
25681
bef21ac72618 eliminate unnecessary sun-utils.h header file
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
82 result = (*user_fcn) (x);
260
74d73a4b3fc7 [project @ 1993-12-14 23:57:42 by jwe]
jwe
parents: 238
diff changeset
83
3136
af7ec9d3a5e6 [project @ 1998-02-01 20:11:06 by jwe]
jwe
parents: 2847
diff changeset
84 return 0;
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
85 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
86
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
87 static F77_INT
27109
c3d5afa00588 eliminate obsolete global variable
John W. Eaton <jwe@octave.org>
parents: 27108
diff changeset
88 float_user_function (const float& x, int&, float& result)
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
89 {
25681
bef21ac72618 eliminate unnecessary sun-utils.h header file
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
90 result = (*float_user_fcn) (x);
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
91
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
92 return 0;
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
93 }
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
94
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
95 double
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
96 DefQuad::do_integrate (octave_idx_type& ier, octave_idx_type& neval,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
97 double& abserr)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
98 {
30082
1788b9f6db6a maint: use "m_" prefix for member variables in file 'Quad.h'.
Rik <rik@octave.org>
parents: 29358
diff changeset
99 F77_INT npts = octave::to_f77_int (m_singularities.numel () + 2);
1788b9f6db6a maint: use "m_" prefix for member variables in file 'Quad.h'.
Rik <rik@octave.org>
parents: 29358
diff changeset
100 double *points = m_singularities.fortran_vec ();
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
101 double result = 0.0;
1935
23c350d0cf9d [project @ 1996-02-12 04:03:05 by jwe]
jwe
parents: 1882
diff changeset
102
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
103 F77_INT leniw = 183*npts - 122;
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
104 Array<F77_INT> iwork (dim_vector (leniw, 1));
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
105 F77_INT *piwork = iwork.fortran_vec ();
1935
23c350d0cf9d [project @ 1996-02-12 04:03:05 by jwe]
jwe
parents: 1882
diff changeset
106
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
107 F77_INT lenw = 2*leniw - npts;
11570
57632dea2446 attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
108 Array<double> work (dim_vector (lenw, 1));
1935
23c350d0cf9d [project @ 1996-02-12 04:03:05 by jwe]
jwe
parents: 1882
diff changeset
109 double *pwork = work.fortran_vec ();
23c350d0cf9d [project @ 1996-02-12 04:03:05 by jwe]
jwe
parents: 1882
diff changeset
110
30101
6e5e6ce2e705 maint: use "m_" prefix for member variables in class Quad.
Rik <rik@octave.org>
parents: 30082
diff changeset
111 user_fcn = m_f;
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
112 F77_INT last;
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
113
289
c23f50e61c58 [project @ 1994-01-13 06:25:58 by jwe]
jwe
parents: 260
diff changeset
114 double abs_tol = absolute_tolerance ();
c23f50e61c58 [project @ 1994-01-13 06:25:58 by jwe]
jwe
parents: 260
diff changeset
115 double rel_tol = relative_tolerance ();
c23f50e61c58 [project @ 1994-01-13 06:25:58 by jwe]
jwe
parents: 260
diff changeset
116
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
117 // NEVAL and IER are output only parameters and F77_INT can not be a
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
118 // wider type than octave_idx_type so we can create local variables
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
119 // here that are the correct type for the Fortran subroutine and then
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
120 // copy them to the function parameters without needing to preserve
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
121 // and pass the values to the Fortran subroutine.
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
122
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
123 F77_INT xneval, xier;
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
124
30082
1788b9f6db6a maint: use "m_" prefix for member variables in file 'Quad.h'.
Rik <rik@octave.org>
parents: 29358
diff changeset
125 F77_XFCN (dqagp, DQAGP, (user_function, m_lower_limit, m_upper_limit,
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
126 npts, points, abs_tol, rel_tol, result,
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
127 abserr, xneval, xier, leniw, lenw, last,
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
128 piwork, pwork));
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
129
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
130 neval = xneval;
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
131 ier = xier;
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
132
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
133 return result;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
134 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
135
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
136 float
7924
4976f66d469b miscellaneous cleanup
John W. Eaton <jwe@octave.org>
parents: 7805
diff changeset
137 DefQuad::do_integrate (octave_idx_type&, octave_idx_type&, float&)
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
138 {
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
139 (*current_liboctave_error_handler) ("incorrect integration function called");
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
140 }
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
141
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
142 double
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
143 IndefQuad::do_integrate (octave_idx_type& ier, octave_idx_type& neval,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
144 double& abserr)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
145 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
146 double result = 0.0;
1935
23c350d0cf9d [project @ 1996-02-12 04:03:05 by jwe]
jwe
parents: 1882
diff changeset
147
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
148 F77_INT leniw = 128;
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
149 Array<F77_INT> iwork (dim_vector (leniw, 1));
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
150 F77_INT *piwork = iwork.fortran_vec ();
1935
23c350d0cf9d [project @ 1996-02-12 04:03:05 by jwe]
jwe
parents: 1882
diff changeset
151
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
152 F77_INT lenw = 8*leniw;
11570
57632dea2446 attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
153 Array<double> work (dim_vector (lenw, 1));
1935
23c350d0cf9d [project @ 1996-02-12 04:03:05 by jwe]
jwe
parents: 1882
diff changeset
154 double *pwork = work.fortran_vec ();
23c350d0cf9d [project @ 1996-02-12 04:03:05 by jwe]
jwe
parents: 1882
diff changeset
155
30101
6e5e6ce2e705 maint: use "m_" prefix for member variables in class Quad.
Rik <rik@octave.org>
parents: 30082
diff changeset
156 user_fcn = m_f;
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
157 F77_INT last;
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
158
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
159 F77_INT inf;
30082
1788b9f6db6a maint: use "m_" prefix for member variables in file 'Quad.h'.
Rik <rik@octave.org>
parents: 29358
diff changeset
160 switch (m_type)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
161 {
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
162 case bound_to_inf:
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
163 inf = 1;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
164 break;
1360
7eb93d12654c [project @ 1995-09-05 21:51:54 by jwe]
jwe
parents: 1315
diff changeset
165
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
166 case neg_inf_to_bound:
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
167 inf = -1;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
168 break;
1360
7eb93d12654c [project @ 1995-09-05 21:51:54 by jwe]
jwe
parents: 1315
diff changeset
169
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
170 case doubly_infinite:
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
171 inf = 2;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
172 break;
1360
7eb93d12654c [project @ 1995-09-05 21:51:54 by jwe]
jwe
parents: 1315
diff changeset
173
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
174 default:
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
175 assert (0);
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
176 break;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
177 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
178
289
c23f50e61c58 [project @ 1994-01-13 06:25:58 by jwe]
jwe
parents: 260
diff changeset
179 double abs_tol = absolute_tolerance ();
c23f50e61c58 [project @ 1994-01-13 06:25:58 by jwe]
jwe
parents: 260
diff changeset
180 double rel_tol = relative_tolerance ();
c23f50e61c58 [project @ 1994-01-13 06:25:58 by jwe]
jwe
parents: 260
diff changeset
181
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
182 // NEVAL and IER are output only parameters and F77_INT can not be a
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
183 // wider type than octave_idx_type so we can create local variables
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
184 // here that are the correct type for the Fortran subroutine and then
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
185 // copy them to the function parameters without needing to preserve
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
186 // and pass the values to the Fortran subroutine.
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
187
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
188 F77_INT xneval, xier;
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
189
30082
1788b9f6db6a maint: use "m_" prefix for member variables in file 'Quad.h'.
Rik <rik@octave.org>
parents: 29358
diff changeset
190 F77_XFCN (dqagi, DQAGI, (user_function, m_bound, inf, abs_tol, rel_tol,
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
191 result, abserr, xneval, xier, leniw, lenw,
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
192 last, piwork, pwork));
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
193
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
194 neval = xneval;
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
195 ier = xier;
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
196
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
197 return result;
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
198 }
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
199
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
200 float
7924
4976f66d469b miscellaneous cleanup
John W. Eaton <jwe@octave.org>
parents: 7805
diff changeset
201 IndefQuad::do_integrate (octave_idx_type&, octave_idx_type&, float&)
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
202 {
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
203 (*current_liboctave_error_handler) ("incorrect integration function called");
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
204 }
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
205
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
206 double
7924
4976f66d469b miscellaneous cleanup
John W. Eaton <jwe@octave.org>
parents: 7805
diff changeset
207 FloatDefQuad::do_integrate (octave_idx_type&, octave_idx_type&, double&)
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
208 {
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
209 (*current_liboctave_error_handler) ("incorrect integration function called");
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
210 }
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
211
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
212 float
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
213 FloatDefQuad::do_integrate (octave_idx_type& ier, octave_idx_type& neval,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
214 float& abserr)
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
215 {
30082
1788b9f6db6a maint: use "m_" prefix for member variables in file 'Quad.h'.
Rik <rik@octave.org>
parents: 29358
diff changeset
216 F77_INT npts = octave::to_f77_int (m_singularities.numel () + 2);
1788b9f6db6a maint: use "m_" prefix for member variables in file 'Quad.h'.
Rik <rik@octave.org>
parents: 29358
diff changeset
217 float *points = m_singularities.fortran_vec ();
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
218 float result = 0.0;
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
219
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
220 F77_INT leniw = 183*npts - 122;
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
221 Array<F77_INT> iwork (dim_vector (leniw, 1));
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
222 F77_INT *piwork = iwork.fortran_vec ();
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
223
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
224 F77_INT lenw = 2*leniw - npts;
11570
57632dea2446 attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
225 Array<float> work (dim_vector (lenw, 1));
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
226 float *pwork = work.fortran_vec ();
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
227
30101
6e5e6ce2e705 maint: use "m_" prefix for member variables in class Quad.
Rik <rik@octave.org>
parents: 30082
diff changeset
228 float_user_fcn = m_ff;
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
229 F77_INT last;
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
230
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
231 float abs_tol = single_precision_absolute_tolerance ();
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
232 float rel_tol = single_precision_relative_tolerance ();
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
233
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
234 // NEVAL and IER are output only parameters and F77_INT can not be a
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
235 // wider type than octave_idx_type so we can create local variables
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
236 // here that are the correct type for the Fortran subroutine and then
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
237 // copy them to the function parameters without needing to preserve
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
238 // and pass the values to the Fortran subroutine.
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
239
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
240 F77_INT xneval, xier;
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
241
30082
1788b9f6db6a maint: use "m_" prefix for member variables in file 'Quad.h'.
Rik <rik@octave.org>
parents: 29358
diff changeset
242 F77_XFCN (qagp, QAGP, (float_user_function, m_lower_limit, m_upper_limit,
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
243 npts, points, abs_tol, rel_tol, result,
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
244 abserr, xneval, xier, leniw, lenw, last,
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
245 piwork, pwork));
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
246
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
247 neval = xneval;
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
248 ier = xier;
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
249
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
250 return result;
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
251 }
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
252
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
253 double
7924
4976f66d469b miscellaneous cleanup
John W. Eaton <jwe@octave.org>
parents: 7805
diff changeset
254 FloatIndefQuad::do_integrate (octave_idx_type&, octave_idx_type&, double&)
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
255 {
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
256 (*current_liboctave_error_handler) ("incorrect integration function called");
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
257 }
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
258
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
259 float
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
260 FloatIndefQuad::do_integrate (octave_idx_type& ier, octave_idx_type& neval,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
261 float& abserr)
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
262 {
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
263 float result = 0.0;
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
264
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
265 F77_INT leniw = 128;
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
266 Array<F77_INT> iwork (dim_vector (leniw, 1));
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
267 F77_INT *piwork = iwork.fortran_vec ();
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
268
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
269 F77_INT lenw = 8*leniw;
11570
57632dea2446 attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
270 Array<float> work (dim_vector (lenw, 1));
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
271 float *pwork = work.fortran_vec ();
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
272
30101
6e5e6ce2e705 maint: use "m_" prefix for member variables in class Quad.
Rik <rik@octave.org>
parents: 30082
diff changeset
273 float_user_fcn = m_ff;
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
274 F77_INT last;
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
275
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
276 F77_INT inf;
30082
1788b9f6db6a maint: use "m_" prefix for member variables in file 'Quad.h'.
Rik <rik@octave.org>
parents: 29358
diff changeset
277 switch (m_type)
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
278 {
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
279 case bound_to_inf:
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
280 inf = 1;
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
281 break;
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
282
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
283 case neg_inf_to_bound:
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
284 inf = -1;
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
285 break;
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
286
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
287 case doubly_infinite:
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
288 inf = 2;
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
289 break;
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
290
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
291 default:
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
292 assert (0);
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
293 break;
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
294 }
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
295
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
296 float abs_tol = single_precision_absolute_tolerance ();
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
297 float rel_tol = single_precision_relative_tolerance ();
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
298
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
299 // NEVAL and IER are output only parameters and F77_INT can not be a
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
300 // wider type than octave_idx_type so we can create local variables
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
301 // here that are the correct type for the Fortran subroutine and then
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
302 // copy them to the function parameters without needing to preserve
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
303 // and pass the values to the Fortran subroutine.
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
304
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
305 F77_INT xneval, xier;
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
306
30082
1788b9f6db6a maint: use "m_" prefix for member variables in file 'Quad.h'.
Rik <rik@octave.org>
parents: 29358
diff changeset
307 F77_XFCN (qagi, QAGI, (float_user_function, m_bound, inf, abs_tol, rel_tol,
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
308 result, abserr, xneval, xier, leniw, lenw,
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
309 last, piwork, pwork));
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
310
22846
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
311 neval = xneval;
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
312 ier = xier;
e827d2c089f4 use F77_INT instead of octave_idx_type for liboctave Quad and lu classes
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
313
7805
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
314 return result;
62affb34e648 Make quad work with single precision
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
315 }