Matrix Accounting