[Pkg-octave-commit] [SCM] octave-symbolic branch, master, updated. 67f86a335f3fb1b8fbc32bcf487585163ac49d07
Rafael Laboissiere
rafael at debian.org
Sat May 23 13:26:07 UTC 2009
The following commit has been merged in the master branch:
commit 67f86a335f3fb1b8fbc32bcf487585163ac49d07
Author: Rafael Laboissiere <rafael at debian.org>
Date: Sat May 23 15:25:34 2009 +0200
Add patch for using cell() instead of the deprecated list()
diff --git a/debian/changelog b/debian/changelog
index ab26820..498eb47 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ octave-symbolic (1.0.8-1) UNRELEASED; urgency=low
* New upstream release
* debian/patches/symfsolve-tests.diff: Add tests to function symfsolve
+ * debian/patches/use-cell-instead-of-list.diff: Use cell() instead of the
+ deprecated list()
* debian/control:
+ (Build-Depends): Add quilt
+ (Standards-Version): Bump to 3.8.1 (no changes needed)
diff --git a/debian/patches/series b/debian/patches/series
index 95a5ed0..5a9c9e3 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
symfsolve-tests.diff
+use-cell-instead-of-list.diff
diff --git a/debian/patches/use-cell-instead-of-list.diff b/debian/patches/use-cell-instead-of-list.diff
new file mode 100644
index 0000000..44f5c43
--- /dev/null
+++ b/debian/patches/use-cell-instead-of-list.diff
@@ -0,0 +1,145 @@
+Use cell() instead of the deprecated list()
+
+The list() function has been deprecated in Octave. The patch below
+replaces all calls to list() in the scripts poly2sym.m, sym2poly.m,
+and symfsolve.m by calls to cell().
+
+Also, add a new test using cell inf function sym2poly.
+
+ -- Rafael Laboissiere <rafael at debian.org> Sat, 23 May 2009 15:20:50 +0200
+
+--- a/inst/poly2sym.m
++++ b/inst/poly2sym.m
+@@ -19,7 +19,7 @@
+ ## @deftypefn {Function File} {} @var{p} = poly2sym (@var{c}, @var{x})
+ ## Creates a symbolic polynomial expression @var{p} with coefficients @var{c}.
+ ## If @var{p} is not specified, the free variable is set to sym("x"). @var{c}
+-## may be a vector or a list/cell-array of symbols. @var{x} may be a symbolic
++## may be a vector or a cell-array of symbols. @var{x} may be a symbolic
+ ## expression or a string.
+ ## The coefficients correspond to decreasing exponent of the free variable.
+ ##
+@@ -28,7 +28,7 @@
+ ## symbols
+ ## x=sym("x"); y=sym("y");
+ ## p = poly2sym ([2,5,-3]); # p = 2*x^2+5*x-3
+-## c = poly2sym (list(2*y,5,-3),x); # p = 2*y*x^2+5*x-3
++## c = poly2sym ({2*y,5,-3},x); # p = 2*y*x^2+5*x-3
+ ## @end example
+ ##
+ ## @end deftypefn
+@@ -45,9 +45,9 @@
+
+ N = length(c);
+
+-if !iscell(c) & !islist(c)
++if !iscell(c)
+ tmp = c;
+- c = list;
++ c = cell;
+ for i=1:N
+ c(i) = tmp(i);
+ endfor
+--- a/inst/sym2poly.m
++++ b/inst/sym2poly.m
+@@ -21,7 +21,7 @@
+ ## as a vector. If there is only one free variable in @var{p} the
+ ## coefficient vector @var{c} is a plain numeric vector. If there is more
+ ## than one free variable in @var{p}, a second argument @var{x} specifies the
+-## free variable and the function returns a list of symbolic expressions.
++## free variable and the function returns a cell vector of symbolic expressions.
+ ## The coefficients correspond to decreasing exponent of the free variable.
+ ##
+ ## Example:
+@@ -29,7 +29,7 @@
+ ## symbols
+ ## x=sym("x"); y=sym("y");
+ ## c = sym2poly (x^2+3*x-4); # c = [1,3,-4]
+-## c = sym2poly (x^2+y*x,x); # c = list(2,y,0)
++## c = sym2poly (x^2+y*x,x); # c = {2,y,0}
+ ## @end example
+ ##
+ ## If @var{p} is not a polynomial the result has no warranty.
+@@ -94,7 +94,7 @@
+ p = expand(p);
+ p_terms = sumterms(p);
+ # if this is well behaved, I can find the coefficients by dividing with x
+-c_ex = list;
++c_ex = cell;
+ for i=1:length(p_terms)
+ tmp = p_terms{i};
+ for j=1:BADPOLY_COEFF_LIMIT
+@@ -146,10 +146,10 @@
+ c = c_ex;
+ endif
+
+-% test examples
++%!shared
++% symbols
++% x=sym("x"); y=sym("y");
+ %!test
+-%! symbols
+-%! x=sym("x"); y=sym("y");
+-%! c = sym2poly (x^2+3*x-4);
+-%! assert(c, [1,3,-4]);
+-
++% assert(sym2poly (x^2+3*x-4), [1,3,-4]);
++%!test
++% assert (sym2poly (x^2+y*x,x), {2,y,0})
+--- a/inst/symfsolve.m
++++ b/inst/symfsolve.m
+@@ -44,7 +44,7 @@
+ ## @end example
+ ##
+ ## The system of equations to solve for can be given as separate arguments or
+-## as a single list/cell-array:
++## as a single cell-array:
+ ##
+ ## @example
+ ## a = symfsolve(@{f,g@},@{y==1,x==2@}); # here y=a(1), x=a(2)
+@@ -52,7 +52,7 @@
+ ##
+ ## If the variables are not specified explicitly with the initial conditions,
+ ## they are placed in alphabetic order. The system of equations can be comma-
+-## separated or given in a list or cell-array. The return-values are those of
++## separated or given in a cell-array. The return-values are those of
+ ## fsolve; @var{x} holds the found roots.
+ ## @end deftypefn
+ ## @seealso{fsolve}
+@@ -65,12 +65,12 @@
+ function [ x,inf,msg ] = symfsolve (varargin)
+
+ #separate variables and equations
+- eqns = list;
+- vars = list;
++ eqns = cell();
++ vars = cell();
+
+- if iscell(varargin{1}) | islist(varargin{1})
++ if iscell(varargin{1})
+ if !strcmp(typeinfo(varargin{1}{1}),"ex")
+- error("First argument must be (a cell-array/list of) symbolic expressions.")
++ error("First argument must be (a cell-array of) symbolic expressions.")
+ endif
+ eqns = varargin{1};
+ arg_count = 1;
+@@ -78,7 +78,7 @@
+ arg_count = 0;
+ for i=1:nargin
+ tmp = disp(varargin{i});
+- if( iscell(varargin{i}) | islist(varargin{i}) | ...
++ if( iscell(varargin{i}) | ...
+ all(isalnum(tmp) | tmp=="_" | tmp==",") | ...
+ !strcmp(typeinfo(varargin{i}),"ex") )
+ break;
+@@ -129,8 +129,8 @@
+ if nvars!=nevars
+ error("The number of initial conditions does not match the number of free variables.")
+ endif
+- if iscell(varargin{arg_count+1}) | islist(varargin{arg_count+1})
+- # List/cell-array of relations - this should work for a list of strings ("x==3") too.
++ if iscell(varargin{arg_count+1})
++ # cell-array of relations - this should work for a list of strings ("x==3") too.
+ for i=1:nvars
+ tmp = disp(varargin{arg_count+1}{i});
+ vars = append(vars,sym(strtok(tmp,"==")));
--
octave-symbolic
More information about the Pkg-octave-commit
mailing list