c,d in polint

This commit is contained in:
David Parkhurst 2021-03-23 19:35:54 -06:00
parent d82d5d610f
commit 78a83edabf

View File

@ -298,21 +298,15 @@ polint(LDBLE * xa, LDBLE * ya, int n, LDBLE xv, LDBLE * yv, LDBLE * dy)
{ {
int i, m, ns; int i, m, ns;
LDBLE den, dif, dift, ho, hp, w; LDBLE den, dif, dift, ho, hp, w;
LDBLE *c, *d;
ns = 1; ns = 1;
dif = fabs(xv - xa[1]); dif = fabs(xv - xa[1]);
/* /*
* Malloc work space * Malloc work space
*/ */
c = (LDBLE *) PHRQ_malloc(((size_t)n + 1) * sizeof(LDBLE)); std::vector<double> c, d;
if (c == NULL) c.resize((size_t)n + 1);
malloc_error(); d.resize((size_t)n + 1);
d = (LDBLE *) PHRQ_malloc(((size_t)n + 1) * sizeof(LDBLE));
if (d == NULL)
malloc_error();
for (i = 1; i <= n; i++) for (i = 1; i <= n; i++)
{ {
@ -354,8 +348,6 @@ polint(LDBLE * xa, LDBLE * ya, int n, LDBLE xv, LDBLE * yv, LDBLE * dy)
/* *yv += (*dy = (2 * ns < (n-m) ? c[ns+1] : d[ns--])); */ /* *yv += (*dy = (2 * ns < (n-m) ? c[ns+1] : d[ns--])); */
} }
c = (LDBLE *) free_check_null(c);
d = (LDBLE *) free_check_null(d);
return; return;
} }