// Mul performs a scalar multiplcation of the matrix. This is equivalent to iterating
// over every element of the matrix and multiply it by c.
490269
func (m1 Mat2x4) Mul(c float64) Mat2x4 {
	return Mat2x4{m1[0] * c, m1[1] * c, m1[2] * c, m1[3] * c, m1[4] * c, m1[5] * c, m1[6] * c, m1[7] * c}
}
1147190
func (m1 Mat3x2) Mul2x3(m2 Mat2x3) Mat3 {
	return Mat3{
		m1[0]*m2[0] + m1[3]*m2[1],
		m1[1]*m2[0] + m1[4]*m2[1],
		m1[2]*m2[0] + m1[5]*m2[1],
		m1[0]*m2[2] + m1[3]*m2[3],
		m1[1]*m2[2] + m1[4]*m2[3],
		m1[2]*m2[2] + m1[5]*m2[3],
		m1[0]*m2[4] + m1[3]*m2[5],
		m1[1]*m2[4] + m1[4]*m2[5],
		m1[2]*m2[4] + m1[5]*m2[5],
	}
}
1316257
func Mul(z, x *big.Int, y uint64) *big.Int {
	if y == 0 || x.Sign() == 0 {
		return z.SetUint64(0)
	}
	return z.SetBits(mulAddWW(z.Bits(), x.Bits(), big.Word(y), 0))
}
478341
func (m1 Mat3x4) Mul(c float64) Mat3x4 {
	return Mat3x4{m1[0] * c, m1[1] * c, m1[2] * c, m1[3] * c, m1[4] * c, m1[5] * c, m1[6] * c, m1[7] * c, m1[8] * c, m1[9] * c, m1[10] * c, m1[11] * c}
}
799634
func (mat *T) AssignMul(a, b *T) *T {
	mat[0] = a.MulVec2(&b[0])
	mat[1] = a.MulVec2(&b[1])
	return mat
}
118252
func (mat *T) AssignMul(a, b *T) *T {
	mat[0] = a.MulVec4(&b[0])
	mat[1] = a.MulVec4(&b[1])
	mat[2] = a.MulVec4(&b[2])
	mat[3] = a.MulVec4(&b[3])
	return mat
}
1081113
func (ms *MatStack) LeftMul(m mgl32.Mat4) {
	(*ms)[len(*ms)-1] = m.Mul4((*ms)[len(*ms)-1])
}
647795
func (m1 Mat3) Mul3(m2 Mat3) Mat3 {
	return Mat3{
		m1[0]*m2[0] + m1[3]*m2[1] + m1[6]*m2[2],
		m1[1]*m2[0] + m1[4]*m2[1] + m1[7]*m2[2],
		m1[2]*m2[0] + m1[5]*m2[1] + m1[8]*m2[2],
		m1[0]*m2[3] + m1[3]*m2[4] + m1[6]*m2[5],
		m1[1]*m2[3] + m1[4]*m2[4] + m1[7]*m2[5],
		m1[2]*m2[3] + m1[5]*m2[4] + m1[8]*m2[5],
		m1[0]*m2[6] + m1[3]*m2[7] + m1[6]*m2[8],
		m1[1]*m2[6] + m1[4]*m2[7] + m1[7]*m2[8],
		m1[2]*m2[6] + m1[5]*m2[7] + m1[8]*m2[8],
	}
}
1111971
func (m1 Mat4x3) Mul3x2(m2 Mat3x2) Mat4x2 {
	return Mat4x2{
		m1[0]*m2[0] + m1[4]*m2[1] + m1[8]*m2[2],
		m1[1]*m2[0] + m1[5]*m2[1] + m1[9]*m2[2],
		m1[2]*m2[0] + m1[6]*m2[1] + m1[10]*m2[2],
		m1[3]*m2[0] + m1[7]*m2[1] + m1[11]*m2[2],
		m1[0]*m2[3] + m1[4]*m2[4] + m1[8]*m2[5],
		m1[1]*m2[3] + m1[5]*m2[4] + m1[9]*m2[5],
		m1[2]*m2[3] + m1[6]*m2[4] + m1[10]*m2[5],
		m1[3]*m2[3] + m1[7]*m2[4] + m1[11]*m2[5],
	}
}
94026
func (m *Matrix) Multiply(m2 *Matrix) (m3 *Matrix, err error) {
	if m.stride*m2.stride != len(m2.elements) {
		return nil, ErrDimensionMismatch
	}

	m3 = &Matrix{epsilon: m.epsilon, stride: m2.stride, elements: make([]float64, (len(m.elements)/m.stride)*m2.stride)}
	for m1c0, m3x := 0, 0; m1c0 < len(m.elements); m1c0 += m.stride {
		for m2r0 := 0; m2r0 < m2.stride; m2r0++ {
			for m1x, m2x := m1c0, m2r0; m2x < len(m2.elements); m2x += m2.stride {
				m3.elements[m3x] += m.elements[m1x] * m2.elements[m2x]
				m1x++
			}
			m3x++
		}
	}
	return
}
890176
func (m1 Mat2x3) Mul(c float32) Mat2x3 {
	return Mat2x3{m1[0] * c, m1[1] * c, m1[2] * c, m1[3] * c, m1[4] * c, m1[5] * c}
}
525778
func (m1 Mat4x2) Mul2x4(m2 Mat2x4) Mat4 {
	return Mat4{
		m1[0]*m2[0] + m1[4]*m2[1],
		m1[1]*m2[0] + m1[5]*m2[1],
		m1[2]*m2[0] + m1[6]*m2[1],
		m1[3]*m2[0] + m1[7]*m2[1],
		m1[0]*m2[2] + m1[4]*m2[3],
		m1[1]*m2[2] + m1[5]*m2[3],
		m1[2]*m2[2] + m1[6]*m2[3],
		m1[3]*m2[2] + m1[7]*m2[3],
		m1[0]*m2[4] + m1[4]*m2[5],
		m1[1]*m2[4] + m1[5]*m2[5],
		m1[2]*m2[4] + m1[6]*m2[5],
		m1[3]*m2[4] + m1[7]*m2[5],
		m1[0]*m2[6] + m1[4]*m2[7],
		m1[1]*m2[6] + m1[5]*m2[7],
		m1[2]*m2[6] + m1[6]*m2[7],
		m1[3]*m2[6] + m1[7]*m2[7],
	}
}
200512
func Mult(v1 Vect, s Float) Vect {
	return Vect{v1.X * s, v1.Y * s}
}
811229
func (m *Matrix) Multiply(m2 *Matrix) *Matrix {
	multiplyMatricies(m.Val[:], m2.Val[:])
	return m
}
1065099
func (m1 Mat2) Mul(c float64) Mat2 {
	return Mat2{m1[0] * c, m1[1] * c, m1[2] * c, m1[3] * c}
}
1168202
func (result *Matrix) Multiply(a, b *Matrix) {
	C.cairo_matrix_multiply((*C.cairo_matrix_t)(unsafe.Pointer(result)), (*C.cairo_matrix_t)(unsafe.Pointer(a)), (*C.cairo_matrix_t)(unsafe.Pointer(b)))
}
702240
func (p *poly) Mul(q *poly) poly {
	// extra=2 because:
	// * some power of 2 is a K-th root of unity when n is a multiple of K/2.
	// * 2 itself is a square (see fermat.ShiftHalf)
	n := valueSize(p.k, p.m, 2)

	pv, qv := p.Transform(n), q.Transform(n)
	rv := pv.Mul(&qv)
	r := rv.InvTransform()
	r.m = p.m
	return r
}