[med-svn] [SCM] aghermann branch, master, updated. 83bfc7bafe1055d29be61afe3e8ec4482539aa1d
Andrei Zavada
johnhommer at gmail.com
Thu Nov 22 23:45:48 UTC 2012
The following commit has been merged in the master branch:
commit 3737c7f04e587865831a848886476bbf5de6b7e9
Author: Andrei Zavada <johnhommer at gmail.com>
Date: Sat Nov 17 23:26:45 2012 +0200
new function sigproc::derivative
diff --git a/src/sigproc/sigproc.cc b/src/sigproc/sigproc.cc
index 3a28440..395e598 100644
--- a/src/sigproc/sigproc.cc
+++ b/src/sigproc/sigproc.cc
@@ -22,6 +22,7 @@ using namespace std;
template void sigproc::smooth( valarray<TFloat>&, size_t);
template void sigproc::normalize( valarray<TFloat>&);
+template valarray<TFloat> sigproc::derivative( const valarray<TFloat>&);
template size_t sigproc::envelope( const valarray<TFloat>&, size_t, size_t, double, valarray<TFloat>&, valarray<TFloat>&, vector<size_t>*, vector<size_t>*);
template valarray<TFloat> sigproc::dzcdf( const valarray<TFloat>&, size_t, float, float, size_t);
template sigproc::CPattern<TFloat>::CPattern( const valarray<TFloat>&, size_t, size_t, size_t, const SPatternParamPack&, float, float, float);
diff --git a/src/sigproc/sigproc.hh b/src/sigproc/sigproc.hh
index f658265..d354fad 100644
--- a/src/sigproc/sigproc.hh
+++ b/src/sigproc/sigproc.hh
@@ -39,6 +39,10 @@ template <typename T>
void
normalize( valarray<T>&);
+template <typename T>
+valarray<T>
+derivative( const valarray<T>&);
+
valarray<float>
resample_f( const valarray<float>&,
diff --git a/src/sigproc/sigproc.ii b/src/sigproc/sigproc.ii
index f7c6c2b..700d07f 100644
--- a/src/sigproc/sigproc.ii
+++ b/src/sigproc/sigproc.ii
@@ -12,6 +12,7 @@
extern template void smooth( valarray<TFloat>&, size_t);
extern template void normalize( valarray<TFloat>&);
+extern template valarray<TFloat> derivative( const valarray<TFloat>&);
extern template size_t envelope( const valarray<TFloat>&, size_t, size_t, float, valarray<TFloat>&, valarray<TFloat>&, vector<size_t>*, vector<size_t>*);
extern template valarray<TFloat> dzcdf( const valarray<TFloat>&, size_t, float, float, size_t);
extern template CPattern<TFloat>::CPattern( const valarray<TFloat>&, size_t, size_t, size_t, const SPatternParamPack&, float, float, float);
@@ -53,6 +54,18 @@ normalize( valarray<T>& a)
}
+template <typename T>
+valarray<T>
+derivative( const valarray<T>& a)
+{
+ valarray<T> out (a.size());
+ for ( size_t i = 1; i < a.size(); ++i )
+ out[i-1] = a[i] - a[i-1];
+ return out;
+}
+
+
+
--
Sleep experiment manager
More information about the debian-med-commit
mailing list