Mercurial > hg > octave-shane
changeset 13130:d7f74a8bdc46
maint: Periodic merge of stable to default
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Sun, 11 Sep 2011 14:04:43 -0500 |
parents | 155d7a5e70f5 (current diff) d049192e5d15 (diff) |
children | 9207cdd7ff40 |
files | scripts/plot/axis.m scripts/plot/plotyy.m src/graphics.cc src/mkoctfile.cc.in |
diffstat | 12 files changed, 163 insertions(+), 120 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/interpreter/stmt.txi +++ b/doc/interpreter/stmt.txi @@ -580,7 +580,7 @@ @example @group -a = [1,3;2,4]; b = cat(3, a, 2*a); +a = [1,3;2,4]; c = cat(3, a, 2*a); for i = c i endfor
old mode 100644 new mode 100755 --- a/liboctave/randgamma.h +++ b/liboctave/randgamma.h @@ -29,8 +29,8 @@ extern "C" { #endif -extern double oct_randg (double a); -extern void oct_fill_randg (double a, octave_idx_type n, double *p); +extern OCTAVE_API double oct_randg (double a); +extern OCTAVE_API void oct_fill_randg (double a, octave_idx_type n, double *p); #ifdef __cplusplus }
old mode 100644 new mode 100755 --- a/liboctave/randmtzig.h +++ b/liboctave/randmtzig.h @@ -71,21 +71,21 @@ #endif /* === Mersenne Twister === */ -extern void oct_init_by_int (uint32_t s); -extern void oct_init_by_array (uint32_t init_key[], int key_length); -extern void oct_init_by_entropy (void); -extern void oct_set_state (uint32_t save[]); -extern void oct_get_state (uint32_t save[]); +extern OCTAVE_API void oct_init_by_int (uint32_t s); +extern OCTAVE_API void oct_init_by_array (uint32_t init_key[], int key_length); +extern OCTAVE_API void oct_init_by_entropy (void); +extern OCTAVE_API void oct_set_state (uint32_t save[]); +extern OCTAVE_API void oct_get_state (uint32_t save[]); /* === Array generators === */ -extern double oct_randu (void); -extern double oct_randn (void); -extern double oct_rande (void); +extern OCTAVE_API double oct_randu (void); +extern OCTAVE_API double oct_randn (void); +extern OCTAVE_API double oct_rande (void); /* === Array generators === */ -extern void oct_fill_randu (octave_idx_type n, double *p); -extern void oct_fill_randn (octave_idx_type n, double *p); -extern void oct_fill_rande (octave_idx_type n, double *p); +extern OCTAVE_API void oct_fill_randu (octave_idx_type n, double *p); +extern OCTAVE_API void oct_fill_randn (octave_idx_type n, double *p); +extern OCTAVE_API void oct_fill_rande (octave_idx_type n, double *p); #ifdef __cplusplus }
old mode 100644 new mode 100755 --- a/liboctave/randpoisson.h +++ b/liboctave/randpoisson.h @@ -29,8 +29,8 @@ extern "C" { #endif -extern double oct_randp (double L); -extern void oct_fill_randp (double L, octave_idx_type n, double *p); +extern OCTAVE_API double oct_randp (double L); +extern OCTAVE_API void oct_fill_randp (double L, octave_idx_type n, double *p); #ifdef __cplusplus }
--- a/scripts/plot/axis.m +++ b/scripts/plot/axis.m @@ -277,8 +277,8 @@ endif for i = 1:2:len - if (ax(i) == ax(i+1)) - error ("axis: limits(%d) cannot equal limits(%d)", i, i+1); + if (ax(i) >= ax(i+1)) + error ("axis: limits(%d) must be less than limits(%d)", i, i+1); endif endfor
--- a/scripts/plot/plotyy.m +++ b/scripts/plot/plotyy.m @@ -70,6 +70,7 @@ else error ("plotyy: expecting first argument to be axes handle"); endif + oldh = gca (); else f = get (0, "currentfigure"); if (isempty (f)) @@ -93,17 +94,18 @@ elseif (isempty (ax)) ax(1) = axes (); ax(2) = axes (); + ca = ax(2); endif if (nargin < 2) varargin = {}; endif + oldh = ca; endif if (nargin < 4) print_usage (); endif - oldh = gca (); unwind_protect [ax, h1, h2] = __plotyy__ (ax, varargin{:}); unwind_protect_cleanup @@ -257,6 +259,15 @@ %! plotyy (x, 10*sin(2*pi*x), x, cos(2*pi*x)) %! axis square +%!demo +%! clf +%! x = linspace (-1, 1, 201); +%! subplot (1, 1, 1); +%! hax = plotyy (x, sin(pi*x), x, cos(pi*x)); +%! ylabel ("Blue and on the Left") +%! ylabel (hax(2), "Green and on the Right") +%! xlabel ("xlabel") + function deleteplotyy (h, d, ax2, t2) if (ishandle (ax2) && strcmp (get (ax2, "type"), "axes") && (isempty (gcbf()) || strcmp (get (gcbf(), "beingdeleted"),"off"))
--- a/scripts/plot/private/__axes_limits__.m +++ b/scripts/plot/private/__axes_limits__.m @@ -44,7 +44,11 @@ if (!isnumeric (arg) && any (size(arg(:)) != [2, 1])) error ("%s: argument must be a 2 element vector", fcn); else - set (h, fcn, arg(:)); + if (arg(1) >= arg(2)) + error ("%s: axis limits must be increasing", fcn) + else + set (h, fcn, arg(:)); + endif endif endif endif
--- a/scripts/polynomial/residue.m +++ b/scripts/polynomial/residue.m @@ -19,8 +19,10 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {[@var{r}, @var{p}, @var{k}, @var{e}] =} residue (@var{b}, @var{a}) -## Compute the partial fraction expansion for the quotient of the -## polynomials, @var{b} and @var{a}. +## @deftypefnx {Function File} {[@var{b}, @var{a}] =} residue (@var{r}, @var{p}, @var{k}) +## @deftypefnx {Function File} {[@var{b}, @var{a}] =} residue (@var{r}, @var{p}, @var{k}, @var{e}) +## The first calling form computes the partial fraction expansion for the +## quotient of the polynomials, @var{b} and @var{a}. ## @tex ## $$ ## {B(s)\over A(s)} = \sum_{m=1}^M {r_m\over (s-p_m)^e_m} @@ -77,12 +79,11 @@ ## ## @end ifnottex ## -## @deftypefnx {Function File} {[@var{b}, @var{a}] =} residue (@var{r}, @var{p}, @var{k}) -## @deftypefnx {Function File} {[@var{b}, @var{a}] =} residue (@var{r}, @var{p}, @var{k}, @var{e}) -## Compute the reconstituted quotient of polynomials, -## @var{b}(s)/@var{a}(s), from the partial fraction expansion; -## represented by the residues, poles, and a direct polynomial specified -## by @var{r}, @var{p} and @var{k}, and the pole multiplicity @var{e}. +## The second calling form performs the inverse operation and computes +## the reconstituted quotient of polynomials, @var{b}(s)/@var{a}(s), +## from the partial fraction expansion; represented by the residues, +## poles, and a direct polynomial specified by @var{r}, @var{p} and +## @var{k}, and the pole multiplicity @var{e}. ## ## If the multiplicity, @var{e}, is not explicitly specified the multiplicity is ## determined by the function @code{mpoles}. @@ -409,3 +410,22 @@ %! [br, ar] = residue (r, p, k); %! assert ((abs (br - b) < 1e-12 %! && abs (ar - a) < 1e-12)); + +## The following test is due to Bernard Grung (bug #34266) +%!xtest +%! z1 = 7.0372976777e6; +%! p1 = -3.1415926536e9; +%! p2 = -4.9964813512e8; +%! r1 = -(1 + z1/p1)/(1 - p1/p2)/p2/p1; +%! r2 = -(1 + z1/p2)/(1 - p2/p1)/p2/p1; +%! r3 = (1 + (p2 + p1)/p2/p1*z1)/p2/p1; +%! r4 = z1/p2/p1; +%! r = [r1; r2; r3; r4]; +%! p = [p1; p2; 0; 0]; +%! k = []; +%! e = [1; 1; 1; 2]; +%! b = [1, z1]; +%! a = [1, -(p1 + p2), p1*p2, 0, 0]; +%! [br, ar] = residue (r, p, k, e); +%! assert (br, b, 1e-8); +%! assert (ar, a, 1e-8);
--- a/scripts/strings/str2num.m +++ b/scripts/strings/str2num.m @@ -24,24 +24,24 @@ ## ## @example ## @group -## str2num("3.141596") -## @result{} 3.141596 +## str2num ("3.141596") +## @result{} 3.141596 ## -## str2num(["1, 2, 3"; "4, 5, 6"]); -## @result{} ans = -## 1 2 3 -## 4 5 6 +## str2num (["1, 2, 3"; "4, 5, 6"]); +## @result{} ans = +## 1 2 3 +## 4 5 6 ## @end group ## @end example ## ## The optional second output, @var{state}, is logically true when the ## coversion is successful. If the conversion fails the numeric output, -## @var{n}, is empty and @var{state} is false. +## @var{x}, is empty and @var{state} is false. ## ## @strong{Caution:} As @code{str2num} uses the @code{eval} function ## to do the conversion, @code{str2num} will execute any code contained -## in the string @var{s}. Use @code{str2double} instead if you want to -## avoid the use of @code{eval}. +## in the string @var{s}. Use @code{str2double} for a safer and faster +## conversion. ## @seealso{str2double, eval} ## @end deftypefn
--- a/src/graphics.cc +++ b/src/graphics.cc @@ -5263,6 +5263,14 @@ double tick_sep = calc_tick_sep (lo , hi); + if (is_logscale && ! (xisinf (hi) || xisinf (lo))) + { + // FIXME - what if (hi-lo) < tick_sep? + // ex: loglog ([1 1.1]) + tick_sep = std::max (tick_sep, 1.); + tick_sep = std::ceil (tick_sep); + } + int i1 = static_cast<int> (gnulib::floor (lo / tick_sep)); int i2 = static_cast<int> (std::ceil (hi / tick_sep));
old mode 100644 new mode 100755 --- a/src/xpow.h +++ b/src/xpow.h @@ -41,118 +41,118 @@ class octave_value; class Range; -extern octave_value xpow (double a, double b); -extern octave_value xpow (double a, const Matrix& b); -extern octave_value xpow (double a, const Complex& b); -extern octave_value xpow (double a, const ComplexMatrix& b); +extern OCTINTERP_API octave_value xpow (double a, double b); +extern OCTINTERP_API octave_value xpow (double a, const Matrix& b); +extern OCTINTERP_API octave_value xpow (double a, const Complex& b); +extern OCTINTERP_API octave_value xpow (double a, const ComplexMatrix& b); -extern octave_value xpow (const Matrix& a, double b); -extern octave_value xpow (const Matrix& a, const Complex& b); +extern OCTINTERP_API octave_value xpow (const Matrix& a, double b); +extern OCTINTERP_API octave_value xpow (const Matrix& a, const Complex& b); -extern octave_value xpow (const DiagMatrix& a, double b); -extern octave_value xpow (const DiagMatrix& a, const Complex& b); +extern OCTINTERP_API octave_value xpow (const DiagMatrix& a, double b); +extern OCTINTERP_API octave_value xpow (const DiagMatrix& a, const Complex& b); -extern octave_value xpow (const PermMatrix& a, double b); +extern OCTINTERP_API octave_value xpow (const PermMatrix& a, double b); -extern octave_value xpow (const Complex& a, double b); -extern octave_value xpow (const Complex& a, const Matrix& b); -extern octave_value xpow (const Complex& a, const Complex& b); -extern octave_value xpow (const Complex& a, const ComplexMatrix& b); +extern OCTINTERP_API octave_value xpow (const Complex& a, double b); +extern OCTINTERP_API octave_value xpow (const Complex& a, const Matrix& b); +extern OCTINTERP_API octave_value xpow (const Complex& a, const Complex& b); +extern OCTINTERP_API octave_value xpow (const Complex& a, const ComplexMatrix& b); -extern octave_value xpow (const ComplexMatrix& a, double b); -extern octave_value xpow (const ComplexMatrix& a, const Complex& b); +extern OCTINTERP_API octave_value xpow (const ComplexMatrix& a, double b); +extern OCTINTERP_API octave_value xpow (const ComplexMatrix& a, const Complex& b); -extern octave_value xpow (const ComplexDiagMatrix& a, double b); -extern octave_value xpow (const ComplexDiagMatrix& a, const Complex& b); +extern OCTINTERP_API octave_value xpow (const ComplexDiagMatrix& a, double b); +extern OCTINTERP_API octave_value xpow (const ComplexDiagMatrix& a, const Complex& b); -extern octave_value elem_xpow (double a, const Matrix& b); -extern octave_value elem_xpow (double a, const ComplexMatrix& b); -extern octave_value elem_xpow (double a, const Range& r); +extern OCTINTERP_API octave_value elem_xpow (double a, const Matrix& b); +extern OCTINTERP_API octave_value elem_xpow (double a, const ComplexMatrix& b); +extern OCTINTERP_API octave_value elem_xpow (double a, const Range& r); -extern octave_value elem_xpow (const Matrix& a, double b); -extern octave_value elem_xpow (const Matrix& a, const Matrix& b); -extern octave_value elem_xpow (const Matrix& a, const Complex& b); -extern octave_value elem_xpow (const Matrix& a, const ComplexMatrix& b); +extern OCTINTERP_API octave_value elem_xpow (const Matrix& a, double b); +extern OCTINTERP_API octave_value elem_xpow (const Matrix& a, const Matrix& b); +extern OCTINTERP_API octave_value elem_xpow (const Matrix& a, const Complex& b); +extern OCTINTERP_API octave_value elem_xpow (const Matrix& a, const ComplexMatrix& b); -extern octave_value elem_xpow (const Complex& a, const Matrix& b); -extern octave_value elem_xpow (const Complex& a, const ComplexMatrix& b); -extern octave_value elem_xpow (const Complex& a, const Range& r); +extern OCTINTERP_API octave_value elem_xpow (const Complex& a, const Matrix& b); +extern OCTINTERP_API octave_value elem_xpow (const Complex& a, const ComplexMatrix& b); +extern OCTINTERP_API octave_value elem_xpow (const Complex& a, const Range& r); -extern octave_value elem_xpow (const ComplexMatrix& a, double b); -extern octave_value elem_xpow (const ComplexMatrix& a, const Matrix& b); -extern octave_value elem_xpow (const ComplexMatrix& a, const Complex& b); -extern octave_value elem_xpow (const ComplexMatrix& a, const ComplexMatrix& b); +extern OCTINTERP_API octave_value elem_xpow (const ComplexMatrix& a, double b); +extern OCTINTERP_API octave_value elem_xpow (const ComplexMatrix& a, const Matrix& b); +extern OCTINTERP_API octave_value elem_xpow (const ComplexMatrix& a, const Complex& b); +extern OCTINTERP_API octave_value elem_xpow (const ComplexMatrix& a, const ComplexMatrix& b); -extern octave_value elem_xpow (double a, const NDArray& b); -extern octave_value elem_xpow (double a, const ComplexNDArray& b); +extern OCTINTERP_API octave_value elem_xpow (double a, const NDArray& b); +extern OCTINTERP_API octave_value elem_xpow (double a, const ComplexNDArray& b); -extern octave_value elem_xpow (const NDArray& a, double b); -extern octave_value elem_xpow (const NDArray& a, const NDArray& b); -extern octave_value elem_xpow (const NDArray& a, const Complex& b); -extern octave_value elem_xpow (const NDArray& a, const ComplexNDArray& b); +extern OCTINTERP_API octave_value elem_xpow (const NDArray& a, double b); +extern OCTINTERP_API octave_value elem_xpow (const NDArray& a, const NDArray& b); +extern OCTINTERP_API octave_value elem_xpow (const NDArray& a, const Complex& b); +extern OCTINTERP_API octave_value elem_xpow (const NDArray& a, const ComplexNDArray& b); -extern octave_value elem_xpow (const Complex& a, const NDArray& b); -extern octave_value elem_xpow (const Complex& a, const ComplexNDArray& b); +extern OCTINTERP_API octave_value elem_xpow (const Complex& a, const NDArray& b); +extern OCTINTERP_API octave_value elem_xpow (const Complex& a, const ComplexNDArray& b); -extern octave_value elem_xpow (const ComplexNDArray& a, double b); -extern octave_value elem_xpow (const ComplexNDArray& a, const NDArray& b); -extern octave_value elem_xpow (const ComplexNDArray& a, const Complex& b); -extern octave_value elem_xpow (const ComplexNDArray& a, const ComplexNDArray& b); +extern OCTINTERP_API octave_value elem_xpow (const ComplexNDArray& a, double b); +extern OCTINTERP_API octave_value elem_xpow (const ComplexNDArray& a, const NDArray& b); +extern OCTINTERP_API octave_value elem_xpow (const ComplexNDArray& a, const Complex& b); +extern OCTINTERP_API octave_value elem_xpow (const ComplexNDArray& a, const ComplexNDArray& b); -extern octave_value xpow (float a, float b); -extern octave_value xpow (float a, const FloatMatrix& b); -extern octave_value xpow (float a, const FloatComplex& b); -extern octave_value xpow (float a, const FloatComplexMatrix& b); +extern OCTINTERP_API octave_value xpow (float a, float b); +extern OCTINTERP_API octave_value xpow (float a, const FloatMatrix& b); +extern OCTINTERP_API octave_value xpow (float a, const FloatComplex& b); +extern OCTINTERP_API octave_value xpow (float a, const FloatComplexMatrix& b); -extern octave_value xpow (const FloatMatrix& a, float b); -extern octave_value xpow (const FloatMatrix& a, const FloatComplex& b); +extern OCTINTERP_API octave_value xpow (const FloatMatrix& a, float b); +extern OCTINTERP_API octave_value xpow (const FloatMatrix& a, const FloatComplex& b); -extern octave_value xpow (const FloatDiagMatrix& a, float b); -extern octave_value xpow (const FloatDiagMatrix& a, const FloatComplex& b); +extern OCTINTERP_API octave_value xpow (const FloatDiagMatrix& a, float b); +extern OCTINTERP_API octave_value xpow (const FloatDiagMatrix& a, const FloatComplex& b); -extern octave_value xpow (const FloatComplex& a, float b); -extern octave_value xpow (const FloatComplex& a, const FloatMatrix& b); -extern octave_value xpow (const FloatComplex& a, const FloatComplex& b); -extern octave_value xpow (const FloatComplex& a, const FloatComplexMatrix& b); +extern OCTINTERP_API octave_value xpow (const FloatComplex& a, float b); +extern OCTINTERP_API octave_value xpow (const FloatComplex& a, const FloatMatrix& b); +extern OCTINTERP_API octave_value xpow (const FloatComplex& a, const FloatComplex& b); +extern OCTINTERP_API octave_value xpow (const FloatComplex& a, const FloatComplexMatrix& b); -extern octave_value xpow (const FloatComplexMatrix& a, float b); -extern octave_value xpow (const FloatComplexMatrix& a, const FloatComplex& b); +extern OCTINTERP_API octave_value xpow (const FloatComplexMatrix& a, float b); +extern OCTINTERP_API octave_value xpow (const FloatComplexMatrix& a, const FloatComplex& b); -extern octave_value xpow (const FloatComplexDiagMatrix& a, float b); -extern octave_value xpow (const FloatComplexDiagMatrix& a, const FloatComplex& b); +extern OCTINTERP_API octave_value xpow (const FloatComplexDiagMatrix& a, float b); +extern OCTINTERP_API octave_value xpow (const FloatComplexDiagMatrix& a, const FloatComplex& b); -extern octave_value elem_xpow (float a, const FloatMatrix& b); -extern octave_value elem_xpow (float a, const FloatComplexMatrix& b); +extern OCTINTERP_API octave_value elem_xpow (float a, const FloatMatrix& b); +extern OCTINTERP_API octave_value elem_xpow (float a, const FloatComplexMatrix& b); -extern octave_value elem_xpow (const FloatMatrix& a, float b); -extern octave_value elem_xpow (const FloatMatrix& a, const FloatMatrix& b); -extern octave_value elem_xpow (const FloatMatrix& a, const FloatComplex& b); -extern octave_value elem_xpow (const FloatMatrix& a, const FloatComplexMatrix& b); +extern OCTINTERP_API octave_value elem_xpow (const FloatMatrix& a, float b); +extern OCTINTERP_API octave_value elem_xpow (const FloatMatrix& a, const FloatMatrix& b); +extern OCTINTERP_API octave_value elem_xpow (const FloatMatrix& a, const FloatComplex& b); +extern OCTINTERP_API octave_value elem_xpow (const FloatMatrix& a, const FloatComplexMatrix& b); -extern octave_value elem_xpow (const FloatComplex& a, const FloatMatrix& b); -extern octave_value elem_xpow (const FloatComplex& a, const FloatComplexMatrix& b); +extern OCTINTERP_API octave_value elem_xpow (const FloatComplex& a, const FloatMatrix& b); +extern OCTINTERP_API octave_value elem_xpow (const FloatComplex& a, const FloatComplexMatrix& b); -extern octave_value elem_xpow (const FloatComplexMatrix& a, float b); -extern octave_value elem_xpow (const FloatComplexMatrix& a, const FloatMatrix& b); -extern octave_value elem_xpow (const FloatComplexMatrix& a, const FloatComplex& b); -extern octave_value elem_xpow (const FloatComplexMatrix& a, const FloatComplexMatrix& b); +extern OCTINTERP_API octave_value elem_xpow (const FloatComplexMatrix& a, float b); +extern OCTINTERP_API octave_value elem_xpow (const FloatComplexMatrix& a, const FloatMatrix& b); +extern OCTINTERP_API octave_value elem_xpow (const FloatComplexMatrix& a, const FloatComplex& b); +extern OCTINTERP_API octave_value elem_xpow (const FloatComplexMatrix& a, const FloatComplexMatrix& b); -extern octave_value elem_xpow (float a, const FloatNDArray& b); -extern octave_value elem_xpow (float a, const FloatComplexNDArray& b); +extern OCTINTERP_API octave_value elem_xpow (float a, const FloatNDArray& b); +extern OCTINTERP_API octave_value elem_xpow (float a, const FloatComplexNDArray& b); -extern octave_value elem_xpow (const FloatNDArray& a, float b); -extern octave_value elem_xpow (const FloatNDArray& a, const FloatNDArray& b); -extern octave_value elem_xpow (const FloatNDArray& a, const FloatComplex& b); -extern octave_value elem_xpow (const FloatNDArray& a, const FloatComplexNDArray& b); +extern OCTINTERP_API octave_value elem_xpow (const FloatNDArray& a, float b); +extern OCTINTERP_API octave_value elem_xpow (const FloatNDArray& a, const FloatNDArray& b); +extern OCTINTERP_API octave_value elem_xpow (const FloatNDArray& a, const FloatComplex& b); +extern OCTINTERP_API octave_value elem_xpow (const FloatNDArray& a, const FloatComplexNDArray& b); -extern octave_value elem_xpow (const FloatComplex& a, const FloatNDArray& b); -extern octave_value elem_xpow (const FloatComplex& a, const FloatComplexNDArray& b); +extern OCTINTERP_API octave_value elem_xpow (const FloatComplex& a, const FloatNDArray& b); +extern OCTINTERP_API octave_value elem_xpow (const FloatComplex& a, const FloatComplexNDArray& b); -extern octave_value elem_xpow (const FloatComplexNDArray& a, float b); -extern octave_value elem_xpow (const FloatComplexNDArray& a, const FloatNDArray& b); -extern octave_value elem_xpow (const FloatComplexNDArray& a, const FloatComplex& b); -extern octave_value elem_xpow (const FloatComplexNDArray& a, const FloatComplexNDArray& b); +extern OCTINTERP_API octave_value elem_xpow (const FloatComplexNDArray& a, float b); +extern OCTINTERP_API octave_value elem_xpow (const FloatComplexNDArray& a, const FloatNDArray& b); +extern OCTINTERP_API octave_value elem_xpow (const FloatComplexNDArray& a, const FloatComplex& b); +extern OCTINTERP_API octave_value elem_xpow (const FloatComplexNDArray& a, const FloatComplexNDArray& b); #endif