# HG changeset patch
# User Chris Cannam
# Date 1538482533 -3600
# Node ID 7ec763dc767cd9beb5bc56ba3d15f010322a66b8
# Parent 3b2fed77a6cfb6793857a7005ede60e1ede8dff6
Indent
diff -r 3b2fed77a6cf -r 7ec763dc767c FChTransformUtils.cpp
--- a/FChTransformUtils.cpp Tue Oct 02 13:14:21 2018 +0100
+++ b/FChTransformUtils.cpp Tue Oct 02 13:15:33 2018 +0100
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see .
- */
+*/
#include "FChTransformUtils.h"
@@ -22,60 +22,58 @@
void cumtrapz(const double *x, const double *y, size_t N, double *accum)
/*Trapezoidal Integrator: 1/2(b-a)(F(a)+F(b))*/
{
-
-accum[0]=0.0;
-for (size_t i = 1; i < N; i++) {
- accum[i]=accum[i-1]+0.5*(x[i]-x[i-1])*(y[i]+y[i-1]);
-}
-
+ accum[0]=0.0;
+ for (size_t i = 1; i < N; i++) {
+ accum[i]=accum[i-1]+0.5*(x[i]-x[i-1])*(y[i]+y[i-1]);
+ }
}
void interp1(const double *x1, const double *y1, size_t N1, const double *x2, double *y2, size_t N2){
/*1-D linear interpolation*/
- for (size_t i = 0; i < N2; i++) {
- /*Smaller or equal than the smallest, or larger or equal than the largest.*/
- if ( x2[i] <= x1[0] ) {
- y2[i] = y1[0];
- } else if ( x2[i] >= x1[N1-1] ) {
- y2[i] = y1[N1-1];
- } else {
- /*Search every value of x2 in x1*/
- size_t j = 1;
- size_t salir = 0;
- while ((j= x1[N1-1] ) {
+ y2[i] = y1[N1-1];
+ } else {
+ /*Search every value of x2 in x1*/
+ size_t j = 1;
+ size_t salir = 0;
+ while ((j