예제 #1
0
 Slots(const P1& plugin1 = P1(),
       const P2& plugin2 = P2(),
       const P3& plugin3 = P3(),
       const P4& plugin4 = P4(),
       const P5& plugin5 = P5())
   : BaseT( plugin1, BaseSlots(plugin2, plugin3, plugin4, plugin5, NullT()) )
 { }
예제 #2
0
int main() {

  Point center(41,29);

  // The numbering of the nodes corresponds to gslib's output order
  Node P5(38,28,0.5740);
  Node P8(45,29,1.2110);
  Node P4(41,26,2.1270);
  Node P3(39,31,8.3400);
  Node P6(38,31,18.6420);
  Node P2(39,30,7.9380);
  Node P7(39,32,2.2840);
  Node P1(40,31,2.5090);
  Node P9(37,20,0.5740);
  Node P10(25,28,1.2110);
  Node P11(39,26,2.1270);
  Node P12(32,31,8.3400);
  Node P13(30,34,18.6420);
  Node P14(33,35,7.9380);
  Node P15(42,32,2.2840);
  Node P16(31,23,2.5090);

  neighborhood voisin;
  voisin.add_node(P1);
  voisin.add_node(P2);
  voisin.add_node(P3);
  voisin.add_node(P4);
  voisin.add_node(P5);
  voisin.add_node(P6);
  voisin.add_node(P7);
  voisin.add_node(P8);
  voisin.add_node(P9);
  voisin.add_node(P10);
  voisin.add_node(P11);
  voisin.add_node(P12);
  voisin.add_node(P13);
  voisin.add_node(P14);
  voisin.add_node(P15);
  voisin.add_node(P16);
  


  

  typedef matrix_lib_traits<TNT_lib<double> >::Vector TNTvector;

  covariance covar;
  
  //______________________________
  // Simple Kriging
  //______________________________

  std::cout << std::endl <<std::endl;
  std::cout << "____________________________________________" 
	    << std::endl
	    << "Simple kriging"
	    << std::endl << std::endl;

  TNTvector SK_weights;
  SK_constraints SK;
  OK_constraints OK;
  double sk_variance;
  

  TNT::stopwatch chrono;
  chrono.start();
  for(int count = 0 ; count < 50000 ; count ++) {
    int change=1;
    if(drand48() <0.5) change = -1;
    (voisin[0].location())[0] += change;
    kriging_weights<GSTL_TNT_lib>(SK_weights,
				  center, voisin,
				  covar, OK );
  }

  chrono.stop();
  std::cout << "time elapsed using Gauss: " << chrono.read() << std::endl;
  
  chrono.reset();
  chrono.start();
  for(int count = 0 ; count < 50000 ; count ++) {
    int change=1;
    if(drand48() <0.5) change = -1;
    voisin[0].property_value() = 0.5*count;
    kriging_weights(SK_weights, 
		    center, voisin,
		    covar, OK );
  }

  chrono.stop();
  std::cout << "time elapsed using LU: " << chrono.read() << std::endl;
  
  
  /*
  //______________________________
  // Ordinary Kriging
  //______________________________

  std::cout << std::endl <<std::endl;
  std::cout << "____________________________________________" 
	    << std::endl
	    << "Ordinary kriging"
	    << std::endl << std::endl;

  TNTvector OK_weights;
  OK_constraints OK;
  double ok_variance;
  status = kriging_weights(OK_weights, ok_variance,
			   center, voisin,
			   covar, OK);
						   
  std::cout << "Here are the weights:" << std::endl
	    << OK_weights << std::endl;

  
  

  //______________________________
  // Kriging with Trend
  //______________________________

  std::cout << std::endl <<std::endl;
  std::cout << "____________________________________________" 
	    << std::endl
	    << "Kriging with Trend"
	    << std::endl << std::endl;
  
  TNTvector KT_weights;
  KT_constraints<functIter> KT(functArray.begin(),functArray.end());
  double kt_variance;
  status = kriging_weights(KT_weights, kt_variance,
			   center, voisin,
			   covar, KT);

						  
  std::cout << "Here are the weights:" << std::endl
	    << KT_weights << std::endl;

  */

  return 0;


}
예제 #3
0
int main() {

  Node center_node(41,29,-99);

  // The numbering of the nodes corresponds to gslib's output order
  Node P5(38,28,0.5740);
  Node P8(45,29,1.2110);
  Node P4(41,26,2.1270);
  Node P3(39,31,8.3400);
  Node P6(38,31,18.6420);
  Node P2(39,30,7.9380);
  Node P7(39,32,2.2840);
  Node P1(40,31,2.5090);


  neighborhood voisin;
  voisin.add_node(P1);
  voisin.add_node(P2);
  voisin.add_node(P3);
  voisin.add_node(P4);
  voisin.add_node(P5);
  voisin.add_node(P6);
  voisin.add_node(P7);
  voisin.add_node(P8);

 

  
  typedef TNT_lib<double> TNT;
  typedef matrix_lib_traits<TNT>::Vector TNTvector;
  typedef matrix_lib_traits<TNT>::Symmetric_matrix TNTMatrix;

  covariance covar;


  
  //_____________________________
  // gaussian cdf estimator 
  //_____________________________

  std::cout << std::endl <<std::endl;
  std::cout << "____________________________________________" 
	    << std::endl
	    << "estimating gaussian cdf with SK"
	    << std::endl << std::endl;

  Gaussian_cdf g_ccdf;

  typedef Kriging_combiner<std::vector<double>::const_iterator,
                           neighborhood>   KCombiner;
  KCombiner sk_combiner( new SK_combiner<std::vector<double>::const_iterator,
                                          neighborhood>( 9.0 )   );
  typedef Kriging_constraints<neighborhood, Point, TNT> KConstraints;
  KConstraints constraints( new SKConstraints_impl<neighborhood, Point,TNT> );


  Gaussian_cdf_Kestimator<covariance,
    neighborhood,KConstraints,TNT>  gK_estimator( covar, constraints, sk_combiner ); 
  
  gK_estimator(center_node, voisin, g_ccdf);
  
  std::cout << "gaussian cdf : mean= " << g_ccdf.mean() << "   variance= " 
	    << g_ccdf.variance() << std::endl;


  /*  
  Gaussian_cdf g_ccdf2;
  
  Gaussian_cdf_Kestimator<covariance,
    neighborhood, SK_constraints>  gK_estimator2( covar, SK_constraints(), sk_combiner2 ); 
  gK_estimator2(center, voisin, g_ccdf2);
  
  std::cout << "gaussian cdf : mean= " << g_ccdf2.mean() << "   variance= " 
       << g_ccdf2.variance() << std::endl;
  */
}