/** * \file cheb_utils.hpp * \author Dhairya Malhotra, dhairya.malhotra@gmail.com * \date 2-11-2011 * \brief This file contains chebyshev related functions. */ #ifndef _PVFMM_CHEB_UTILS_HPP_ #define _PVFMM_CHEB_UTILS_HPP_ #include #include #include #include namespace pvfmm{ /** * \brief Returns the sum of the absolute value of coeffecients of the highest * order polynomial as an estimate of error. */ template T cheb_err(T* cheb_coeff, int deg, int dof); /** * \brief Computes Chebyshev approximation from function values at cheb node points. */ template T cheb_approx(T* fn_v, int d, int dof, T* out); /** * \brief Evaluates polynomial values from input coefficients at points on * a regular grid defined by in_x, in_y, in_z the values in the input vector. */ template void cheb_eval(Vector& coeff_, int cheb_deg, std::vector& in_x, std::vector& in_y, std::vector& in_z, Vector& out); /** * \brief Evaluates polynomial values from input coefficients at points on * a regular grid defined by the values in the input vector. */ template void cheb_eval(Vector& coeff_, int cheb_deg, std::vector& coord, Vector& out); /** * \brief Computes a least squares solution for Chebyshev approximation over a * cube from point samples. * \param[in] deg Maximum degree of the polynomial. * \param[in] coord Coordinates of points (x,y,z interleaved). * \param[in] node_coord Coordinates of the octant. * \param[in] node_size Length of the side of the octant. * \param[out] cheb_coeff Output coefficients. */ template void points2cheb(int deg, T* coord, T* val, int n, int dim, T* node_coord, T node_size, Vector& cheb_coeff); /** * \brief * \param[in] r Length of the side of cubic region. */ template std::vector cheb_integ(int m, T* s, T r, Kernel& kernel); /** * \brief Returns coordinates of Chebyshev node points in 'dim' dimensional * space. */ template std::vector cheb_nodes(int deg, int dim); template void cheb_grad(T* A, int deg, T* B); template void cheb_laplacian(T* A, int deg, T* B); template void cheb_curl(T* A, int deg, T* B); /* * \brief Computes image of the chebyshev interpolation along the specified axis. */ template void cheb_img(T* A, T* B, int cheb_deg, int dir, bool neg_); }//end namespace #include #endif //_PVFMM_CHEB_UTILS_HPP_