Example #1
0
    def test_comutativity_inprod(self):
        monomial = Monomial(n_basis=4)
        bspline = BSpline(n_basis=5, order=3)
        bsplinefd = FDataBasis(bspline, np.arange(0, 15).reshape(3, 5))

        np.testing.assert_allclose(
            inner_product_matrix(bsplinefd, monomial),
            np.transpose(inner_product_matrix(monomial, bsplinefd)))
Example #2
0
    def test_basis_fdatabasis_inprod(self):
        monomial = Monomial(n_basis=4)
        bspline = BSpline(n_basis=5, order=3)
        bsplinefd = FDataBasis(bspline, np.arange(0, 15).reshape(3, 5))

        np.testing.assert_allclose(
            inner_product_matrix(monomial, bsplinefd),
            np.array([[2., 7., 12.],
                      [1.29626206, 3.79626206, 6.29626206],
                      [0.96292873, 2.62959539, 4.29626206],
                      [0.7682873, 2.0182873, 3.2682873]]), rtol=1e-4)
Example #3
0
    def test_fdatabasis_fdatabasis_inprod(self):
        monomial = Monomial(n_basis=4)
        monomialfd = FDataBasis(monomial,
                                [[5, 4, 1, 0], [4, 2, 1, 0], [4, 1, 6, 4],
                                 [4, 5, 0, 1], [5, 6, 2, 0]])
        bspline = BSpline(n_basis=5, order=3)
        bsplinefd = FDataBasis(bspline, np.arange(0, 15).reshape(3, 5))

        np.testing.assert_allclose(
            inner_product_matrix(monomialfd, bsplinefd),
            np.array([[16.14797697, 52.81464364, 89.4813103],
                      [11.55565285, 38.22211951, 64.88878618],
                      [18.14698361, 55.64698361, 93.14698361],
                      [15.2495976, 48.9995976, 82.7495976],
                      [19.70392982, 63.03676315, 106.37009648]]),
            rtol=1e-4)