annotate src/DLD-FUNCTIONS/__pchip_deriv__.cc @ 14846:460a3c6d8bf1

maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists. Example: func() => func () * dynamic.txi, func.txi, oop.txi, var.txi, embedded.cc, fortdemo.cc, funcdemo.cc, paramdemo.cc, stringdemo.cc, unwinddemo.cc, Array.cc, Array.h, CColVector.cc, CDiagMatrix.h, CMatrix.cc, CNDArray.cc, CRowVector.cc, CSparse.cc, CmplxGEPBAL.cc, EIG.cc, MSparse.cc, MatrixType.cc, Sparse-op-defs.h, Sparse-perm-op-defs.h, Sparse.cc, Sparse.h, SparseCmplxCHOL.cc, SparseCmplxCHOL.h, SparseCmplxLU.cc, SparseCmplxQR.cc, SparseCmplxQR.h, SparseQR.cc, SparseQR.h, SparsedbleCHOL.cc, SparsedbleCHOL.h, SparsedbleLU.cc, SparsedbleLU.h, base-lu.cc, cmd-hist.cc, dColVector.cc, dDiagMatrix.h, dMatrix.cc, dNDArray.cc, dRowVector.cc, dSparse.cc, dbleCHOL.cc, dbleGEPBAL.cc, dim-vector.cc, eigs-base.cc, f2c-main.c, fCColVector.cc, fCDiagMatrix.h, fCMatrix.cc, fCNDArray.cc, fCRowVector.cc, fCmplxGEPBAL.cc, fColVector.cc, fDiagMatrix.h, fEIG.cc, fMatrix.cc, fNDArray.cc, fRowVector.cc, file-ops.cc, file-stat.cc, floatCHOL.cc, floatGEPBAL.cc, idx-vector.h, lo-specfun.cc, lo-sysdep.cc, mx-inlines.cc, oct-binmap.h, oct-convn.cc, oct-md5.cc, oct-mem.h, oct-rand.cc, oct-syscalls.cc, randgamma.c, randmtzig.c, sparse-base-chol.cc, sparse-base-chol.h, sparse-base-lu.cc, sparse-dmsolve.cc, tempname.c, curl.m, divergence.m, randi.m, dlmwrite.m, edit.m, getappdata.m, what.m, getarchdir.m, install.m, installed_packages.m, repackage.m, unload_packages.m, colorbar.m, figure.m, isosurface.m, legend.m, loglog.m, plot.m, plot3.m, plotyy.m, polar.m, __errplot__.m, __ghostscript__.m, __marching_cube__.m, __plt__.m, __scatter__.m, semilogx.m, semilogy.m, trimesh.m, trisurf.m, demo.m, test.m, datetick.m, __delaunayn__.cc, __dsearchn__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc, __lin_interpn__.cc, __magick_read__.cc, __pchip_deriv__.cc, balance.cc, bsxfun.cc, ccolamd.cc, cellfun.cc, chol.cc, daspk.cc, dasrt.cc, dassl.cc, dmperm.cc, eig.cc, eigs.cc, fftw.cc, filter.cc, find.cc, kron.cc, lookup.cc, lsode.cc, matrix_type.cc, md5sum.cc, mgorth.cc, qr.cc, quad.cc, rand.cc, regexp.cc, symbfact.cc, tril.cc, urlwrite.cc, op-bm-bm.cc, op-cdm-cdm.cc, op-cell.cc, op-chm.cc, op-cm-cm.cc, op-cm-scm.cc, op-cm-sm.cc, op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc, op-fcdm-fcdm.cc, op-fcm-fcm.cc, op-fdm-fdm.cc, op-fm-fm.cc, op-int.h, op-m-m.cc, op-m-scm.cc, op-m-sm.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-range.cc, op-s-scm.cc, op-s-sm.cc, op-sbm-sbm.cc, op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc, op-str-str.cc, op-struct.cc, bitfcns.cc, data.cc, debug.cc, dynamic-ld.cc, error.cc, gl-render.cc, graphics.cc, graphics.in.h, load-path.cc, ls-hdf5.cc, ls-mat5.cc, ls-mat5.h, ls-oct-ascii.cc, ls-oct-ascii.h, mex.cc, mk-errno-list, oct-map.cc, oct-obj.h, oct-parse.yy, octave-config.in.cc, ov-base-int.cc, ov-base-mat.cc, ov-base.cc, ov-bool-mat.cc, ov-bool-sparse.cc, ov-bool.cc, ov-cell.cc, ov-class.cc, ov-class.h, ov-cx-mat.cc, ov-cx-sparse.cc, ov-fcn-handle.cc, ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-intx.h, ov-range.h, ov-re-mat.cc, ov-re-sparse.cc, ov-str-mat.cc, ov-struct.cc, ov-usr-fcn.h, ov.h, pr-output.cc, pt-id.cc, pt-id.h, pt-mat.cc, pt-select.cc, sparse.cc, symtab.cc, symtab.h, syscalls.cc, toplev.cc, txt-eng-ft.cc, variables.cc, zfstream.cc, zfstream.h, Dork.m, getStash.m, myStash.m, Gork.m, Pork.m, myStash.m, getStash.m, myStash.m, getStash.m, myStash.m, fntests.m: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
author Rik <octave@nomad.inbox5.com>
date Sun, 08 Jul 2012 11:28:50 -0700
parents 60e5cf354d80
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
1 /*
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
2
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 12805
diff changeset
3 Copyright (C) 2002-2012 Kai Habel
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 11518
diff changeset
4 Copyright (C) 2008-2009 Jaroslav Hajek
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
5
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
7
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
9 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: 6945
diff changeset
10 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
11 option) any later version.
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
12
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
13 Octave is distributed in the hope that it will be useful, but WITHOUT
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
16 for more details.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
17
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
18 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: 6945
diff changeset
19 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
20 <http://www.gnu.org/licenses/>.
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
21
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
22 */
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
23
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
24 #ifdef HAVE_CONFIG_H
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
25 #include <config.h>
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
26 #endif
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
27
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
28 #include "defun-dld.h"
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
29 #include "error.h"
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
30 #include "gripes.h"
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
31 #include "oct-obj.h"
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
32 #include "utils.h"
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
33 #include "f77-fcn.h"
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
34
5838
376e02b2ce70 [project @ 2006-06-01 20:23:53 by jwe]
jwe
parents: 5837
diff changeset
35 extern "C"
376e02b2ce70 [project @ 2006-06-01 20:23:53 by jwe]
jwe
parents: 5837
diff changeset
36 {
6242
64bad7c6a607 [project @ 2007-01-16 07:03:51 by jwe]
jwe
parents: 5838
diff changeset
37 F77_RET_T
11518
141b3fb5cef7 style fixes
John W. Eaton <jwe@octave.org>
parents: 10154
diff changeset
38 F77_FUNC (dpchim, DPCHIM) (const octave_idx_type& n, const double *x,
141b3fb5cef7 style fixes
John W. Eaton <jwe@octave.org>
parents: 10154
diff changeset
39 const double *f, double *d,
141b3fb5cef7 style fixes
John W. Eaton <jwe@octave.org>
parents: 10154
diff changeset
40 const octave_idx_type &incfd,
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
41 octave_idx_type *ierr);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
42
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
43 F77_RET_T
11518
141b3fb5cef7 style fixes
John W. Eaton <jwe@octave.org>
parents: 10154
diff changeset
44 F77_FUNC (pchim, PCHIM) (const octave_idx_type& n, const float *x,
141b3fb5cef7 style fixes
John W. Eaton <jwe@octave.org>
parents: 10154
diff changeset
45 const float *f, float *d,
141b3fb5cef7 style fixes
John W. Eaton <jwe@octave.org>
parents: 10154
diff changeset
46 const octave_idx_type& incfd,
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
47 octave_idx_type *ierr);
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
48 }
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
49
6945
6bbf56a9718a [project @ 2007-10-02 20:47:22 by jwe]
jwe
parents: 6549
diff changeset
50 // Wrapper for SLATEC/PCHIP function DPCHIM to calculate the derivates
6bbf56a9718a [project @ 2007-10-02 20:47:22 by jwe]
jwe
parents: 6549
diff changeset
51 // for piecewise polynomials.
6bbf56a9718a [project @ 2007-10-02 20:47:22 by jwe]
jwe
parents: 6549
diff changeset
52
6549
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6242
diff changeset
53 DEFUN_DLD (__pchip_deriv__, args, ,
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
54 "-*- texinfo -*-\n\
8712
010e15c7be9a support pchip method in interp2
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
55 @deftypefn {Loadable Function} {} __pchip_deriv__ (@var{x}, @var{y}, @var{dim})\n\
6945
6bbf56a9718a [project @ 2007-10-02 20:47:22 by jwe]
jwe
parents: 6549
diff changeset
56 Undocumented internal function.\n\
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
57 @end deftypefn")
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
58 {
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
59 octave_value retval;
5838
376e02b2ce70 [project @ 2006-06-01 20:23:53 by jwe]
jwe
parents: 5837
diff changeset
60 const int nargin = args.length ();
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
61
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14501
diff changeset
62 bool rows = (nargin == 3 && args (2).uint_value () == 2);
8712
010e15c7be9a support pchip method in interp2
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
63
010e15c7be9a support pchip method in interp2
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
64 if (nargin >= 2)
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
65 {
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
66 if (args(0).is_single_type () || args(1).is_single_type ())
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
67 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
68 FloatColumnVector xvec (args(0).float_vector_value ());
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
69 FloatMatrix ymat (args(1).float_matrix_value ());
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
70
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
71 octave_idx_type nx = xvec.length ();
14462
af552038cc52 Fix segfault in pchip when input array is too small (bug #35835).
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
72
af552038cc52 Fix segfault in pchip when input array is too small (bug #35835).
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
73 if (nx < 2)
af552038cc52 Fix segfault in pchip when input array is too small (bug #35835).
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
74 {
af552038cc52 Fix segfault in pchip when input array is too small (bug #35835).
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
75 error ("__pchip_deriv__: X must be at least of length 2");
af552038cc52 Fix segfault in pchip when input array is too small (bug #35835).
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
76 return retval;
af552038cc52 Fix segfault in pchip when input array is too small (bug #35835).
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
77 }
af552038cc52 Fix segfault in pchip when input array is too small (bug #35835).
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
78
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
79 octave_idx_type nyr = ymat.rows ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
80 octave_idx_type nyc = ymat.columns ();
5838
376e02b2ce70 [project @ 2006-06-01 20:23:53 by jwe]
jwe
parents: 5837
diff changeset
81
8712
010e15c7be9a support pchip method in interp2
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
82 if (nx != (rows ? nyc : nyr))
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
83 {
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
84 error ("__pchip_deriv__: X and Y dimension mismatch");
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
85 return retval;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
86 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
87
8712
010e15c7be9a support pchip method in interp2
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
88 const float *yvec = ymat.data ();
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
89 FloatMatrix dmat (nyr, nyc);
8712
010e15c7be9a support pchip method in interp2
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
90 float *dvec = dmat.fortran_vec ();
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
91
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
92 octave_idx_type ierr;
8712
010e15c7be9a support pchip method in interp2
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
93 const octave_idx_type incfd = rows ? nyr : 1;
8713
02d4c764de61 fix typo in previous patch
Jaroslav Hajek <highegg@gmail.com>
parents: 8712
diff changeset
94 const octave_idx_type inc = rows ? 1 : nyr;
8712
010e15c7be9a support pchip method in interp2
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
95
010e15c7be9a support pchip method in interp2
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
96 for (octave_idx_type i = (rows ? nyr : nyc); i > 0; i--)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
97 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
98 F77_FUNC (pchim, PCHIM) (nx, xvec.data (),
8712
010e15c7be9a support pchip method in interp2
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
99 yvec, dvec, incfd, &ierr);
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
100
8712
010e15c7be9a support pchip method in interp2
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
101 yvec += inc;
010e15c7be9a support pchip method in interp2
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
102 dvec += inc;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
103
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
104 if (ierr < 0)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
105 {
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
106 error ("PCHIM: error: %i\n", ierr);
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
107 return retval;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
108 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
109 }
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
110
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
111 retval = dmat;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
112 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
113 else
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
114 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
115 ColumnVector xvec (args(0).vector_value ());
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
116 Matrix ymat (args(1).matrix_value ());
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
117
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
118 octave_idx_type nx = xvec.length ();
14462
af552038cc52 Fix segfault in pchip when input array is too small (bug #35835).
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
119
af552038cc52 Fix segfault in pchip when input array is too small (bug #35835).
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
120 if (nx < 2)
af552038cc52 Fix segfault in pchip when input array is too small (bug #35835).
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
121 {
af552038cc52 Fix segfault in pchip when input array is too small (bug #35835).
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
122 error ("__pchip_deriv__: X must be at least of length 2");
af552038cc52 Fix segfault in pchip when input array is too small (bug #35835).
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
123 return retval;
af552038cc52 Fix segfault in pchip when input array is too small (bug #35835).
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
124 }
af552038cc52 Fix segfault in pchip when input array is too small (bug #35835).
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
125
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
126 octave_idx_type nyr = ymat.rows ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
127 octave_idx_type nyc = ymat.columns ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
128
8712
010e15c7be9a support pchip method in interp2
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
129 if (nx != (rows ? nyc : nyr))
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
130 {
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
131 error ("__pchip_deriv__: X and Y dimension mismatch");
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
132 return retval;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
133 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
134
8712
010e15c7be9a support pchip method in interp2
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
135 const double *yvec = ymat.data ();
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
136 Matrix dmat (nyr, nyc);
8712
010e15c7be9a support pchip method in interp2
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
137 double *dvec = dmat.fortran_vec ();
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
138
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
139 octave_idx_type ierr;
8712
010e15c7be9a support pchip method in interp2
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
140 const octave_idx_type incfd = rows ? nyr : 1;
8713
02d4c764de61 fix typo in previous patch
Jaroslav Hajek <highegg@gmail.com>
parents: 8712
diff changeset
141 const octave_idx_type inc = rows ? 1 : nyr;
8712
010e15c7be9a support pchip method in interp2
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
142
010e15c7be9a support pchip method in interp2
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
143 for (octave_idx_type i = (rows ? nyr : nyc); i > 0; i--)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
144 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
145 F77_FUNC (dpchim, DPCHIM) (nx, xvec.data (),
8712
010e15c7be9a support pchip method in interp2
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
146 yvec, dvec, incfd, &ierr);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
147
8712
010e15c7be9a support pchip method in interp2
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
148 yvec += inc;
010e15c7be9a support pchip method in interp2
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
149 dvec += inc;
5838
376e02b2ce70 [project @ 2006-06-01 20:23:53 by jwe]
jwe
parents: 5837
diff changeset
150
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
151 if (ierr < 0)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
152 {
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
153 error ("DPCHIM: error: %i\n", ierr);
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
154 return retval;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
155 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
156 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
157
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
158 retval = dmat;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 8713
diff changeset
159 }
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
160 }
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
161
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
162 return retval;
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
163 }
12805
3641167e5b75 codesprint: *.cc helper functions do not need tests
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
164
3641167e5b75 codesprint: *.cc helper functions do not need tests
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
165 /*
3641167e5b75 codesprint: *.cc helper functions do not need tests
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
166 ## No test needed for internal helper function.
3641167e5b75 codesprint: *.cc helper functions do not need tests
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
167 %!assert (1)
3641167e5b75 codesprint: *.cc helper functions do not need tests
Rik <octave@nomad.inbox5.com>
parents: 11586
diff changeset
168 */