Beispiel #1
0
def runpwbasis(k, u, Npw, quadrule):
    bc = pcad.PWFBCreator(k, origin, npw, nfb, params = None)
    newnbc = puo.optimalbasis3(lsf.optimise, nbc.pwbasis, nbc.params, None, nbc.newparams) if nbc.npw > 0 else nbc

    gen, ini = pcad.pwbasisgeneration(k, Npw)
    basis, (coeffs, err) = pcad.optimalbasis2(u, gen, ini, quadrule)
    l2err = math.sqrt(np.vdot(err,err))
    print l2err, basis, coeffs
    return pcb.BasisReduce(basis, coeffs)
Beispiel #2
0
def runadaptivebasis2(k, u, Nb, origin, quadrule):
    bases = []
    coefflist = []
    for nfb in range(Nb/2):
        npw = Nb - (2*nfb + 1)
        if npw > 0:
            gen, ini = pcad.pwbasisgeneration(k, npw)
            ini = ini
            fb = pcb.FourierBessel(origin, range(-nfb,nfb+1), k)
            basis, (coeffs, err) = pcad.optimalbasis2(u, gen, ini, quadrule, fb)
            
            l2err = math.sqrt(np.vdot(err,err))
#            print nfb, npw, basis,coeffs,l2err
            print nfb, npw, l2err
            print basis
            print coeffs
            bases.append(basis)
            coefflist.append(coeffs)
    return [pcb.BasisReduce(b, c) for b,c in zip(bases, coefflist)]