int main() { DenseVector sings; GeMat deltas(3,2); std::vector<GeMat> _deltas; Function x2f(x2, sings); Function onef(one, sings); Function x3f(x3, sings); Function cosf(mycos, sings); Function sinf(mysin, sings); Function expf(myexp, sings); Basis basis(4); basis.template enforceBoundaryCondition<lawa::DirichletBC>(); IndexSet indexset; Coeff1D coeff; std::vector<Function> fvec; int rank = 2; int dim = 64; for (int i=1; i<=32; ++i) { fvec.push_back(cosf); fvec.push_back(onef); fvec.push_back(x2f); fvec.push_back(onef); } SepCoeff coeffs(rank, dim); IndexSetVec indexsetvec(dim); lawa::SeparableFunctionD<T> F(fvec, rank, dim); MatInt derivs(rank, dim); for (int i=1; i<=rank; ++i) { for (int j=1; j<=dim; ++j) { derivs(i,j) = 0; _deltas.push_back(deltas); } } lawa::SeparableRHSD<T, Basis> Fint(basis, F, _deltas, derivs); getFullIndexSet(basis, indexset, 2); std::cout << "The index set size is\n" << indexset.size() << std::endl; for (int l=0; (unsigned)l<indexsetvec.size(); ++l) { indexsetvec[l] = indexset; } /* Map */ lawa::Mapwavind<Index1D> map(dim); map.rehash(50); genCoefficients(coeffs, Fint, indexsetvec); lawa::HTCoefficients<T, Basis> f(dim, basis, map); lawa::HTCoefficients<T, Basis> u(dim, basis, map); lawa::HTCoefficients<T, Basis> r(dim, basis, map); Laplace1D LaplaceBil(basis); RefLaplace1D RefLaplaceBil(basis.refinementbasis); Identity1D IdentityBil(basis); RefIdentity1D RefIdentityBil(basis.refinementbasis); LOp_Lapl1D lapl(basis, basis, RefLaplaceBil, LaplaceBil); Sepop A(lapl, dim, dim); lawa::Sepdiagscal<Basis> S(dim, basis); setScaling(S, 0.5); lawa::HTAWGM_Params params; params.maxit_pcg = 100; params.maxit_awgm = 100; params.tol_awgm = 1e-08; params.delta1_pcg = 1e-01; params.delta2_pcg = 1e-01; params.delta3_pcg = 1e-01; params.alpha = 0.95; params.recompr = 1e-02; params.gamma = 0.1; params.theta = 1e-08; std::cout << "HTAWGM params =\n"; std::cout << params << std::endl; unsigned its; double res; its = htawgm(A, S, u, Fint, indexsetvec, res, params); std::cout << "htawgm took " << its << " iterations to reach " << res << " accuracy" << std::endl; std::cout << "Final scaling set to\n" << S << std::endl; return 0; }
vixl::FPRegister D(Vreg r) { return x2f(r); }