def multiply_deg_two_one_poly(a: torch.Tensor, b: torch.Tensor) -> torch.Tensor:
    r"""Multiply two polynomials a and b of degrees two and one [@nister2004efficient].

    Args:
        a: a second degree poly for variables :math:`(x^2, x*y, x*z, x, y^2, y*z, y, z^2, z, 1)`.
        b: a first degree poly for variables :math:`(x y z 1)`.

    Returns:
        a third degree poly for variables,
        :math:`(x^3, y^3, x^2*y, x*y^2, x^2*z, x^2, y^2*z, y^2,
        x*y*z, x*y, x*z^2, x*z, x, y*z^2, y*z, y, z^3, z^2, z, 1)`.

    """
    return stack(
        [
            a[:, 0] * b[:, 0],
            a[:, 4] * b[:, 1],
            a[:, 0] * b[:, 1] + a[:, 1] * b[:, 0],
            a[:, 1] * b[:, 1] + a[:, 4] * b[:, 0],
            a[:, 0] * b[:, 2] + a[:, 2] * b[:, 0],
            a[:, 0] * b[:, 3] + a[:, 3] * b[:, 0],
            a[:, 4] * b[:, 2] + a[:, 5] * b[:, 1],
            a[:, 4] * b[:, 3] + a[:, 6] * b[:, 1],
            a[:, 1] * b[:, 2] + a[:, 2] * b[:, 1] + a[:, 5] * b[:, 0],
            a[:, 1] * b[:, 3] + a[:, 3] * b[:, 1] + a[:, 6] * b[:, 0],
            a[:, 2] * b[:, 2] + a[:, 7] * b[:, 0],
            a[:, 2] * b[:, 3] + a[:, 3] * b[:, 2] + a[:, 8] * b[:, 0],
            a[:, 3] * b[:, 3] + a[:, 9] * b[:, 0],
            a[:, 5] * b[:, 2] + a[:, 7] * b[:, 1],
            a[:, 5] * b[:, 3] + a[:, 6] * b[:, 2] + a[:, 8] * b[:, 1],
            a[:, 6] * b[:, 3] + a[:, 9] * b[:, 1],
            a[:, 7] * b[:, 2],
            a[:, 7] * b[:, 3] + a[:, 8] * b[:, 2],
            a[:, 8] * b[:, 3] + a[:, 9] * b[:, 2],
            a[:, 9] * b[:, 3],
        ],
        dim=-1,
    )
Multiply two polynomials a and b of degrees two and one [@nister2004efficient].

    Args:
        a: a second degree poly for variables :math:`(x^2, x*y, x*z, x, y^2, y*z, y, z^2, z, 1)`.
        b: a first degree poly for variables :math:`(x y z 1)`.

    Returns:
        a third degree poly for variables,
        :math:`(x^3, y^3, x^2*y, x*y^2, x^2*z, x^2, y^2*z, y^2,
        x*y*z, x*y, x*z^2, x*z, x, y*z^2, y*z, y, z^3, z^2, z, 1)`.

    
kornia/geometry/solvers/polynomial_solver.py