linac.pycuda_row_reduce

linac.pycuda_row_reduce.cuda_row_reduce(matrix, field_characteristic=0, verbose=False, _real=None, _mod64=None)
Args:
matrix (2D numpy.ndarray):

The matrix to be cast to row-reduced echelon form.

field_characteristic (int, optional, default: 0):

The characteristic p of the field, or 0 for real and complex matrices.

verbose (bool, optional, default: False):

If True, prints additional information.

linac.row_reduce

linac.row_reduce.row_reduce(matrix, pivoting=1, scaling=True, reduced_echelon=True, threshold=1e-09, prime=None, verbose=False)

Row reduction to (reduced) echelon form on the cpu using numpy. The matrix is kept of whatever object type it is made of, unless prime is specified. In the latter case the computation happens over numpy.int64 in a finite field of cardinality prime.

linac.linear_algebra_tools

linac.linear_algebra_tools.canonical_kernel_from_row_reduced_echelon_form(row_reduced_echelon_form)

Returns the kernel or null-space of a matrix in canonical form. The input should be in reduced echelon form.

linac.linear_algebra_tools.drop_bottom_zero_rows(row_reduced_matrix)
linac.linear_algebra_tools.invert_permutation(permutation)

Returns the inverse of permutation (requires input and output as tuples of indices)

linac.linear_algebra_tools.isclose_or_greater(x, y, *args, **kwargs)
linac.linear_algebra_tools.non_pivot_columns_from_canonical_kernel(canonical_kernel)
linac.linear_algebra_tools.non_pivot_columns_from_row_reduced_echelon_form(row_reduced_echelon_form)
linac.linear_algebra_tools.permutation_matrix_from_permutation(permutation)

Permutation (as list of indices) to permutation matrix.

linac.linear_algebra_tools.pivot_columns_from_canonical_kernel(canonical_kernel)
linac.linear_algebra_tools.pivot_columns_from_row_reduced_echelon_form(row_reduced_echelon_form)
linac.linear_algebra_tools.row_reduced_echelon_form_from_canonical_kernel(canonical_kernel)

Returns the row reduced echelon form the kernel kernel.

linac.sparse_matrix_tools

linac.sparse_matrix_tools.coo_from_json_coo(file_name, dtype=<class 'fractions.Fraction'>)

Loads coo from json containing coo dictionary.

linac.sparse_matrix_tools.coo_from_matrix(matrix)

COO (Coordinate list) dictionary: {(row, column): value}.

linac.sparse_matrix_tools.coo_from_plain_txt_coo(file_name, dtype=<class 'fractions.Fraction'>)

Loads coo from json containing coo dictionary.

linac.sparse_matrix_tools.json_coo_from_coo(coo, file_name)
linac.sparse_matrix_tools.json_coo_from_matrix(matrix, file_name)
linac.sparse_matrix_tools.matrix_from_coo(coo)

Converts a COO dictionary back to a numpy array.

linac.sparse_matrix_tools.matrix_from_json_coo(file_name, dtype=<class 'fractions.Fraction'>)

Loads matrix from json containing coo dictionary.

linac.sparse_matrix_tools.matrix_from_plain_txt_coo(file_name, dtype=<class 'fractions.Fraction'>)

Loads coo from json containing coo dictionary.

linac.sparse_matrix_tools.plain_txt_coo_from_coo(coo, file_name)
linac.sparse_matrix_tools.plain_txt_coo_from_matrix(matrix, file_name)
linac.sparse_matrix_tools.sparsity(matrix)

String representing the % of zeros in matrix.

linac.tensor_function

linac.tensor_function.memoized(*decorator_args, **decorator_kwargs)

Diskcaching decorator generator.

class linac.tensor_function.tensor_function(callable_function)

Tensor function supporting indexing and iteration. For instance, the initializer ‘callable_function’ can be a function returning a numpy.array

as_span(input_generator, field=Field('finite field', 2147483647, 1), **vs_kwargs)

Return the VectorSpaceOfFunctions spanned by the components of this tensor_function. All arguments are passed directly to VectorSpaceOfFunctions.

flatten()
property shape
linac.tensor_function.update_shape(func)

Decorator to update shape/size metadata after function call.

linac.vector_spaces.over_number_fields

class linac.vector_spaces.over_number_fields.ColumnVectorSpace(matrix, prime=2147483647, use_galois=None, use_gpu=None, verbose=False)

Column vector space over number fields (finite fields and rationals currently supported).

property GFp
property dim

linac.vector_spaces.over_function_fields

class linac.vector_spaces.over_function_fields.VectorSpaceOfFunctions(functions_evaluator, input_generator, field=Field('finite field', 2147483647, 1), verbose=True, use_gpu=None, iteration_start=20, iteration_step=20, max_iteration=50, Cores=8)

Vector space spanned by a set of functions (e.g. functions in fraction fields of polynomial (quotient) rings), with coefficients in a given number field.

close_under_symmetries(symmetries)

Symmetries are applied to first positional arguments, which should define a image function under the symmetry.

property dim
property kernel

Module contents

class linac.ColumnVectorSpace(matrix, prime=2147483647, use_galois=None, use_gpu=None, verbose=False)

Column vector space over number fields (finite fields and rationals currently supported).

property GFp
property dim
class linac.VectorSpaceOfFunctions(functions_evaluator, input_generator, field=Field('finite field', 2147483647, 1), verbose=True, use_gpu=None, iteration_start=20, iteration_step=20, max_iteration=50, Cores=8)

Vector space spanned by a set of functions (e.g. functions in fraction fields of polynomial (quotient) rings), with coefficients in a given number field.

close_under_symmetries(symmetries)

Symmetries are applied to first positional arguments, which should define a image function under the symmetry.

property dim
property kernel
linac.cuda_load_matrix(bases, lindices, shape=None, field_characteristic=0, _real=None, _mod64=None, verbose=False)

Construct a dense matrix on the GPU by evaluating monomials as products of precomputed base values.

Parameters

bases(n_rows, basis_length) array

Variable values per row/point (optionally including a prefactor column).

lindices(n_cols, degree) uint32 array

Each row specifies a monomial as indices into bases (assumes uniform degree).

field_characteristicint, default 0

Modulus p for finite fields or p-adics leading digit; 0 selects real/complex arithmetic.

Returns

A(n_rows, n_cols) ndarray

Matrix representing the linear system.

linac.cuda_row_reduce(matrix, field_characteristic=0, verbose=False, _real=None, _mod64=None)
Args:
matrix (2D numpy.ndarray):

The matrix to be cast to row-reduced echelon form.

field_characteristic (int, optional, default: 0):

The characteristic p of the field, or 0 for real and complex matrices.

verbose (bool, optional, default: False):

If True, prints additional information.

linac.iterative_gaussian_solver(matrix, use_gpu=True, max_iterations=1, pivoting=1, scaling=True, field_characteristic=0, verbose=True)
linac.load_matrices(prefactors, ansatze, points, use_cuda=True, _use_galois=True, verbose=False)

Build one or more matrices representing polynomial linear systems evaluated at numerical points.

Parameters

prefactorslist

One prefactor per system (string key or callable), e.g. inverse denominators for rational functions.

ansatzelist

One ansatz per system; each ansatz is a list of monomials, i.e. a polynomial with unknown coefficients.

pointslist or dict

Numerical evaluation points (vectorised), including a field descriptor (e.g. a syngular.RingPoints list subclass).

use_cudabool, default True

Use CUDA backend when available.

Returns

Aslist of ndarrays

One matrix per system.

linac.timeit(func)

Print the runtime of the decorated function as hours:minutes:seconds:milliseconds