コード例 #1
0
    def test_CompositionOperator_direct3(self):
        ig = self.ig
        data = self.data
        G = GradientOperator(domain_geometry=ig)

        Id1 = 2 * IdentityOperator(ig)
        Id2 = IdentityOperator(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())
コード例 #2
0
    def test_CompositionOperator_adjoint2(self):
        ig = self.ig
        data = self.data
        G = GradientOperator(domain_geometry=ig)

        Id1 = 2 * IdentityOperator(ig)
        Id2 = IdentityOperator(ig)

        d = CompositionOperator(G, Id1)
        da = d.direct(data)

        out1 = G.adjoint(da)
        out2 = d.adjoint(da)

        numpy.testing.assert_array_almost_equal(out2.as_array(),
                                                2 * out1.as_array())
コード例 #3
0
    def test_CompositionOperator_direct1(self):
        ig = self.ig
        data = self.data
        G = GradientOperator(domain_geometry=ig)

        Id1 = 2 * IdentityOperator(ig)
        Id2 = IdentityOperator(ig)

        d = CompositionOperator(G, Id2)

        out1 = G.direct(data)
        out2 = d.direct(data)

        numpy.testing.assert_array_almost_equal(
            out2.get_item(0).as_array(),
            out1.get_item(0).as_array())
        numpy.testing.assert_array_almost_equal(
            out2.get_item(1).as_array(),
            out1.get_item(1).as_array())