CiFEr
Data Structures | Typedefs | Functions
mat_curve.h File Reference

Matrices of elements of an elliptic curve struct and operations on it. More...

Go to the source code of this file.

Data Structures

struct  cfe_mat_G1
 
struct  cfe_mat_G2
 
struct  cfe_mat_GT
 

Typedefs

typedef struct cfe_mat_G1 cfe_mat_G1
 
typedef struct cfe_mat_G2 cfe_mat_G2
 
typedef struct cfe_mat_GT cfe_mat_GT
 

Functions

void cfe_mat_G1_init (cfe_mat_G1 *m, size_t rows, size_t cols)
 
void cfe_mat_G1_transpose (cfe_mat_G1 *res, cfe_mat_G1 *m)
 
void cfe_mat_mul_G1 (cfe_mat_G1 *m, cfe_mat *u)
 
void cfe_mat_mul_G1_mat (cfe_mat_G1 *res, cfe_mat *mi, cfe_mat_G1 *m)
 
void cfe_mat_G1_mul_vec (cfe_vec_G1 *res, cfe_mat_G1 *m, cfe_vec *mi)
 
void cfe_mat_G1_free (cfe_mat_G1 *m)
 
void cfe_mat_G2_init (cfe_mat_G2 *m, size_t rows, size_t cols)
 
void cfe_mat_G2_transpose (cfe_mat_G2 *res, cfe_mat_G2 *m)
 
void cfe_mat_mul_G2 (cfe_mat_G2 *m, cfe_mat *u)
 
void cfe_mat_mul_G2_mat (cfe_mat_G2 *res, cfe_mat *mi, cfe_mat_G2 *m)
 
void cfe_mat_G2_mul_vec (cfe_vec_G2 *res, cfe_mat_G2 *m, cfe_vec *u)
 
void cfe_mat_G2_free (cfe_mat_G2 *m)
 
void cfe_mat_GT_init (cfe_mat_GT *m, size_t rows, size_t cols)
 
void cfe_mat_GT_transpose (cfe_mat_GT *res, cfe_mat_GT *m)
 
void cfe_mat_mul_GT_mat (cfe_mat_GT *res, cfe_mat *mi, cfe_mat_GT *m)
 
void cfe_mat_GT_mul_vec (cfe_vec_GT *res, cfe_mat_GT *m, cfe_vec *u)
 
void cfe_mat_GT_pair_mat_G1 (cfe_mat_GT *res, cfe_mat_G1 *m)
 
void cfe_mat_GT_pair_mat_G2 (cfe_mat_GT *res, cfe_mat_G2 *m)
 
void cfe_mat_GT_free (cfe_mat_GT *m)
 

Detailed Description

Matrices of elements of an elliptic curve struct and operations on it.

Typedef Documentation

◆ cfe_mat_G1

typedef struct cfe_mat_G1 cfe_mat_G1

Matrix of ECP_BN254 elements.

◆ cfe_mat_G2

typedef struct cfe_mat_G2 cfe_mat_G2

Matrix of ECP2_BN254 elements.

◆ cfe_mat_GT

typedef struct cfe_mat_GT cfe_mat_GT

Matrix of FP12_BN254 elements.

Function Documentation

◆ cfe_mat_G1_init()

void cfe_mat_G1_init ( cfe_mat_G1 m,
size_t  rows,
size_t  cols 
)

Initializes a matrix of ECP_BN254 elements

Parameters
mA pointer to an uninitialized cfe_mat_G1 matrix
rowsThe number of rows
colsThe number of columns

◆ cfe_mat_G1_transpose()

void cfe_mat_G1_transpose ( cfe_mat_G1 res,
cfe_mat_G1 m 
)

Transposes the given cfe_mat_G1 matrix

Parameters
resA pointer to an initialized cfe_mat_G1 matrix
mA pointer to a cfe_mat_G1 matrix

◆ cfe_mat_mul_G1()

void cfe_mat_mul_G1 ( cfe_mat_G1 m,
cfe_mat u 
)

Creates a matrix whose i-th element equals u[i] * g, where g is the generator of ECP_BN254. The sizes of m and u must match.

Parameters
mA pointer to an initialized cfe_mat_G1 matrix
uA pointer to matrix of integers

◆ cfe_mat_mul_G1_mat()

void cfe_mat_mul_G1_mat ( cfe_mat_G1 res,
cfe_mat mi,
cfe_mat_G1 m 
)

Multiplication of a matrix of integers by a matrix of elements of G1

Parameters
resA pointer to an initialized cfe_mat_G1 matrix
miA pointer to matrix of integers
mA pointer to an initialized cfe_mat_G1 matrix

◆ cfe_mat_G1_mul_vec()

void cfe_mat_G1_mul_vec ( cfe_vec_G1 res,
cfe_mat_G1 m,
cfe_vec mi 
)

Multiplication of a matrix of elements of G1 by a vector of integers.

Parameters
resA pointer to an initialized cfe_vec_G1 vector
mA pointer to a cfe_mat_G1 matrix
miA pointer to matrix of integers

◆ cfe_mat_G1_free()

void cfe_mat_G1_free ( cfe_mat_G1 m)

Frees the memory occupied by the struct members. It does not free memory occupied by the struct itself.

Parameters
mA pointer to a matrix (initialized cfe_mat_G1 struct)

◆ cfe_mat_G2_init()

void cfe_mat_G2_init ( cfe_mat_G2 m,
size_t  rows,
size_t  cols 
)

Initializes a matrix of ECP2_BN254 elements

Parameters
mA pointer to an uninitialized cfe_mat_G2 matrix
rowsThe number of rows
colsThe number of columns

◆ cfe_mat_G2_transpose()

void cfe_mat_G2_transpose ( cfe_mat_G2 res,
cfe_mat_G2 m 
)

Transposes the given cfe_mat_G2 matrix.

Parameters
resA pointer to an initialized cfe_mat_G2 matrix
mA pointer to a cfe_mat_G2 matrix

◆ cfe_mat_mul_G2()

void cfe_mat_mul_G2 ( cfe_mat_G2 m,
cfe_mat u 
)

Creates a matrix whose i-th element equals u[i] * g, where g is the generator of ECP2_BN254. The sizes of m and u must match.

Parameters
mA pointer to an initialized cfe_mat_G2 matrix
uA pointer to matrix of integers.

◆ cfe_mat_mul_G2_mat()

void cfe_mat_mul_G2_mat ( cfe_mat_G2 res,
cfe_mat mi,
cfe_mat_G2 m 
)

Multiplication of a matrix of integers by a matrix of elements of G2

Parameters
resA pointer to an initialized cfe_mat_G2 matrix
miA pointer to matrix of integers
mA pointer to an initialized cfe_mat_G2 matrix

◆ cfe_mat_G2_mul_vec()

void cfe_mat_G2_mul_vec ( cfe_vec_G2 res,
cfe_mat_G2 m,
cfe_vec u 
)

Multiplication of a matrix of elements of G2 by a vector of integers.

Parameters
resA pointer to an initialized cfe_vec_G2 vector
mA pointer to a cfe_mat_G2 matrix
uA pointer to matrix of integers.

◆ cfe_mat_G2_free()

void cfe_mat_G2_free ( cfe_mat_G2 m)

Frees the memory occupied by the struct members. It does not free memory occupied by the struct itself.

Parameters
mA pointer to a matrix (initialized cfe_mat_G2 struct)

◆ cfe_mat_GT_init()

void cfe_mat_GT_init ( cfe_mat_GT m,
size_t  rows,
size_t  cols 
)

Initializes a matrix of FP12_BN254 elements

Parameters
mA pointer to an uninitialized cfe_mat_GT matrix
rowsThe number of rows
colsThe number of columns

◆ cfe_mat_GT_transpose()

void cfe_mat_GT_transpose ( cfe_mat_GT res,
cfe_mat_GT m 
)

Transposes the given cfe_mat_GT matrix.

Parameters
resA pointer to an initialized cfe_mat_GT matrix
mA pointer to a cfe_mat_GT matrix

◆ cfe_mat_mul_GT_mat()

void cfe_mat_mul_GT_mat ( cfe_mat_GT res,
cfe_mat mi,
cfe_mat_GT m 
)

Multiplication of a matrix of integers by a matrix of elements of GT

Parameters
resA pointer to an initialized cfe_mat_GT matrix
miA pointer to matrix of integers
mA pointer to an initialized cfe_mat_GT matrix

◆ cfe_mat_GT_mul_vec()

void cfe_mat_GT_mul_vec ( cfe_vec_GT res,
cfe_mat_GT m,
cfe_vec u 
)

Multiplication of a matrix of elements of GT by a vector of integers.

Parameters
resA pointer to an initialized cfe_vec_GT vector
mA pointer to a cfe_mat_GT matrix
uA pointer to matrix of integers.

◆ cfe_mat_GT_pair_mat_G1()

void cfe_mat_GT_pair_mat_G1 ( cfe_mat_GT res,
cfe_mat_G1 m 
)

Pairs a given cfe_mat_G1 matrix with the generator of G2

Parameters
resA pointer to an initialized cfe_vec_GT matrix
mA pointer to a cfe_mat_G1 matrix

◆ cfe_mat_GT_pair_mat_G2()

void cfe_mat_GT_pair_mat_G2 ( cfe_mat_GT res,
cfe_mat_G2 m 
)

Pairs a given cfe_mat_G2 matrix with the generator of G1

Parameters
resA pointer to an initialized cfe_vec_GT matrix
mA pointer to a cfe_mat_G2 matrix

◆ cfe_mat_GT_free()

void cfe_mat_GT_free ( cfe_mat_GT m)

Frees the memory occupied by the struct members. It does not free memory occupied by the struct itself.

Parameters
mA pointer to a matrix (initialized cfe_mat_GT struct)