Re: AI-GEOSTATS: Re: Numerical method to solve kriging equations

2008-03-31 Thread Syed Shibli
> /*
> Program 2
> */
>
> #include "tnt.h"
> #include "jama_cholesky.h"
> #include "jama_lu.h"
>
> using namespace JAMA;
> using namespace TNT;
> using namespace std;
>
> int main()
> {
> Array2D  C(5,5);
> Array1D  c(5);
> Array2D  V(5,5);
> Array1D  v(5);
> Array1D  Xc;
> Array1D  Xv;
> Stopwatch Q;
> int i;
>
> C[0][0]=2000;  C[1][0]=704.8;   C[2][0]=695.6;C[3][0]=
> 466.4;  C[4][0]=1;
> C[0][1]=704.8; C[1][1]=2000;C[2][1]=689.4;C[3][1]=
> 461.2;  C[4][1]=1;
> C[0][2]=695.6; C[1][2]=689.4;   C[2][2]=2000; C[3][2]=
> 1285.8; C[4][2]=1;
> C[0][3]=466.4; C[1][3]=461.2;   C[2][3]=1285.8;
> C[3][3]=2000;   C[4][3]=1;
> C[0][4]=1; C[1][4]=1;   C[2][4]=1;C[3][4]=1;
> C[4][4]=0;
>
> c[0]=908.7;
> c[1]=831.8;
> c[2]=1507.2;
> c[3]=973.6;
> c[4]=1;
>
> V[0][0]=0;  V[1][0]=1295.2;   V[2][0]=1304.4;V[3][0]=
> 1533.6;  V[4][0]=1;
> V[0][1]=1295.2; V[1][1]=0;V[2][1]=1310.6;V[3][1]=
> 1538.8;  V[4][1]=1;
> V[0][2]=1304.4; V[1][2]=1310.6;   V[2][2]=0; V[3][2]=
> 714.2;   V[4][2]=1;
> V[0][3]=1533.6; V[1][3]=1538.8;   V[2][3]=714.2;
> V[3][3]=0;   V[4][3]=1;
> V[0][4]=1;  V[1][4]=1;V[2][4]=1;
> V[3][4]=1;   V[4][4]=0;
>
>
> v[0]=1091.3;
> v[1]=1168.2;
> v[2]=492.8;
> v[3]=1026.4;
> v[4]=1;
>
>
> //To check results
> //LU with Covariance
> {LU  lu(C);
> Xc=lu.solve(c);
> cout << "LU con C: " << Xc <
> //LU with Varigram
>     {LU  lu(V);
>     Xv=lu.solve(v);
> cout << "LU con V: " << Xv <
>
> //To compare speed
>
> //LU with Covariance
> Q.start();
> for(i=1; i<=10; ++i)
> {
> LU  lu(C);
> Xc=lu.solve(c);
> }
> Q.stop();
> cout << "Tiempo de LU con C: " << Q.read() <
> //LU with Varigram
> Q.start();
> for(i=1; i<=10; ++i)
> {
> LU  lu(V);
> Xv=lu.solve(v);
> }
> Q.stop();
> cout << "Tiempo de LU con V: " << Q.read() <
> return 0;
> }
>
> - Original Message -
> *From:* Isobel Clark <[EMAIL PROTECTED]>
> *To:* Adrian Martínez Vargas <[EMAIL PROTECTED]> ; ai-geostats@jrc.it
> *Sent:* Friday, March 28, 2008 6:31 PM
> *Subject:* AI-GEOSTATS: Re: Numerical method to solve kriging equations
>
>
> Adrian
>
> It is a common misconception that using the covariance (total sill -
> semi-variogram) rather than the semi-variogram brings more robust solutions.
> You get exactly the same answer either way since one is just a constant
> minus the other.
>
> You can avoid solution problems by simple pivoting or by putting the
> condition equation first -- sum of weights equals 1.
>
> If you look at the details of the solution, you generally only have to
> pivot the first equation to remove the diagonal zeroes.
>
> Isobel
> http://courses.kriging.com
>
>
> *Adrian Martínez Vargas <[EMAIL PROTECTED]>* wrote:
>
>  What about to produce "pseudo covariance" to replace kriging matrix in
> term of variogram to make more efficient the numerical solution of the
> system?  The ceros in the matrix diagonal are a problem in robustness and
> efficiency!
>
> Some one knows how to implement something like that? Papers/books can be
> useful!
>
> - Original Message -
> *From:* Adrian Martínez Vargas <[EMAIL PROTECTED]>
> *To:* ai-geostats@jrc.it
> *Sent:* Friday, March 28, 2008 5:23 PM
> *Subject:* Numerical method to solve kriging equations
>
>
>  Hello dear list
>
> What numerical method give faster and robust solution to kriging
> equations. What to us as C++ library (for example TNT and JAMA?). It is
> usual to use cholesky in the case of simple kriging.
>
> I will appreciate your advice and experiences.
>
> Best regards
> Dr. Adrian Martínez Vargas
> Revista Minería y Geología
> ISMM, Las Coloradas, s/n
> Moa, Holguín,
> Cuba
> CP. 83329
> http://www.ismm.edu.cu/revistamg/index.htm
>
>
>
>


AI-GEOSTATS: Re: Numerical method to solve kriging equations

2008-03-28 Thread Isobel Clark
Adrian
   
  It is a common misconception that using the covariance (total sill - 
semi-variogram) rather than the semi-variogram brings more robust solutions. 
You get exactly the same answer either way since one is just a constant minus 
the other.
   
  You can avoid solution problems by simple pivoting or by putting the 
condition equation first -- sum of weights equals 1. 
   
  If you look at the details of the solution, you generally only have to pivot 
the first equation to remove the diagonal zeroes.
   
  Isobel
  http://courses.kriging.com
  

Adrian Martínez Vargas <[EMAIL PROTECTED]> wrote:
What about to produce “pseudo covariance” to replace kriging matrix 
in term of variogram to make more efficient the numerical solution of the 
system?  The ceros in the matrix diagonal are a problem in robustness and 
efficiency!
   
  Some one knows how to implement something like that? Papers/books can be 
useful! 

- Original Message - 
  From: Adrian Martínez Vargas 
  To: ai-geostats@jrc.it 
  Sent: Friday, March 28, 2008 5:23 PM
  Subject: Numerical method to solve kriging equations
  

Hello dear list
   
  What numerical method give faster and robust solution to kriging equations. 
What to us as C++ library (for example TNT and JAMA?). It is usual to use 
cholesky in the case of simple kriging.
   
  I will appreciate your advice and experiences.
   
  Best regards
  Dr. Adrian Martínez Vargas 
Revista Minería y Geología 
ISMM, Las Coloradas, s/n 
Moa, Holguín, 
Cuba 
CP. 83329 
http://www.ismm.edu.cu/revistamg/index.htm





AI-GEOSTATS: Re: Numerical method to solve kriging equations

2008-03-28 Thread Adrian Martínez Vargas
What about to produce "pseudo covariance" to replace kriging matrix in term of 
variogram to make more efficient the numerical solution of the system?  The 
ceros in the matrix diagonal are a problem in robustness and efficiency!

 

Some one knows how to implement something like that? Papers/books can be 
useful! 

  - Original Message - 
  From: Adrian Martínez Vargas 
  To: ai-geostats@jrc.it 
  Sent: Friday, March 28, 2008 5:23 PM
  Subject: Numerical method to solve kriging equations


  Hello dear list

   

  What numerical method give faster and robust solution to kriging equations. 
What to us as C++ library (for example TNT and JAMA?). It is usual to use 
cholesky in the case of simple kriging.

   

  I will appreciate your advice and experiences.

   

  Best regards

  Dr. Adrian Martínez Vargas 
  Revista Minería y Geología 
  ISMM, Las Coloradas, s/n 
  Moa, Holguín, 
  Cuba 
  CP. 83329 
  http://www.ismm.edu.cu/revistamg/index.htm