annotate scripts/deprecated/cor.m @ 17398:4bcd301754ce

Add Matlab-compatible flintmax function * bitfcns.cc (Fflintmax): New function based on bitmax. (Fbitmax, Fintmax, Fintmin): Update seealso to refer to flintmax. * numbers.txi: Include flintmax docstring.
author Mike Miller <mtmiller@ieee.org>
date Sun, 08 Sep 2013 17:28:05 -0400
parents 72c96de7a403
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 12856
diff changeset
1 ## Copyright (C) 1995-2012 Kurt Hornik
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3200
diff changeset
2 ##
3922
38c61cbf086c [project @ 2002-05-01 06:48:35 by jwe]
jwe
parents: 3456
diff changeset
3 ## This file is part of Octave.
38c61cbf086c [project @ 2002-05-01 06:48:35 by jwe]
jwe
parents: 3456
diff changeset
4 ##
38c61cbf086c [project @ 2002-05-01 06:48:35 by jwe]
jwe
parents: 3456
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
38c61cbf086c [project @ 2002-05-01 06:48:35 by jwe]
jwe
parents: 3456
diff changeset
6 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6754
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6754
diff changeset
8 ## your option) any later version.
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3200
diff changeset
9 ##
3922
38c61cbf086c [project @ 2002-05-01 06:48:35 by jwe]
jwe
parents: 3456
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3200
diff changeset
13 ## General Public License for more details.
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3200
diff changeset
14 ##
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
15 ## 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: 6754
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6754
diff changeset
17 ## <http://www.gnu.org/licenses/>.
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
18
3453
71d2e09c15a2 [project @ 2000-01-18 08:32:09 by jwe]
jwe
parents: 3426
diff changeset
19 ## -*- texinfo -*-
11436
e151e23f73bc Overhaul base statistics functions and documentation of same.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
20 ## @deftypefn {Function File} {} cor (@var{x})
e151e23f73bc Overhaul base statistics functions and documentation of same.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
21 ## @deftypefnx {Function File} {} cor (@var{x}, @var{y})
e151e23f73bc Overhaul base statistics functions and documentation of same.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
22 ## Compute matrix of correlation coefficients.
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
23 ##
11436
e151e23f73bc Overhaul base statistics functions and documentation of same.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
24 ## This is an alias for @code{corrcoef}.
e151e23f73bc Overhaul base statistics functions and documentation of same.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
25 ## @seealso{corrcoef}
3453
71d2e09c15a2 [project @ 2000-01-18 08:32:09 by jwe]
jwe
parents: 3426
diff changeset
26 ## @end deftypefn
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
27
12555
422a7a7e9b6e cor.m: fix operation with only single input (bug #32961)
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
28 function retval = cor (x, y = x)
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
29
12856
cad4cba03f19 Deprecate corrcoef, cor and replace with Matlab equivalent corr
Rik <octave@nomad.inbox5.com>
parents: 12656
diff changeset
30 persistent warned = false;
cad4cba03f19 Deprecate corrcoef, cor and replace with Matlab equivalent corr
Rik <octave@nomad.inbox5.com>
parents: 12656
diff changeset
31 if (! warned)
cad4cba03f19 Deprecate corrcoef, cor and replace with Matlab equivalent corr
Rik <octave@nomad.inbox5.com>
parents: 12656
diff changeset
32 warned = true;
cad4cba03f19 Deprecate corrcoef, cor and replace with Matlab equivalent corr
Rik <octave@nomad.inbox5.com>
parents: 12656
diff changeset
33 warning ("Octave:deprecated-function",
cad4cba03f19 Deprecate corrcoef, cor and replace with Matlab equivalent corr
Rik <octave@nomad.inbox5.com>
parents: 12656
diff changeset
34 "cor is obsolete and will be removed from a future version of Octave; please use corr instead");
cad4cba03f19 Deprecate corrcoef, cor and replace with Matlab equivalent corr
Rik <octave@nomad.inbox5.com>
parents: 12656
diff changeset
35 endif
cad4cba03f19 Deprecate corrcoef, cor and replace with Matlab equivalent corr
Rik <octave@nomad.inbox5.com>
parents: 12656
diff changeset
36
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
37 if (nargin < 1 || nargin > 2)
6046
34f96dd5441b [project @ 2006-10-10 16:10:25 by jwe]
jwe
parents: 5428
diff changeset
38 print_usage ();
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
39 endif
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
40
11436
e151e23f73bc Overhaul base statistics functions and documentation of same.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
41 retval = corrcoef (x, y);
3200
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
42
781c930425fd [project @ 1998-10-29 05:23:08 by jwe]
jwe
parents:
diff changeset
43 endfunction
11436
e151e23f73bc Overhaul base statistics functions and documentation of same.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
44
12656
6b2f14af2360 Overhaul functions in statistics/base directory.
Rik <octave@nomad.inbox5.com>
parents: 12557
diff changeset
45
12555
422a7a7e9b6e cor.m: fix operation with only single input (bug #32961)
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
46 %!test
422a7a7e9b6e cor.m: fix operation with only single input (bug #32961)
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
47 %! x = rand (10, 2);
12557
4715ce9f911d cor.m: Increase tolerance of %!tests using random data to assure passage.
Rik <octave@nomad.inbox5.com>
parents: 12555
diff changeset
48 %! assert (cor (x), corrcoef (x), 5*eps);
12555
422a7a7e9b6e cor.m: fix operation with only single input (bug #32961)
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
49 %! assert (cor (x(:,1), x(:,2)) == corrcoef (x(:,1), x(:,2)));
422a7a7e9b6e cor.m: fix operation with only single input (bug #32961)
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
50
422a7a7e9b6e cor.m: fix operation with only single input (bug #32961)
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
51 %% Test input validation
422a7a7e9b6e cor.m: fix operation with only single input (bug #32961)
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
52 %!error corrcoef ();
422a7a7e9b6e cor.m: fix operation with only single input (bug #32961)
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
53 %!error corrcoef (1, 2, 3);
422a7a7e9b6e cor.m: fix operation with only single input (bug #32961)
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
54