distsumgra: Computes the gradient of distsum function

distsumgraR Documentation

Computes the gradient of distsum function

Description

The gradient of the objective function for the min-sum location problem.

Usage

distsumgra(o, x = 0, y = 0, lp = numeric(0), partial = F)

Arguments

o

An object of loca.p class.

x

The x coordinate of the point to be evaluated.

y

The y coordinate of the point to be evaluated.

lp

If given, then l_p norm will be used instead of the Euclidean norm.

partial

If (x,y) is a demand point partial=T means ignore such point to compute the gradient. This option is mainly for internal use.

Details

The function zsumgra is deprecated and will be removed from new versions of the package.

Value

distsumgra returns the gradient vector of the objective function of the min-sum location problem, \sum_{a_i \in o} w_i d(a_i, (x,y)), where d(a_i, (x,y)) gives the euclidean or the l_p distances between a_i and the point (x,y).

See Also

See also orloca-package and distsum.

Examples

# A new unweighted loca.p object
loca <- loca.p(x = c(-1, 1, 1, -1), y = c(-1, -1, 1, 1))
# Evaluation of distsum at (0, 0)
distsum(loca)

# Evaluation of distsum at (1, 3)
distsum(loca, 1, 3)
# Compute the objective function at point (3, 4) using lp norm and p = 2.5
distsum(loca, 3, 4, lp=2.5)
# The gradient function at (1,3)
distsumgra(loca, 1, 3)


orloca documentation built on Feb. 1, 2024, 3 p.m.