MRHS solver based on linear algebra and exhaustive search