matrix equation solver