Matrix contracts