mirror of
https://github.com/gonum/gonum.git
synced 2025-10-20 05:54:41 +08:00
Add test fixture for weighted Harmonic Mean
Added a simple test case for weighted harmonic mean.
This commit is contained in:
@@ -321,6 +321,11 @@ func TestHarmonicMean(t *testing.T) {
|
||||
x: []float64{.5, .125},
|
||||
ans: .2,
|
||||
},
|
||||
{
|
||||
x: []float64{.5, .125},
|
||||
wts: []float64{2, 1},
|
||||
ans: .25,
|
||||
},
|
||||
} {
|
||||
c := HarmonicMean(test.x, test.wts)
|
||||
if math.Abs(c-test.ans) > 1e-14 {
|
||||
|
Reference in New Issue
Block a user