g_hav | R Documentation |
Calculate great circle distance between a set of points and a boundary, with gradient
g_hav(z, dV, r = 1)
z |
matrix of euclidean coordinates |
dV |
boundary in euclidean coordinates |
r |
radius of sphere, default 1 |
This is one possible boundary function g
that can be used for truncated score matching on a sphere,
used by the "Haversine"
argument to sphere_sm
.
This function first finds the distance between the truncated dataset z
and the boundary dV
, using the
haversine distance function (from the geosphere
package):
d = 2 r arcsin( √{ sin^2 ( (θ_2 - θ_1) / 2 ) + cos (θ_1) cos(θ_2) sin^2( (φ_2 - φ_1)/2 ) } ),
where (φ_1, θ_1) is the longitude and latitude of point 1, and (φ_2, θ_2)
is the longitude and latitude of point 2, both in radians, and r is the radius, default r=1
.
Once the distances are found, the smallest distances between x
and the boundary as well as the first derivative
of the haversine function are saved and output back to the score matching function.
Note that z
and dV
are Euclidean coordinates, and this function converts them to spherical coordinates
before taking the distance (as required by the Haversine). This is for consistency.
List containing two elements
|
values of function |
|
matrix of derivatives of |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.