Calculator for matrices