def test_CompositionOperator_direct3(self): ig = self.ig data = self.data G = Gradient(domain_geometry=ig) Id1 = 2 * Identity(ig) Id2 = Identity(ig) d = CompositionOperator(G, Id2) out1 = G.direct(data) d_out = d.direct(data) d1 = Id2.direct(data) d2 = G.direct(d1) numpy.testing.assert_array_almost_equal(d2.get_item(0).as_array(), d_out.get_item(0).as_array()) numpy.testing.assert_array_almost_equal(d2.get_item(1).as_array(), d_out.get_item(1).as_array()) G2Id = G.compose(2*Id2) d2g = G2Id.direct(data) numpy.testing.assert_array_almost_equal(d2g.get_item(0).as_array(), 2 * d_out.get_item(0).as_array()) numpy.testing.assert_array_almost_equal(d2g.get_item(1).as_array(), 2 * d_out.get_item(1).as_array())
def test_CompositionOperator_adjoint6(self): ig = self.ig data = self.data G = Gradient(domain_geometry=ig) Id1 = 3 * Identity(ig) Id = ZeroOperator(ig) d = G.compose(Id) da = d.direct(data) out1 = G.adjoint(da) out2 = d.adjoint(da) numpy.testing.assert_array_almost_equal(out2.as_array(), 0 * out1.as_array())