dsp/window: clean up doc formatting

This commit is contained in:
Dan Kortschak
2021-04-10 11:58:01 +09:30
parent c297b7e2de
commit eae7c2a69e
3 changed files with 50 additions and 30 deletions

View File

@@ -6,7 +6,8 @@ package window
import "math" import "math"
// Rectangular modifies seq in place by the Rectangular window and returns the result. // Rectangular modifies seq in place by the Rectangular window and returns
// the result.
// See https://en.wikipedia.org/wiki/Window_function#Rectangular_window and // See https://en.wikipedia.org/wiki/Window_function#Rectangular_window and
// https://www.recordingblogs.com/wiki/rectangular-window for details. // https://www.recordingblogs.com/wiki/rectangular-window for details.
// //
@@ -66,7 +67,8 @@ func Lanczos(seq []float64) []float64 {
return seq return seq
} }
// Triangular modifies seq in place by the Triangular window and returns the result. // Triangular modifies seq in place by the Triangular window and returns
// the result.
// See https://en.wikipedia.org/wiki/Window_function#Triangular_window and // See https://en.wikipedia.org/wiki/Window_function#Triangular_window and
// https://www.recordingblogs.com/wiki/triangular-window for details. // https://www.recordingblogs.com/wiki/triangular-window for details.
// //
@@ -104,7 +106,8 @@ func Hann(seq []float64) []float64 {
return seq return seq
} }
// BartlettHann modifies seq in place by the Bartlett-Hann window and returns result. // BartlettHann modifies seq in place by the Bartlett-Hann window and returns
// result.
// See https://en.wikipedia.org/wiki/Window_function#Bartlett%E2%80%93Hann_window // See https://en.wikipedia.org/wiki/Window_function#Bartlett%E2%80%93Hann_window
// and https://www.recordingblogs.com/wiki/bartlett-hann-window for details. // and https://www.recordingblogs.com/wiki/bartlett-hann-window for details.
// //
@@ -154,7 +157,8 @@ func Hamming(seq []float64) []float64 {
return seq return seq
} }
// Blackman modifies seq in place by the Blackman window and returns the result. // Blackman modifies seq in place by the Blackman window and returns the
// result.
// See https://en.wikipedia.org/wiki/Window_function#Blackman_window and // See https://en.wikipedia.org/wiki/Window_function#Blackman_window and
// https://www.recordingblogs.com/wiki/blackman-window for details. // https://www.recordingblogs.com/wiki/blackman-window for details.
// //
@@ -180,7 +184,8 @@ func Blackman(seq []float64) []float64 {
return seq return seq
} }
// BlackmanHarris modifies seq in place by the Blackman-Harris window and returns the result. // BlackmanHarris modifies seq in place by the Blackman-Harris window and
// returns the result.
// See https://en.wikipedia.org/wiki/Window_function#Blackman%E2%80%93Harris_window // See https://en.wikipedia.org/wiki/Window_function#Blackman%E2%80%93Harris_window
// and https://www.recordingblogs.com/wiki/blackman-harris-window for details. // and https://www.recordingblogs.com/wiki/blackman-harris-window for details.
// //
@@ -236,7 +241,8 @@ func Nuttall(seq []float64) []float64 {
return seq return seq
} }
// BlackmanNuttall modifies seq in place by the Blackman-Nuttall window and returns the result. // BlackmanNuttall modifies seq in place by the Blackman-Nuttall window and
// returns the result.
// See https://en.wikipedia.org/wiki/Window_function#Blackman%E2%80%93Nuttall_window // See https://en.wikipedia.org/wiki/Window_function#Blackman%E2%80%93Nuttall_window
// and https://www.recordingblogs.com/wiki/blackman-nuttall-window for details. // and https://www.recordingblogs.com/wiki/blackman-nuttall-window for details.
// //
@@ -264,7 +270,8 @@ func BlackmanNuttall(seq []float64) []float64 {
return seq return seq
} }
// FlatTop modifies seq in place by the Flat Top window and returns the result. // FlatTop modifies seq in place by the Flat Top window and returns the
// result.
// See https://en.wikipedia.org/wiki/Window_function#Flat_top_window and // See https://en.wikipedia.org/wiki/Window_function#Flat_top_window and
// https://www.recordingblogs.com/wiki/flat-top-window for details. // https://www.recordingblogs.com/wiki/flat-top-window for details.
// //

View File

@@ -6,7 +6,8 @@ package window
import "math" import "math"
// Rectangular modifies seq in place by the Rectangular window and returns the result. // Rectangular modifies seq in place by the Rectangular window and returns
// the result.
// See https://en.wikipedia.org/wiki/Window_function#Rectangular_window and // See https://en.wikipedia.org/wiki/Window_function#Rectangular_window and
// https://www.recordingblogs.com/wiki/rectangular-window for details. // https://www.recordingblogs.com/wiki/rectangular-window for details.
// //
@@ -23,7 +24,8 @@ func RectangularComplex(seq []complex128) []complex128 {
return seq return seq
} }
// SineComplex modifies seq in place by the Sine window and returns the result. // SineComplex modifies seq in place by the Sine window and returns the
// result.
// See https://en.wikipedia.org/wiki/Window_function#Sine_window and // See https://en.wikipedia.org/wiki/Window_function#Sine_window and
// https://www.recordingblogs.com/wiki/sine-window for details. // https://www.recordingblogs.com/wiki/sine-window for details.
// //
@@ -43,7 +45,8 @@ func SineComplex(seq []complex128) []complex128 {
return seq return seq
} }
// LanczosComplex modifies seq in place by the Lanczos window and returns the result. // LanczosComplex modifies seq in place by the Lanczos window and returns
// the result.
// See https://en.wikipedia.org/wiki/Window_function#Lanczos_window and // See https://en.wikipedia.org/wiki/Window_function#Lanczos_window and
// https://www.recordingblogs.com/wiki/lanczos-window for details. // https://www.recordingblogs.com/wiki/lanczos-window for details.
// //
@@ -68,7 +71,8 @@ func LanczosComplex(seq []complex128) []complex128 {
return seq return seq
} }
// TriangularComplex modifies seq in place by the Triangular window and returns the result. // TriangularComplex modifies seq in place by the Triangular window and
// returns the result.
// See https://en.wikipedia.org/wiki/Window_function#Triangular_window and // See https://en.wikipedia.org/wiki/Window_function#Triangular_window and
// https://www.recordingblogs.com/wiki/triangular-window for details. // https://www.recordingblogs.com/wiki/triangular-window for details.
// //
@@ -108,7 +112,8 @@ func HannComplex(seq []complex128) []complex128 {
return seq return seq
} }
// BartlettHannComplex modifies seq in place by the Bartlett-Hann window and returns result. // BartlettHannComplex modifies seq in place by the Bartlett-Hann window
// and returns result.
// See https://en.wikipedia.org/wiki/Window_function#Bartlett%E2%80%93Hann_window // See https://en.wikipedia.org/wiki/Window_function#Bartlett%E2%80%93Hann_window
// and https://www.recordingblogs.com/wiki/bartlett-hann-window for details. // and https://www.recordingblogs.com/wiki/bartlett-hann-window for details.
// //
@@ -134,7 +139,8 @@ func BartlettHannComplex(seq []complex128) []complex128 {
return seq return seq
} }
// HammingComplex modifies seq in place by the Hamming window and returns the result. // HammingComplex modifies seq in place by the Hamming window and returns
// the result.
// See https://en.wikipedia.org/wiki/Window_function#Hann_and_Hamming_windows // See https://en.wikipedia.org/wiki/Window_function#Hann_and_Hamming_windows
// and https://www.recordingblogs.com/wiki/hamming-window for details. // and https://www.recordingblogs.com/wiki/hamming-window for details.
// //
@@ -160,7 +166,8 @@ func HammingComplex(seq []complex128) []complex128 {
return seq return seq
} }
// BlackmanComplex modifies seq in place by the Blackman window and returns the result. // BlackmanComplex modifies seq in place by the Blackman window and returns
// the result.
// See https://en.wikipedia.org/wiki/Window_function#Blackman_window and // See https://en.wikipedia.org/wiki/Window_function#Blackman_window and
// https://www.recordingblogs.com/wiki/blackman-window for details. // https://www.recordingblogs.com/wiki/blackman-window for details.
// //
@@ -187,7 +194,8 @@ func BlackmanComplex(seq []complex128) []complex128 {
return seq return seq
} }
// BlackmanHarrisComplex modifies seq in place by the Blackman-Harris window and returns the result. // BlackmanHarrisComplex modifies seq in place by the Blackman-Harris window
// and returns the result.
// See https://en.wikipedia.org/wiki/Window_function#Blackman%E2%80%93Harris_window // See https://en.wikipedia.org/wiki/Window_function#Blackman%E2%80%93Harris_window
// and https://www.recordingblogs.com/wiki/blackman-harris-window for details. // and https://www.recordingblogs.com/wiki/blackman-harris-window for details.
// //
@@ -216,7 +224,8 @@ func BlackmanHarrisComplex(seq []complex128) []complex128 {
return seq return seq
} }
// NuttallComplex modifies seq in place by the Nuttall window and returns the result. // NuttallComplex modifies seq in place by the Nuttall window and returns
// the result.
// See https://en.wikipedia.org/wiki/Window_function#Nuttall_window,_continuous_first_derivative // See https://en.wikipedia.org/wiki/Window_function#Nuttall_window,_continuous_first_derivative
// and https://www.recordingblogs.com/wiki/nuttall-window for details. // and https://www.recordingblogs.com/wiki/nuttall-window for details.
// //
@@ -245,7 +254,8 @@ func NuttallComplex(seq []complex128) []complex128 {
return seq return seq
} }
// BlackmanNuttallComplex modifies seq in place by the Blackman-Nuttall window and returns the result. // BlackmanNuttallComplex modifies seq in place by the Blackman-Nuttall
// window and returns the result.
// See https://en.wikipedia.org/wiki/Window_function#Blackman%E2%80%93Nuttall_window // See https://en.wikipedia.org/wiki/Window_function#Blackman%E2%80%93Nuttall_window
// and https://www.recordingblogs.com/wiki/blackman-nuttall-window for details. // and https://www.recordingblogs.com/wiki/blackman-nuttall-window for details.
// //
@@ -274,7 +284,8 @@ func BlackmanNuttallComplex(seq []complex128) []complex128 {
return seq return seq
} }
// FlatTopComplex modifies seq in place by the Flat Top window and returns the result. // FlatTopComplex modifies seq in place by the Flat Top window and returns
// the result.
// See https://en.wikipedia.org/wiki/Window_function#Flat_top_window and // See https://en.wikipedia.org/wiki/Window_function#Flat_top_window and
// https://www.recordingblogs.com/wiki/flat-top-window for details. // https://www.recordingblogs.com/wiki/flat-top-window for details.
// //

View File

@@ -6,7 +6,8 @@ package window
import "math" import "math"
// Gaussian can modify a sequence using the Gaussian window and return the result. // Gaussian can modify a sequence using the Gaussian window and return the
// result.
// See https://en.wikipedia.org/wiki/Window_function#Gaussian_window // See https://en.wikipedia.org/wiki/Window_function#Gaussian_window
// and https://www.recordingblogs.com/wiki/gaussian-window for details. // and https://www.recordingblogs.com/wiki/gaussian-window for details.
// //
@@ -31,8 +32,8 @@ type Gaussian struct {
Sigma float64 Sigma float64
} }
// Transform applies the Gaussian transformation to seq in place, using the value // Transform applies the Gaussian transformation to seq in place, using the
// of the receiver as the sigma parameter, and returning the result. // value of the receiver as the sigma parameter, and returning the result.
func (g Gaussian) Transform(seq []float64) []float64 { func (g Gaussian) Transform(seq []float64) []float64 {
a := float64(len(seq)-1) / 2 a := float64(len(seq)-1) / 2
for i := range seq { for i := range seq {
@@ -42,8 +43,9 @@ func (g Gaussian) Transform(seq []float64) []float64 {
return seq return seq
} }
// TransformComplex applies the Gaussian transformation to seq in place, using the value // TransformComplex applies the Gaussian transformation to seq in place,
// of the receiver as the sigma parameter, and returning the result. // using the value of the receiver as the sigma parameter, and returning
// the result.
func (g Gaussian) TransformComplex(seq []complex128) []complex128 { func (g Gaussian) TransformComplex(seq []complex128) []complex128 {
a := float64(len(seq)-1) / 2 a := float64(len(seq)-1) / 2
for i, v := range seq { for i, v := range seq {
@@ -77,8 +79,8 @@ type Tukey struct {
Alpha float64 Alpha float64
} }
// Transform applies the Tukey transformation to seq in place, using the value // Transform applies the Tukey transformation to seq in place, using the
// of the receiver as the Alpha parameter, and returning the result // value of the receiver as the Alpha parameter, and returning the result.
func (t Tukey) Transform(seq []float64) []float64 { func (t Tukey) Transform(seq []float64) []float64 {
switch { switch {
case t.Alpha <= 0: case t.Alpha <= 0:
@@ -97,8 +99,8 @@ func (t Tukey) Transform(seq []float64) []float64 {
} }
} }
// TransformComplex applies the Tukey transformation to seq in place, using the value // TransformComplex applies the Tukey transformation to seq in place, using
// of the receiver as the Alpha parameter, and returning the result // the value of the receiver as the Alpha parameter, and returning the result.
func (t Tukey) TransformComplex(seq []complex128) []complex128 { func (t Tukey) TransformComplex(seq []complex128) []complex128 {
switch { switch {
case t.Alpha <= 0: case t.Alpha <= 0:
@@ -165,9 +167,9 @@ func (v Values) TransformTo(dst, src []float64) {
} }
} }
// TransformComplex applies the weights in the receiver to seq in place, returning // TransformComplex applies the weights in the receiver to seq in place,
// the result. If v is nil, TransformComplex is a no-op, otherwise the length of v // returning the result. If v is nil, TransformComplex is a no-op, otherwise
// must match the length of seq. // the length of v must match the length of seq.
func (v Values) TransformComplex(seq []complex128) []complex128 { func (v Values) TransformComplex(seq []complex128) []complex128 {
if v == nil { if v == nil {
return seq return seq