# HG changeset patch # User Chris Cannam # Date 1202906987 0 # Node ID a63c7b6191b5b46b1e5a48543a6287dd36e496ea # Parent 9aedf5ea8c3536221469828924a709172e4fddf7 * Add direct support for ATLAS version of CLAPACK diff -r 9aedf5ea8c35 -r a63c7b6191b5 dsp/segmentation/ClusterMeltSegmenter.cpp --- a/dsp/segmentation/ClusterMeltSegmenter.cpp Thu Feb 07 10:01:38 2008 +0000 +++ b/dsp/segmentation/ClusterMeltSegmenter.cpp Wed Feb 13 12:49:47 2008 +0000 @@ -112,13 +112,13 @@ int ClusterMeltSegmenter::getWindowsize() { - return static_cast(windowSize * samplerate); + return static_cast(windowSize * samplerate + 0.001); } int ClusterMeltSegmenter::getHopsize() { - return static_cast(hopSize * samplerate); + return static_cast(hopSize * samplerate + 0.001); } void ClusterMeltSegmenter::extractFeatures(const double* samples, int nsamples) diff -r 9aedf5ea8c35 -r a63c7b6191b5 hmm/hmm.c --- a/hmm/hmm.c Thu Feb 07 10:01:38 2008 +0000 +++ b/hmm/hmm.c Wed Feb 13 12:49:47 2008 +0000 @@ -12,7 +12,21 @@ #include #include #include /* to seed random number generator */ + #include /* LAPACK for matrix inversion */ + +#ifdef ATLAS_ORDER +#define HAVE_ATLAS 1 +#endif + +#ifdef HAVE_ATLAS +// Using ATLAS C interface to LAPACK +#define dgetrf_(m, n, a, lda, ipiv, info) \ + clapack_dgetrf(CblasColMajor, *m, *n, a, *lda, ipiv) +#define dgetri_(n, a, lda, ipiv, work, lwork, info) \ + clapack_dgetri(CblasColMajor, *n, a, *lda, ipiv) +#endif + #ifdef _MAC_OS_X #include #else @@ -671,9 +685,9 @@ for (i=0; i < L; i++) a[j*L+i] = cov[i][j]; - long M = (long) L; - long* ipiv = (long*) malloc(L*L*sizeof(int)); - long ret; + int M = (int) L; + int* ipiv = (int *) malloc(L*L*sizeof(int)); + int ret; /* LU decomposition */ ret = dgetrf_(&M, &M, a, &M, ipiv, &ret); /* ret should be zero, negative if cov is singular */ @@ -700,20 +714,24 @@ *detcov = det; /* allocate required working storage */ - long lwork = -1; - double lwbest; +#ifndef HAVE_ATLAS + int lwork = -1; + double lwbest = 0.0; dgetri_(&M, a, &M, ipiv, &lwbest, &lwork, &ret); - lwork = (long) lwbest; + lwork = (int) lwbest; double* work = (double*) malloc(lwork*sizeof(double)); +#endif /* find inverse */ dgetri_(&M, a, &M, ipiv, work, &lwork, &ret); - + for(j=0; j < L; j++) for (i=0; i < L; i++) icov[i][j] = a[j*L+i]; +#ifndef HAVE_ATLAS free(work); +#endif free(a); } diff -r 9aedf5ea8c35 -r a63c7b6191b5 qm-dsp.pro --- a/qm-dsp.pro Thu Feb 07 10:01:38 2008 +0000 +++ b/qm-dsp.pro Wed Feb 13 12:49:47 2008 +0000 @@ -17,7 +17,9 @@ # dsp/tempotracking \ # dsp/tonal \ # dsp/transforms -INCLUDEPATH += . include + +#INCLUDEPATH += . include +INCLUDEPATH += . # Input HEADERS += base/Pitch.h \