def multiply_deg_one_poly(a: torch.Tensor, b: torch.Tensor) -> torch.Tensor:
    r"""Multiply two polynomials of the first order [@nister2004efficient].

    Args:
        a: a first order polynomial for variables :math:`(x,y,z,1)`.
        b: a first order polynomial for variables :math:`(x,y,z,1)`.

    Returns:
        degree 2 poly with the order :math:`(x^2, x*y, x*z, x, y^2, y*z, y, z^2, z, 1)`.

    """
    return stack(
        [
            a[:, 0] * b[:, 0],
            a[:, 0] * b[:, 1] + a[:, 1] * b[:, 0],
            a[:, 0] * b[:, 2] + a[:, 2] * b[:, 0],
            a[:, 0] * b[:, 3] + a[:, 3] * b[:, 0],
            a[:, 1] * b[:, 1],
            a[:, 1] * b[:, 2] + a[:, 2] * b[:, 1],
            a[:, 1] * b[:, 3] + a[:, 3] * b[:, 1],
            a[:, 2] * b[:, 2],
            a[:, 2] * b[:, 3] + a[:, 3] * b[:, 2],
            a[:, 3] * b[:, 3],
        ],
        dim=-1,
    )
Multiply two polynomials of the first order [@nister2004efficient].

    Args:
        a: a first order polynomial for variables :math:`(x,y,z,1)`.
        b: a first order polynomial for variables :math:`(x,y,z,1)`.

    Returns:
        degree 2 poly with the order :math:`(x^2, x*y, x*z, x, y^2, y*z, y, z^2, z, 1)`.

    
kornia/geometry/solvers/polynomial_solver.py