1
/************************************************************************************
2
TerraLib - a library for developing GIS applications.
3
Copyright � 2001-2004 INPE and Tecgraf/PUC-Rio.
5
This code is part of the TerraLib library.
6
This library is free software; you can redistribute it and/or
7
modify it under the terms of the GNU Lesser General Public
8
License as published by the Free Software Foundation; either
9
version 2.1 of the License, or (at your option) any later version.
11
You should have received a copy of the GNU Lesser General Public
12
License along with this library.
14
The authors reassure the license terms regarding the warranties.
15
They specifically disclaim any warranties, including, but not limited to,
16
the implied warranties of merchantability and fitness for a particular purpose.
17
The library provided hereunder is on an "as is" basis, and the authors have no
18
obligation to provide maintenance, support, updates, enhancements, or modifications.
19
In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
20
indirect, special, incidental, or consequential damages arising out of the use
21
of this library and its documentation.
22
*************************************************************************************/
24
#include <TeSemivarModelFactory.h>
29
static TeEsfericSemivar_Factory mesf("Esferic");
30
static TeExponentialSemivar_Factory mexp("Exponential");
31
static TeGaussianSemivar_Factory mgau("Gaussian");
35
TeEsfericSemivarModel :: calculate (TeMatrix& g)
42
c0=modeloefeitopepita_;
43
c1=modelocontribuicao_;
46
mxesf.Init(nlag+1, 2);
48
for (i=0; i<nlag; ++i)
53
else if (g(i,0) > 0 && g(i,0) < 1000000.0)
55
esf.push_back( c0 + c1*(1.5*(g(i,0)/a)) - 0.5*(pow(g(i,0)/a,3) ));
64
mxesf(i+1,0) = g(i,0); // h
65
mxesf(i+1,1) = esf[i]; // gama(h)
68
// quando h=0 => gama(h)=c0
71
// acrescentar o �ltimo valor
72
mxesf(nlag,0)= mxesf(nlag-1,0) + (mxesf(nlag-1,0) - mxesf(nlag-2,0));
73
mxesf(nlag,1)= mxesf(nlag-1,1);
79
TeExponentialSemivarModel :: calculate (TeMatrix& g)
86
c0=modeloefeitopepita_;
87
c1=modelocontribuicao_;
90
mxexp.Init(nlag+1, 2);
92
for (i=0; i<nlag; ++i)
97
//expo(i) = c0 + c1*( 1 - exp( -(3*g(i,1))/a) );
98
expo.push_back(c0 + c1*( 1 - exp( -(3*g(i,0))/a) ));
101
mxexp(i+1,0) = g(i,0); // h
102
mxexp(i+1,1) = expo[i]; // gama(h)
105
// quando h=0 => gama(h)=c0
108
// acrescentar o �ltimo valor
109
mxexp(nlag,0)= mxexp(nlag-1,0) + (mxexp(nlag-1,0) - mxexp(nlag-2,0));
110
mxexp(nlag,1)= mxexp(nlag-1,1);
116
TeGaussianSemivarModel :: calculate (TeMatrix& g)
123
c0=modeloefeitopepita_;
124
c1=modelocontribuicao_;
127
mxgau.Init(nlag+1, 2);
129
for (i=0; i<nlag; ++i)
134
// gaus(i) = c0 + c1*( 1 - exp(-3*(g(i,1)/a)^2) );
135
gau.push_back( c0 + c1*( 1 - exp(-3*pow(g(i,0)/a,2))) );
138
mxgau(i+1,0) = g(i,0); // h
139
mxgau(i+1,1) = gau[i]; // gama(h)
142
// quando h=0 => gama(h)=c0
145
// acrescentar o �ltimo valor
146
mxgau(nlag,0)= mxgau(nlag-1,0) + (mxgau(nlag-1,0) - mxgau(nlag-2,0));
147
mxgau(nlag,1)= mxgau(nlag-1,1);
159
elseif (g(i,1) > 0 & g(i,1) < a)
160
sphe(i) = c0 + c1*((1.5*(g(i,1)/a) - 0.5*((g(i,1)/a)^3)));
166
gaus(i) = c0 + c1*( 1 - exp(-3*(g(i,1)/a)^2) );
167
expo(i) = c0 + c1*( 1 - exp( -(3*g(i,1))/a) );
170
m(i+1,1) = g(i,1);% lag distance
184
%Para o modelo quando h=0 => gamma(h)=c0
187
%Para o modelo quando h >= a => gamma(h)=c0+c1
189
case 1 %Para modelo esferico
192
case 2 %Para modelo exponencial
193
m(nlag+2,2)= m(nlag+1,2);
195
case 3 %Para modelo gaussiano
196
m(nlag+2,2)= m(nlag+1,2);