| 145 | } |
| 146 | |
| 147 | func TestMatrixColumns(t *testing.T) { |
| 148 | // Create a sample matrix |
| 149 | data := [][]int{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}} |
| 150 | matrix, err := matrix.NewFromElements(data) |
| 151 | if err != nil { |
| 152 | t.Fatalf("Failed to copy matrix: %v", err) |
| 153 | } |
| 154 | // Check the number of columns |
| 155 | expectedColumns := len(data[0]) |
| 156 | columns := matrix.Columns() |
| 157 | if columns != expectedColumns { |
| 158 | t.Errorf("Expected %d columns, but got %d", expectedColumns, columns) |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | func TestMatrixEmptyRowsAndColumns(t *testing.T) { |
| 163 | // Create an empty matrix |