annotate src/DLD-FUNCTIONS/betainc.cc @ 12541:dd2c70b30f28

Add tests for ifftshift.m
author Robert T. Short <octave@phaselockedsystems.com.com>
date Sat, 26 Mar 2011 06:50:12 -0700
parents fd0a3ac60b0e
children 08f8fc1e9872
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3254
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
1 /*
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
2
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 10846
diff changeset
3 Copyright (C) 1997-2011 John W. Eaton
3254
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
4
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
6
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
8 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
9 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
10 option) any later version.
3254
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
11
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
15 for more details.
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
16
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
17 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
18 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
19 <http://www.gnu.org/licenses/>.
3254
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
20
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
21 */
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
22
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
23 #ifdef HAVE_CONFIG_H
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
24 #include <config.h>
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
25 #endif
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
26
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
27 #include "lo-specfun.h"
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
28
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
29 #include "defun-dld.h"
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
30 #include "error.h"
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
31 #include "gripes.h"
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
32 #include "oct-obj.h"
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
33 #include "utils.h"
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
34
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
35 DEFUN_DLD (betainc, args, ,
3444
fa0d84558faa [project @ 2000-01-17 08:40:39 by jwe]
jwe
parents: 3254
diff changeset
36 "-*- texinfo -*-\n\
fa0d84558faa [project @ 2000-01-17 08:40:39 by jwe]
jwe
parents: 3254
diff changeset
37 @deftypefn {Mapping Function} {} betainc (@var{x}, @var{a}, @var{b})\n\
fa0d84558faa [project @ 2000-01-17 08:40:39 by jwe]
jwe
parents: 3254
diff changeset
38 Return the incomplete Beta function,\n\
fa0d84558faa [project @ 2000-01-17 08:40:39 by jwe]
jwe
parents: 3254
diff changeset
39 @tex\n\
fa0d84558faa [project @ 2000-01-17 08:40:39 by jwe]
jwe
parents: 3254
diff changeset
40 $$\n\
5402
2ecbb26cd239 [project @ 2005-07-06 22:12:42 by jwe]
jwe
parents: 5401
diff changeset
41 \\beta (x, a, b) = B (a, b)^{-1} \\int_0^x t^{(a-z)} (1-t)^{(b-1)} dt.\n\
3444
fa0d84558faa [project @ 2000-01-17 08:40:39 by jwe]
jwe
parents: 3254
diff changeset
42 $$\n\
fa0d84558faa [project @ 2000-01-17 08:40:39 by jwe]
jwe
parents: 3254
diff changeset
43 @end tex\n\
8517
81d6ab3ac93c Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents: 7815
diff changeset
44 @ifnottex\n\
10846
a4f482e66b65 Grammarcheck more of the documentation.
Rik <octave@nomad.inbox5.com>
parents: 10840
diff changeset
45 @c Set example in small font to prevent overfull line\n\
3254
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
46 \n\
3444
fa0d84558faa [project @ 2000-01-17 08:40:39 by jwe]
jwe
parents: 3254
diff changeset
47 @smallexample\n\
10840
89f4d7e294cc Grammarcheck .cc files
Rik <octave@nomad.inbox5.com>
parents: 10155
diff changeset
48 @group\n\
5401
f654f94c46af [project @ 2005-07-05 16:29:22 by jwe]
jwe
parents: 5307
diff changeset
49 x\n\
f654f94c46af [project @ 2005-07-05 16:29:22 by jwe]
jwe
parents: 5307
diff changeset
50 /\n\
f654f94c46af [project @ 2005-07-05 16:29:22 by jwe]
jwe
parents: 5307
diff changeset
51 betainc (x, a, b) = beta (a, b)^(-1) | t^(a-1) (1-t)^(b-1) dt.\n\
f654f94c46af [project @ 2005-07-05 16:29:22 by jwe]
jwe
parents: 5307
diff changeset
52 /\n\
f654f94c46af [project @ 2005-07-05 16:29:22 by jwe]
jwe
parents: 5307
diff changeset
53 t=0\n\
10840
89f4d7e294cc Grammarcheck .cc files
Rik <octave@nomad.inbox5.com>
parents: 10155
diff changeset
54 @end group\n\
3444
fa0d84558faa [project @ 2000-01-17 08:40:39 by jwe]
jwe
parents: 3254
diff changeset
55 @end smallexample\n\
10840
89f4d7e294cc Grammarcheck .cc files
Rik <octave@nomad.inbox5.com>
parents: 10155
diff changeset
56 \n\
8517
81d6ab3ac93c Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents: 7815
diff changeset
57 @end ifnottex\n\
3254
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
58 \n\
3444
fa0d84558faa [project @ 2000-01-17 08:40:39 by jwe]
jwe
parents: 3254
diff changeset
59 If x has more than one component, both @var{a} and @var{b} must be\n\
fa0d84558faa [project @ 2000-01-17 08:40:39 by jwe]
jwe
parents: 3254
diff changeset
60 scalars. If @var{x} is a scalar, @var{a} and @var{b} must be of\n\
fa0d84558faa [project @ 2000-01-17 08:40:39 by jwe]
jwe
parents: 3254
diff changeset
61 compatible dimensions.\n\
fa0d84558faa [project @ 2000-01-17 08:40:39 by jwe]
jwe
parents: 3254
diff changeset
62 @end deftypefn")
3254
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
63 {
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
64 octave_value retval;
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
65
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
66 int nargin = args.length ();
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
67
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
68 if (nargin == 3)
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
69 {
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
70 octave_value x_arg = args(0);
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
71 octave_value a_arg = args(1);
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
72 octave_value b_arg = args(2);
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
73
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
74 // FIXME Can we make a template version of the duplicated code below
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
75 if (x_arg.is_single_type () || a_arg.is_single_type () ||
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
76 b_arg.is_single_type ())
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
77 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
78 if (x_arg.is_scalar_type ())
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
79 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
80 float x = x_arg.float_value ();
3254
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
81
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
82 if (a_arg.is_scalar_type ())
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
83 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
84 float a = a_arg.float_value ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
85
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
86 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
87 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
88 if (b_arg.is_scalar_type ())
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
89 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
90 float b = b_arg.float_value ();
3254
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
91
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
92 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
93 retval = betainc (x, a, b);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
94 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
95 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
96 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
97 FloatNDArray b = b_arg.float_array_value ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
98
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
99 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
100 retval = betainc (x, a, b);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
101 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
102 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
103 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
104 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
105 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
106 FloatNDArray a = a_arg.float_array_value ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
107
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
108 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
109 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
110 if (b_arg.is_scalar_type ())
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
111 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
112 float b = b_arg.float_value ();
3254
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
113
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
114 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
115 retval = betainc (x, a, b);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
116 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
117 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
118 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
119 FloatNDArray b = b_arg.float_array_value ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
120
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
121 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
122 retval = betainc (x, a, b);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
123 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
124 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
125 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
126 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
127 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
128 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
129 FloatNDArray x = x_arg.float_array_value ();
3254
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
130
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
131 if (a_arg.is_scalar_type ())
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
132 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
133 float a = a_arg.float_value ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
134
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
135 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
136 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
137 if (b_arg.is_scalar_type ())
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
138 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
139 float b = b_arg.float_value ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
140
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
141 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
142 retval = betainc (x, a, b);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
143 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
144 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
145 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
146 FloatNDArray b = b_arg.float_array_value ();
3254
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
147
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
148 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
149 retval = betainc (x, a, b);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
150 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
151 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
152 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
153 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
154 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
155 FloatNDArray a = a_arg.float_array_value ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
156
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
157 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
158 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
159 if (b_arg.is_scalar_type ())
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
160 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
161 float b = b_arg.float_value ();
3254
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
162
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
163 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
164 retval = betainc (x, a, b);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
165 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
166 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
167 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
168 FloatNDArray b = b_arg.float_array_value ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
169
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
170 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
171 retval = betainc (x, a, b);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
172 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
173 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
174 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
175 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
176 }
3254
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
177 else
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
178 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
179 if (x_arg.is_scalar_type ())
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
180 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
181 double x = x_arg.double_value ();
3254
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
182
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
183 if (a_arg.is_scalar_type ())
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
184 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
185 double a = a_arg.double_value ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
186
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
187 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
188 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
189 if (b_arg.is_scalar_type ())
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
190 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
191 double b = b_arg.double_value ();
3254
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
192
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
193 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
194 retval = betainc (x, a, b);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
195 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
196 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
197 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
198 NDArray b = b_arg.array_value ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
199
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
200 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
201 retval = betainc (x, a, b);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
202 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
203 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
204 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
205 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
206 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
207 NDArray a = a_arg.array_value ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
208
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
209 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
210 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
211 if (b_arg.is_scalar_type ())
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
212 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
213 double b = b_arg.double_value ();
3254
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
214
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
215 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
216 retval = betainc (x, a, b);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
217 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
218 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
219 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
220 NDArray b = b_arg.array_value ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
221
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
222 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
223 retval = betainc (x, a, b);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
224 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
225 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
226 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
227 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
228 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
229 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
230 NDArray x = x_arg.array_value ();
3254
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
231
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
232 if (a_arg.is_scalar_type ())
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
233 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
234 double a = a_arg.double_value ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
235
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
236 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
237 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
238 if (b_arg.is_scalar_type ())
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
239 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
240 double b = b_arg.double_value ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
241
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
242 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
243 retval = betainc (x, a, b);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
244 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
245 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
246 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
247 NDArray b = b_arg.array_value ();
3254
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
248
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
249 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
250 retval = betainc (x, a, b);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
251 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
252 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
253 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
254 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
255 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
256 NDArray a = a_arg.array_value ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
257
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
258 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
259 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
260 if (b_arg.is_scalar_type ())
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
261 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
262 double b = b_arg.double_value ();
3254
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
263
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
264 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
265 retval = betainc (x, a, b);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
266 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
267 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
268 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
269 NDArray b = b_arg.array_value ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
270
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
271 if (! error_state)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
272 retval = betainc (x, a, b);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
273 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
274 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
275 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
276 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
277 }
3254
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
278 }
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
279 else
5823
080c08b192d8 [project @ 2006-05-19 05:32:17 by jwe]
jwe
parents: 5402
diff changeset
280 print_usage ();
3254
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
281
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
282 return retval;
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
283 }
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
284
28d5f556b8cf [project @ 1999-07-15 16:02:57 by jwe]
jwe
parents:
diff changeset
285 /*
7815
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
286
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
287 %% test/octave.test/arith/betainc-1.m
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
288 %!test
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
289 %! a=[1, 1.5, 2, 3];
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
290 %! b=[4, 3, 2, 1];
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
291 %! v1=betainc(1,a,b);
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
292 %! v2=[1,1,1,1];
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
293 %! x = [.2, .4, .6, .8];
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
294 %! v3=betainc(x, a, b);
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
295 %! v4 = 1-betainc(1.-x, b, a);
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
296 %! assert(v1, v2, sqrt(eps));
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
297 %! assert(v3, v4, sqrt(eps));
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
298
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
299 %% Single precision
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
300 %!test
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
301 %! a=single ([1, 1.5, 2, 3]);
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
302 %! b=single ([4, 3, 2, 1]);
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
303 %! v1=betainc(1,a,b);
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
304 %! v2=single ([1,1,1,1]);
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
305 %! x = single ([.2, .4, .6, .8]);
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
306 %! v3=betainc(x, a, b);
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
307 %! v4 = 1-betainc(1.-x, b, a);
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
308 %! assert(v1, v2, sqrt(eps ('single')));
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
309 %! assert(v3, v4, sqrt(eps ('single')));
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
310
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
311 %% Mixed double/single precision
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
312 %!test
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
313 %! a=single ([1, 1.5, 2, 3]);
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
314 %! b=[4, 3, 2, 1];
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
315 %! v1=betainc(1,a,b);
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
316 %! v2=single ([1,1,1,1]);
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
317 %! x = [.2, .4, .6, .8];
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
318 %! v3=betainc(x, a, b);
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
319 %! v4 = 1-betainc(1.-x, b, a);
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
320 %! assert(v1, v2, sqrt(eps ('single')));
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
321 %! assert(v3, v4, sqrt(eps ('single')));
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
322
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
323 %% test/octave.test/arith/betainc-2.m
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
324 %!error <Invalid call to betainc.*> betainc();
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
325
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
326 %% test/octave.test/arith/betainc-3.m
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
327 %!error <Invalid call to betainc.*> betainc(1);
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
328
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
329 %% test/octave.test/arith/betainc-4.m
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
330 %!error <Invalid call to betainc.*> betainc(1,2);
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
331
a41df65f3f00 Add some single precision test code and fix resulting bugs
David Bateman <dbateman@free.fr>
parents: 7789
diff changeset
332 */