Non-contiguous array in min-src
This commit is contained in:
parent
4fdabd2b4e
commit
c56461e3a5
|
@ -833,15 +833,14 @@ void bytes_to_bls_field(BLSFieldElement *out, const uint8_t bytes[32]) {
|
||||||
/**
|
/**
|
||||||
* Compute linear combinations of a sequence of vectors with some scalars
|
* Compute linear combinations of a sequence of vectors with some scalars
|
||||||
*/
|
*/
|
||||||
void vector_lincomb(fr_t out[], const fr_t *vectors, const fr_t *scalars, uint64_t n, uint64_t m) {
|
void vector_lincomb(fr_t out[], const fr_t *vectors[], const fr_t *scalars, uint64_t n, uint64_t m) {
|
||||||
fr_t (*vectors_ptr)[n][m] = (fr_t (*)[n][m]) vectors;
|
|
||||||
fr_t tmp;
|
fr_t tmp;
|
||||||
uint64_t i, j;
|
uint64_t i, j;
|
||||||
for (j = 0; j < m; j++)
|
for (j = 0; j < m; j++)
|
||||||
out[j] = fr_zero;
|
out[j] = fr_zero;
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
for (j = 0; j < m; j++) {
|
for (j = 0; j < m; j++) {
|
||||||
fr_mul(&tmp, &scalars[i], &((*vectors_ptr)[i][j]));
|
fr_mul(&tmp, &scalars[i], &vectors[i][j]);
|
||||||
fr_add(&out[j], &out[j], &tmp);
|
fr_add(&out[j], &out[j], &tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ void free_trusted_setup(KZGSettings *s);
|
||||||
|
|
||||||
void bytes_to_bls_field(BLSFieldElement *out, const uint8_t bytes[32]);
|
void bytes_to_bls_field(BLSFieldElement *out, const uint8_t bytes[32]);
|
||||||
|
|
||||||
void vector_lincomb(BLSFieldElement out[], const BLSFieldElement *vectors, const BLSFieldElement *scalars, uint64_t num_vectors, uint64_t vector_len);
|
void vector_lincomb(BLSFieldElement out[], const BLSFieldElement *vectors[], const BLSFieldElement *scalars, uint64_t num_vectors, uint64_t vector_len);
|
||||||
|
|
||||||
void g1_lincomb(KZGCommitment *out, const KZGCommitment points[], const BLSFieldElement scalars[], uint64_t num_points);
|
void g1_lincomb(KZGCommitment *out, const KZGCommitment points[], const BLSFieldElement scalars[], uint64_t num_points);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue