def test_dense_minimum_norm_multiple_rhs(self): solver = QRMUMPSSolver(self.A, verbose=False) B = np.ones([self.m, 3], dtype=np.float64) B[:, 1] = 2 * B[:, 1] B[:, 2] = 3 * B[:, 2] with pytest.raises(RuntimeError): solver = solver.minimum_norm(B)
def test_dense_minimum_norm_multiple_rhs(self): solver = QRMUMPSSolver((self.m, self.n, self.arow, self.acol, self.aval), verbose=False) B = np.ones([self.n, 3], dtype=np.complex64) B[: ,1] = 2 * B[:,1] B[: ,2] = 3 * B[:,2] rhs = np.dot(self.A, B) with pytest.raises(RuntimeError): x = solver.minimum_norm(rhs)
def test_dense_minimum_norm_multiple_rhs(self): solver = QRMUMPSSolver((self.m, self.n, self.arow, self.acol, self.aval), verbose=False) B = np.ones([self.n, 3], dtype=np.float64) B[: ,1] = 2 * B[:,1] B[: ,2] = 3 * B[:,2] rhs = np.dot(self.A, B) x = solver.minimum_norm(rhs) assert np.allclose(np.dot(self.A,x), rhs, 1e-5)
def test_dense_minimum_norm_multiple_rhs(self): solver = QRMUMPSSolver(self.A, verbose=False) B = np.ones([self.m, 3], dtype=np.float64) B[:, 1] = 2 * B[:, 1] B[:, 2] = 3 * B[:, 2] x = solver.minimum_norm(B) assert np.allclose(self.A * x[:, 0], B[:, 0], 1e-5) assert np.allclose(self.A * x[:, 1], B[:, 1], 1e-5) assert np.allclose(self.A * x[:, 2], B[:, 2], 1e-5)
def test_dense_minimum_norm_wrong_size_rhs(self): solver = QRMUMPSSolver(self.A, verbose=False) rhs = np.ones([self.m + 1, 1], dtype=np.float64) with pytest.raises(ValueError): x = solver.minimum_norm(rhs)
def test_dense_minimum_norm_wrong_size_rhs(self): solver = QRMUMPSSolver((self.m, self.n, self.arow, self.acol, self.aval), verbose=False) rhs = np.ones([self.m+1, 1], dtype=np.float32) with pytest.raises(ValueError): x = solver.minimum_norm(rhs)