Revision: 56032
http://sourceforge.net/p/brlcad/code/56032
Author: brlcad
Date: 2013-07-13 03:08:27 +0000 (Sat, 13 Jul 2013)
Log Message:
-----------
accept sf patch #187 Code Reduction in bwhisteq-2
(https://sourceforge.net/p/brlcad/patches/187/) from mohit daga that avoids
iterating over the bins unnecessarily. cuts two lines overall but more
interestingly was compared with an equivalent matlab function. results were
nearly identical with differences assumed to be floating point drift/error.
Modified Paths:
--------------
brlcad/trunk/AUTHORS
brlcad/trunk/src/util/bwhisteq.c
Modified: brlcad/trunk/AUTHORS
===================================================================
--- brlcad/trunk/AUTHORS 2013-07-13 02:58:17 UTC (rev 56031)
+++ brlcad/trunk/AUTHORS 2013-07-13 03:08:27 UTC (rev 56032)
@@ -669,7 +669,12 @@
2013 May
Open Source (GSoC)
+Daga, Mohit
+nicknames zero_level
+2013 June
+Open Source (GSoC)
+
SPECIAL THANKS
--------------
Modified: brlcad/trunk/src/util/bwhisteq.c
===================================================================
--- brlcad/trunk/src/util/bwhisteq.c 2013-07-13 02:58:17 UTC (rev 56031)
+++ brlcad/trunk/src/util/bwhisteq.c 2013-07-13 03:08:27 UTC (rev 56032)
@@ -76,17 +76,15 @@
}
/* Tally up the intensities */
+ havg = 0.0;
while ((n = fread(buf, sizeof(*buf), 512, fp)) > 0) {
bp = &buf[0];
- for (i = 0; i < n; i++)
+ for (i = 0; i < n; i++)
bin[ *bp++ ]++;
+ havg += n;
}
+ havg /= (double)BINSIZE;
- havg = 0.0;
- for (i = 0; i < BINSIZE; i++)
- havg += bin[ i ];
- havg /= (double)BINSIZE;
-
r = 0;
hint = 0;
for (i = 0; i < BINSIZE; i++) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits