def test_compare_pushforward_pullback_derivatives2(self): x = UTPS(numpy.array([1.,0.,0.,0.]), P = 1) y = UTPS(numpy.array([2.,1.,0.,0.]), P = 1) z = div(x,y) zbar = UTPS([1.,0.,0., 0.], P = 1) xbar = UTPS(numpy.zeros(4), P = 1) ybar = UTPS(numpy.zeros(4), P = 1) epb_div(x,y,z, zbar, xbar, ybar) facs = numpy.array([1.,1.,2.,6.]) assert_array_almost_equal((z.data*facs)[1:], (ybar.data*facs)[:-1])
def test_div_epb(self): x = UTPS(numpy.array([1.,2.,3.]), P = 1) y = UTPS(numpy.array([5.,7.,11.]), P = 1) z = div(x,y) zbar = UTPS(numpy.random.rand(3), P = 1) xbar = UTPS(numpy.zeros(3), P = 1) ybar = UTPS(numpy.zeros(3), P = 1) xbar2 = zbar/y ybar2 = - zbar*z/y epb_div(x,y,z, zbar, xbar, ybar) assert_array_almost_equal(xbar2.data, xbar.data) assert_array_almost_equal(ybar2.data, ybar.data)