[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: log2 calculations, entropy
From: |
Marcus G. Daniels |
Subject: |
Re: log2 calculations, entropy |
Date: |
09 Aug 1999 13:14:55 -0700 |
User-agent: |
Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4 |
>>>>> "PJ" == Paul Johnson <address@hidden> writes:
PJ> I can't figure how to get a logarithm to the base 2.
#import <misc.h> // M_LN2, log, atof, printf
double log2 (double val)
{
return log (val) / M_LN2;
}
int
main (int argc, const char **argv)
{
printf ("%f\n", log2 (atof (argv[1])));
}
/*
Local Variables:
compile-command: "/opt/gnu/bin/gcc -o log2 -g -Wno-import
-L/opt/SUNWtcl/8.0/sun4/lib -R/opt/SUNWtcl/8.0/sun4/lib -L/opt/SDGblt/2.4g/lib
-R/opt/SDGblt/2.4g/lib -L/opt/SDGlibffi/1.20/lib -R/opt/SDGlibffi/1.20/lib
-L/opt/SDGswarm/1.4.1/lib -L/opt/SDGzlib/1.1.3/lib -L/usr/local/X11/lib
-R/usr/local/X11/lib -L/usr/openwin/lib -R/usr/openwin/lib
-L/opt/SDGhdf5/1.0.1/lib -I/opt/SDGswarm/1.4.1/include log2.m -lanalysis
-lsimtools -lsimtoolsgui -lactivity -ltkobjc -lrandom -lobjectbase -ldefobj
-lcollections -lmisc -ltclobjc -ltk8.0 -ltcl8.0 -lBLT -lsocket -ldl -lnsl
-L/usr/openwin/lib -lhdf5 -lpng -lz -lXpm -lX11 -lffi -lm -lobjc -lpthread
-lposix4"
End:
*/
PJ> While looking for an answer, I notice in the swarm
PJ> src/analysis/Entropy.m, that the natual log is used to calculate
PJ> entropy, not log base 2. If Balch is correct, the current method is
PJ> wrong.
Notice the denominator in `log2' is a constant.
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.