contents next up previous
Next: Sequential Simulation, Single-Variable Case Up: Algorithms Previous: Linear Combination

Subsections


Multi Linear Combination

template<class InputIterator, class InputIterator2>
double
multi_linear_combination(InputIterator begin_weights, InputIterator end_weights,
                         InputIterator2 first_neigh, InputIterator2 last_neigh)


Computes the linear combination of the weights in range
[begin_weights, end_weights) and the property values of the geo-values contained in the neighborhoods in range [first_neigh, last_neigh). Denote $ \lambda_{1}^{}$,...,$ \lambda_{P}^{}$ the weights, and zj($ \bf u_{1}^{j}$),..., zj($ \bf u_{n_j}^{j}$), j = 1,..., Nv property values of the geo-values contained in the Nv neighborhoods. linear_combination returns:

$\displaystyle \sum_{j=1}^{N_v}$$\displaystyle \sum_{i=1}^{n_j}$$\displaystyle \lambda_{\alpha(i,j)}^{}$ zj($\displaystyle \bf u_{i}^{j}$)

where $ \alpha$(i, j) = $ \sum_{k=1}^{j-1}$nk + i



Where defined

In header file <kriging.h>



Preconditions

P, the number of weights, must be equal or greater than the total number of geo-values in all the neighborhoods combined. 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 properties 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.

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

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

  location2d u3(1,2);
  geo_value2d S1(u3,42.1);
  neighbors2.push_back(S1);

  neighborhood* neigh_array[2]={&neighbors1, &neighbors2};

  location2d u(0,0);

  std::vector<double> weights;

  double kvariance;
  kriging_weights(weights, kvariance,
                  u, neigh_array, 2,
                  LMC_covariance, OK_constraint);

  double kmean = multi_linear_combine(weights.begin(),
                                      weights.end(),
                                      neigh_array, neigh_array+2);
}



contents next up previous
Next: Sequential Simulation, Single-Variable Case Up: Algorithms Previous: Linear Combination
nicolas
2002-05-07