API¶
Linear System of Equations¶
Local¶
This module contains pure numpy
implementation of the secure LSE algorithm.
|
Perform secure masking Q @ (A + Z) @ P. |
|
Performs SLSE Transformation to the input problem. |
|
Performs Privacy Preserving Conjugate Gradient Method (PPCGM). |
|
Solve any linear system of equations using the proposed algorithm. |
-
secout.LSE.local.
secure_mask
(A, Q=None, P=None, Z=None, l=16, p=8, q=4)¶ Perform secure masking Q @ (A + Z) @ P.
- Parameters
- A(M, N) array_like
The array to be masked
- Q(M, M) array_like, optional
Row permutation matrix. If Q is not supplied, a random permutation matrix of corresponding shape is generated.
- P(N, N) array_like, optional
Column permutation matrix. If P is not supplied, a random permutation matrix of corresponding shape is generated.
- Z(M, N) array_like, optional
Additive noise matrix. If Z is not supplied, a random additive noise of
A.shape
is generated- lint, optional
Parameter for additive noise, assuming that the value of A is within (-2^l, 2^l) (the default is 16)
- pint, optional
parameter for additive noise (the default is 8).
- qint, optional
parameter for additive noise (the default is 4).
- Returns
- (M, N) array_like
The result of the secure mask
Q @ (A + Z) @ P
- Z(M, N) array_like
Additive noise
- Q(M, M) array_like
Row permutation matrix
- P(N, N) array_like
Column permutation matrix
-
secout.LSE.local.
slse_transformation
(A, b, l)¶ Performs SLSE Transformation to the input problem.
Computes \(A.T A\) and \(A.T b\) using the proposed secure LSE transformation using local computational resources.
- Parameters
- A(M, N) matrix_like
Coefficient matrix to the linear system of equations
- b(M,) matrix_like
Constant matrix to the linear system of equations
- lint
Constraint for A: The values in A must be within \((-2^l, 2^l)\)
- Returns
- Ap(N, N) ndarray
The transformed coefficient matrix. \(A.T A\)
- bp(N,) ndarray
The transformed constant matrix. \(A.T b\)
-
secout.LSE.local.
ppcgm
(Ap, bp, l, tol=1e-05)¶ Performs Privacy Preserving Conjugate Gradient Method (PPCGM).
Computes the result of the input linear system using the proposed PPCGM with local computational resources. The input linear system must be nonsingular, symmetric and positive definite.
- Parameters
- Ap(N, N) array_like
Coefficient matrix that is nonsingular, symmetric and positive definite.
- bp(N,) array_like
Constant matrix
- lint
Constraint for A: The values in A must be within \((-2^l, 2^l)\)
- tolfloat, optional
The stopping threshold for PPCGM (default is 1e-5)
- Returns
- x(N,) array_like
The solution to the linear system computed by PPCGM
-
secout.LSE.local.
solve
(A, b, tol=1e-05)¶ Solve any linear system of equations using the proposed algorithm.
Transform the input A and b using SLSE_transformation and compute the result using PPCGM.
- Parameters
- A(M, N) matrix_like
Coefficient matrix to the linear system of equations
- b(M,) matrix_like
Constant matrix to the linear system of equations
- tolfloat, optional
The stopping threshold for PPCGM (default is 1e-5)
- Returns
- x(N,) array_like
The solution to the linear system computed by PPCGM
Dask¶
-
class
secout.LSE.
DaskLSE
(A, b, l=16, p=6, q=3, remote=None, local=None)¶ Secure solver for linear system of equation.
Solves the specified linear system of equation by exploiting local and remote computational resources using the proposed algorithms.
- Parameters
- A: (M, N) array_like
The coefficient matrix of the linear system to be solved
- b: (M,) matrix_like
The constant matrix of the linear system to be solved
- l: int, optional
Parameter for additive noise, assuming that the value of A is within (-2^l, 2^l) (the default is 16)
- p: int, optional
parameter for additive noise (the default is 8).
- q: int, optional
parameter for additive noise (the default is 4).
- remote: dask.distributed.Client
The client instance represents remote resources
- local: dask.distributed.Client
The client instance represents local resources
See also
dask.distributed.Client
- Attributes
- Ap(N, N) array_like
Transformed coefficient matrix
- bp(N, ) array_like
Transformed constant matrix
- x(N,) array_like
Solution for the input problem
Methods
Recover coefficient A and constant b to de-normalized form
Normalize the coefficient matrix A and constant matrix b
ppcgm
([tol])Performs Privacy Preserving Conjugate Gradient Method (PPCGM).
secure_mask
(A[, Q, P, Z])Perform secure masking Q @ (A + Z) @ P.
Performs SLSE transformations to the given problem.
solve
([tol])Solve any linear system of equations using the proposed algorithm.
-
denormalize_problem
()¶ Recover coefficient A and constant b to de-normalized form
- Returns
- None
-
normalize_problem
()¶ Normalize the coefficient matrix A and constant matrix b
The normalization is based on the upper and lower bound of A.
- Returns
- None
-
ppcgm
(tol=1e-05)¶ Performs Privacy Preserving Conjugate Gradient Method (PPCGM).
The result is saved as a instance attribute x.
- Parameters
- tol: float, optional
The stopping threshold for PPCGM (default is 1e-5)
- Returns
- None
-
secure_mask
(A, Q=None, P=None, Z=None)¶ Perform secure masking Q @ (A + Z) @ P.
- Parameters
- A: (M, N) array_like
The array to be masked
- Q: (M, M) array_like, optional
Row permutation matrix. If Q is not supplied, a random permutation matrix of corresponding shape is generated.
- P: (N, N) array_like, optional
Column permutation matrix. If P is not supplied, a random permutation matrix of corresponding shape is generated.
- Z: (M, N) array_like, optional
Additive noise matrix. If Z is not supplied, a random additive noise of
A.shape
is generated
- Returns
- (M, N) array_like
The result of the secure mask
Q @ (A + Z) @ P
- Z: (M, N) array_like
Additive noise
- Q: (M, M) array_like
Row permutation matrix
- P: (N, N) array_like
Column permutation matrix
-
slse_transformation
()¶ Performs SLSE transformations to the given problem.
Computes \(A.T A\) and \(A.T b\) using the proposed secure LSE transformation. The results are saved as instance attributes Ap and bp.
- Returns
- None
-
solve
(tol=1e-05)¶ Solve any linear system of equations using the proposed algorithm.
Transform the input A and b using SLSE_transformation and compute the result using PPCGM.
- Parameters
- tol: float, optional
The stopping threshold for PPCGM (default is 1e-5)
- Returns
- None