func generalFromSymmetric(a blas64.Symmetric) blas64.General {
	return blas64.General{
		Rows:   a.N,
		Cols:   a.N,
		Stride: a.Stride,
		Data:   a.Data,
	}
}
generalFromSymmetric returns a blas64.General with the backing
data and dimensions of a.
package mat
import (
	"gonum.org/v1/gonum/blas/blas64"
)
const (
	regionOverlap = "mat: bad region: overlap"
	regionIdentity = "mat: bad region: identical"
	mismatchedStrides = "mat: bad region: different strides"
)
func checkOverlap(a, b blas64.General) bool {
	if cap(a.Data) == 0 || cap(b.Data) == 0 {
		return false
	}
	off := offset(a.Data[:1], b.Data[:1])
	if off == 0 {
		if a.Cols == b.Cols && a.Rows == b.Rows && a.Stride == b.Stride {
			panic(regionIdentity)
		}
		panic(regionOverlap)
	}
	if off > 0 && len(a.Data) <= off {
		return false
	}
	if off < 0 && len(b.Data) <= -off {
		return false
	}
	if a.Stride != b.Stride {
		panic(mismatchedStrides)
	}
	if off < 0 {
		off = -off
		a.Cols, b.Cols = b.Cols, a.Cols
	}
	if rectanglesOverlap(off, a.Cols, b.Cols, a.Stride) {
		panic(regionOverlap)
	}
	return false
}
func (m *Dense) checkOverlap(a blas64.General) bool {
	return checkOverlap(m.RawMatrix(), a)
}
func (m *Dense) checkOverlapMatrix(a Matrix) bool {
	if m == a {
		return false
	}
	var amat blas64.General
	switch a := a.(type) {
	default:
		return false
	case RawMatrixer:
		amat = a.RawMatrix()
	case RawSymmetricer:
		amat = generalFromSymmetric(a.RawSymmetric())
	case RawTriangular:
		amat = generalFromTriangular(a.RawTriangular())
	}
	return m.checkOverlap(amat)
}
func (s *SymDense) checkOverlap(a blas64.General) bool {
	return checkOverlap(generalFromSymmetric(s.RawSymmetric()), a)
}
func (s *SymDense) checkOverlapMatrix(a Matrix) bool {
	if s == a {
		return false
	}
	var amat blas64.General
	switch a := a.(type) {
	default:
		return false
	case RawMatrixer:
		amat = a.RawMatrix()
	case RawSymmetricer:
		amat = generalFromSymmetric(a.RawSymmetric())
	case RawTriangular:
		amat = generalFromTriangular(a.RawTriangular())
	}
	return s.checkOverlap(amat)
}