1 // Copyright ©2015 The Gonum Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
10 "gonum.org/v1/gonum/mat"
13 func ExampleSymDense_SubsetSym() {
15 s := mat.NewSymDense(5, nil)
17 for i := 0; i < n; i++ {
18 for j := i; j < n; j++ {
23 fmt.Println("Original matrix:")
24 fmt.Printf("%0.4v\n\n", mat.Formatted(s))
26 // Take the subset {0, 2, 4}
28 sub.SubsetSym(s, []int{0, 2, 4})
29 fmt.Println("Subset {0, 2, 4}")
30 fmt.Printf("%0.4v\n\n", mat.Formatted(&sub))
32 // Take the subset {0, 0, 4}
33 sub.SubsetSym(s, []int{0, 0, 4})
34 fmt.Println("Subset {0, 0, 4}")
35 fmt.Printf("%0.4v\n\n", mat.Formatted(&sub))