basis_quality_characteristics
Definitions
Lattice volume
For a full-rank square basis matrix \(B\), the lattice volume is defined as the absolute value of the \(det(B)\).
Root Hermite Factor
The Root Hermite factor is defined as
where \(||b_0||\) is the length of the shortest vector, \(Vol(L)\) is the lattice volume, and \(n\) is the lattice dimension.
Dimension-Normalized Orthogonality defect
The dimension-normalized orthogonality defect is defined as
where \(\prod_{i=0}^{n-1}||b_i||\) is the product of the column norms, \(Vol(L)\) is the lattice volume, and \(n\) is the lattice dimension.
Functions
compute_column_norms(basis)
Computes the Euclidean norms of the columns of a basis matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
basis
|
ndarray
|
A 2D NumPy array of shape (n, n) representing the lattice basis. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
A 1D NumPy array of length n containing the norms of each column. |
Source code in bkz/BasisQualityEvaluation/basis_quality_characteristics.py
4 5 6 7 8 9 10 11 12 13 14 | |
compute_hermite_factor(shortest_vector_len, log_vol, dim)
Computes the Hermite factor for a lattice basis in a numerically stable way.
The function receives standard (non-log) inputs, internally converts
the values to log-space, performs the computation in log-space, and
returns the result in normal numeric space.
The Hermite factor is defined as ||b_0|| / (Vol(L))^(1/n)
where ||b_0|| is the length of the shortest vector, Vol(L) is the lattice volume,
and n is the dimension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shortest_vector_len
|
float
|
Length of the shortest vector in the basis. |
required |
vol
|
float
|
Volume of the lattice. |
required |
dim
|
int
|
Dimension of the lattice (n). |
required |
Returns:
| Type | Description |
|---|---|
float
|
The Hermite factor. |
Source code in bkz/BasisQualityEvaluation/basis_quality_characteristics.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
compute_lattice_volume_log(basis)
Compute log-volume of a full-rank square lattice basis B in a numerically stable way. For a square, full-rank basis B, Vol(L) = |det(B)|.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
basis
|
ndarray
|
A 2D NumPy array of shape (n, n) representing the lattice basis. |
required |
Returns:
| Type | Description |
|---|---|
float
|
The log-space value of the volume of the lattice. |
Source code in bkz/BasisQualityEvaluation/basis_quality_characteristics.py
17 18 19 20 21 22 23 24 25 26 27 | |
compute_orthogonality_defect(norms, log_vol, dim)
Computes the dimension-normalized orthogonality defect of a lattice basis
in a numerically stable way. This function calculates: OD^(1/dim) = (prod(||b_i||) / Vol(L))^(1/dim)
where prod(||b_i||) is the product of the basis vector norms, Vol(L) is the lattice volume (absolute determinant), dim is the lattice dimension (number of basis vectors). Normalizing by dimension removes the exponential growth of OD with n, making the metric comparable across different lattice sizes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
norms
|
ndarray
|
1D NumPy array of basis vector norms |
required |
log_vol
|
float
|
Logarithm of the lattice volume, |
required |
dim
|
int
|
Lattice dimension (number of basis vectors). |
required |
Returns:
| Type | Description |
|---|---|
float
|
The per-dimension orthogonality defect, |
Source code in bkz/BasisQualityEvaluation/basis_quality_characteristics.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
compute_root_hermite_factor(shortest_vector_len, log_vol, dim)
Computes the Root Hermite factor (RHF) for a lattice basis in a numerically stable way.
The function receives standard (non-log) inputs, internally converts
the values to log-space, performs the computation in log-space, and
returns the result in normal numeric space.
The Root Hermite factor is defined as (||b_0|| / (Vol(L))^(1/n))^(1/n))
where ||b_0|| is the length of the shortest vector, Vol(L) is the lattice volume,
and n is the dimension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shortest_vector_len
|
float
|
Length of the shortest vector in the basis. |
required |
vol
|
float
|
Volume of the lattice. |
required |
dim
|
int
|
Dimension of the lattice (n). |
required |
Returns:
| Type | Description |
|---|---|
float
|
The Root Hermite factor. |
Source code in bkz/BasisQualityEvaluation/basis_quality_characteristics.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |