From: <ha...@us...> - 2010-03-11 13:01:50
|
Revision: 12597 http://jmol.svn.sourceforge.net/jmol/?rev=12597&view=rev Author: hansonr Date: 2010-03-11 13:01:44 +0000 (Thu, 11 Mar 2010) Log Message: ----------- version=11.9.33_dev # new feature: quaterion array .average .stddev using SphereMean Modified Paths: -------------- trunk/Jmol/src/org/jmol/util/Quaternion.java Modified: trunk/Jmol/src/org/jmol/util/Quaternion.java =================================================================== --- trunk/Jmol/src/org/jmol/util/Quaternion.java 2010-03-11 12:53:32 UTC (rev 12596) +++ trunk/Jmol/src/org/jmol/util/Quaternion.java 2010-03-11 13:01:44 UTC (rev 12597) @@ -739,6 +739,11 @@ return dqMean.mul(mean); } + /** + * @param data + * @param mean + * @return standard deviation in units of degrees + */ private static float stdDev(Quaternion[] data, Quaternion mean) { double sum = 0; double sum2 = 0; @@ -747,9 +752,10 @@ // that is, cos(theta/2) for theta between them for (int i = n; --i >= 0;) { - float dist = 2 * (float) Math.acos(data[i].dot(mean)); - sum += dist; - sum2 += dist * dist; + Quaternion dq = data[i].div(mean); + float theta = dq.getTheta(); + sum += theta; + sum2 += theta * theta; } sum2 = sum2 - sum * sum / n; if (sum2 < 0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |