mat: return ErrZeroLength when size is zero and document it

This commit is contained in:
Vladimir Chalupecky
2021-05-12 17:49:40 +02:00
committed by Vladimír Chalupecký
parent ea5c577f8c
commit 3de5d6c644
10 changed files with 108 additions and 34 deletions

View File

@@ -269,7 +269,8 @@ func (v *VecDense) CopyVec(a Vector) int {
// 2 - The Euclidean norm, the square root of the sum of the squares of the elements
// Inf - The maximum element magnitude
//
// Norm will panic with ErrNormOrder if an illegal norm is specified.
// Norm will panic with ErrNormOrder if an illegal norm is specified and with
// ErrZeroLength if the vector has zero size.
func (v *VecDense) Norm(norm float64) float64 {
if v.IsEmpty() {
panic(ErrZeroLength)