MOTION
0.01
Framework for mixed-protocol multi-party computation
|
Go to the documentation of this file.
50 BitMatrix(std::size_t rows, std::size_t columns,
bool value =
false)
51 : number_of_columns_(columns) {
52 for (
auto i = 0ull; i < rows; ++i) {
53 data_.emplace_back(columns, value);
60 BitMatrix(std::vector<AlignedBitVector>&& vectors) : data_(std::move(vectors)) {
61 if (data_.size() > 0) {
62 auto number_of_columns = data_.at(0).GetSize();
63 for (
auto i = 1ull; i < data_.size(); ++i) {
64 assert(data_.at(i).GetSize() == number_of_columns);
66 number_of_columns_ = number_of_columns;
73 BitMatrix(
const std::vector<AlignedBitVector>& vectors) : data_(vectors) {
74 if (data_.size() > 0) {
75 auto number_of_columns = data_.at(0).GetSize();
76 for (
auto i = 1ull; i < data_.size(); ++i) {
77 assert(data_.at(i).GetSize() == number_of_columns);
79 number_of_columns_ = number_of_columns;
86 data_.insert(data_.begin(), other.data_.begin(), other.data_.end());
87 number_of_columns_ = other.number_of_columns_;
91 data_ = std::move(other.data_);
92 number_of_columns_ = other.number_of_columns_;
96 data_.insert(data_.begin(), other.data_.begin(), other.data_.end());
97 number_of_columns_ = other.number_of_columns_;
101 data_ = std::move(other.data_);
102 number_of_columns_ = other.number_of_columns_;
119 bool Get(std::size_t row_i, std::size_t column_i)
const {
return data_.at(row_i).Get(column_i); }
125 void Set(std::size_t row_i, std::size_t column_i,
bool value) {
126 data_.at(row_i).Set(value, column_i);
168 std::size_t number_of_columns);
175 std::size_t number_of_columns);
186 const std::size_t number_of_columns,
187 const std::vector<std::size_t>& bitlengths);
197 const std::size_t number_of_columns,
198 const std::vector<std::size_t>& bitlengths);
215 std::vector<AlignedBitVector> data_;
217 std::size_t number_of_columns_ = 0;
220 void TransposeInternal();
223 void Transpose128RowsInternal();
225 static void Transpose128x128InPlace(std::array<std::uint64_t*, 128>& rows_64_bit,
226 std::array<std::uint32_t*, 128>& rows_32_bit);
std::string to_string(Provider p)
Definition: benchmark_providers.h:44
encrypto::motion::PartyPointer CreateParty(const program_options::variables_map &user_options)
Definition: benchmark_providers_main.cpp:204
void ForceSetNumColumns(std::size_t n)
Force the number of columns to be equal to n.
Definition: bit_matrix.h:154
@ kSb
Definition: benchmark_providers.h:38
void Add(const communication::TransportStatistics &statistics)
Definition: analysis.cpp:125
@ kROt
Definition: benchmark_providers.h:37
Definition: bit_matrix.h:42
Definition: analysis.h:43
static void TransposeUsingBitSlicing(std::array< std::byte *, 128 > &matrix, std::size_t number_of_columns)
Transposes a matrix of 128 rows and arbitrary column size inplace using BitSlicing.
Definition: bit_matrix.cpp:409
std::size_t bit_size
Definition: benchmark_main.cpp:60
static void ReceiverTransposeAndEncrypt(const std::array< const std::byte *, 128 > &matrix, std::vector< BitVector<>> &output, primitives::Prg &prg_fixed_key, const std::size_t number_of_columns, const std::vector< std::size_t > &bitlengths)
Transposes a matrix of 128 rows and arbitrary column size and encrypts it for the recepient role.
Definition: bit_matrix.cpp:640
std::tuple< std::size_t, std::string, std::uint16_t > ParsePartyArgument(const std::string &party_arguments)
Definition: benchmark_providers_main.cpp:124
std::size_t bit_size_
Definition: benchmark_integers_main.cpp:60
void SetKey(const std::uint8_t *key)
Definition: pseudo_random_generator.cpp:32
BitMatrix(std::size_t rows, std::size_t columns, bool value=false)
Construct a rows x columns BitMatrix with all bits set to value.
Definition: bit_matrix.h:50
std::string AsString() const
Return a string representation of the BitMatrix.
Definition: bit_matrix.cpp:244
std::unique_ptr< Party > PartyPointer
Definition: party.h:387
constexpr std::size_t BitsToBytes(const std::size_t bits)
Returns the number of bytes necessary to store bits bits.
Definition: helpers.h:504
auto GetNumColumns() const noexcept
Get number of columns in the BitMatrix.
Definition: bit_matrix.h:212
@ kBmt
Definition: benchmark_providers.h:33
constexpr std::size_t kKappa
Definition: constants.h:65
@ kAcOt
Definition: benchmark_providers.h:36
Class representing a series of bits and providing single bit access.
Definition: bit_vector.h:64
Definition: tcp_transport.h:69
BitMatrix(std::vector< AlignedBitVector > &&vectors)
Construct a BitMatrix by moving a vector of AlignedBitVectors.
Definition: bit_matrix.h:60
@ kAmt
Definition: benchmark_providers.h:32
void AppendColumn(const AlignedBitVector &bit_vector)
Appends a new column by copying the input bit_vector to the matrix.
Definition: bit_matrix.cpp:234
choices
Definition: geninput.py:153
Provider
Definition: benchmark_providers.h:31
const std::regex kPartyArgumentRegex("(\\d+),(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}),(\\d{1,5})")
bool operator!=(const BitMatrix &other) const
Compare with another BitMatrix for inequality.
Definition: bit_matrix.h:206
Definition: motion_base_provider.h:35
auto GetNumRows() const noexcept
Get number of rows in the BitMatrix.
Definition: bit_matrix.h:209
static void Transpose128RowsInplace(std::array< std::byte *, 128 > &matrix, std::size_t number_of_columns)
Transposes a matrix of 128 rows and arbitrary column size inplace.
Definition: bit_matrix.cpp:252
BitMatrix(const BitMatrix &other)
Definition: bit_matrix.h:85
std::vector< TcpConnectionConfiguration > TcpPartiesConfiguration
Definition: tcp_transport.h:62
Definition: benchmark_main.cpp:52
void AppendRow(const AlignedBitVector &bit_vector)
Appends a new row by copying the input bit_vector to the matrix.
Definition: bit_matrix.cpp:220
int main(int ac, char *av[])
Definition: benchmark_providers_main.cpp:50
bool CheckPartyArgumentSyntax(const std::string &party_arguments)
Definition: benchmark_providers_main.cpp:119
void AppendColumn(AlignedBitVector &&bit_vector)
Appends a new column by moving the input bit_vector to the matrix.
Definition: bit_matrix.h:147
Definition: algorithm_description.cpp:35
auto GetSize() const noexcept
Get size of BitVector.
Definition: bit_vector.h:149
Combination(std::size_t bit_size, encrypto::motion::MpcProtocol protocol, encrypto::motion::PrimitiveOperationType operation_type, std::size_t number_of_simd)
Definition: benchmark_main.cpp:53
help
Definition: geninput.py:150
bool Get(std::size_t position) const
Get bit at given position.
Definition: bit_vector.cpp:471
Definition: pseudo_random_generator.h:41
@ kGOt
Definition: benchmark_providers.h:34
bool operator==(const BitMatrix &other) const
Compare with another BitMatrix for equality.
Definition: bit_matrix.cpp:751
BitMatrix(const std::vector< AlignedBitVector > &vectors)
Construct a BitMatrix by copying a vector of AlignedBitVectors.
Definition: bit_matrix.h:73
std::tuple< program_options::variables_map, bool, bool > ParseProgramOptions(int ac, char *av[])
Definition: benchmark_providers_main.cpp:135
std::string PrintStatistics(const std::string &experiment_name, const AccumulatedRunTimeStatistics &execution_statistics, const AccumulatedCommunicationStatistics &communication_statistics)
Definition: analysis.cpp:176
std::vector< std::byte > Encrypt(const std::size_t bytes)
Definition: pseudo_random_generator.cpp:46
const AlignedBitVector & GetRow(std::size_t i) const
Returns a const AlignedBitVector reference to row i of the matrix.
Definition: bit_matrix.h:107
@ kSp
Definition: benchmark_providers.h:39
void Transpose128Rows()
Transposes a matrix with exactly 128 rows (faster).
Definition: bit_matrix.cpp:147
void Mmo(std::byte *input)
Definition: pseudo_random_generator.cpp:148
void operator=(const BitMatrix &other)
Definition: bit_matrix.h:95
void operator=(BitMatrix &&other)
Definition: bit_matrix.h:100
void swap(ReusablePromise< R, MutexType, ConditionVariableType > &lhs, ReusablePromise< R, MutexType, ConditionVariableType > &rhs) noexcept
Definition: reusable_future.h:270
encrypto::motion::RunTimeStatistics BenchmarkProvider(encrypto::motion::PartyPointer &party, std::size_t batch_size, Provider provider, std::size_t bit_size)
Definition: benchmark_providers.cpp:37
static void SenderTransposeAndEncrypt(const std::array< const std::byte *, 128 > &matrix, std::vector< BitVector<>> &y0, std::vector< BitVector<>> &y1, const BitVector<> choices, primitives::Prg &prg_fixed_key, const std::size_t number_of_columns, const std::vector< std::size_t > &bitlengths)
Transposes a matrix of 128 rows and arbitrary column size and encrypts it for the sender role.
Definition: bit_matrix.cpp:511
BitMatrix(BitMatrix &&other)
Definition: bit_matrix.h:90
void Set(std::size_t row_i, std::size_t column_i, bool value)
Set or unset bit at input position.
Definition: bit_matrix.h:125
AlignedBitVector & GetMutableRow(std::size_t i)
Returns a mutable AlignedBitVector reference to row i of the matrix.
Definition: bit_matrix.h:114
Definition: analysis.h:65
void Transpose()
Transposes the matrix inplace.
Definition: bit_matrix.cpp:37
bool Get(std::size_t row_i, std::size_t column_i) const
Get Bit at input position.
Definition: bit_matrix.h:119
void Add(const RunTimeStatistics &statistics)
Definition: analysis.cpp:43
@ kXcOt
Definition: benchmark_providers.h:35
std::vector< std::unique_ptr< Transport > > SetupConnections()
Definition: tcp_transport.cpp:203