nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: gonum/gonum
Pull request #1693 (2021-07-02 06:54:25)

A+C: add Will Tekulve
Please take a look.

<!--
Checklist:

- API changes have been discussed
- code is goformated correctly (goimports)
- packages with generated code have had code generation run
- tests pass locally
- linked to relevant issues

Please make sure your commit message summary line and pull request
title match the Go convention; a one-line summary of the change,
prefixed by the primary affected package that should complete the
sentence, "This change modifies Gonum to _____."
-->



Patch:
diff --git a/AUTHORS b/AUTHORS
index 31a9d386..ac89e14e 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -110,6 +110,7 @@ Tobin Harding <me@tobin.cc>
 Valentin Deleplace <deleplace2015@gmail.com>
 Vincent Thiery <vjmthiery@gmail.com>
 Vladimír Chalupecký <vladimir.chalupecky@gmail.com>
+Will Tekulve <tekulve.will@gmail.com>
 Yevgeniy Vahlis <evahlis@gmail.com>
 Yucheng Zhu <zyctc000@gmail.com>
 Zoe Juozapaitis
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 2777ee30..3e255d3c 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -113,6 +113,7 @@ Tobin Harding <me@tobin.cc>
 Valentin Deleplace <deleplace2015@gmail.com>
 Vincent Thiery <vjmthiery@gmail.com>
 Vladimír Chalupecký <vladimir.chalupecky@gmail.com>
+Will Tekulve <tekulve.will@gmail.com>
 Yevgeniy Vahlis <evahlis@gmail.com>
 Yucheng Zhu <zyctc000@gmail.com>
 Zoe Juozapaitis


Test patch:
diff --git a/stat/stat_example_test.go b/stat/stat_example_test.go
index 9d6e7d00..f1f7241a 100644
--- a/stat/stat_example_test.go
+++ b/stat/stat_example_test.go
@@ -34,12 +34,12 @@ func ExampleLinearRegression() {
 	alpha, beta := stat.LinearRegression(xs, ys, weights, origin)
 	r2 := stat.RSquared(xs, ys, weights, alpha, beta)
 
-	fmt.Printf("Estimated slope is:  %.6f\n", alpha)
-	fmt.Printf("Estimated offset is: %.6f\n", beta)
+	fmt.Printf("Estimated offset is: %.6f\n", alpha)
+	fmt.Printf("Estimated slope is:  %.6f\n", beta)
 	fmt.Printf("R^2: %.6f\n", r2)
 
 	// Output:
-	// Estimated slope is:  0.988572
-	// Estimated offset is: 3.000154
+	// Estimated offset is: 0.988572
+	// Estimated slope is:  3.000154
 	// R^2: 0.999999
 }
Repository: gonum/gonum
Pull request #1722 (2021-09-19 18:04:14)

stat/distuv: improve Pareto.Rand performance, also adding Pareto.Rand benchmark
Please take a look.

Just removes an unnecessary math.Log call.

benchstat:
```
name        old time/op  new time/op  delta
ParetoRand  38.0ns ± 8%  24.4ns ± 2%  -35.72%  (p=0.000 n=9+10)
```


Patch:
diff --git a/stat/distuv/pareto.go b/stat/distuv/pareto.go
index b6aafae0..b29abacb 100644
--- a/stat/distuv/pareto.go
+++ b/stat/distuv/pareto.go
@@ -104,7 +104,7 @@ func (p Pareto) Rand() float64 {
 	} else {
 		rnd = rand.New(p.Src).ExpFloat64()
 	}
-	return math.Exp(math.Log(p.Xm) + 1/p.Alpha*rnd)
+	return p.Xm * math.Exp(rnd/p.Alpha)
 }
 
 // StdDev returns the standard deviation of the probability distribution.


Test patch:
diff --git a/stat/distuv/pareto_test.go b/stat/distuv/pareto_test.go
index e7bb8d1a..6bc8805a 100644
--- a/stat/distuv/pareto_test.go
+++ b/stat/distuv/pareto_test.go
@@ -204,3 +204,11 @@ func TestParetoNotExists(t *testing.T) {
 		t.Errorf("Expected standard deviation == +Inf for Alpha == 1, got %v", stdDev)
 	}
 }
+
+func BenchmarkParetoRand(b *testing.B) {
+	src := rand.New(rand.NewSource(1))
+	p := Pareto{1, 1, src}
+	for i := 0; i < b.N; i++ {
+		p.Rand()
+	}
+}