// LengthSqr returns the squared length of the vector.
// See also Length and Normalize.
195841
func (vec *T) LengthSqr() float64 {
	return vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]
}
435173
func (i Interval) Length() float64 {
	l := i.Hi - i.Lo
	if l >= 0 {
		return l
	}
	l += 2 * math.Pi
	if l > 0 {
		return l
	}
	return -1
}
180907
func (b *Buffer) Length() int {
	if b == nil || b.C_gss_buffer_t == nil || b.C_gss_buffer_t.length == 0 {
		return 0
	}
	return int(b.C_gss_buffer_t.length)
}
252389
func (c *Container) Length() int {
	nc := c
	var l int
	for nc != nil {
		l += nc.length
		nc = nc.next
	}
	return l
}
72290
func (l *Line) SquaredDistanceFrom(point *Point) float64 {
	x := l.a[0]
	y := l.a[1]
	dx := l.b[0] - x
	dy := l.b[1] - y

	if dx != 0 || dy != 0 {
		t := ((point[0]-x)*dx + (point[1]-y)*dy) / (dx*dx + dy*dy)

		if t > 1 {
			x = l.b[0]
			y = l.b[1]
		} else if t > 0 {
			x += dx * t
			y += dy * t
		}
	}

	dx = point[0] - x
	dy = point[1] - y

	return dx*dx + dy*dy
}
427542
func (pq *PriorityQueue) Length() uint64 {
	pq.RLock()
	defer pq.RUnlock()

	var length uint64
	for _, v := range pq.levels {
		length += v.length()
	}

	return length
}
478984
func (s *String) Length() *Number {
	return &Number{s.chain, float64(len(s.value))}
}
1090891
func (a *Array) Length() *Number {
	return &Number{a.chain, float64(len(a.value))}
}
1302218
func StringLength(str string) (strlen int) {
	str = vtclean.Clean(str, false)
	for str != "" {
		_, rest, runeWidth := ReadRune(str)
		str = rest
		strlen += runeWidth
	}
	// Alternative:
	// strlen = utf8.RuneCountInString(str)
	// Alternative:
	// var ia norm.Iter
	// ia.InitString(norm.NFKD, str)
	return
}
44119
func Sqrt(a []float32) {
	for i, v := range a {
		a[i] = math32.Sqrt(v)
	}
}
205214
func (qzs *queryzRow) RowsPQ() string {
	val := float64(qzs.Rows) / float64(qzs.Count)
	return fmt.Sprintf("%.6f", val)
}
821041
func (as ArraySpec) Sumsqr(val Input) Input {
	return as.proc(func(i Input) Input {
		return i.Sumsqr(val)
	})
}
730899
func distsqRef(x, y []simd.I32x4) int32 {
	if len(x) != len(y) {
		return -1
	}
	n := len(x)
	dist := int32(math.MaxInt32)
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if i == j {
				continue
			}
			for idx := 0; idx < 4; idx++ {
				dx := x[j][idx] - x[i][idx]
				dy := y[j][idx] - y[i][idx]
				sqX := dx * dx
				sqY := dy * dy
				sqDist := sqX + sqY
				if sqDist < dist {
					dist = sqDist
				}
			}
		}
	}
	return dist
}
1220123
func (as ArraySpec) Difsqr(val Input) Input {
	return as.proc(func(i Input) Input {
		return i.Difsqr(val)
	})
}
112304
func (s Sample) IQR() float64 {
	if !s.Sorted {
		s = *s.Copy().Sort()
	}
	return s.Quantile(0.75) - s.Quantile(0.25)
}
9805
func (g *MultiLineString) Length() float64 {
	return length2(g.flatCoords, 0, g.ends, g.stride)
}
1100824
func (v1 Vec4) LenSqr() float64 {
	return v1[0]*v1[0] + v1[1]*v1[1] + v1[2]*v1[2] + v1[3]*v1[3]
}