annotate scripts/polynomial/ppder.m @ 11587:c792872f8942

all script files: untabify and strip trailing whitespace
author John W. Eaton <jwe@octave.org>
date Thu, 20 Jan 2011 17:35:29 -0500
parents 702dbd0c53f5
children d0b799dafede
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 11472
diff changeset
1 ## Copyright (C) 2008-2011 VZLU Prague, a.s., Czech Republic
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11536
diff changeset
2 ##
9976
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
3 ## This file is part of Octave.
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11536
diff changeset
4 ##
9976
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
6 ## it under the terms of the GNU General Public License as published by
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
8 ## (at your option) any later version.
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11536
diff changeset
9 ##
9976
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
10 ## This program is distributed in the hope that it will be useful,
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
13 ## GNU General Public License for more details.
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11536
diff changeset
14 ##
9976
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
16 ## along with this software; see the file COPYING. If not, see
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
18
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
19 ## -*- texinfo -*-
11472
1740012184f9 Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
20 ## @deftypefn {Function File} {@var{ppd} =} ppder (@var{pp})
11536
702dbd0c53f5 Add undocumented ppder, ppint, ppjumps functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
21 ## Compute the piecewise derivative of the piecewise polynomial struct @var{pp}.
702dbd0c53f5 Add undocumented ppder, ppint, ppjumps functions to documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
22 ## @seealso{mkpp,ppval,ppint}
9976
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
23 ## @end deftypefn
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
24
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
25 function ppd = ppder (pp)
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
26 if (nargin != 1)
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
27 print_usage ();
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
28 endif
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
29 if (! isstruct (pp))
11472
1740012184f9 Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
30 error ("ppder: PP must be a structure");
9976
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
31 endif
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
32
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
33 [x, p, n, k, d] = unmkpp (pp);
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
34 p = reshape (p, [], k);
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
35 if (k <= 1)
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
36 pd = zeros (rows (p), 1);
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
37 k = 1;
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
38 else
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
39 k -= 1;
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
40 pd = p(:,1:k) * diag (k:-1:1);
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
41 endif
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
42 ppd = mkpp (x, pd, d);
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
43 endfunction
702b998698ea implement ppder, ppint, ppjmups
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
44