Skip to content

Commit c57344f

Browse files
sglyonTomas Lycken
authored andcommitted
Updated readme
* Updated readme - Added notes about `Cubic` - Fixed gridded example so it runs without errors - Added note about Hessian
1 parent b11bdd5 commit c57344f

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ gradient!(g, itp, x, y, ...)
6363
```
6464
where `g` is a pre-allocated vector.
6565

66+
Some interpolation objects support computation of the hessian, which
67+
can be obtained as
68+
```jl
69+
h = hessian(itp, x, y, ...)
70+
```
71+
or, if you're evaluating the hessian repeatedly, a somewhat more
72+
efficient option is
73+
```jl
74+
hessian!(h, itp, x, y, ...)
75+
```
76+
where `h` is a pre-allocated matrix.
77+
6678
`A` may have any element type that supports the operations of addition
6779
and multiplication. Examples include scalars like `Float64`, `Int`,
6880
and `Rational`, but also multi-valued types like `RGB` color vectors.
@@ -91,7 +103,7 @@ fine = itp[linspace(1,10,1001), linspace(1,15,201)]
91103

92104
### BSplines
93105

94-
The interpolation type is described in terms of *degree*, *grid behavior* and, if necessary, *boundary conditions*. There are currently three degrees available: `Constant`, `Linear` and `Quadratic`, corresponding to B-splines of degree 0, 1 and 2, respectively.
106+
The interpolation type is described in terms of *degree*, *grid behavior* and, if necessary, *boundary conditions*. There are currently three degrees available: `Constant`, `Linear`, `Quadratic`, and `Cubic` corresponding to B-splines of degree 0, 1, 2, and 3 respectively.
95107

96108
You also have to specify what *grid representation* you want. There are currently two choices: `OnGrid`, in which the supplied data points are assumed to lie *on* the boundaries of the interpolation interval, and `OnCell` in which the data points are assumed to lie on half-intervals between cell boundaries.
97109

@@ -132,9 +144,9 @@ defining the knots of the array.
132144
In 1D
133145
```jl
134146
A = rand(20)
135-
A_x = collect(1.:40.)
136-
knots = (a,)
137-
itp = interpolate(knots,A, Gridded(Linear()))
147+
A_x = collect(1.0:2.0:40.0)
148+
knots = (A_x,)
149+
itp = interpolate(knots, A, Gridded(Linear()))
138150
itp[2.0]
139151
```
140152

@@ -157,7 +169,6 @@ One may also mix modes, by specifying a mode vector in the form of an explicit t
157169
itp = interpolate(knots, A, (Gridded(Linear()),Gridded(Constant())))
158170
```
159171

160-
161172
Presently there are only three modes for gridded:
162173
```jl
163174
Gridded(Linear())

0 commit comments

Comments
 (0)