mirror of
https://github.com/gonum/gonum.git
synced 2025-10-24 15:43:07 +08:00
Added example for Cumprod
This commit is contained in:
@@ -92,3 +92,16 @@ func ExampleAddConst() {
|
|||||||
// Output:
|
// Output:
|
||||||
// s = [6 3 8 1]
|
// s = [6 3 8 1]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ExampleCumprod() {
|
||||||
|
s := []float64{1, -2, 3, -4}
|
||||||
|
dst := make([]float64, len(s))
|
||||||
|
|
||||||
|
Cumprod(dst, s)
|
||||||
|
|
||||||
|
fmt.Println("dst = ", dst)
|
||||||
|
fmt.Println("s = ", s)
|
||||||
|
// Output:
|
||||||
|
// dst = [1 -2 -6 24]
|
||||||
|
// s = [1 -2 3 -4]
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user