Lattice module¶
General lattice functions¶
pqlattice.lattice.volume ¶
summary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lattice_basis
|
SquareMatrix
|
description |
required |
Returns:
| Type | Description |
|---|---|
int
|
description |
pqlattice.lattice.rank ¶
summary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lattice_basis
|
SquareMatrix
|
description |
required |
Returns:
| Type | Description |
|---|---|
int
|
description |
pqlattice.lattice.hadamard_ratio ¶
summary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lattice_basis
|
SquareMatrix
|
description |
required |
Returns:
| Type | Description |
|---|---|
float
|
description |
pqlattice.lattice.discriminant ¶
summary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lattice_basis
|
SquareMatrix
|
description |
required |
Returns:
| Type | Description |
|---|---|
int
|
description |
pqlattice.lattice.gaussian_heuristic ¶
summary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lattice_basis
|
SquareMatrix
|
description |
required |
Returns:
| Type | Description |
|---|---|
float
|
description |
pqlattice.lattice.is_lll_reduced ¶
summary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lattice_basis
|
SquareMatrix
|
description |
required |
delta
|
float
|
description, by default 0.99 |
0.99
|
Returns:
| Type | Description |
|---|---|
bool
|
description |
pqlattice.lattice.is_size_reduced ¶
summary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lattice_basis
|
SquareMatrix
|
description |
required |
Returns:
| Type | Description |
|---|---|
bool
|
description |
Lattice reduction algorithms¶
pqlattice.lattice.gso ¶
summary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
B
|
Matrix
|
description |
required |
Returns:
| Type | Description |
|---|---|
tuple[Matrix, SquareMatrix]
|
description |
pqlattice.lattice.bkz ¶
pqlattice.lattice.glr_2dim ¶
summary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lattice_basis
|
SquareMatrix
|
description |
required |
Returns:
| Type | Description |
|---|---|
SquareMatrix
|
description |
Raises:
| Type | Description |
|---|---|
ValueError
|
description |
SVP and CVP¶
pqlattice.lattice.babai_closest_vector ¶
summary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lattice_basis
|
SquareMatrix
|
description |
required |
target_vector
|
Vector
|
description |
required |
Returns:
| Type | Description |
|---|---|
Vector
|
description |
pqlattice.lattice.babai_nearest_plane ¶
summary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lattice_basis
|
SquareMatrix
|
description |
required |
target_vector
|
Vector
|
description |
required |
Returns:
| Type | Description |
|---|---|
Vector
|
description |
Lattice embeddings¶
pqlattice.lattice.embeddings.sis_basis ¶
lattice: L = { x | Ax = 0 mod q }
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
A
|
Matrix
|
description |
required |
q
|
int
|
description |
required |
Returns:
| Type | Description |
|---|---|
SquareMatrix
|
description |
pqlattice.lattice.embeddings.lwe_basis ¶
lattice: L = { y | y = xA mod q }
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
A
|
Matrix
|
description |
required |
q
|
int
|
description |
required |
Returns:
| Type | Description |
|---|---|
SquareMatrix
|
description |
pqlattice.lattice.embeddings.kannan ¶
summary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
A
|
Matrix
|
description |
required |
b
|
Vector
|
description |
required |
q
|
int
|
description |
required |
Returns:
| Type | Description |
|---|---|
SquareMatrix
|
description |
pqlattice.lattice.embeddings.bai_galbraith ¶
summary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
A
|
Matrix
|
description |
required |
b
|
Vector
|
description |
required |
q
|
int
|
description |
required |
M
|
int
|
description |
required |
Returns:
| Type | Description |
|---|---|
SquareMatrix
|
description |
pqlattice.lattice.embeddings.subset_sum ¶
summary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sequence
|
Vector
|
description |
required |
S
|
int
|
description |
required |
Returns:
| Type | Description |
|---|---|
SquareMatrix
|
description |
pqlattice.lattice.embeddings.ntru ¶
construct the ntru lattice basis
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
quotient
|
Vector
|
description |
required |
q
|
int
|
description |
required |
h
|
Vector
|
description |
required |
Returns:
| Type | Description |
|---|---|
SquareMatrix
|
description |