Revert "Revert "Revert "cache the inverse of the matrix"""

This reverts commit a5c48f9aedb8fd962c46cc5a1081c52a19430de1.
Revert "Revert "Revert "Revert "cache the inverse of the matrix""""

This reverts commit 5004f129e57094090c7e10540aa36d5b1282933f.