Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hpval #4

Merged
merged 3 commits into from
Jan 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add hpval
same inputs as `hval`
  • Loading branch information
zmoon committed Jan 23, 2024
commit 8382f3596dd7bef23df2949b4e5f712cf10b3a1e
31 changes: 31 additions & 0 deletions pytspack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,37 @@ def hval(xp, x, y, yp, sigma):
return y_out


def hpval(xp, x, y, yp, sigma):
"""Function which evaluates the first derivative of a Hermite
interpolatory tension spline ("HP") at points `xp`.

Parameters
----------
xp : array_like
New X points at which HP is to be evaluated.
x : array_like
Original X points (abscissae).
y : array_like
Data values at the original X points.
yp : array_like
First derivatives of Y at original X points. HP(X(I)) = YP(I).
sigma : array_like
Tension factors, for each interval in the original X points
(as such, length N - 1).

Returns
-------
list of float
HP values.
"""
xp = array(xp)
x = array(x)
y = array(y)
sigma = array(sigma)
yp_out = [tspack.hpval(xi, x, y, yp, sigma, 1) for xi in xp]
return yp_out


def tspsi(x, y, ncd=1, slopes=None, curvs=None, per=0, tension=None):
"""Subroutine which constructs a shape-preserving or
unconstrained interpolatory function. Refer to
Expand Down