[Debtags-commits] [svn] r1965 - in tagcoll/2.0: . tagcoll/coll
Enrico Zini
enrico at costa.debian.org
Fri Sep 29 06:40:23 UTC 2006
Author: enrico
Date: Fri Sep 29 06:40:23 2006
New Revision: 1965
Modified:
tagcoll/2.0/ (props changed)
tagcoll/2.0/tagcoll/coll/base.tcc
Log:
r3427 at viaza: enrico | 2006-09-29 08:39:57 +0200
Squares are easier to compute than sqrts
Modified: tagcoll/2.0/tagcoll/coll/base.tcc
==============================================================================
--- tagcoll/2.0/tagcoll/coll/base.tcc (original)
+++ tagcoll/2.0/tagcoll/coll/base.tcc Fri Sep 29 06:40:23 2006
@@ -26,7 +26,6 @@
#include <tagcoll/coll/base.h>
#include <tagcoll/utils/set.h>
#include <algorithm>
-#include <math.h>
namespace tagcoll {
namespace coll {
@@ -41,12 +40,12 @@
{
// New cardinality divided by the square root of the old cardinality.
// The square root is used to downplay the very common tags a bit
- float csub1 = second.getCardinality(t1);
+ int csub1 = second.getCardinality(t1);
float cfull1 = first.getCardinality(t1);
- float csub2 = second.getCardinality(t2);
+ int csub2 = second.getCardinality(t2);
float cfull2 = first.getCardinality(t2);
- float rel1 = csub1 / sqrt(cfull1);
- float rel2 = csub2 / sqrt(cfull2);
+ float rel1 = (float)(csub1 * csub1) / cfull1;
+ float rel2 = (float)(csub2 * csub2) / cfull2;
return rel1 < rel2;
// return 10000 * second.getCardinality(t1) / first.getCardinality(t1)
More information about the Debtags-commits
mailing list