mirror of
https://github.com/gonum/gonum.git
synced 2025-10-05 15:16:59 +08:00
testlapack: add equalGeneral helper
This commit is contained in:

committed by
Vladimír Chalupecký

parent
1caee46e06
commit
133b3496e8
@@ -988,6 +988,21 @@ func equalApprox(m, n int, a []float64, lda int, b []float64, tol float64) bool
|
||||
return true
|
||||
}
|
||||
|
||||
// equalGeneral returns whether the general matrices a and b are equal.
|
||||
func equalGeneral(a, b blas64.General) bool {
|
||||
if a.Rows != b.Rows || a.Cols != b.Cols {
|
||||
panic("bad input")
|
||||
}
|
||||
for i := 0; i < a.Rows; i++ {
|
||||
for j := 0; j < a.Cols; j++ {
|
||||
if a.Data[i*a.Stride+j] != b.Data[i*b.Stride+j] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// equalApproxGeneral returns whether the general matrices a and b are
|
||||
// approximately equal within given tolerance.
|
||||
func equalApproxGeneral(a, b blas64.General, tol float64) bool {
|
||||
|
Reference in New Issue
Block a user