// QuatLerp is a *L*inear Int*erp*olation between two Quaternions, cheap and simple.
//
// Not excessively useful, but uses can be found.
773031
func QuatLerp(q1, q2 Quat, amount float32) Quat {
	return q1.Add(q2.Sub(q1).Scale(amount))
}
1298336
func RectFromLatLng(p LatLng) Rect {
	return Rect{
		Lat: r1.Interval{p.Lat.Radians(), p.Lat.Radians()},
		Lng: s1.Interval{p.Lng.Radians(), p.Lng.Radians()},
	}
}
935252
func NewTernaryIfExpr(cond, tx, fx Expr, pos Pos) *TernaryIfExpr {
	return &TernaryIfExpr{pos, cond, tx, fx}
}
1256705
func LinearRegIntercept(real []float64, timePeriod int32) []float64 {
	var outBegIdx C.int
	var outNBElement C.int
	outReal := make([]float64, len(real))
	C.TA_LINEARREG_INTERCEPT(0, C.int(len(real)-1), (*C.double)(unsafe.Pointer(&real[0])), C.int(timePeriod), &outBegIdx, &outNBElement, (*C.double)(unsafe.Pointer(&outReal[0])))
	return outReal[:outNBElement]
}
804152
func rotateLeft(x uint32, n uint32) uint32 {
	return (x << n) | (x >> (32 - n))
}
145720
func EqualDepth(x, y Value, depth int) (bool, error) {
	return CompareDepth(syntax.EQL, x, y, depth)
}
1137656
func NewHilStateQuaternion(TIME_USEC uint64, ATTITUDE_QUATERNION [4]float32, ROLLSPEED float32, PITCHSPEED float32, YAWSPEED float32, LAT int32, LON int32, ALT int32, VX int16, VY int16, VZ int16, IND_AIRSPEED uint16, TRUE_AIRSPEED uint16, XACC int16, YACC int16, ZACC int16) *HilStateQuaternion {
	m := HilStateQuaternion{}
	m.TIME_USEC = TIME_USEC
	m.ATTITUDE_QUATERNION = ATTITUDE_QUATERNION
	m.ROLLSPEED = ROLLSPEED
	m.PITCHSPEED = PITCHSPEED
	m.YAWSPEED = YAWSPEED
	m.LAT = LAT
	m.LON = LON
	m.ALT = ALT
	m.VX = VX
	m.VY = VY
	m.VZ = VZ
	m.IND_AIRSPEED = IND_AIRSPEED
	m.TRUE_AIRSPEED = TRUE_AIRSPEED
	m.XACC = XACC
	m.YACC = YACC
	m.ZACC = ZACC
	return &m
}
393147
func QuartileOutliers(input Float64Data) (Outliers, error) {
	if input.Len() == 0 {
		return Outliers{}, EmptyInputErr
	}

	// Start by sorting a copy of the slice
	copy := sortedCopy(input)

	// Calculate the quartiles and interquartile range
	qs, _ := Quartile(copy)
	iqr, _ := InterQuartileRange(copy)

	// Calculate the lower and upper inner and outer fences
	lif := qs.Q1 - (1.5 * iqr)
	uif := qs.Q3 + (1.5 * iqr)
	lof := qs.Q1 - (3 * iqr)
	uof := qs.Q3 + (3 * iqr)

	// Find the data points that are outside of the
	// inner and upper fences and add them to mild
	// and extreme outlier slices
	var mild Float64Data
	var extreme Float64Data
	for _, v := range copy {

		if v < lof || v > uof {
			extreme = append(extreme, v)
		} else if v < lif || v > uif {
			mild = append(mild, v)
		}
	}

	// Wrap them into our struct
	return Outliers{mild, extreme}, nil
}
345779
func symMerge_func(data lessSwap, a, m, b int) {
	if m-a == 1 {
		i := m
		j := b
		for i < j {
			h := i + (j-i)/2
			if data.Less(h, a) {
				i = h + 1
			} else {
				j = h
			}
		}
		for k := a; k < i-1; k++ {
			data.Swap(k, k+1)
		}
		return
	}
	if b-m == 1 {
		i := a
		j := m
		for i < j {
			h := i + (j-i)/2
			if !data.Less(m, h) {
				i = h + 1
			} else {
				j = h
			}
		}
		for k := m; k > i; k-- {
			data.Swap(k, k-1)
		}
		return
	}
	mid := a + (b-a)/2
	n := mid + m
	var start, r int
	if m > mid {
		start = n - b
		r = mid
	} else {
		start = a
		r = m
	}
	p := n - 1
	for start < r {
		c := start + (r-start)/2
		if !data.Less(p-c, c) {
			start = c + 1
		} else {
			r = c
		}
	}
	end := n - start
	if start < m && m < end {
		rotate_func(data, start, m, end)
	}
	if a < start && start < mid {
		symMerge_func(data, a, start, mid)
	}
	if mid < end && end < b {
		symMerge_func(data, mid, end, b)
	}
}
1181430
func unaryOpDistort(rate int8, in Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(UnaryOpUgenName, rate, UnaryOpDistort, numOutputs, in)
}
1277399
func QuatRotate(angle float32, axis Vec3) Quat {
	// angle = (float32(math.Pi) * angle) / 180.0

	c, s := float32(math.Cos(float64(angle/2))), float32(math.Sin(float64(angle/2)))

	return Quat{c, axis.Mul(s)}
}
6939
func (sr *sr_Latn_BA) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
	return locales.PluralRuleOther
}
861721
func (quat *T) Invert() *T {
	quat[0] = -quat[0]
	quat[1] = -quat[1]
	quat[2] = -quat[2]
	return quat
}
1052876
func GratuitousArp(srcIP net.IP) error {
	if err := validateIP(srcIP); err != nil {
		return err
	}

	iface, err := findUsableInterfaceForNetwork(srcIP)
	if err != nil {
		return err
	}
	return GratuitousArpOverIface(srcIP, *iface)
}
1005220
func (q1 Quat) ApproxEqualFunc(q2 Quat, f func(float32, float32) bool) bool {
	return f(q1.W, q2.W) && q1.V.ApproxFuncEqual(q2.V, f)
}
476711
func (naq *naq) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
	return locales.PluralRuleUnknown
}
1110340
func (quat *T) IsUnitQuat(tolerance float64) bool {
	norm := quat.Norm()
	return norm >= (1.0-tolerance) && norm <= (1.0+tolerance)
}