Learn R Programming

KRIG (version 0.1.0)

weight_pow_dist: Generic weighted p-distance

Description

Many isotropic models can be defined employing a distance. In particular this function implements a distance employing weights and different powers.

Usage

weight_pow_dist(x, y, w, p)

Arguments

x

First vector.

y

Second vector.

w

Weights for every coordinate in the vectors.

p

Powers for every coordinate in the vectors. To define a true norm every coordinate has to be greater than 1.

Value

Real value of the weighted p-distance.

Examples

Run this code
# NOT RUN {
library(KRIG)

n<-1e5
x<-runif( n )
y<-runif( n )
p<-rep(2.5,n)
w<-runif(n)

kw<-weight_pow_dist( x, y, w, p )
nw<-sum( w * abs( x - y )^p )

nw == kw
# }

Run the code above in your browser using DataLab