Mercurial > hg > constant-q-cpp
changeset 8:68f673176a6c
Normalisation -- now it *really* matches the toolbox
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Fri, 25 Oct 2013 14:38:17 +0100 |
parents | 3cbf89635f34 |
children | c339dc95a7bd |
files | yeti/cqtkernel.yeti |
diffstat | 1 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/yeti/cqtkernel.yeti Fri Oct 25 12:49:04 2013 +0100 +++ b/yeti/cqtkernel.yeti Fri Oct 25 14:38:17 2013 +0100 @@ -97,11 +97,22 @@ kmat = cm.toSparse (cm.scaled (1/fftLen) - (cm.newComplexMatrix (ColumnMajor()) (concat kernels))); // or row major? + (cm.newComplexMatrix (RowMajor()) (concat kernels))); println "density = \(cm.density kmat)"; -kmat; +// Normalisation +wx1 = bf.maxindex (complex.magnitudes (cm.getRow 0 kmat)); +wx2 = bf.maxindex (complex.magnitudes (cm.getRow (cm.height kmat - 1) kmat)); +subset = cm.columnSlice kmat wx1 (wx2+1); +square = cm.product (cm.conjugateTransposed subset) subset; +diag = complex.magnitudes (cm.getDiagonal 0 square); +wK = vec.slice diag (round(1/q)) (vec.length diag - round(1/q) - 2); +weight = (fftHop / fftLen) / (bf.mean (bf.abs wK)); +weight = sqrt(weight); + +cm.scaled weight kmat; +