secure_learning.utils.matrix_augmenter¶
Contains the MatrixAugmenter class
Attributes¶
Classes¶
Representation of an augmented matrix build from multiple sequence-of- |
Module Contents¶
- class secure_learning.utils.matrix_augmenter.MatrixAugmenter[source]¶
Representation of an augmented matrix build from multiple sequence-of- sequences matrices.
Multiple identical-length matrices can be augmented to the MatrixAugmenter object. The object stores all matrices in a dictionary so that they can be retrieved individually. The MatrixAugmenter itself is a sequence; in particular, it behaves as a larger sequence-of-sequences. An update to the augmented matrix object translates to an update of all of the individual matrices.
- property shape: Tuple[int, int][source]¶
Return the shape of the augmented matrix.
- Returns:
Number of rows and columns
- keys() Any[source]¶
Provide a set-like object providing a view on the keys of the individual matrices.
- Returns:
set-like object providing a view on the keys of the individual matrices
- augment(key: str, matrix: tno.mpc.mpyc.secure_learning.utils.types.SeqMatrix[TemplateType]) None[source]¶
Augments a new matrix to the existing augmented matrix.
- Parameters:
key – Key used for storing and retrieving the new matrix
matrix – Matrix to be augmented
- Raises:
KeyError – Key already in use
- update_key(key: str, matrix: tno.mpc.mpyc.secure_learning.utils.types.SeqMatrix[TemplateType]) None[source]¶
Updates an existing matrix in the augmented matrix.
- Parameters:
key – Key for retrieving the existing matrix
matrix – New values for matrix
- Raises:
KeyError – Key not in use
- update(matrix: tno.mpc.mpyc.secure_learning.utils.types.SeqMatrix[TemplateType]) None[source]¶
Update augmented matrix in its entirety.
All individual matrices are updated accordingly.
- Parameters:
matrix – New augmented matrix
- Raises:
ValueError – Number of columns of new augmented matrix does not agree with old number of columns