Function Determinant calculates wrong values for matrices of dimension 1x1, 4x4, 5x5 and larger. Here's sample code describing my issue.
mat1x1 := [][]float64{
[]float64{5},
}
fmt.Println(matrix.Determinant(mat1x1))
// Prints 0, expected 5
mat4x4 := [][]float64{
[]float64{2, 4, 3, 7},
[]float64{6, 5, 9, 9},
[]float64{9, 3, 6, 7},
[]float64{7, 4, 2, 8},
}
fmt.Println(matrix.Determinant(mat4x4))
// Prints 297, expected -77
mat5x5 := [][]float64{
[]float64{2, 4, 3, 7, 6},
[]float64{5, 9, 9, 9, 3},
[]float64{6, 7, 7, 4, 2},
[]float64{8, 2, 4, 6, 0},
[]float64{1, 5, 2, 6, 8},
}
fmt.Println(matrix.Determinant(mat5x5))
// Prints -16188, expected -1092