def test_reduce_B(self): """Given modes, test reduced B matrix""" B_returned = self.LTI_proj.reduce_B(self.B_on_standard_basis_array) np.testing.assert_allclose(B_returned, self.B_true) LTI_proj = LGP.LTIGalerkinProjectionMatrices(self.basis_vecs, self.adjoint_basis_vecs, is_basis_orthonormal=False) B_returned = LTI_proj.reduce_B(self.B_on_standard_basis_array) np.testing.assert_allclose(B_returned, self.B_true_nonorth)
def setUp(self): self.num_basis_vecs = 10 self.num_adjoint_basis_vecs = 10 self.num_states = 11 self.num_inputs = 3 self.num_outputs = 2 self.generate_data_set(self.num_basis_vecs, self.num_adjoint_basis_vecs, self.num_states, self.num_inputs, self.num_outputs) self.LTI_proj = LGP.LTIGalerkinProjectionMatrices(self.basis_vecs, self.adjoint_basis_vecs, is_basis_orthonormal=True)
def test_reduce_A(self): """Reduction of A matrix for Matrix, LookUp operators and in_memory.""" A_returned = self.LTI_proj.reduce_A(self.A_on_basis_vecs) np.testing.assert_allclose(A_returned, self.A_true) # Precomputed operations A object with vec handles, non-orthonormal # modes LTI_proj = LGP.LTIGalerkinProjectionMatrices(self.basis_vecs, self.adjoint_basis_vecs, is_basis_orthonormal=False) A_returned = LTI_proj.reduce_A(self.A_on_basis_vecs) np.testing.assert_allclose(LTI_proj._proj_mat, self.proj_mat) np.testing.assert_allclose(A_returned, self.A_true_nonorth)
def test_adjoint_basis_vec_optional(self): """Test that adjoint modes default to direct modes""" no_adjoints_LTI_proj = LGP.LTIGalerkinProjectionMatrices( self.basis_vecs, is_basis_orthonormal=True) np.testing.assert_equal(no_adjoints_LTI_proj.adjoint_basis_vecs, self.basis_vecs)