Skip to content

Commit ae8cb87

Browse files
committed
more precise theoretical GFS
1 parent 14352ff commit ae8cb87

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

panicmage

106 Bytes
Binary file not shown.

source/treestatistics.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,14 @@ void theoGfs_core (float *gfs, int nsam, float theta, float rho, float core) {
5858
int k,l;
5959
float l2;
6060
for (k = 1; k <= nsam; k++){
61-
gfs[k-1] = theta/((float) k );
61+
gfs[k-1] = std::log(theta/((float) k ) );
6262
for( l = nsam; l >= nsam-k+1; l--){
63-
gfs[k-1] *= l;
63+
gfs[k-1] += std::log(l);
6464
}
6565
for( l2 = ((float)nsam)-1.+rho ; l2 > ((float)nsam)-k+rho-0.5; l2 -= 1.){
66-
gfs[k-1] *= 1./l2;
66+
gfs[k-1] += std::log(1./l2);
6767
}
68+
gfs[k-1] = std::exp(gfs[k-1]);
6869
}
6970
gfs[nsam-1] = gfs[nsam-1]+core;
7071
// R code to do the same

0 commit comments

Comments
 (0)