// VectorLength calculates the length of the vector from 0,0,0 to vector
773613
func VectorLength(vector geom.Coord) float64 {
	return math.Sqrt(vector[0]*vector[0] + vector[1]*vector[1] + vector[2]*vector[2])
}
371647
func (o *ElapseParams) validateLength(formats strfmt.Registry) error {

	if err := validate.MinimumInt("length", "path", int64(o.Length), 2, false); err != nil {
		return err
	}

	if err := validate.MaximumInt("length", "path", int64(o.Length), 30, false); err != nil {
		return err
	}

	return nil
}
384362
func (s *Scanner) readLength(first byte) (int64, error) {
	length := int64(first & maskFirstLength)

	c := first
	shift := firstLengthBits
	var err error
	for c&maskContinue > 0 {
		if c, err = s.r.ReadByte(); err != nil {
			return 0, err
		}

		length += int64(c&maskLength) << shift
		shift += lengthBits
	}

	return length, nil
}
723743
func (o *FuzzyCompletionSuggesterOptions) PrefixLength(prefixLength int) *FuzzyCompletionSuggesterOptions {
	o.prefixLength = &prefixLength
	return o
}
1143925
func (pc PrefixCodes) Length() (nb uint) {
	for _, c := range pc {
		nb += uint(c.Len * c.Cnt)
	}
	return nb
}
660405
func (vv *VectorisedView) CapLength(length int) {
	if length < 0 {
		length = 0
	}
	if vv.size < length {
		return
	}
	vv.size = length
	for i := range vv.views {
		v := &vv.views[i]
		if len(*v) >= length {
			if length == 0 {
				vv.views = vv.views[:i]
			} else {
				v.CapLength(length)
				vv.views = vv.views[:i+1]
			}
			return
		}
		length -= len(*v)
	}
}
845385
func length(v interface{}, param string) error {
	st := reflect.ValueOf(v)
	valid := true
	if st.Kind() == reflect.Ptr {
		if st.IsNil() {
			return nil
		}
		st = st.Elem()
	}
	switch st.Kind() {
	case reflect.String:
		p, err := asInt(param)
		if err != nil {
			return ErrBadParameter
		}
		valid = int64(len(st.String())) == p
	case reflect.Slice, reflect.Map, reflect.Array:
		p, err := asInt(param)
		if err != nil {
			return ErrBadParameter
		}
		valid = int64(st.Len()) == p
	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
		p, err := asInt(param)
		if err != nil {
			return ErrBadParameter
		}
		valid = st.Int() == p
	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
		p, err := asUint(param)
		if err != nil {
			return ErrBadParameter
		}
		valid = st.Uint() == p
	case reflect.Float32, reflect.Float64:
		p, err := asFloat(param)
		if err != nil {
			return ErrBadParameter
		}
		valid = st.Float() == p
	default:
		return ErrUnsupported
	}
	if !valid {
		return ErrLen
	}
	return nil
}
741666
func StringLength(str string, params ...string) bool {

	if len(params) == 2 {
		strLength := utf8.RuneCountInString(str)
		min, _ := ToInt(params[0])
		max, _ := ToInt(params[1])
		return strLength >= int(min) && strLength <= int(max)
	}

	return false
}
136397
func (r *Rows) ColumnTypeLength(index int) (int64, bool) {
	return r.rows.FieldDescriptions()[index].Length()
}
930869
func (f *RetireConnectionIDFrame) Length(protocol.VersionNumber) protocol.ByteCount {
	return 1 + utils.VarIntLen(f.SequenceNumber)
}
238584
func intLength(bits, base int) int {
	return int(math.Ceil(float64(bits) * math.Log10(2.0) / math.Log10(float64(base))))
}
1022582
func (fs *TermvectorsFilterSettings) MinWordLength(value int64) *TermvectorsFilterSettings {
	fs.minWordLength = &value
	return fs
}
1237242
func MinLength(path, in, data string, minLength int64) *errors.Validation {
	strLen := int64(utf8.RuneCount([]byte(data)))
	if strLen < minLength {
		return errors.TooShort(path, in, minLength)
	}
	return nil
}
569598
func (d *CompoundFileDirectory) FileLength(name string) (n int64, err error) {
	panic("not implemented yet")
}
597693
func Length(x uint64) int {
	// TODO: use math/bits when it's merged in 1.9

	// Loop: for loop
	// Log10: math.Log10
	// Asm: https://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10
	// 	with "IntegerLogBase2(v)" in assembly implemented similar to GCC's
	// 	__builtin_clzll.
	// Cond: the switch below
	//
	// 	Seq: sequential numbers
	// 	Rand: random numbers
	//
	// BenchmarkIntLenLoopSeq-4     	200000000         7.87 ns/op
	// BenchmarkIntLenLog10Seq-4    	30000000        43.8 ns/op
	// BenchmarkIntLenAsmSeq-4      	200000000         7.38 ns/op
	// BenchmarkIntLenCondSeq-4     	500000000         3.67 ns/op
	//
	// BenchmarkIntLenLoopRand-4    	10000000000000000000        21.8 ns/op
	// BenchmarkIntLenLog10Rand-4   	30000000        44.5 ns/op
	// BenchmarkIntLenAsmRand-4     	200000000         8.62 ns/op
	// BenchmarkIntLenCondRand-4    	200000000         8.09 ns/op

	switch {
	case x < 10:
		return 1
	case x < 100:
		return 2
	case x < 1000:
		return 3
	case x < 10000:
		return 4
	case x < 100000:
		return 5
	case x < 1000000:
		return 6
	case x < 10000000:
		return 7
	case x < 100000000:
		return 8
	case x < 1000000000:
		return 9
	case x < 10000000000:
		return 10
	case x < 100000000000:
		return 11
	case x < 1000000000000:
		return 12
	case x < 10000000000000:
		return 13
	case x < 100000000000000:
		return 14
	case x < 1000000000000000:
		return 15
	case x < 10000000000000000:
		return 16
	case x < 100000000000000000:
		return 17
	case x < 1000000000000000000:
		return 18
	case x < 10000000000000000000:
		return 19
	default:
		panic("unreachable")
	}
}
807039
func KeyLength(key interface{}) int {
	if key == nil {
		return 0
	}
	if ecdsaKey, ok := key.(*ecdsa.PublicKey); ok {
		return ecdsaKey.Curve.Params().BitSize
	} else if rsaKey, ok := key.(*rsa.PublicKey); ok {
		return rsaKey.N.BitLen()
	}

	return 0
}
546474
func Length(p0, p1, p2 *vec2.T, t float64) float64 {
	ax := p0[0] - 2*p1[0] + p2[0]
	ay := p0[1] - 2*p1[1] + p2[1]
	bx := 2*p1[0] - 2*p0[0]
	by := 2*p1[1] - 2*p0[1]

	a := 4 * (ax*ax + ay*ay)
	b := 4 * (ax*bx + ay*by)
	c := bx*bx + by*by

	abc := 2 * math.Sqrt(a+b+c)
	a2 := math.Sqrt(a)
	a32 := 2 * a * a2
	c2 := 2 * math.Sqrt(c)
	ba := b / a2

	return t * (a32*abc + a2*b*(abc-c2) + (4*c*a-b*b)*math.Log((2*a2+ba+abc)/(ba+c2))) / (4 * a32)
}