From 133b3496e831a707f5608b5aaef323c5d97feff3 Mon Sep 17 00:00:00 2001 From: Vladimir Chalupecky Date: Mon, 10 Feb 2020 23:47:35 +0100 Subject: [PATCH] testlapack: add equalGeneral helper --- lapack/testlapack/general.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lapack/testlapack/general.go b/lapack/testlapack/general.go index 96a16f54..861698ae 100644 --- a/lapack/testlapack/general.go +++ b/lapack/testlapack/general.go @@ -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 {