/*Sqrt - Vector Square Root

Input = double

Output = double

*/
776863
func Sqrt(real []float64) []float64 {
	var outBegIdx C.int
	var outNBElement C.int
	outReal := make([]float64, len(real))
	C.TA_SQRT(0, C.int(len(real)-1), (*C.double)(unsafe.Pointer(&real[0])), &outBegIdx, &outNBElement, (*C.double)(unsafe.Pointer(&outReal[0])))
	return outReal[:outNBElement]
}
914082
func (c C) Difsqr(val Input) Input {
	return c.Squared().Add(val.Squared().Neg())
}
373183
func (a *AggregateSample) Stddev() float64 {
	num := (float64(a.Count) * a.SumSq) - math.Pow(a.Sum, 2)
	div := float64(a.Count * (a.Count - 1))
	if div == 0 {
		return 0
	}
	return math.Sqrt(num / div)
}
582571
func Cosh(real []float64) []float64 {
	var outBegIdx C.int
	var outNBElement C.int
	outReal := make([]float64, len(real))
	C.TA_COSH(0, C.int(len(real)-1), (*C.double)(unsafe.Pointer(&real[0])), &outBegIdx, &outNBElement, (*C.double)(unsafe.Pointer(&outReal[0])))
	return outReal[:outNBElement]
}
100650
func (p *Path) SquaredDistanceFrom(point *Point) float64 {
	dist := math.Inf(1)

	l := &Line{}
	loopTo := len(p.PointSet) - 1
	for i := 0; i < loopTo; i++ {
		l.a = p.PointSet[i]
		l.b = p.PointSet[i+1]
		dist = math.Min(l.SquaredDistanceFrom(point), dist)
	}

	return dist
}
870218
func (v Vector) IsUnit() bool {
	const epsilon = 5e-14
	return math.Abs(v.Norm2()-1) <= epsilon
}
1315774
func InterQuartileRange(input Float64Data) (float64, error) {
	if input.Len() == 0 {
		return math.NaN(), EmptyInputErr
	}
	qs, _ := Quartile(input)
	iqr := qs.Q3 - qs.Q1
	return iqr, nil
}
412180
func (dc *Context) QuadraticTo(x1, y1, x2, y2 float64) {
	if !dc.hasCurrent {
		dc.MoveTo(x1, y1)
	}
	x1, y1 = dc.TransformPoint(x1, y1)
	x2, y2 = dc.TransformPoint(x2, y2)
	p1 := Point{x1, y1}
	p2 := Point{x2, y2}
	dc.strokePath.Add2(p1.Fixed(), p2.Fixed())
	dc.fillPath.Add2(p1.Fixed(), p2.Fixed())
	dc.current = p2
}
675564
func Norm(x Vector, pow float64) float64 {
	s := 0.0

	for _, xval := range x {
		s += math.Pow(xval, pow)
	}

	return math.Pow(s, 1/pow)
}
773613
func VectorLength(vector geom.Coord) float64 {
	return math.Sqrt(vector[0]*vector[0] + vector[1]*vector[1] + vector[2]*vector[2])
}
196605
func Float(input interface{}) (output float64, err error) {

	switch castValue := input.(type) {
	case Floater:
		output = castValue.Float()
		return
	case string:
		output, err = strconv.ParseFloat(castValue, 64)
	case []byte:
		output, err = strconv.ParseFloat(string(castValue), 64)
		return
	case int:
		output = float64(castValue)
		return
	case int8:
		output = float64(castValue)
		return
	case int16:
		output = float64(castValue)
		return
	case int32:
		output = float64(castValue)
		return
	case int64:
		output = float64(castValue)
		return
	case uint:
		output = float64(castValue)
		return
	case uint8:
		output = float64(castValue)
		return
	case uint16:
		output = float64(castValue)
		return
	case uint32:
		output = float64(castValue)
		return
	case uint64:
		output = float64(castValue)
		return
	case float32:
		output = float64(castValue)
		return
	case float64:
		output = float64(castValue)
		return
	case bool:
		output = float64(0)
		if castValue {
			output = float64(1)
		}
		return
	case nil:
		output = float64(0)
		return
	default:
		err = NewCastError("Could not convert to float64")
	}
	return
}
649715
func linear(v0, v1, v2, v3 *uint32) {
	*v0 = ((*v0 << 13) | (*v0 >> (32 - 13)))
	*v2 = ((*v2 << 3) | (*v2 >> (32 - 3)))
	*v1 ^= *v0 ^ *v2
	*v3 ^= *v2 ^ (*v0 << 3)
	*v1 = (*v1 << 1) | (*v1 >> (32 - 1))
	*v3 = (*v3 << 7) | (*v3 >> (32 - 7))
	*v0 ^= *v1 ^ *v3
	*v2 ^= *v3 ^ (*v1 << 7)
	*v0 = (*v0 << 5) | (*v0 >> (32 - 5))
	*v2 = (*v2 << 22) | (*v2 >> (32 - 22))
}
982081
func (c C) Sqrdif(val Input) Input {
	return c.Add(val.Neg()).Squared()
}
1276283
func (c C) Cos() Input {
	return C(float32(math.Cos(float64(c))))
}
111739
func (BitCurve *BitCurve) Double(x1, y1 *big.Int) (*big.Int, *big.Int) {
	z1 := new(big.Int).SetInt64(1)
	return BitCurve.affineFromJacobian(BitCurve.doubleJacobian(x1, y1, z1))
}
197719
func Output(lv Level, calldepth int, s string) error {
	return std.Output(lv, calldepth, s)
}
254234
func (p *Point) SquaredDistanceFrom(point *Point) float64 {
	d0 := (point[0] - p[0])
	d1 := (point[1] - p[1])
	return d0*d0 + d1*d1
}