Esempio n. 1
0
def H1_cheb(f):
    f = sp.mirror1(f, -1)
    N = f.shape[0]; h = 2*pi/N
    f = sp.F(f)
    f = sp.fourier_K_inv(f, 0, h)
    f = sp.fourier_S(f, +h/2)
    f = sp.Finv(f)
    f = sp.unmirror1(f)
    return real(f)
Esempio n. 2
0
def H1_cheb(f):
    f = sp.mirror1(f, -1)
    N = f.shape[0]
    h = 2 * pi / N
    f = sp.F(f)
    f = sp.fourier_K_inv(f, 0, h)
    f = sp.fourier_S(f, +h / 2)
    f = sp.Finv(f)
    f = sp.unmirror1(f)
    return real(f)
Esempio n. 3
0
def H0d_regular(f):
    r'''

    .. math::
        \widetilde{\mathbf{H}}^{0}=
            \mathbf{M}_{1}^{\dagger}
            \mathbf{I}^{-\frac{h}{2},\frac{h}{2}}
            \mathbf{M}_{1}^{+}
    '''
    f = sp.mirror1(f, +1)
    N = f.shape[0]; h = 2*pi/N
    f = sp.I_space(-h/2, h/2)(f)
    f = sp.unmirror1(f)
    return f
Esempio n. 4
0
def H1_regular(f):
    r'''

    .. math::
        \mathbf{H}^{1}=
            \mathbf{M}_{1}^{\dagger}
            {\mathbf{I}^{-\frac{h}{2},\frac{h}{2}}}^{-1}
            \mathbf{M}_{1}^{+}
    '''
    f = sp.mirror1(f, +1)
    N = f.shape[0]; h = 2*pi/N
    f = sp.I_space_inv(-h/2, h/2)(f)
    f = sp.unmirror1(f)
    return f
Esempio n. 5
0
def H0d_regular(f):
    r'''

    .. math::
        \widetilde{\mathbf{H}}^{0}=
            \mathbf{M}_{1}^{\dagger}
            \mathbf{I}^{-\frac{h}{2},\frac{h}{2}}
            \mathbf{M}_{1}^{+}
    '''
    f = sp.mirror1(f, +1)
    N = f.shape[0]
    h = 2 * pi / N
    f = sp.I_space(-h / 2, h / 2)(f)
    f = sp.unmirror1(f)
    return f
Esempio n. 6
0
def H1_regular(f):
    r'''

    .. math::
        \mathbf{H}^{1}=
            \mathbf{M}_{1}^{\dagger}
            {\mathbf{I}^{-\frac{h}{2},\frac{h}{2}}}^{-1}
            \mathbf{M}_{1}^{+}
    '''
    f = sp.mirror1(f, +1)
    N = f.shape[0]
    h = 2 * pi / N
    f = sp.I_space_inv(-h / 2, h / 2)(f)
    f = sp.unmirror1(f)
    return f
Esempio n. 7
0
def S_cheb_pinv(f):
    '''
    Interpolate from dual to primal vertices.
    Since there are smaller number of dual vertices, 
    this is only a pseudo inverse of S_cheb, and not an 
    exact inverse.
    >>> allclose(  S_cheb_pinv(array([ -1/sqrt(2),  1/sqrt(2)])), 
    ...            array([ -1, 0, 1]))
    True
    >>> allclose(  S_cheb_pinv(array([ 1/sqrt(2),  -1/sqrt(2)])), 
    ...            array([ 1, 0, -1]))
    True
    >>> sp.to_matrix(S_cheb_pinv, 2).round(3)
    array([[ 1.207, -0.207],
           [ 0.5  ,  0.5  ],
           [-0.207,  1.207]])
    '''
    f = sp.mirror1(f, +1)
    N = f.shape[0]; h = 2*pi/N
    f = sp.Finv(sp.F(f)*sp.S_diag(N, -h/2))
    f = sp.unmirror0(f)
    return real(f)
Esempio n. 8
0
def S_cheb_pinv(f):
    '''
    Interpolate from dual to primal vertices.
    Since there are smaller number of dual vertices, 
    this is only a pseudo inverse of S_cheb, and not an 
    exact inverse.
    >>> allclose(  S_cheb_pinv(array([ -1/sqrt(2),  1/sqrt(2)])), 
    ...            array([ -1, 0, 1]))
    True
    >>> allclose(  S_cheb_pinv(array([ 1/sqrt(2),  -1/sqrt(2)])), 
    ...            array([ 1, 0, -1]))
    True
    >>> sp.to_matrix(S_cheb_pinv, 2).round(3)
    array([[ 1.207, -0.207],
           [ 0.5  ,  0.5  ],
           [-0.207,  1.207]])
    '''
    f = sp.mirror1(f, +1)
    N = f.shape[0]
    h = 2 * pi / N
    f = sp.Finv(sp.F(f) * sp.S_diag(N, -h / 2))
    f = sp.unmirror0(f)
    return real(f)