annotate src/DLD-FUNCTIONS/besselj.cc @ 7789:82be108cc558

First attempt at single precision tyeps * * * corrections to qrupdate single precision routines * * * prefer demotion to single over promotion to double * * * Add single precision support to log2 function * * * Trivial PROJECT file update * * * Cache optimized hermitian/transpose methods * * * Add tests for tranpose/hermitian and ChangeLog entry for new transpose code
author David Bateman <dbateman@free.fr>
date Sun, 27 Apr 2008 22:34:17 +0200
parents 120f3135952f
children 9d080df0c843
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
1 /*
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
2
7017
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006,
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
4 2007 John W. Eaton
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
5
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
7
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5823
diff changeset
10 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5823
diff changeset
11 option) any later version.
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
12
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
13 Octave is distributed in the hope that it will be useful, but WITHOUT
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
16 for more details.
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
17
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5823
diff changeset
19 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5823
diff changeset
20 <http://www.gnu.org/licenses/>.
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
21
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
22 */
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
23
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
24 #ifdef HAVE_CONFIG_H
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
25 #include <config.h>
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
26 #endif
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
27
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
28 #include "lo-specfun.h"
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3810
diff changeset
29 #include "quit.h"
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
30
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
31 #include "defun-dld.h"
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
32 #include "error.h"
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
33 #include "gripes.h"
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
34 #include "oct-obj.h"
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
35 #include "utils.h"
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
36
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
37 enum bessel_type
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
38 {
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
39 BESSEL_J,
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
40 BESSEL_Y,
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
41 BESSEL_I,
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
42 BESSEL_K,
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
43 BESSEL_H1,
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
44 BESSEL_H2
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
45 };
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
46
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
47 #define DO_BESSEL(type, alpha, x, scaled, ierr, result) \
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
48 do \
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
49 { \
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
50 switch (type) \
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
51 { \
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
52 case BESSEL_J: \
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
53 result = besselj (alpha, x, scaled, ierr); \
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
54 break; \
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
55 \
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
56 case BESSEL_Y: \
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
57 result = bessely (alpha, x, scaled, ierr); \
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
58 break; \
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
59 \
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
60 case BESSEL_I: \
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
61 result = besseli (alpha, x, scaled, ierr); \
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
62 break; \
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
63 \
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
64 case BESSEL_K: \
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
65 result = besselk (alpha, x, scaled, ierr); \
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
66 break; \
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
67 \
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
68 case BESSEL_H1: \
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
69 result = besselh1 (alpha, x, scaled, ierr); \
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
70 break; \
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
71 \
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
72 case BESSEL_H2: \
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
73 result = besselh2 (alpha, x, scaled, ierr); \
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
74 break; \
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
75 \
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
76 default: \
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
77 break; \
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
78 } \
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
79 } \
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
80 while (0)
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
81
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
82 static inline Matrix
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4844
diff changeset
83 int_array2_to_matrix (const Array2<octave_idx_type>& a)
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
84 {
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4844
diff changeset
85 octave_idx_type nr = a.rows ();
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4844
diff changeset
86 octave_idx_type nc = a.cols ();
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
87
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
88 Matrix retval (nr, nc);
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
89
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4844
diff changeset
90 for (octave_idx_type j = 0; j < nc; j++)
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4844
diff changeset
91 for (octave_idx_type i = 0; i < nr; i++)
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3810
diff changeset
92 {
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3810
diff changeset
93 OCTAVE_QUIT;
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3810
diff changeset
94
5760
8d7162924bd3 [project @ 2006-04-14 04:01:37 by jwe]
jwe
parents: 5448
diff changeset
95 retval(i,j) = static_cast<double> (a(i,j));
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3810
diff changeset
96 }
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
97
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
98 return retval;
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
99 }
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
100
4844
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
101 static inline NDArray
5760
8d7162924bd3 [project @ 2006-04-14 04:01:37 by jwe]
jwe
parents: 5448
diff changeset
102 int_arrayN_to_array (const ArrayN<octave_idx_type>& a)
4844
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
103 {
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
104 dim_vector dv = a.dims ();
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
105 int nel = dv.numel ();
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
106
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
107 NDArray retval (dv);
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
108
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
109 for (int i = 0; i < nel; i++)
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
110 {
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
111 OCTAVE_QUIT;
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
112
5760
8d7162924bd3 [project @ 2006-04-14 04:01:37 by jwe]
jwe
parents: 5448
diff changeset
113 retval(i) = static_cast<double> (a(i));
4844
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
114 }
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
115
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
116 return retval;
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
117 }
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
118
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
119 static inline FloatMatrix
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
120 int_array2_to_float_matrix (const Array2<octave_idx_type>& a)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
121 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
122 octave_idx_type nr = a.rows ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
123 octave_idx_type nc = a.cols ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
124
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
125 FloatMatrix retval (nr, nc);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
126
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
127 for (octave_idx_type j = 0; j < nc; j++)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
128 for (octave_idx_type i = 0; i < nr; i++)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
129 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
130 OCTAVE_QUIT;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
131
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
132 retval(i,j) = static_cast<float> (a(i,j));
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
133 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
134
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
135 return retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
136 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
137
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
138 static inline FloatNDArray
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
139 int_arrayN_to_float_array (const ArrayN<octave_idx_type>& a)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
140 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
141 dim_vector dv = a.dims ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
142 int nel = dv.numel ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
143
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
144 FloatNDArray retval (dv);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
145
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
146 for (int i = 0; i < nel; i++)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
147 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
148 OCTAVE_QUIT;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
149
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
150 retval(i) = static_cast<float> (a(i));
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
151 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
152
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
153 return retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
154 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
155
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
156 static void
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
157 gripe_bessel_arg (const char *fn, const char *arg)
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
158 {
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
159 error ("%s: expecting scalar or matrix as %s argument", fn, arg);
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
160 }
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
161
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
162 octave_value_list
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
163 do_bessel (enum bessel_type type, const char *fn,
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
164 const octave_value_list& args, int nargout)
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
165 {
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
166 octave_value_list retval;
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
167
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
168 int nargin = args.length ();
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
169
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
170 if (nargin == 2 || nargin == 3)
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
171 {
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
172 bool scaled = (nargin == 3);
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
173
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
174 octave_value alpha_arg = args(0);
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
175 octave_value x_arg = args(1);
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
176
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
177 if (alpha_arg.is_single_type () || x_arg.is_single_type ())
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
178 {
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
179 if (alpha_arg.is_scalar_type ())
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
180 {
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
181 float alpha = args(0).float_value ();
4844
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
182
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
183 if (! error_state)
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
184 {
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
185 if (x_arg.is_scalar_type ())
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
186 {
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
187 FloatComplex x = x_arg.float_complex_value ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
188
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
189 if (! error_state)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
190 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
191 octave_idx_type ierr;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
192 octave_value result;
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
193
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
194 DO_BESSEL (type, alpha, x, scaled, ierr, result);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
195
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
196 if (nargout > 1)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
197 retval(1) = static_cast<float> (ierr);
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
198
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
199 retval(0) = result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
200 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
201 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
202 gripe_bessel_arg (fn, "second");
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
203 }
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
204 else
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
205 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
206 FloatComplexNDArray x = x_arg.float_complex_array_value ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
207
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
208 if (! error_state)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
209 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
210 ArrayN<octave_idx_type> ierr;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
211 octave_value result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
212
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
213 DO_BESSEL (type, alpha, x, scaled, ierr, result);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
214
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
215 if (nargout > 1)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
216 retval(1) = int_arrayN_to_float_array (ierr);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
217
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
218 retval(0) = result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
219 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
220 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
221 gripe_bessel_arg (fn, "second");
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
222 }
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
223 }
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
224 else
4844
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
225 gripe_bessel_arg (fn, "first");
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
226 }
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
227 else
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
228 {
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
229 dim_vector dv0 = args(0).dims ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
230 dim_vector dv1 = args(1).dims ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
231
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
232 bool args0_is_row_vector = (dv0 (1) == dv0.numel ());
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
233 bool args1_is_col_vector = (dv1 (0) == dv1.numel ());
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
234
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
235 if (args0_is_row_vector && args1_is_col_vector)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
236 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
237 FloatRowVector ralpha = args(0).float_row_vector_value ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
238
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
239 if (! error_state)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
240 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
241 FloatComplexColumnVector cx =
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
242 x_arg.float_complex_column_vector_value ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
243
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
244 if (! error_state)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
245 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
246 Array2<octave_idx_type> ierr;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
247 octave_value result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
248
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
249 DO_BESSEL (type, ralpha, cx, scaled, ierr, result);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
250
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
251 if (nargout > 1)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
252 retval(1) = int_array2_to_float_matrix (ierr);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
253
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
254 retval(0) = result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
255 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
256 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
257 gripe_bessel_arg (fn, "second");
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
258 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
259 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
260 gripe_bessel_arg (fn, "first");
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
261 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
262 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
263 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
264 FloatNDArray alpha = args(0).float_array_value ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
265
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
266 if (! error_state)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
267 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
268 if (x_arg.is_scalar_type ())
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
269 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
270 FloatComplex x = x_arg.float_complex_value ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
271
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
272 if (! error_state)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
273 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
274 ArrayN<octave_idx_type> ierr;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
275 octave_value result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
276
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
277 DO_BESSEL (type, alpha, x, scaled, ierr, result);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
278
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
279 if (nargout > 1)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
280 retval(1) = int_arrayN_to_float_array (ierr);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
281
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
282 retval(0) = result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
283 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
284 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
285 gripe_bessel_arg (fn, "second");
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
286 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
287 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
288 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
289 FloatComplexNDArray x = x_arg.float_complex_array_value ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
290
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
291 if (! error_state)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
292 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
293 ArrayN<octave_idx_type> ierr;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
294 octave_value result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
295
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
296 DO_BESSEL (type, alpha, x, scaled, ierr, result);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
297
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
298 if (nargout > 1)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
299 retval(1) = int_arrayN_to_float_array (ierr);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
300
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
301 retval(0) = result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
302 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
303 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
304 gripe_bessel_arg (fn, "second");
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
305 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
306 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
307 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
308 gripe_bessel_arg (fn, "first");
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
309 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
310 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
311 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
312 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
313 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
314 if (alpha_arg.is_scalar_type ())
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
315 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
316 double alpha = args(0).double_value ();
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
317
4844
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
318 if (! error_state)
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
319 {
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
320 if (x_arg.is_scalar_type ())
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
321 {
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
322 Complex x = x_arg.complex_value ();
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
323
4844
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
324 if (! error_state)
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
325 {
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
326 octave_idx_type ierr;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
327 octave_value result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
328
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
329 DO_BESSEL (type, alpha, x, scaled, ierr, result);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
330
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
331 if (nargout > 1)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
332 retval(1) = static_cast<double> (ierr);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
333
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
334 retval(0) = result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
335 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
336 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
337 gripe_bessel_arg (fn, "second");
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
338 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
339 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
340 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
341 ComplexNDArray x = x_arg.complex_array_value ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
342
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
343 if (! error_state)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
344 {
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4844
diff changeset
345 ArrayN<octave_idx_type> ierr;
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
346 octave_value result;
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
347
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
348 DO_BESSEL (type, alpha, x, scaled, ierr, result);
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
349
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
350 if (nargout > 1)
4844
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
351 retval(1) = int_arrayN_to_array (ierr);
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
352
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
353 retval(0) = result;
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
354 }
4844
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
355 else
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
356 gripe_bessel_arg (fn, "second");
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
357 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
358 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
359 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
360 gripe_bessel_arg (fn, "first");
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
361 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
362 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
363 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
364 dim_vector dv0 = args(0).dims ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
365 dim_vector dv1 = args(1).dims ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
366
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
367 bool args0_is_row_vector = (dv0 (1) == dv0.numel ());
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
368 bool args1_is_col_vector = (dv1 (0) == dv1.numel ());
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
369
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
370 if (args0_is_row_vector && args1_is_col_vector)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
371 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
372 RowVector ralpha = args(0).row_vector_value ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
373
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
374 if (! error_state)
4844
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
375 {
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
376 ComplexColumnVector cx =
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
377 x_arg.complex_column_vector_value ();
4844
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
378
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
379 if (! error_state)
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
380 {
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
381 Array2<octave_idx_type> ierr;
4844
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
382 octave_value result;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
383
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
384 DO_BESSEL (type, ralpha, cx, scaled, ierr, result);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
385
4844
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
386 if (nargout > 1)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
387 retval(1) = int_array2_to_matrix (ierr);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
388
4844
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
389 retval(0) = result;
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
390 }
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
391 else
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
392 gripe_bessel_arg (fn, "second");
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
393 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
394 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
395 gripe_bessel_arg (fn, "first");
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
396 }
4844
9f7ef92b50b0 [project @ 2004-04-02 17:26:53 by jwe]
jwe
parents: 4153
diff changeset
397 else
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
398 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
399 NDArray alpha = args(0).array_value ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
400
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
401 if (! error_state)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
402 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
403 if (x_arg.is_scalar_type ())
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
404 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
405 Complex x = x_arg.complex_value ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
406
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
407 if (! error_state)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
408 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
409 ArrayN<octave_idx_type> ierr;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
410 octave_value result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
411
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
412 DO_BESSEL (type, alpha, x, scaled, ierr, result);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
413
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
414 if (nargout > 1)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
415 retval(1) = int_arrayN_to_array (ierr);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
416
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
417 retval(0) = result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
418 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
419 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
420 gripe_bessel_arg (fn, "second");
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
421 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
422 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
423 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
424 ComplexNDArray x = x_arg.complex_array_value ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
425
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
426 if (! error_state)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
427 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
428 ArrayN<octave_idx_type> ierr;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
429 octave_value result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
430
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
431 DO_BESSEL (type, alpha, x, scaled, ierr, result);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
432
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
433 if (nargout > 1)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
434 retval(1) = int_arrayN_to_array (ierr);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
435
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
436 retval(0) = result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
437 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
438 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
439 gripe_bessel_arg (fn, "second");
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
440 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
441 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
442 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
443 gripe_bessel_arg (fn, "first");
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
444 }
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
445 }
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
446 }
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
447 }
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
448 else
5823
080c08b192d8 [project @ 2006-05-19 05:32:17 by jwe]
jwe
parents: 5760
diff changeset
449 print_usage ();
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
450
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
451 return retval;
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
452 }
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
453
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
454 DEFUN_DLD (besselj, args, nargout,
3459
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
455 "-*- texinfo -*-\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
456 @deftypefn {Loadable Function} {[@var{j}, @var{ierr}] =} besselj (@var{alpha}, @var{x}, @var{opt})\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
457 @deftypefnx {Loadable Function} {[@var{y}, @var{ierr}] =} bessely (@var{alpha}, @var{x}, @var{opt})\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
458 @deftypefnx {Loadable Function} {[@var{i}, @var{ierr}] =} besseli (@var{alpha}, @var{x}, @var{opt})\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
459 @deftypefnx {Loadable Function} {[@var{k}, @var{ierr}] =} besselk (@var{alpha}, @var{x}, @var{opt})\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
460 @deftypefnx {Loadable Function} {[@var{h}, @var{ierr}] =} besselh (@var{alpha}, @var{k}, @var{x}, @var{opt})\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
461 Compute Bessel or Hankel functions of various kinds:\n\
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
462 \n\
3459
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
463 @table @code\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
464 @item besselj\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
465 Bessel functions of the first kind.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
466 @item bessely\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
467 Bessel functions of the second kind.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
468 @item besseli\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
469 Modified Bessel functions of the first kind.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
470 @item besselk\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
471 Modified Bessel functions of the second kind.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
472 @item besselh\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
473 Compute Hankel functions of the first (@var{k} = 1) or second (@var{k}\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
474 = 2) kind.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
475 @end table\n\
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
476 \n\
3568
58549b931ad5 [project @ 2000-02-03 10:21:54 by jwe]
jwe
parents: 3549
diff changeset
477 If the argument @var{opt} is supplied, the result is scaled by the\n\
3459
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
478 @code{exp (-I*@var{x})} for @var{k} = 1 or @code{exp (I*@var{x})} for\n\
3499
3e3e14ad5149 [project @ 2000-01-31 05:18:07 by jwe]
jwe
parents: 3459
diff changeset
479 @var{k} = 2.\n\
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
480 \n\
3459
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
481 If @var{alpha} is a scalar, the result is the same size as @var{x}.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
482 If @var{x} is a scalar, the result is the same size as @var{alpha}.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
483 If @var{alpha} is a row vector and @var{x} is a column vector, the\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
484 result is a matrix with @code{length (@var{x})} rows and\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
485 @code{length (@var{alpha})} columns. Otherwise, @var{alpha} and\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
486 @var{x} must conform and the result will be the same size.\n\
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
487 \n\
3459
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
488 The value of @var{alpha} must be real. The value of @var{x} may be\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
489 complex.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
490 \n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
491 If requested, @var{ierr} contains the following status information\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
492 and is the same size as the result.\n\
3548
ab7fa5a8f23f [project @ 2000-02-03 01:17:15 by jwe]
jwe
parents: 3499
diff changeset
493 \n\
3459
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
494 @enumerate 0\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
495 @item\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
496 Normal return.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
497 @item\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
498 Input error, return @code{NaN}.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
499 @item\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
500 Overflow, return @code{Inf}.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
501 @item\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
502 Loss of significance by argument reduction results in less than\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
503 half of machine accuracy.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
504 @item\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
505 Complete loss of significance by argument reduction, return @code{NaN}.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
506 @item\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
507 Error---no computation, algorithm termination condition not met,\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
508 return @code{NaN}.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
509 @end enumerate\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
510 @end deftypefn")
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
511 {
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
512 return do_bessel (BESSEL_J, "besselj", args, nargout);
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
513 }
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
514
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
515 DEFUN_DLD (bessely, args, nargout,
3459
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
516 "-*- texinfo -*-\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
517 @deftypefn {Loadable Function} {[@var{y}, @var{ierr}] =} bessely (@var{alpha}, @var{x}, @var{opt})\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
518 See besselj.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
519 @end deftypefn")
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
520 {
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
521 return do_bessel (BESSEL_Y, "bessely", args, nargout);
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
522 }
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
523
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
524 DEFUN_DLD (besseli, args, nargout,
3459
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
525 "-*- texinfo -*-\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
526 @deftypefn {Loadable Function} {[@var{i}, @var{ierr}] =} besseli (@var{alpha}, @var{x}, @var{opt})\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
527 See besselj.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
528 @end deftypefn")
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
529 {
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
530 return do_bessel (BESSEL_I, "besseli", args, nargout);
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
531 }
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
532
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
533 DEFUN_DLD (besselk, args, nargout,
3459
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
534 "-*- texinfo -*-\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
535 @deftypefn {Loadable Function} {[@var{k}, @var{ierr}] =} besselk (@var{alpha}, @var{x}, @var{opt})\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
536 See besselj.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
537 @end deftypefn")
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
538 {
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
539 return do_bessel (BESSEL_K, "besselk", args, nargout);
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
540 }
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
541
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
542 DEFUN_DLD (besselh, args, nargout,
3459
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
543 "-*- texinfo -*-\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
544 @deftypefn {Loadable Function} {[@var{h}, @var{ierr}] =} besselh (@var{alpha}, @var{k}, @var{x}, @var{opt})\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
545 See besselj.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
546 @end deftypefn")
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
547 {
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
548 octave_value_list retval;
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
549
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
550 int nargin = args.length ();
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
551
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
552 if (nargin == 2)
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
553 {
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
554 retval = do_bessel (BESSEL_H1, "besselh", args, nargout);
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
555 }
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
556 else if (nargin == 3 || nargin == 4)
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
557 {
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4844
diff changeset
558 octave_idx_type kind = args(1).int_value ();
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
559
3810
f19f00339363 [project @ 2001-03-29 21:03:01 by jwe]
jwe
parents: 3568
diff changeset
560 if (! error_state)
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
561 {
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
562 octave_value_list tmp_args;
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
563
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
564 if (nargin == 4)
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
565 tmp_args(2) = args(3);
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
566
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
567 tmp_args(1) = args(2);
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
568 tmp_args(0) = args(0);
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
569
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
570 if (kind == 1)
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
571 retval = do_bessel (BESSEL_H1, "besselh", tmp_args, nargout);
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
572 else if (kind == 2)
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
573 retval = do_bessel (BESSEL_H2, "besselh", tmp_args, nargout);
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
574 else
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
575 error ("besselh: expecting K = 1 or 2");
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
576 }
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
577 else
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
578 error ("besselh: invalid value of K");
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
579 }
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
580 else
5823
080c08b192d8 [project @ 2006-05-19 05:32:17 by jwe]
jwe
parents: 5760
diff changeset
581 print_usage ();
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
582
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
583 return retval;
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
584 }
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
585
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
586 DEFUN_DLD (airy, args, nargout,
3459
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
587 "-*- texinfo -*-\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
588 @deftypefn {Loadable Function} {[@var{a}, @var{ierr}] =} airy (@var{k}, @var{z}, @var{opt})\n\
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
589 Compute Airy functions of the first and second kind, and their\n\
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
590 derivatives.\n\
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
591 \n\
3459
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
592 @example\n\
7031
120f3135952f [project @ 2007-10-15 15:30:03 by jwe]
jwe
parents: 7017
diff changeset
593 K Function Scale factor (if 'opt' is supplied)\n\
120f3135952f [project @ 2007-10-15 15:30:03 by jwe]
jwe
parents: 7017
diff changeset
594 --- -------- ---------------------------------------\n\
120f3135952f [project @ 2007-10-15 15:30:03 by jwe]
jwe
parents: 7017
diff changeset
595 0 Ai (Z) exp ((2/3) * Z * sqrt (Z))\n\
120f3135952f [project @ 2007-10-15 15:30:03 by jwe]
jwe
parents: 7017
diff changeset
596 1 dAi(Z)/dZ exp ((2/3) * Z * sqrt (Z))\n\
120f3135952f [project @ 2007-10-15 15:30:03 by jwe]
jwe
parents: 7017
diff changeset
597 2 Bi (Z) exp (-abs (real ((2/3) * Z *sqrt (Z))))\n\
120f3135952f [project @ 2007-10-15 15:30:03 by jwe]
jwe
parents: 7017
diff changeset
598 3 dBi(Z)/dZ exp (-abs (real ((2/3) * Z *sqrt (Z))))\n\
3459
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
599 @end example\n\
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
600 \n\
3549
03025e79d8b9 [project @ 2000-02-03 01:28:24 by jwe]
jwe
parents: 3548
diff changeset
601 The function call @code{airy (@var{z})} is equivalent to\n\
3459
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
602 @code{airy (0, @var{z})}.\n\
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
603 \n\
3549
03025e79d8b9 [project @ 2000-02-03 01:28:24 by jwe]
jwe
parents: 3548
diff changeset
604 The result is the same size as @var{z}.\n\
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
605 \n\
3459
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
606 If requested, @var{ierr} contains the following status information and\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
607 is the same size as the result.\n\
3548
ab7fa5a8f23f [project @ 2000-02-03 01:17:15 by jwe]
jwe
parents: 3499
diff changeset
608 \n\
3459
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
609 @enumerate 0\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
610 @item\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
611 Normal return.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
612 @item\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
613 Input error, return @code{NaN}.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
614 @item\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
615 Overflow, return @code{Inf}.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
616 @item\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
617 Loss of significance by argument reduction results in less than half\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
618 of machine accuracy.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
619 @item\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
620 Complete loss of significance by argument reduction, return @code{NaN}.\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
621 @item\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
622 Error---no computation, algorithm termination condition not met,\n\
5448
ebe5d7d15522 [project @ 2005-09-14 18:55:04 by jwe]
jwe
parents: 5307
diff changeset
623 return @code{NaN}.\n\
3459
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
624 @end enumerate\n\
8e36c45e3a61 [project @ 2000-01-19 10:26:18 by jwe]
jwe
parents: 3325
diff changeset
625 @end deftypefn")
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
626 {
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
627 octave_value_list retval;
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
628
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
629 int nargin = args.length ();
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
630
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
631 if (nargin > 0 && nargin < 4)
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
632 {
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
633 bool scale = (nargin == 3);
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
634
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
635 int kind = 0;
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
636
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
637 if (nargin > 1)
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
638 {
5760
8d7162924bd3 [project @ 2006-04-14 04:01:37 by jwe]
jwe
parents: 5448
diff changeset
639 kind = args(0).int_value ();
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
640
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
641 if (! error_state)
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
642 {
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
643 if (kind < 0 || kind > 3)
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
644 error ("airy: expecting K = 0, 1, 2, or 3");
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
645 }
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
646 else
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
647 error ("airy: expecting integer value for K");
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
648 }
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
649
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
650 if (! error_state)
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
651 {
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
652 int idx = nargin == 1 ? 0 : 1;
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
653
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
654 if (args (idx).is_single_type ())
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
655 {
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
656 FloatComplexNDArray z = args(idx).float_complex_array_value ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
657
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
658 if (! error_state)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
659 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
660 ArrayN<octave_idx_type> ierr;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
661 octave_value result;
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
662
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
663 if (kind > 1)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
664 result = biry (z, kind == 3, scale, ierr);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
665 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
666 result = airy (z, kind == 1, scale, ierr);
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
667
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
668 if (nargout > 1)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
669 retval(1) = int_arrayN_to_float_array (ierr);
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
670
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
671 retval(0) = result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
672 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
673 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
674 error ("airy: expecting complex matrix for Z");
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
675 }
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
676 else
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
677 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
678 ComplexNDArray z = args(idx).complex_array_value ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
679
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
680 if (! error_state)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
681 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
682 ArrayN<octave_idx_type> ierr;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
683 octave_value result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
684
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
685 if (kind > 1)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
686 result = biry (z, kind == 3, scale, ierr);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
687 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
688 result = airy (z, kind == 1, scale, ierr);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
689
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
690 if (nargout > 1)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
691 retval(1) = int_arrayN_to_array (ierr);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
692
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
693 retval(0) = result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
694 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
695 else
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
696 error ("airy: expecting complex matrix for Z");
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
697 }
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
698 }
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
699 }
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
700 else
5823
080c08b192d8 [project @ 2006-05-19 05:32:17 by jwe]
jwe
parents: 5760
diff changeset
701 print_usage ();
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
702
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
703 return retval;
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
704 }
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
705
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
706 /*
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
707 ;;; Local Variables: ***
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
708 ;;; mode: C++ ***
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
709 ;;; End: ***
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
710 */