func (v *VecDense) AddVec(a, b Vector) {
	ar := a.Len()
	br := b.Len()
	if ar != br {
		panic(ErrShape)
	}
	v.reuseAs(ar)
	aU, _ := untranspose(a)
	bU, _ := untranspose(b)
	if arv, ok := aU.(RawVectorer); ok {
		if brv, ok := bU.(RawVectorer); ok {
			amat := arv.RawVector()
			bmat := brv.RawVector()
			if v != a {
				v.checkOverlap(amat)
			}
			if v != b {
				v.checkOverlap(bmat)
			}
			if v.mat.Inc == 1 && amat.Inc == 1 && bmat.Inc == 1 {
				f64.AxpyUnitaryTo(v.mat.Data, 1, bmat.Data, amat.Data)
				return
			}
			f64.AxpyIncTo(v.mat.Data, uintptr(v.mat.Inc), 0,
				1, bmat.Data, amat.Data,
				uintptr(ar), uintptr(bmat.Inc), uintptr(amat.Inc), 0, 0)
			return
		}
	}
	for i := 0; i < ar; i++ {
		v.setVec(i, a.AtVec(i)+b.AtVec(i))
	}
}
AddVec adds the vectors a and b, placing the result in the receiver.
package mat
import (
	"gonum.org/v1/gonum/blas"
	"gonum.org/v1/gonum/blas/blas64"
	"gonum.org/v1/gonum/internal/asm/f64"
)
var (
	vector *VecDense
	_ Matrix  = vector
	_ Vector  = vector
	_ Reseter = vector
)
type Vector interface {
	Matrix
	AtVec(int) float64
	Len() int
}
type TransposeVec struct {
	Vector Vector
}
func (t TransposeVec) At(i, j int) float64 {
	return t.Vector.At(j, i)
}
func (t TransposeVec) AtVec(i int) float64 {
	return t.Vector.AtVec(i)
}
func (t TransposeVec) Dims() (r, c int) {
	c, r = t.Vector.Dims()
	return r, c
}
func (t TransposeVec) T() Matrix {
	return t.Vector
}
func (t TransposeVec) Len() int {
	return t.Vector.Len()
}
func (t TransposeVec) TVec() Vector {
	return t.Vector
}
func (t TransposeVec) Untranspose() Matrix {
	return t.Vector
}
func (t TransposeVec) UntransposeVec() Vector {
	return t.Vector
}
type VecDense struct {
	mat blas64.Vector
}
func NewVecDense(n int, data []float64) *VecDense {
	if n <= 0 {
		if n == 0 {
			panic(ErrZeroLength)
		}
		panic("mat: negative dimension")
	}
	if len(data) != n && data != nil {
		panic(ErrShape)
	}
	if data == nil {
		data = make([]float64, n)
	}
	return &VecDense{
		mat: blas64.Vector{
			N:    n,
			Inc:  1,
			Data: data,
		},
	}
}
func (v *VecDense) SliceVec(i, k int) Vector {
	if i < 0 || k <= i || v.Cap() < k {
		panic(ErrIndexOutOfRange)
	}
	return &VecDense{
		mat: blas64.Vector{
			N:    k - i,
			Inc:  v.mat.Inc,
			Data: v.mat.Data[i*v.mat.Inc : (k-1)*v.mat.Inc+1],
		},
	}
}
func (v *VecDense) Dims() (r, c int) {
	if v.IsZero() {
		return 0, 0
	}
	return v.mat.N, 1
}
func (v *VecDense) Caps() (r, c int) {
	if v.IsZero() {
		return 0, 0
	}
	return v.Cap(), 1
}
func (v *VecDense) Len() int {
	return v.mat.N
}
func (v *VecDense) Cap() int {
	if v.IsZero() {
		return 0
	}
	return (cap(v.mat.Data)-1)/v.mat.Inc + 1
}
func (v *VecDense) T() Matrix {
	return Transpose{v}
}
func (v *VecDense) TVec() Vector {
	return TransposeVec{v}
}
func (v *VecDense) Reset() {
	v.mat.Inc = 0
	v.mat.N = 0
	v.mat.Data = v.mat.Data[:0]
}
func (v *VecDense) Zero() {
	for i := 0; i < v.mat.N; i++ {
		v.mat.Data[v.mat.Inc*i] = 0
	}
}
func (v *VecDense) CloneVec(a Vector) {
	if v == a {
		return
	}
	n := a.Len()
	v.mat = blas64.Vector{
		N:    n,
		Inc:  1,
		Data: use(v.mat.Data, n),
	}
	if r, ok := a.(RawVectorer); ok {
		blas64.Copy(r.RawVector(), v.mat)
		return
	}
	for i := 0; i < a.Len(); i++ {
		v.SetVec(i, a.AtVec(i))
	}
}
func VecDenseCopyOf(a Vector) *VecDense {
	v := &VecDense{}
	v.CloneVec(a)
	return v
}
func (v *VecDense) RawVector() blas64.Vector {
	return v.mat
}
func (v *VecDense) CopyVec(a Vector) int {
	n := min(v.Len(), a.Len())
	if v == a {
		return n
	}
	if r, ok := a.(RawVectorer); ok {
		blas64.Copy(r.RawVector(), v.mat)
		return n
	}
	for i := 0; i < n; i++ {
		v.setVec(i, a.AtVec(i))
	}
	return n
}
func (v *VecDense) ScaleVec(alpha float64, a Vector) {
	n := a.Len()
	if v == a {
		if v.mat.Inc == 1 {
			f64.ScalUnitary(alpha, v.mat.Data)
			return
		}
		f64.ScalInc(alpha, v.mat.Data, uintptr(n), uintptr(v.mat.Inc))
		return
	}
	v.reuseAs(n)
	if rv, ok := a.(RawVectorer); ok {
		mat := rv.RawVector()
		v.checkOverlap(mat)
		if v.mat.Inc == 1 && mat.Inc == 1 {
			f64.ScalUnitaryTo(v.mat.Data, alpha, mat.Data)
			return
		}
		f64.ScalIncTo(v.mat.Data, uintptr(v.mat.Inc),
			alpha, mat.Data, uintptr(n), uintptr(mat.Inc))
		return
	}
	for i := 0; i < n; i++ {
		v.setVec(i, alpha*a.AtVec(i))
	}
}
func (v *VecDense) AddScaledVec(a Vector, alpha float64, b Vector) {
	if alpha == 1 {
		v.AddVec(a, b)
		return
	}
	if alpha == -1 {
		v.SubVec(a, b)
		return
	}
	ar := a.Len()
	br := b.Len()
	if ar != br {
		panic(ErrShape)
	}
	var amat, bmat blas64.Vector
	fast := true
	aU, _ := untranspose(a)
	if rv, ok := aU.(RawVectorer); ok {
		amat = rv.RawVector()
		if v != a {
			v.checkOverlap(amat)
		}
	} else {
		fast = false
	}
	bU, _ := untranspose(b)
	if rv, ok := bU.(RawVectorer); ok {
		bmat = rv.RawVector()
		if v != b {
			v.checkOverlap(bmat)
		}
	} else {
		fast = false
	}
	v.reuseAs(ar)
	switch {
	case alpha == 0:  
		if v == a {
			return
		}
		v.CopyVec(a)
	case v == a && v == b:  
		blas64.Scal(alpha+1, v.mat)
	case !fast:  
		for i := 0; i < ar; i++ {
			v.setVec(i, a.AtVec(i)+alpha*b.AtVec(i))
		}
	case v == a && v != b:  
		if v.mat.Inc == 1 && bmat.Inc == 1 {
			f64.AxpyUnitaryTo(v.mat.Data, alpha, bmat.Data, amat.Data)
		} else {
			f64.AxpyInc(alpha, bmat.Data, v.mat.Data,
				uintptr(ar), uintptr(bmat.Inc), uintptr(v.mat.Inc), 0, 0)
		}
	default:  
		if v.mat.Inc == 1 && amat.Inc == 1 && bmat.Inc == 1 {
			f64.AxpyUnitaryTo(v.mat.Data, alpha, bmat.Data, amat.Data)
		} else {
			f64.AxpyIncTo(v.mat.Data, uintptr(v.mat.Inc), 0,
				alpha, bmat.Data, amat.Data,
				uintptr(ar), uintptr(bmat.Inc), uintptr(amat.Inc), 0, 0)
		}
	}
}