type mat struct { offs []int cols []int vals []float32 } func yatx(y []float32, a *mat, x []float32) { lo := a.offs[0] for row, hi := range a.offs[1:] { sum := y[row] for ; lo < hi; lo++ { col := a.cols[lo] val := a.vals[lo] sum += val * x[col] } y[row] = sum } } func yax(y []float32, a *mat, x []float32) { lo := a.offs[0] for col, hi := range a.offs[1:] { x := x[col] for ; lo < hi; lo++ { row := a.cols[lo] val := a.vals[lo] y[row] += val * x } } }
To receive a hint, submit unfixed code.