contents next up previous
Next: Multi Linear Combination Up: Algorithms Previous: Cokriging Weights

Subsections

Linear Combination

template<class InputIterator, class Neighborhood>
double
linear_combination(InputIterator begin_weights, InputIterator end_weights,
                   const Neigborhood& neighbors) 


Computes the linear combination of the weights in range [begin_weights, end_weights), and the property values of the geo-values contained in the neighborhood that neighbors points to. Denote $ \lambda_{1}^{}$,...,$ \lambda_{P}^{}$ the weights, and z($ \bf u_{1}^{}$),..., z($ \bf u_{N}^{}$) the geo-values property values. linear_combination returns: $ \sum_{i=1}^{N}$$ \lambda_{i}^{}$ z($ \bf u_{i}^{}$)



Where defined

In header file <kriging.h>



Preconditions

P, the number of weights, must be equal or greater than the number of geo-values in the neighborhood. The algorithm loops on the geo-values, hence if P > N only the N first weights are used, the others are ignored.

The type of the geo-values property must be convertible to double.



Requirements on types



Example

Compute the kriging estimate from the kriging weights. gauss_covariance is the Gaussian covariance defined in the example following the description of
kriging_weights.

typedef std::vector<geo_value2d> neighborhood;

int main()
{  
  location2d u1(2,3);
  location2d u2(4,-7);

  geo_value2d Z1(u1,0.21);
  geo_value2d Z2(u2,0.09); 
  
  Neighborhood neighbors;
  neighbors.push_back(Z1);
  neighbors.push_back(Z2);

  location2d u(0,0);

  std::vector<double> weights;

  double kvariance = kriging_weights(weights,
                                     u, &neighbors,
                                     gauss_covariance, OK_constraint);

  double kmean = linear_combine(weights.begin(),weights.end(),
                                neighbors);
}


Replacing the last line by

  std::vector<double>::iterator end_weights = weights.begin()+2;

  double kmean = linear_combine(weights.begin(), end_weights,
                                neighbors);

would have led to the same value of kmean.


contents next up previous
Next: Multi Linear Combination Up: Algorithms Previous: Cokriging Weights
nicolas
2002-05-07