First bash at this cached matrix thing