[Vinecopula-commits] r8 - pkg/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Do Apr 18 18:10:29 CEST 2013
Author: ben_graeler
Date: 2013-04-18 18:10:29 +0200 (Thu, 18 Apr 2013)
New Revision: 8
Modified:
pkg/src/tools.c
Log:
- fix of the former bug-fix -- now producing the correct values
Modified: pkg/src/tools.c
===================================================================
--- pkg/src/tools.c 2013-04-18 15:10:56 UTC (rev 7)
+++ pkg/src/tools.c 2013-04-18 16:10:29 UTC (rev 8)
@@ -105,14 +105,21 @@
do
{
I = L;
- J = (I+K)<(*N-1)?(I+K):(*N-1); // changed both from *N to (*N-1)
+ J = (I+K)<(*N)?(I+K):(*N);
Iend = J;
Jend = (J+K)<(*N)?(J+K):(*N);
do
{
Iflag = (I < Iend);
Jflag = (J < Jend);
- Xflag = ((X[I] > X[J]) | ((X[I] == X[J]) & (Y[I] > Y[J]))); //Error? is it possible to get X[*N]? but X has only length *N
+ if (Iflag & Jflag)
+ {
+ Xflag = ((X[I] > X[J]) | ((X[I] == X[J]) & (Y[I] > Y[J])));
+ }
+ else
+ {
+ Xflag = FALSE;
+ }
if((Iflag & !Jflag) | (Iflag & Jflag & !Xflag))
{
X2[L] = X[I];
@@ -128,7 +135,7 @@
L++;
};
}
- while((Iflag | Jflag) & I < *N & J < *N); // added additional constraints
+ while(Iflag | Jflag);
}
while(L < *N);
@@ -178,14 +185,21 @@
do
{
I = L;
- J = (I+K)<(*N-1)?(I+K):(*N-1); // changed both from *N to (*N-1)
+ J = (I+K)<(*N)?(I+K):(*N);
Iend = J;
Jend = (J+K)<(*N)?(J+K):(*N);
do
{
Iflag = (I < Iend);
Jflag = (J < Jend);
- Xflag = (Y[I] > Y[J]);
+ if (Iflag & Jflag)
+ {
+ Xflag = (Y[I] > Y[J]);
+ }
+ else
+ {
+ Xflag = FALSE;
+ }
if((Iflag & !Jflag) | (Iflag & Jflag & !Xflag))
{
X2[L] = X[I];
@@ -202,7 +216,7 @@
L++;
};
}
- while((Iflag | Jflag) & I < *N & J < *N); // added additional constraints
+ while((Iflag | Jflag));
}
while(L < *N);
Mehr Informationen über die Mailingliste Vinecopula-commits