// Dot returns the dot product of two (dived by w) vectors.
551798
func Dot(a, b *T) float64 {
	a3 := a.Vec3DividedByW()
	b3 := b.Vec3DividedByW()
	return vec3.Dot(&a3, &b3)
}
229264
func (m Mat2x3) Row(row int) Vec3 {
	return Vec3{m[row+0], m[row+2], m[row+4]}
}
1293502
func (v Vector) Angle(ov Vector) s1.Angle {
	return s1.Angle(math.Atan2(v.Cross(ov).Norm(), v.Dot(ov))) * s1.Radian
}
117198
func Dotted(d Duration, dots int) Duration {
	return Duration{d.Value, dots, false}
}
393751
func Merge(dots ...*DotSql) *DotSql {
	queries := make(map[string]string)

	for _, dot := range dots {
		for k, v := range dot.QueryMap() {
			queries[k] = v
		}
	}

	return &DotSql{
		queries: queries,
	}
}
955425
func (m Mat2) Abs() Mat2 {
	return Mat2{Abs(m[0]), Abs(m[1]), Abs(m[2]), Abs(m[3])}
}
163773
func (m *Matrix) Identity() *Matrix {
	m.Val[m00] = 1
	m.Val[m10] = 0
	m.Val[m20] = 0
	m.Val[m01] = 0
	m.Val[m11] = 1
	m.Val[m21] = 0
	m.Val[m02] = 0
	m.Val[m12] = 0
	m.Val[m22] = 1
	return m
}
1268133
func (m Mat4x2) Row(row int) Vec2 {
	return Vec2{m[row+0], m[row+4]}
}
725844
func (p *Point) Dot(v *Point) float64 {
	return p[0]*v[0] + p[1]*v[1]
}
1062328
func cosDistance(x, y Point) (cos, err float64) {
	cos = x.Dot(y.Vector)
	return cos, 9.5*dblError*math.Abs(cos) + 1.5*dblError
}
669656
private static double dot(double vector1[], double vector2[]) {

        double product = 0;
        assert vector1.length == vector2.length;
        for (int i = 0; i < vector1.length; i++) {
            product += vector1[i] * vector2[i];
        }
        return product;

    }
726982
func Product(x, y Vector) (Vector, error) {
	if len(x) != len(y) {
		return nil, fmt.Errorf("x and y have unequal lengths: %d / %d", len(x), len(y))
	}

	p := make(Vector, len(x))
	for i, _ := range x {
		p[i] = x[i] * y[i]
	}
	return p, nil
}
974506
func Dot4(a, b *T) float64 {
	return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]
}
526962
func Div(a, b []float64) {
	if len(a) != len(b) {
		panic("vectors must be the same length")
	}
	divAsm(a, b)
}
1366856
func (s Style) GetDotWidth(defaults ...float64) float64 {
	if s.DotWidth == 0 {
		if len(defaults) > 0 {
			return defaults[0]
		}
		return DefaultDotWidth
	}
	return s.DotWidth
}
116549
func Angle(a, b *T) float32 {
	v := Dot(a, b) / (a.Length() * b.Length())
	// prevent NaN
	if v > 1. {
		v = v - 2
	} else if v < -1. {
		v = v + 2
	}
	return math.Acos(v)
}
3504
func (c *Cosine) Distance(vectorX *mat.Dense, vectorY *mat.Dense) float64 {
	dotXY := c.Dot(vectorX, vectorY)
	lengthX := math.Sqrt(c.Dot(vectorX, vectorX))
	lengthY := math.Sqrt(c.Dot(vectorY, vectorY))

	cos := dotXY / (lengthX * lengthY)

	return 1 - cos
}