symfem.caching

Functions to cache matrices.

Module Contents

Functions

load_cached_matrix(...)

Load a cached matrix.

save_cached_matrix(matrix_type, cache_id, matrix)

Save a matrix to the cache.

matrix_to_string(→ str)

Convert a matrix to a string.

matrix_from_string(...)

Convert a string to a matrix.

Attributes

CACHE_DIR

CACHE_FORMAT

symfem.caching.CACHE_DIR
symfem.caching.CACHE_FORMAT = '1'
symfem.caching.load_cached_matrix(matrix_type: str, cache_id: str, size: Tuple[int, int]) sympy.matrices.dense.MutableDenseMatrix | None

Load a cached matrix.

Parameters:
  • matrix_type – The type of the matrix. This will be included in the filename.

  • cache_id – The unique identifier of the matrix within this type

Returns:

The matrix

symfem.caching.save_cached_matrix(matrix_type: str, cache_id: str, matrix: sympy.matrices.dense.MutableDenseMatrix)

Save a matrix to the cache.

Parameters:
  • matrix_type – The type of the matrix. This will be included in the filename.

  • cache_id – The unique identifier of the matrix within this type

  • matrix – The matrix

symfem.caching.matrix_to_string(m: sympy.matrices.dense.MutableDenseMatrix) str

Convert a matrix to a string.

Parameters:

m – The matrix

Returns:

A representation of the matrix as a string

symfem.caching.matrix_from_string(mstr: str) sympy.matrices.dense.MutableDenseMatrix

Convert a string to a matrix.

Parameters:

mstr – The string in the format output by matrix_to_string

Returns:

The matrix