Mercurial > hg > qm-dsp
changeset 79:054c384d860d
* Solaris build fixes
author | cannam |
---|---|
date | Mon, 14 Sep 2009 13:01:44 +0000 |
parents | 0965d2af5213 |
children | a5eae96a357c |
files | base/Pitch.cpp dsp/tempotracking/TempoTrackV2.cpp hmm/hmm.c maths/MathUtilities.cpp maths/MathUtilities.h maths/nan-inf.h qm-dsp.pro |
diffstat | 7 files changed, 46 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/base/Pitch.cpp Thu Jun 25 13:35:34 2009 +0000 +++ b/base/Pitch.cpp Mon Sep 14 13:01:44 2009 +0000 @@ -9,7 +9,7 @@ #include "Pitch.h" -#include <cmath> +#include <math.h> float Pitch::getFrequencyForPitch(int midiPitch,
--- a/dsp/tempotracking/TempoTrackV2.cpp Thu Jun 25 13:35:34 2009 +0000 +++ b/dsp/tempotracking/TempoTrackV2.cpp Mon Sep 14 13:01:44 2009 +0000 @@ -87,8 +87,9 @@ void -TempoTrackV2::calculateBeatPeriod(const d_vec_t &df, d_vec_t &beat_period, - d_vec_t &tempi) +TempoTrackV2::calculateBeatPeriod(const vector<double> &df, + vector<double> &beat_period, + vector<double> &tempi) { // to follow matlab.. split into 512 sample frames with a 128 hop size // calculate the acf, @@ -392,8 +393,9 @@ } void -TempoTrackV2::calculateBeats(const d_vec_t &df, const d_vec_t &beat_period, - d_vec_t &beats) +TempoTrackV2::calculateBeats(const vector<double> &df, + const vector<double> &beat_period, + vector<double> &beats) { if (df.empty() || beat_period.empty()) return;
--- a/hmm/hmm.c Thu Jun 25 13:35:34 2009 +0000 +++ b/hmm/hmm.c Mon Sep 14 13:01:44 2009 +0000 @@ -15,6 +15,8 @@ #include <clapack.h> /* LAPACK for matrix inversion */ +#include "maths/nan-inf.h" + #ifdef ATLAS_ORDER #define HAVE_ATLAS 1 #endif @@ -216,7 +218,7 @@ fprintf(stderr, "re-estimation...\n"); fflush(stderr); */ - if (isnan(loglik)) { + if (ISNAN(loglik)) { foundnan = 1; continue; } @@ -339,16 +341,16 @@ cov[d][e] /= sum_sum_gamma; - if (isnan(cov[d][e])) + if (ISNAN(cov[d][e])) { printf("cov[%d][%d] was nan\n", d, e); for (j = 0; j < N; j++) for (i = 0; i < L; i++) - if (isnan(mu[j][i])) + if (ISNAN(mu[j][i])) printf("mu[%d][%d] was nan\n", j, i); for (t = 0; t < T; t++) for (j = 0; j < N; j++) - if (isnan(gamma[t][j])) + if (ISNAN(gamma[t][j])) printf("gamma[%d][%d] was nan\n", t, j); exit(-1); } @@ -783,11 +785,11 @@ /* // TEST - if (isinf(ret) > 0) + if (ISINF(ret) > 0) printf("loggauss returning infinity\n"); - if (isinf(ret) < 0) + if (ISINF(ret) < 0) printf("loggauss returning -infinity\n"); - if (isnan(ret)) + if (ISNAN(ret)) printf("loggauss returning nan\n"); */
--- a/maths/MathUtilities.cpp Thu Jun 25 13:35:34 2009 +0000 +++ b/maths/MathUtilities.cpp Mon Sep 14 13:01:44 2009 +0000 @@ -41,7 +41,7 @@ { temp = data[ i ]; - a += ::pow( fabs(temp), alpha ); + a += ::pow( fabs(temp), double(alpha) ); } a /= ( double )len; a = ::pow( a, ( 1.0 / (double) alpha ) ); @@ -60,7 +60,7 @@ { temp = data[ i ]; - a += ::pow( fabs(temp), alpha ); + a += ::pow( fabs(temp), double(alpha) ); } a /= ( double )len; a = ::pow( a, ( 1.0 / (double) alpha ) );
--- a/maths/MathUtilities.h Thu Jun 25 13:35:34 2009 +0000 +++ b/maths/MathUtilities.h Mon Sep 14 13:01:44 2009 +0000 @@ -13,6 +13,8 @@ #include <vector> +#include "nan-inf.h" + class MathUtilities { public:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maths/nan-inf.h Mon Sep 14 13:01:44 2009 +0000 @@ -0,0 +1,20 @@ + +#ifndef NAN_INF_H +#define NAN_INF_H + +#include <math.h> + +#ifdef sun + +#include <ieeefp.h> +#define ISNAN(x) ((sizeof(x)==sizeof(float))?isnanf(x):isnand(x)) +#define ISINF(x) (!finite(x)) + +#else + +#define ISNAN(x) isnan(x) +#define ISINF(x) isinf(x) + +#endif + +#endif
--- a/qm-dsp.pro Thu Jun 25 13:35:34 2009 +0000 +++ b/qm-dsp.pro Mon Sep 14 13:01:44 2009 +0000 @@ -31,6 +31,12 @@ QMAKE_CXXFLAGS_RELEASE += -fvisibility=hidden } +solaris* { + QMAKE_CXXFLAGS_RELEASE += -DNDEBUG -fast + INCLUDEPATH += /opt/ATLAS3.9.14/include + DEFINES += USE_PTHREADS +} + INCLUDEPATH += . # Input