mirror of
https://github.com/gonum/gonum.git
synced 2025-10-18 21:15:23 +08:00
Change NewDense signature and behaviour
This is an API breaking change. NewDense now panics if len(mat) != r*c, unless mat == nil. When mat is nil a new, correctly sized slice is allocated.
This commit is contained in:
@@ -19,22 +19,22 @@ func (s *S) TestLUD(c *check.C) {
|
||||
sign int
|
||||
}{
|
||||
{ // This is a hard coded equivalent of the approach used in the Jama LU test.
|
||||
a: mustDense(NewDense(3, 3, []float64{
|
||||
a: NewDense(3, 3, []float64{
|
||||
0, 2, 3,
|
||||
4, 5, 6,
|
||||
7, 8, 9,
|
||||
})),
|
||||
}),
|
||||
|
||||
l: mustDense(NewDense(3, 3, []float64{
|
||||
l: NewDense(3, 3, []float64{
|
||||
1, 0, 0,
|
||||
0, 1, 0,
|
||||
0.5714285714285714, 0.2142857142857144, 1,
|
||||
})),
|
||||
u: mustDense(NewDense(3, 3, []float64{
|
||||
}),
|
||||
u: NewDense(3, 3, []float64{
|
||||
7, 8, 9,
|
||||
0, 2, 3,
|
||||
0, 0, 0.2142857142857144,
|
||||
})),
|
||||
}),
|
||||
pivot: []int{
|
||||
2, // 0 0 1
|
||||
0, // 1 0 0
|
||||
@@ -78,22 +78,22 @@ func (s *S) TestLUDGaussian(c *check.C) {
|
||||
sign int
|
||||
}{
|
||||
{ // This is a hard coded equivalent of the approach used in the Jama LU test.
|
||||
a: mustDense(NewDense(3, 3, []float64{
|
||||
a: NewDense(3, 3, []float64{
|
||||
0, 2, 3,
|
||||
4, 5, 6,
|
||||
7, 8, 9,
|
||||
})),
|
||||
}),
|
||||
|
||||
l: mustDense(NewDense(3, 3, []float64{
|
||||
l: NewDense(3, 3, []float64{
|
||||
1, 0, 0,
|
||||
0, 1, 0,
|
||||
0.5714285714285714, 0.2142857142857144, 1,
|
||||
})),
|
||||
u: mustDense(NewDense(3, 3, []float64{
|
||||
}),
|
||||
u: NewDense(3, 3, []float64{
|
||||
7, 8, 9,
|
||||
0, 2, 3,
|
||||
0, 0, 0.2142857142857144,
|
||||
})),
|
||||
}),
|
||||
pivot: []int{
|
||||
2, // 0 0 1
|
||||
0, // 1 0 0
|
||||
|
Reference in New Issue
Block a user