import "github.com/hrautila/matrix" func main() { // Create a 2x2 matrix mat := matrix.FloatMatrixFromTable(2, 2, []float64{1, 2, 3, 4}) // Get the rows of the matrix rows := mat.Rows() // Print the rows fmt.Println(rows) }
[[1 2] [3 4]]
import "github.com/hrautila/matrix" func main() { // Create a 3x3 matrix mat := matrix.FloatMatrixFromTable(3, 3, []float64{1, 2, 3, 4, 5, 6, 7, 8, 9}) // Get the rows of the matrix rows := mat.Rows() // Print the first row fmt.Println(rows[0]) }
[1 2 3]In both examples, we create a matrix using the `FloatMatrixFromTable` method and then use the `Rows` method to get the rows of the matrix. We then print the rows to the console in different ways. This package library helps in performing matrix operations in a Go program.