Skip to content

Commit

Permalink
cache-friendly in simple linear regression
Browse files Browse the repository at this point in the history
  • Loading branch information
templexxx committed Feb 19, 2022
1 parent 4c4d930 commit a336b4f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tsc_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,11 @@ func Calibrate() {
func simpleLinearRegression(tscs, syss []float64) (coeff float64, offset int64) {

tmean, wmean := float64(0), float64(0)
for i := range tscs {
tmean += tscs[i]
wmean += syss[i]
for _, i := range tscs {
tmean += i
}
for _, i := range syss {
wmean += i
}
tmean = tmean / float64(len(tscs))
wmean = wmean / float64(len(syss))
Expand Down

0 comments on commit a336b4f

Please sign in to comment.