Mercurial > octave-nkf
annotate src/DLD-FUNCTIONS/besselj.cc @ 10846:a4f482e66b65
Grammarcheck more of the documentation.
Use @noindent macro appropriately.
Limit line length to 80 characters.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 01 Aug 2010 20:22:17 -0700 |
parents | 89f4d7e294cc |
children | fd0a3ac60b0e |
rev | line source |
---|---|
3155 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006, |
8920 | 4 2007, 2008 John W. Eaton |
3155 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
3155 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
3155 | 21 |
22 */ | |
23 | |
24 #ifdef HAVE_CONFIG_H | |
25 #include <config.h> | |
26 #endif | |
27 | |
28 #include "lo-specfun.h" | |
4153 | 29 #include "quit.h" |
3155 | 30 |
31 #include "defun-dld.h" | |
32 #include "error.h" | |
33 #include "gripes.h" | |
34 #include "oct-obj.h" | |
35 #include "utils.h" | |
36 | |
3220 | 37 enum bessel_type |
38 { | |
39 BESSEL_J, | |
40 BESSEL_Y, | |
41 BESSEL_I, | |
42 BESSEL_K, | |
43 BESSEL_H1, | |
44 BESSEL_H2 | |
45 }; | |
46 | |
47 #define DO_BESSEL(type, alpha, x, scaled, ierr, result) \ | |
3155 | 48 do \ |
49 { \ | |
50 switch (type) \ | |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
51 { \ |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
52 case BESSEL_J: \ |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
53 result = besselj (alpha, x, scaled, ierr); \ |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
54 break; \ |
3220 | 55 \ |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
56 case BESSEL_Y: \ |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
57 result = bessely (alpha, x, scaled, ierr); \ |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
58 break; \ |
3155 | 59 \ |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
60 case BESSEL_I: \ |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
61 result = besseli (alpha, x, scaled, ierr); \ |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
62 break; \ |
3155 | 63 \ |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
64 case BESSEL_K: \ |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
65 result = besselk (alpha, x, scaled, ierr); \ |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
66 break; \ |
3155 | 67 \ |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
68 case BESSEL_H1: \ |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
69 result = besselh1 (alpha, x, scaled, ierr); \ |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
70 break; \ |
3220 | 71 \ |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
72 case BESSEL_H2: \ |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
73 result = besselh2 (alpha, x, scaled, ierr); \ |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
74 break; \ |
3155 | 75 \ |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
76 default: \ |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
77 break; \ |
3155 | 78 } \ |
79 } \ | |
80 while (0) | |
81 | |
82 static void | |
3220 | 83 gripe_bessel_arg (const char *fn, const char *arg) |
3155 | 84 { |
3220 | 85 error ("%s: expecting scalar or matrix as %s argument", fn, arg); |
3155 | 86 } |
87 | |
88 octave_value_list | |
3220 | 89 do_bessel (enum bessel_type type, const char *fn, |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
90 const octave_value_list& args, int nargout) |
3155 | 91 { |
3220 | 92 octave_value_list retval; |
3155 | 93 |
94 int nargin = args.length (); | |
95 | |
3220 | 96 if (nargin == 2 || nargin == 3) |
3155 | 97 { |
3220 | 98 bool scaled = (nargin == 3); |
99 | |
3155 | 100 octave_value alpha_arg = args(0); |
3220 | 101 octave_value x_arg = args(1); |
3155 | 102 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
103 if (alpha_arg.is_single_type () || x_arg.is_single_type ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
104 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
105 if (alpha_arg.is_scalar_type ()) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
106 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
107 float alpha = args(0).float_value (); |
4844 | 108 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
109 if (! error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
110 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
111 if (x_arg.is_scalar_type ()) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
112 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
113 FloatComplex x = x_arg.float_complex_value (); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
114 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
115 if (! error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
116 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
117 octave_idx_type ierr; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
118 octave_value result; |
3155 | 119 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
120 DO_BESSEL (type, alpha, x, scaled, ierr, result); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
121 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
122 if (nargout > 1) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
123 retval(1) = static_cast<float> (ierr); |
3220 | 124 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
125 retval(0) = result; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
126 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
127 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
128 gripe_bessel_arg (fn, "second"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
129 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
130 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
131 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
132 FloatComplexNDArray x = x_arg.float_complex_array_value (); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
133 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
134 if (! error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
135 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
136 Array<octave_idx_type> ierr; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
137 octave_value result; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
138 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
139 DO_BESSEL (type, alpha, x, scaled, ierr, result); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
140 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
141 if (nargout > 1) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
142 retval(1) = NDArray (ierr); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
143 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
144 retval(0) = result; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
145 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
146 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
147 gripe_bessel_arg (fn, "second"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
148 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
149 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
150 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
151 gripe_bessel_arg (fn, "first"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
152 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
153 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
154 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
155 dim_vector dv0 = args(0).dims (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
156 dim_vector dv1 = args(1).dims (); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
157 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
158 bool args0_is_row_vector = (dv0 (1) == dv0.numel ()); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
159 bool args1_is_col_vector = (dv1 (0) == dv1.numel ()); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
160 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
161 if (args0_is_row_vector && args1_is_col_vector) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
162 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
163 FloatRowVector ralpha = args(0).float_row_vector_value (); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
164 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
165 if (! error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
166 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
167 FloatComplexColumnVector cx = |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
168 x_arg.float_complex_column_vector_value (); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
169 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
170 if (! error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
171 { |
10352 | 172 Array<octave_idx_type> ierr; |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
173 octave_value result; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
174 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
175 DO_BESSEL (type, ralpha, cx, scaled, ierr, result); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
176 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
177 if (nargout > 1) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
178 retval(1) = NDArray (ierr); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
179 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
180 retval(0) = result; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
181 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
182 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
183 gripe_bessel_arg (fn, "second"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
184 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
185 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
186 gripe_bessel_arg (fn, "first"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
187 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
188 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
189 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
190 FloatNDArray alpha = args(0).float_array_value (); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
191 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
192 if (! error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
193 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
194 if (x_arg.is_scalar_type ()) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
195 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
196 FloatComplex x = x_arg.float_complex_value (); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
197 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
198 if (! error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
199 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
200 Array<octave_idx_type> ierr; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
201 octave_value result; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
202 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
203 DO_BESSEL (type, alpha, x, scaled, ierr, result); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
204 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
205 if (nargout > 1) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
206 retval(1) = NDArray (ierr); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
207 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
208 retval(0) = result; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
209 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
210 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
211 gripe_bessel_arg (fn, "second"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
212 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
213 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
214 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
215 FloatComplexNDArray x = x_arg.float_complex_array_value (); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
216 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
217 if (! error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
218 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
219 Array<octave_idx_type> ierr; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
220 octave_value result; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
221 |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
222 DO_BESSEL (type, alpha, x, scaled, ierr, result); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
223 |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
224 if (nargout > 1) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
225 retval(1) = NDArray (ierr); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
226 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
227 retval(0) = result; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
228 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
229 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
230 gripe_bessel_arg (fn, "second"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
231 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
232 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
233 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
234 gripe_bessel_arg (fn, "first"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
235 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
236 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
237 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
238 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
239 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
240 if (alpha_arg.is_scalar_type ()) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
241 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
242 double alpha = args(0).double_value (); |
3220 | 243 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
244 if (! error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
245 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
246 if (x_arg.is_scalar_type ()) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
247 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
248 Complex x = x_arg.complex_value (); |
3155 | 249 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
250 if (! error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
251 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
252 octave_idx_type ierr; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
253 octave_value result; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
254 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
255 DO_BESSEL (type, alpha, x, scaled, ierr, result); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
256 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
257 if (nargout > 1) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
258 retval(1) = static_cast<double> (ierr); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
259 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
260 retval(0) = result; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
261 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
262 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
263 gripe_bessel_arg (fn, "second"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
264 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
265 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
266 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
267 ComplexNDArray x = x_arg.complex_array_value (); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
268 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
269 if (! error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
270 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
271 Array<octave_idx_type> ierr; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
272 octave_value result; |
3220 | 273 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
274 DO_BESSEL (type, alpha, x, scaled, ierr, result); |
3220 | 275 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
276 if (nargout > 1) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
277 retval(1) = NDArray (ierr); |
3220 | 278 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
279 retval(0) = result; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
280 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
281 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
282 gripe_bessel_arg (fn, "second"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
283 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
284 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
285 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
286 gripe_bessel_arg (fn, "first"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
287 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
288 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
289 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
290 dim_vector dv0 = args(0).dims (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
291 dim_vector dv1 = args(1).dims (); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
292 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
293 bool args0_is_row_vector = (dv0 (1) == dv0.numel ()); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
294 bool args1_is_col_vector = (dv1 (0) == dv1.numel ()); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
295 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
296 if (args0_is_row_vector && args1_is_col_vector) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
297 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
298 RowVector ralpha = args(0).row_vector_value (); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
299 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
300 if (! error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
301 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
302 ComplexColumnVector cx = |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
303 x_arg.complex_column_vector_value (); |
4844 | 304 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
305 if (! error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
306 { |
10352 | 307 Array<octave_idx_type> ierr; |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
308 octave_value result; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
309 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
310 DO_BESSEL (type, ralpha, cx, scaled, ierr, result); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
311 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
312 if (nargout > 1) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
313 retval(1) = NDArray (ierr); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
314 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
315 retval(0) = result; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
316 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
317 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
318 gripe_bessel_arg (fn, "second"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
319 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
320 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
321 gripe_bessel_arg (fn, "first"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
322 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
323 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
324 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
325 NDArray alpha = args(0).array_value (); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
326 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
327 if (! error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
328 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
329 if (x_arg.is_scalar_type ()) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
330 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
331 Complex x = x_arg.complex_value (); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
332 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
333 if (! error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
334 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
335 Array<octave_idx_type> ierr; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
336 octave_value result; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
337 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
338 DO_BESSEL (type, alpha, x, scaled, ierr, result); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
339 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
340 if (nargout > 1) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
341 retval(1) = NDArray (ierr); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
342 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
343 retval(0) = result; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
344 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
345 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
346 gripe_bessel_arg (fn, "second"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
347 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
348 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
349 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
350 ComplexNDArray x = x_arg.complex_array_value (); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
351 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
352 if (! error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
353 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
354 Array<octave_idx_type> ierr; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
355 octave_value result; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
356 |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
357 DO_BESSEL (type, alpha, x, scaled, ierr, result); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
358 |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
359 if (nargout > 1) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
360 retval(1) = NDArray (ierr); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
361 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
362 retval(0) = result; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
363 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
364 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
365 gripe_bessel_arg (fn, "second"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
366 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
367 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
368 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
369 gripe_bessel_arg (fn, "first"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
370 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
371 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
372 } |
3155 | 373 } |
374 else | |
5823 | 375 print_usage (); |
3155 | 376 |
377 return retval; | |
378 } | |
379 | |
3220 | 380 DEFUN_DLD (besselj, args, nargout, |
3459 | 381 "-*- texinfo -*-\n\ |
10840 | 382 @deftypefn {Loadable Function} {[@var{j}, @var{ierr}] =} besselj (@var{alpha}, @var{x}, @var{opt})\n\ |
3459 | 383 @deftypefnx {Loadable Function} {[@var{y}, @var{ierr}] =} bessely (@var{alpha}, @var{x}, @var{opt})\n\ |
384 @deftypefnx {Loadable Function} {[@var{i}, @var{ierr}] =} besseli (@var{alpha}, @var{x}, @var{opt})\n\ | |
385 @deftypefnx {Loadable Function} {[@var{k}, @var{ierr}] =} besselk (@var{alpha}, @var{x}, @var{opt})\n\ | |
386 @deftypefnx {Loadable Function} {[@var{h}, @var{ierr}] =} besselh (@var{alpha}, @var{k}, @var{x}, @var{opt})\n\ | |
387 Compute Bessel or Hankel functions of various kinds:\n\ | |
3155 | 388 \n\ |
3459 | 389 @table @code\n\ |
390 @item besselj\n\ | |
9064
7c02ec148a3c
Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
391 Bessel functions of the first kind. If the argument @var{opt} is supplied, \n\ |
8278
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
392 the result is multiplied by @code{exp(-abs(imag(x)))}.\n\ |
10840 | 393 \n\ |
3459 | 394 @item bessely\n\ |
9064
7c02ec148a3c
Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
395 Bessel functions of the second kind. If the argument @var{opt} is supplied,\n\ |
8278
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
396 the result is multiplied by @code{exp(-abs(imag(x)))}.\n\ |
10840 | 397 \n\ |
3459 | 398 @item besseli\n\ |
10840 | 399 \n\ |
400 Modified Bessel functions of the first kind. If the argument @var{opt} is\n\ | |
401 supplied, the result is multiplied by @code{exp(-abs(real(x)))}.\n\ | |
402 \n\ | |
3459 | 403 @item besselk\n\ |
10840 | 404 \n\ |
405 Modified Bessel functions of the second kind. If the argument @var{opt} is\n\ | |
406 supplied, the result is multiplied by @code{exp(x)}.\n\ | |
407 \n\ | |
3459 | 408 @item besselh\n\ |
409 Compute Hankel functions of the first (@var{k} = 1) or second (@var{k}\n\ | |
10846
a4f482e66b65
Grammarcheck more of the documentation.
Rik <octave@nomad.inbox5.com>
parents:
10840
diff
changeset
|
410 = 2) kind. If the argument @var{opt} is supplied, the result is multiplied\n\ |
a4f482e66b65
Grammarcheck more of the documentation.
Rik <octave@nomad.inbox5.com>
parents:
10840
diff
changeset
|
411 by @code{exp (-I*@var{x})} for @var{k} = 1 or @code{exp (I*@var{x})} for\n\ |
8278
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
412 @var{k} = 2.\n\ |
3459 | 413 @end table\n\ |
3220 | 414 \n\ |
3459 | 415 If @var{alpha} is a scalar, the result is the same size as @var{x}.\n\ |
416 If @var{x} is a scalar, the result is the same size as @var{alpha}.\n\ | |
417 If @var{alpha} is a row vector and @var{x} is a column vector, the\n\ | |
418 result is a matrix with @code{length (@var{x})} rows and\n\ | |
419 @code{length (@var{alpha})} columns. Otherwise, @var{alpha} and\n\ | |
420 @var{x} must conform and the result will be the same size.\n\ | |
3155 | 421 \n\ |
3459 | 422 The value of @var{alpha} must be real. The value of @var{x} may be\n\ |
423 complex.\n\ | |
424 \n\ | |
425 If requested, @var{ierr} contains the following status information\n\ | |
426 and is the same size as the result.\n\ | |
3548 | 427 \n\ |
3459 | 428 @enumerate 0\n\ |
429 @item\n\ | |
430 Normal return.\n\ | |
10840 | 431 \n\ |
3459 | 432 @item\n\ |
433 Input error, return @code{NaN}.\n\ | |
10840 | 434 \n\ |
3459 | 435 @item\n\ |
436 Overflow, return @code{Inf}.\n\ | |
10840 | 437 \n\ |
3459 | 438 @item\n\ |
439 Loss of significance by argument reduction results in less than\n\ | |
440 half of machine accuracy.\n\ | |
10840 | 441 \n\ |
3459 | 442 @item\n\ |
443 Complete loss of significance by argument reduction, return @code{NaN}.\n\ | |
10840 | 444 \n\ |
3459 | 445 @item\n\ |
446 Error---no computation, algorithm termination condition not met,\n\ | |
447 return @code{NaN}.\n\ | |
448 @end enumerate\n\ | |
449 @end deftypefn") | |
3155 | 450 { |
3220 | 451 return do_bessel (BESSEL_J, "besselj", args, nargout); |
3155 | 452 } |
453 | |
3220 | 454 DEFUN_DLD (bessely, args, nargout, |
3459 | 455 "-*- texinfo -*-\n\ |
456 @deftypefn {Loadable Function} {[@var{y}, @var{ierr}] =} bessely (@var{alpha}, @var{x}, @var{opt})\n\ | |
457 See besselj.\n\ | |
458 @end deftypefn") | |
3155 | 459 { |
3220 | 460 return do_bessel (BESSEL_Y, "bessely", args, nargout); |
3155 | 461 } |
462 | |
3220 | 463 DEFUN_DLD (besseli, args, nargout, |
3459 | 464 "-*- texinfo -*-\n\ |
465 @deftypefn {Loadable Function} {[@var{i}, @var{ierr}] =} besseli (@var{alpha}, @var{x}, @var{opt})\n\ | |
466 See besselj.\n\ | |
467 @end deftypefn") | |
3155 | 468 { |
3220 | 469 return do_bessel (BESSEL_I, "besseli", args, nargout); |
3155 | 470 } |
471 | |
3220 | 472 DEFUN_DLD (besselk, args, nargout, |
3459 | 473 "-*- texinfo -*-\n\ |
474 @deftypefn {Loadable Function} {[@var{k}, @var{ierr}] =} besselk (@var{alpha}, @var{x}, @var{opt})\n\ | |
475 See besselj.\n\ | |
476 @end deftypefn") | |
3220 | 477 { |
478 return do_bessel (BESSEL_K, "besselk", args, nargout); | |
479 } | |
480 | |
481 DEFUN_DLD (besselh, args, nargout, | |
3459 | 482 "-*- texinfo -*-\n\ |
483 @deftypefn {Loadable Function} {[@var{h}, @var{ierr}] =} besselh (@var{alpha}, @var{k}, @var{x}, @var{opt})\n\ | |
484 See besselj.\n\ | |
485 @end deftypefn") | |
3220 | 486 { |
487 octave_value_list retval; | |
488 | |
489 int nargin = args.length (); | |
490 | |
491 if (nargin == 2) | |
492 { | |
493 retval = do_bessel (BESSEL_H1, "besselh", args, nargout); | |
494 } | |
495 else if (nargin == 3 || nargin == 4) | |
496 { | |
5275 | 497 octave_idx_type kind = args(1).int_value (); |
3220 | 498 |
3810 | 499 if (! error_state) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
500 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
501 octave_value_list tmp_args; |
3220 | 502 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
503 if (nargin == 4) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
504 tmp_args(2) = args(3); |
3220 | 505 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
506 tmp_args(1) = args(2); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
507 tmp_args(0) = args(0); |
3220 | 508 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
509 if (kind == 1) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
510 retval = do_bessel (BESSEL_H1, "besselh", tmp_args, nargout); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
511 else if (kind == 2) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
512 retval = do_bessel (BESSEL_H2, "besselh", tmp_args, nargout); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
513 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
514 error ("besselh: expecting K = 1 or 2"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
515 } |
3220 | 516 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
517 error ("besselh: invalid value of K"); |
3220 | 518 } |
519 else | |
5823 | 520 print_usage (); |
3220 | 521 |
522 return retval; | |
523 } | |
524 | |
525 DEFUN_DLD (airy, args, nargout, | |
3459 | 526 "-*- texinfo -*-\n\ |
527 @deftypefn {Loadable Function} {[@var{a}, @var{ierr}] =} airy (@var{k}, @var{z}, @var{opt})\n\ | |
3220 | 528 Compute Airy functions of the first and second kind, and their\n\ |
529 derivatives.\n\ | |
530 \n\ | |
3459 | 531 @example\n\ |
9064
7c02ec148a3c
Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
532 @group\n\ |
7031 | 533 K Function Scale factor (if 'opt' is supplied)\n\ |
534 --- -------- ---------------------------------------\n\ | |
535 0 Ai (Z) exp ((2/3) * Z * sqrt (Z))\n\ | |
536 1 dAi(Z)/dZ exp ((2/3) * Z * sqrt (Z))\n\ | |
537 2 Bi (Z) exp (-abs (real ((2/3) * Z *sqrt (Z))))\n\ | |
538 3 dBi(Z)/dZ exp (-abs (real ((2/3) * Z *sqrt (Z))))\n\ | |
9064
7c02ec148a3c
Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
539 @end group\n\ |
3459 | 540 @end example\n\ |
3220 | 541 \n\ |
3549 | 542 The function call @code{airy (@var{z})} is equivalent to\n\ |
3459 | 543 @code{airy (0, @var{z})}.\n\ |
3155 | 544 \n\ |
3549 | 545 The result is the same size as @var{z}.\n\ |
3220 | 546 \n\ |
3459 | 547 If requested, @var{ierr} contains the following status information and\n\ |
548 is the same size as the result.\n\ | |
3548 | 549 \n\ |
3459 | 550 @enumerate 0\n\ |
551 @item\n\ | |
552 Normal return.\n\ | |
10840 | 553 \n\ |
3459 | 554 @item\n\ |
555 Input error, return @code{NaN}.\n\ | |
10840 | 556 \n\ |
3459 | 557 @item\n\ |
558 Overflow, return @code{Inf}.\n\ | |
10840 | 559 \n\ |
3459 | 560 @item\n\ |
561 Loss of significance by argument reduction results in less than half\n\ | |
562 of machine accuracy.\n\ | |
10840 | 563 \n\ |
3459 | 564 @item\n\ |
565 Complete loss of significance by argument reduction, return @code{NaN}.\n\ | |
10840 | 566 \n\ |
3459 | 567 @item\n\ |
568 Error---no computation, algorithm termination condition not met,\n\ | |
5448 | 569 return @code{NaN}.\n\ |
3459 | 570 @end enumerate\n\ |
571 @end deftypefn") | |
3155 | 572 { |
3220 | 573 octave_value_list retval; |
574 | |
575 int nargin = args.length (); | |
576 | |
577 if (nargin > 0 && nargin < 4) | |
578 { | |
579 bool scale = (nargin == 3); | |
580 | |
581 int kind = 0; | |
582 | |
583 if (nargin > 1) | |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
584 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
585 kind = args(0).int_value (); |
3220 | 586 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
587 if (! error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
588 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
589 if (kind < 0 || kind > 3) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
590 error ("airy: expecting K = 0, 1, 2, or 3"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
591 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
592 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
593 error ("airy: expecting integer value for K"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
594 } |
3220 | 595 |
596 if (! error_state) | |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
597 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
598 int idx = nargin == 1 ? 0 : 1; |
3220 | 599 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
600 if (args (idx).is_single_type ()) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
601 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
602 FloatComplexNDArray z = args(idx).float_complex_array_value (); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
603 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
604 if (! error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
605 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
606 Array<octave_idx_type> ierr; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
607 octave_value result; |
3220 | 608 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
609 if (kind > 1) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
610 result = biry (z, kind == 3, scale, ierr); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
611 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
612 result = airy (z, kind == 1, scale, ierr); |
3220 | 613 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
614 if (nargout > 1) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
615 retval(1) = NDArray (ierr); |
3220 | 616 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
617 retval(0) = result; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
618 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
619 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
620 error ("airy: expecting complex matrix for Z"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
621 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
622 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
623 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
624 ComplexNDArray z = args(idx).complex_array_value (); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
625 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
626 if (! error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
627 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
628 Array<octave_idx_type> ierr; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
629 octave_value result; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
630 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
631 if (kind > 1) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
632 result = biry (z, kind == 3, scale, ierr); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
633 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
634 result = airy (z, kind == 1, scale, ierr); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
635 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
636 if (nargout > 1) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
637 retval(1) = NDArray (ierr); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7031
diff
changeset
|
638 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
639 retval(0) = result; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
640 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
641 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
642 error ("airy: expecting complex matrix for Z"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
643 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
9732
diff
changeset
|
644 } |
3220 | 645 } |
646 else | |
5823 | 647 print_usage (); |
3220 | 648 |
649 return retval; | |
3155 | 650 } |
651 | |
652 /* | |
8278
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
653 %! # Test values computed with GP/PARI version 2.3.3 |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
654 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
655 %!shared alpha, x, jx, yx, ix, kx, nix |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
656 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
657 %! # Bessel functions, even order, positive and negative x |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
658 %! alpha = 2; x = 1.25; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
659 %! jx = 0.1710911312405234823613091417; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
660 %! yx = -1.193199310178553861283790424; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
661 %! ix = 0.2220184483766341752692212604; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
662 %! kx = 0.9410016167388185767085460540; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
663 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
664 %!assert(besselj(alpha,x), jx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
665 %!assert(bessely(alpha,x), yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
666 %!assert(besseli(alpha,x), ix, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
667 %!assert(besselk(alpha,x), kx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
668 %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
669 %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
670 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
671 %!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
672 %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
673 %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
674 %!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
675 %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
676 %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
677 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
678 %!assert(besselj(-alpha,x), jx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
679 %!assert(bessely(-alpha,x), yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
680 %!assert(besseli(-alpha,x), ix, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
681 %!assert(besselk(-alpha,x), kx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
682 %!assert(besselh(-alpha,1,x), jx + I*yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
683 %!assert(besselh(-alpha,2,x), jx - I*yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
684 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
685 %!assert(besselj(-alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
686 %!assert(bessely(-alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
687 %!assert(besseli(-alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
688 %!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
689 %!assert(besselh(-alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
690 %!assert(besselh(-alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
691 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
692 %! x *= -1; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
693 %! yx = -1.193199310178553861283790424 + 0.3421822624810469647226182835*I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
694 %! kx = 0.9410016167388185767085460540 - 0.6974915263814386815610060884*I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
695 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
696 %!assert(besselj(alpha,x), jx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
697 %!assert(bessely(alpha,x), yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
698 %!assert(besseli(alpha,x), ix, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
699 %!assert(besselk(alpha,x), kx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
700 %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
701 %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
702 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
703 %!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
704 %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
705 %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
706 %!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
707 %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
708 %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
709 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
710 %! # Bessel functions, odd order, positive and negative x |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
711 %! alpha = 3; x = 2.5; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
712 %! jx = 0.2166003910391135247666890035; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
713 %! yx = -0.7560554967536709968379029772; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
714 %! ix = 0.4743704087780355895548240179; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
715 %! kx = 0.2682271463934492027663765197; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
716 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
717 %!assert(besselj(alpha,x), jx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
718 %!assert(bessely(alpha,x), yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
719 %!assert(besseli(alpha,x), ix, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
720 %!assert(besselk(alpha,x), kx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
721 %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
722 %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
723 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
724 %!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
725 %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
726 %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
727 %!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
728 %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
729 %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
730 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
731 %!assert(besselj(-alpha,x), -jx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
732 %!assert(bessely(-alpha,x), -yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
733 %!assert(besseli(-alpha,x), ix, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
734 %!assert(besselk(-alpha,x), kx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
735 %!assert(besselh(-alpha,1,x), -(jx + I*yx), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
736 %!assert(besselh(-alpha,2,x), -(jx - I*yx), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
737 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
738 %!assert(besselj(-alpha,x,1), -jx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
739 %!assert(bessely(-alpha,x,1), -yx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
740 %!assert(besseli(-alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
741 %!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
742 %!assert(besselh(-alpha,1,x,1), -(jx + I*yx)*exp(-I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
743 %!assert(besselh(-alpha,2,x,1), -(jx - I*yx)*exp(I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
744 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
745 %! x *= -1; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
746 %! jx = -jx; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
747 %! yx = 0.7560554967536709968379029772 - 0.4332007820782270495333780070*I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
748 %! ix = -ix; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
749 %! kx = -0.2682271463934492027663765197 - 1.490278591297463775542004240*I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
750 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
751 %!assert(besselj(alpha,x), jx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
752 %!assert(bessely(alpha,x), yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
753 %!assert(besseli(alpha,x), ix, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
754 %!assert(besselk(alpha,x), kx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
755 %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
756 %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
757 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
758 %!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
759 %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
760 %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
761 %!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
762 %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
763 %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
764 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
765 %! # Bessel functions, fractional order, positive and negative x |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
766 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
767 %! alpha = 3.5; x = 2.75; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
768 %! jx = 0.1691636439842384154644784389; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
769 %! yx = -0.8301381935499356070267953387; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
770 %! ix = 0.3930540878794826310979363668; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
771 %! kx = 0.2844099013460621170288192503; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
772 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
773 %!assert(besselj(alpha,x), jx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
774 %!assert(bessely(alpha,x), yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
775 %!assert(besseli(alpha,x), ix, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
776 %!assert(besselk(alpha,x), kx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
777 %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
778 %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
779 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
780 %!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
781 %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
782 %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
783 %!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
784 %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
785 %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
786 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
787 %! nix = 0.2119931212254662995364461998; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
788 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
789 %!assert(besselj(-alpha,x), yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
790 %!assert(bessely(-alpha,x), -jx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
791 %!assert(besseli(-alpha,x), nix, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
792 %!assert(besselk(-alpha,x), kx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
793 %!assert(besselh(-alpha,1,x), -I*(jx + I*yx), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
794 %!assert(besselh(-alpha,2,x), I*(jx - I*yx), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
795 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
796 %!assert(besselj(-alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
797 %!assert(bessely(-alpha,x,1), -jx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
798 %!assert(besseli(-alpha,x,1), nix*exp(-abs(real(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
799 %!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
800 %!assert(besselh(-alpha,1,x,1), -I*(jx + I*yx)*exp(-I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
801 %!assert(besselh(-alpha,2,x,1), I*(jx - I*yx)*exp(I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
802 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
803 %! x *= -1; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
804 %! jx *= -I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
805 %! yx = -0.8301381935499356070267953387*I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
806 %! ix *= -I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
807 %! kx = -0.9504059335995575096509874508*I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
808 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
809 %!assert(besselj(alpha,x), jx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
810 %!assert(bessely(alpha,x), yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
811 %!assert(besseli(alpha,x), ix, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
812 %!assert(besselk(alpha,x), kx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
813 %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
814 %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
815 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
816 %!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
817 %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
818 %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
819 %!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
820 %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
821 %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
822 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
823 %! # Bessel functions, even order, complex x |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
824 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
825 %! alpha = 2; x = 1.25 + 3.625 * I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
826 %! jx = -1.299533366810794494030065917 + 4.370833116012278943267479589*I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
827 %! yx = -4.370357232383223896393056727 - 1.283083391453582032688834041*I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
828 %! ix = -0.6717801680341515541002273932 - 0.2314623443930774099910228553*I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
829 %! kx = -0.01108009888623253515463783379 + 0.2245218229358191588208084197*I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
830 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
831 %!assert(besselj(alpha,x), jx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
832 %!assert(bessely(alpha,x), yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
833 %!assert(besseli(alpha,x), ix, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
834 %!assert(besselk(alpha,x), kx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
835 %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
836 %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
837 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
838 %!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
839 %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
840 %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
841 %!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
842 %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
843 %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
844 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
845 %!assert(besselj(-alpha,x), jx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
846 %!assert(bessely(-alpha,x), yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
847 %!assert(besseli(-alpha,x), ix, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
848 %!assert(besselk(-alpha,x), kx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
849 %!assert(besselh(-alpha,1,x), jx + I*yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
850 %!assert(besselh(-alpha,2,x), jx - I*yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
851 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
852 %!assert(besselj(-alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
853 %!assert(bessely(-alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
854 %!assert(besseli(-alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
855 %!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
856 %!assert(besselh(-alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
857 %!assert(besselh(-alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
858 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
859 %! # Bessel functions, odd order, complex x |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
860 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
861 %! alpha = 3; x = 2.5 + 1.875 * I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
862 %! jx = 0.1330721523048277493333458596 + 0.5386295217249660078754395597*I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
863 %! yx = -0.6485072392105829901122401551 + 0.2608129289785456797046996987*I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
864 %! ix = -0.6182064685486998097516365709 + 0.4677561094683470065767989920*I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
865 %! kx = -0.1568585587733540007867882337 - 0.05185853709490846050505141321*I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
866 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
867 %!assert(besselj(alpha,x), jx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
868 %!assert(bessely(alpha,x), yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
869 %!assert(besseli(alpha,x), ix, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
870 %!assert(besselk(alpha,x), kx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
871 %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
872 %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
873 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
874 %!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
875 %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
876 %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
877 %!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
878 %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
879 %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
880 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
881 %!assert(besselj(-alpha,x), -jx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
882 %!assert(bessely(-alpha,x), -yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
883 %!assert(besseli(-alpha,x), ix, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
884 %!assert(besselk(-alpha,x), kx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
885 %!assert(besselh(-alpha,1,x), -(jx + I*yx), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
886 %!assert(besselh(-alpha,2,x), -(jx - I*yx), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
887 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
888 %!assert(besselj(-alpha,x,1), -jx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
889 %!assert(bessely(-alpha,x,1), -yx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
890 %!assert(besseli(-alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
891 %!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
892 %!assert(besselh(-alpha,1,x,1), -(jx + I*yx)*exp(-I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
893 %!assert(besselh(-alpha,2,x,1), -(jx - I*yx)*exp(I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
894 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
895 %! # Bessel functions, fractional order, complex x |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
896 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
897 %! alpha = 3.5; x = 1.75 + 4.125 * I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
898 %! jx = -3.018566131370455929707009100 - 0.7585648436793900607704057611*I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
899 %! yx = 0.7772278839106298215614791107 - 3.018518722313849782683792010*I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
900 %! ix = 0.2100873577220057189038160913 - 0.6551765604618246531254970926*I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
901 %! kx = 0.1757147290513239935341488069 + 0.08772348296883849205562558311*I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
902 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
903 %!assert(besselj(alpha,x), jx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
904 %!assert(bessely(alpha,x), yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
905 %!assert(besseli(alpha,x), ix, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
906 %!assert(besselk(alpha,x), kx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
907 %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
908 %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
909 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
910 %!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
911 %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
912 %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
913 %!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
914 %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
915 %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
916 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
917 %! nix = 0.09822388691172060573913739253 - 0.7110230642207380127317227407*I; |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
918 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
919 %!assert(besselj(-alpha,x), yx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
920 %!assert(bessely(-alpha,x), -jx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
921 %!assert(besseli(-alpha,x), nix, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
922 %!assert(besselk(-alpha,x), kx, 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
923 %!assert(besselh(-alpha,1,x), -I*(jx + I*yx), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
924 %!assert(besselh(-alpha,2,x), I*(jx - I*yx), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
925 %! |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
926 %!assert(besselj(-alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
927 %!assert(bessely(-alpha,x,1), -jx*exp(-abs(imag(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
928 %!assert(besseli(-alpha,x,1), nix*exp(-abs(real(x))), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
929 %!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
930 %!assert(besselh(-alpha,1,x,1), -I*(jx + I*yx)*exp(-I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
931 %!assert(besselh(-alpha,2,x,1), I*(jx - I*yx)*exp(I*x), 100*eps) |
ab0674a8b345
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7919
diff
changeset
|
932 */ |