Sparse matrices with lots of repeated elements in Scipy
Definitely, you can use the sparse matrix data structures from 'scipy.sparse'. If you know the values tend to group in certain patterns you can use specific sparse matrix structures optimized for that pattern. If the values group along diagonals use 'dia_matrix', columns use 'csc_matrix', rows use 'csr_matrix', and blocks use 'bsr_matrix'.
I have a triangular sparse matrix of dimension n where the only coefficients that appear are c_1, c_2,...c_n. There are at most n repetitions of a single coefficient in the matrix. Is there any way to use the fact that there are many elements of the matrix that are the same and use much less memory instead of assigning the same value to many different (row, column) and not exploiting the fact that many are the same. At the end of the day I want to apply the inverse of the said matrix to an arbitrary vector.
Thank you!