implemented cached matrix