Matrix calculation added.