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