commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark R. Diggory" <mdigg...@latte.harvard.edu>
Subject Re: [math] Priorities, help needed
Date Wed, 21 May 2003 21:59:10 GMT
Phil Steitz wrote:

>I agree that we need to carefully document preconditions
>for *all* interfaces; but I strongly disagree with the
>assertion that we need separate implementations to enforce
>domain restrictions.  Will we have an
>"InvertibleRealMatrix" class? I don't think so.  Better to
>just document that the inversion method will throw an
>exception if the matrix is singular -- and provide a test
>for singularity (I think this is in the interface already).
>  
>
Good point.

>
>I will do a little research on this and post some links
>and/or code.  What I meant was to consider using the using
>the alternative computational formula 
>geom mean = exp(((log(v1) + ... + log(vn))/n).  This
>*might* control rounding error better.  As I said, this
>needs to be researched.  The alternative formula just comes
>from the identity log(ab) = log(a) + log(b).
>  
>

Looks like we just need to calc sumLog as:

sumLog += Math.log(v);

and

sumLog -= Math.log(discard);

and then do


Math.exp( sumLog / n );

A not so stable reference to the methodology is:
http://shazam.econ.ubc.ca/intro/gmean.htm

-Mark



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message