Numpy Examples

This section contains examples of some numpy functions when called on Galois field arrays. Many more functions are supported, just not explicitly documented here.

General

np.copy(a)

Returns a copy of a given Galois field array.

np.concatenate(arrays[, axis])

Concatenates the input arrays along the given axis.

np.insert(array, object, values[, axis])

Inserts values along the given axis.

Arithmetic

np.add(x, y)

Adds two Galois field arrays element-wise.

np.subtract(x, y)

Subtracts two Galois field arrays element-wise.

np.multiply(x, y)

Multiplies two Galois field arrays element-wise.

np.divide(x, y)

Divides two Galois field arrays element-wise.

np.negative(x)

Returns the element-wise additive inverse of a Galois field array.

np.reciprocal(x)

Returns the element-wise multiplicative inverse of a Galois field array.

np.power(x, y)

Exponentiates a Galois field array element-wise.

np.square(x)

Squares a Galois field array element-wise.

np.log(x)

Computes the logarithm (base GF.primitive_element) of a Galois field array element-wise.

np.matmul(a, b)

Returns the matrix multiplication of two Galois field arrays.

Advanced Arithmetic

np.convolve(a, b)

Convolves the input arrays.

Linear Algebra

np.dot(a, b)

Returns the dot product of two Galois field arrays.

np.vdot(a, b)

Returns the dot product of two Galois field vectors.

np.inner(a, b)

Returns the inner product of two Galois field arrays.

np.outer(a, b)

Returns the outer product of two Galois field arrays.

np.matmul(a, b)

Returns the matrix multiplication of two Galois field arrays.

np.linalg.matrix_power(x)

Raises a square Galois field matrix to an integer power.

np.linalg.det(A)

Computes the determinant of the matrix.

np.linalg.matrix_rank(x)

Returns the rank of a Galois field matrix.

np.trace(x)

Returns the sum along the diagonal of a Galois field array.

np.linalg.solve(x)

Solves the system of linear equations.

np.linalg.inv(A)

Computes the inverse of the matrix.