func DownSample(x []float64, n int) []float64 {
	if len(x)%n != 0 {
		panic(fmt.Sprintf("len(x) (%d) is not an integer multiple of n (%d)", len(x), n))
	}
	x1 := make([]float64, len(x)/n)
	for i, j := 0, 0; j < len(x1); i, j = i+n, j+1 {
		x1[j] = x[i]
	}
	return x1
}
/*
DownSample returns x downsampled by n
Function panics if len(x) is not an integer multiple of n.
package godsp
import (
	"bufio"
	"bytes"
	"fmt"
	"io/ioutil"
	"math"
	"strconv"
	"strings"
	myioutil "github.com/goccmack/goutil/ioutil"
)
func Abs(x []float64) []float64 {
	x1 := make([]float64, len(x))
	for i, f := range x {
		x1[i] = math.Abs(f)
	}
	return x1
}
func AbsInt(x []int) []int {
	x1 := make([]int, len(x))
	for i, e := range x {
		if e < 0 {
			x1[i] = -e
		} else {
			x1[i] = e
		}
	}
	return x1
}
func AbsAll(X [][]float64) [][]float64 {
	x1 := make([][]float64, len(X))
	for i, x := range X {
		x1[i] = Abs(x)
	}
	return x1
}
func Average(x []float64) float64 {
	return Sum(x) / float64(len(x))
}
func DivS(x []float64, s float64) []float64 {
	y := make([]float64, len(x))
	for i := range x {
		y[i] = x[i] / s
	}
	return y
}
func DownSampleAll(xs [][]float64) [][]float64 {
	N := len(xs[0])
	for _, x := range xs {
		if len(x) < N {
			N = len(x)
		}
	}
	ys := make([][]float64, len(xs))
	for i, x := range xs {
		ys[i] = DownSample(x, len(x)/N)
	}
	return ys
}