-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathcommitment.cuh
45 lines (34 loc) · 1.55 KB
/
commitment.cuh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef COMMITMENT_CUH
#define COMMITMENT_CUH
#include "fr-tensor.cuh"
#include "g1-tensor.cuh"
#include "proof.cuh"
class Commitment: public G1TensorJacobian
{
public:
using G1TensorJacobian::G1TensorJacobian;
using G1TensorJacobian::operator+;
using G1TensorJacobian::operator-;
using G1TensorJacobian::operator*;
using G1TensorJacobian::operator*=;
G1TensorJacobian commit(const FrTensor& t) const;
G1TensorJacobian commit_int (const FrTensor& t) const;
G1TensorJacobian commit_int_multi(const vector<FrTensor>& t) const;
Fr_t open(const FrTensor& t, const G1TensorJacobian& c, const vector<Fr_t>& u) const;
static Commitment random(uint size);
static Fr_t me_open(const FrTensor& t, const Commitment& generators, vector<Fr_t>::const_iterator begin, vector<Fr_t>::const_iterator end, vector<G1Jacobian_t>& proof);
};
struct Weight {
Commitment generator;
FrTensor weight;
G1TensorJacobian com;
uint in_dim;
uint out_dim;
};
Weight create_weight(string generator_filename, string weight_filename, string com_filename, uint in_dim, uint out_dim);
// KERNEL void sum_axis_n_optimized(GLOBAL G1Jacobian_t* arr, GLOBAL G1Jacobian_t* arr_out, uint n, uint m);
KERNEL void me_open_step(GLOBAL Fr_t* scalars, GLOBAL G1Jacobian_t* generators, Fr_t u, // always assume that scalars and u is in mont form
GLOBAL Fr_t* new_scalars, GLOBAL G1Jacobian_t* new_generators,
GLOBAL G1Jacobian_t* temp_out, GLOBAL G1Jacobian_t* temp_out0, GLOBAL G1Jacobian_t* temp_out1,
uint old_size, uint new_size);
#endif