Skip to content

Commit

Permalink
added IncrMod as gorgonia now supports Mod
Browse files Browse the repository at this point in the history
  • Loading branch information
chewxy committed Jul 23, 2017
1 parent a106a75 commit 1f59516
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion incr.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func IncrDiv(a, b, incr []float32) {
}
}

// IncrDiv performs a̅ ÷ b̅. a̅ will be clobbered
// IncrDiv performs a̅ ÷ b̅. then adds it to incr
func IncrPow(a, b, incr []float32) {
a = a[:len(a)]
b = b[:len(a)]
Expand All @@ -66,6 +66,17 @@ func IncrPow(a, b, incr []float32) {
}
}

// IncrMod performs a̅ % b̅ then adds it to incr
func IncrMod(a, b, incr []float32) {
a = a[:len(a)]
b = b[:len(a)]
incr = incr[:len(a)]

for i, v := range a {
incr[i] += math32.Mod(v, b[i])
}
}

// Scale multiplies all values in the slice by the scalar and then increments the incr slice
// incr += a̅ * s
func IncrScale(a []float32, s float32, incr []float32) {
Expand Down

0 comments on commit 1f59516

Please sign in to comment.