Non-contiguous array in min-src

This commit is contained in:
Ramana Kumar 2022-10-01 17:07:41 +01:00
parent 4fdabd2b4e
commit c56461e3a5
No known key found for this signature in database
GPG Key ID: ED471C788B900433
2 changed files with 3 additions and 4 deletions

View File

@ -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
*/
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;
void vector_lincomb(fr_t out[], const fr_t *vectors[], const fr_t *scalars, uint64_t n, uint64_t m) {
fr_t tmp;
uint64_t i, j;
for (j = 0; j < m; j++)
out[j] = fr_zero;
for (i = 0; i < n; i++) {
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);
}
}

View File

@ -106,7 +106,7 @@ void free_trusted_setup(KZGSettings *s);
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);