Mercurial > hg > audiodb
changeset 84:94b6fb73d2ee
Hack the right answer out of the L2Norm offset computation.
We need to subtract off the number vectors that we've just added, as
dbH->length has already been updated to reflect them.
author | mas01cr |
---|---|
date | Tue, 02 Oct 2007 13:16:00 +0000 |
parents | 48aaee766d8a |
children | 4d2587e683ff |
files | audioDB.cpp |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/audioDB.cpp Tue Oct 02 13:14:37 2007 +0000 +++ b/audioDB.cpp Tue Oct 02 13:16:00 2007 +0000 @@ -2453,10 +2453,15 @@ X+=dim; } unsigned offset; - if(append) - offset=dbH->length/(dbH->dim*sizeof(double)); // number of vectors - else + if(append) { + // FIXME: a hack, a very palpable hack: the vectors have already + // been inserted, and dbH->length has already been updated. We + // need to subtract off again the number of vectors that we've + // inserted this time... + offset=(dbH->length/(dbH->dim*sizeof(double)))-n; // number of vectors + } else { offset=0; + } memcpy(l2normTable+offset, l2buf, n*sizeof(double)); if(l2buf) delete[] l2buf;