Skip to content

Allow passing weight= or solution_scale= to LLL() #40299

Open
@user202729

Description

@user202729

Specifying a weight for the different columns in LLL is a very common use case. In practice, this means you performing LLL to find shortest vector(s), but instead of the usual norm $∑ x_i^2$, you use the norm $∑ (w_i x_i)^2$ where ${w_i}$ are the weights. ($w_i$ must be all nonnegative.)

One case where this is used is in the current implementation of small_roots

    if X is None:
        X = (0.5 * N**(beta**2/delta - epsilon)).ceil()
    verbose("X = %s" % X, level=2)

⋮

    B = Matrix(ZZ, len(g), delta*m + max(delta,t) )
    for i in range(B.nrows()):
        for j in range( g[i].degree()+1 ):
            B[i, j] = g[i][j]*X**j

    B = B.LLL(**kwds)

    f = sum([ZZ(B[0, i]//X**i)*x**i for i in range(B.ncols())])
    R = f.roots()

Here the X**j is the weight of column j — notice all elements of column j are multiplied by X**j then they're immediately divided after running the LLL.

Alternatively we can give a solution_scale which is essentially the inverse of weight.

Possible extension: pass that to approximate_closest_vector too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions