Skip to content

moirepy.utils.are_coeffs_integers

Check if v3 is an integer linear combination of v1 and v2.

Solves a * v1 + b * v2 = v3 in 2D using Cramer's rule, then tests whether a and b are integers up to a tolerance.

Parameters:

Name Type Description Default
v1 array-like of shape (2,)

Input 2D vectors.

required
v2 array-like of shape (2,)

Input 2D vectors.

required
v3 array-like of shape (2,)

Input 2D vectors.

required
tol float

Tolerance for determinant singularity and integer closeness test.

1e-08

Returns:

Type Description
bool

True if a unique solution exists and both coefficients are integer-valued within tol; otherwise False.