Go语言版:离散正弦变换与离散余弦变换及其逆变换
func dst(in []float64) []float64 { out := make([]float64, len(in)) nr := len(in) for i := 0; i < nr; i++ { for j := 0; j < nr; j++ { tmp := (float64(i) + 0.5) * (float64(j) + 0.5) / float64(nr) out[i] += in[j] * math.Sin(tmp*math.Pi) } } return out } func idst(in []float64) []float64 { out := dst(in) for i, v := range out { out[i] = v * 2 / float64...阅读全文