def evaluate_basis_at(self, nodes, component, prefactor=False): r""" Evaluate the Hagedorn functions :math:`\phi_k` recursively at the given nodes :math:`\gamma`. :param nodes: The nodes :math:`\gamma` at which the Hagedorn functions are evaluated. :param component: The index :math:`i` of the component whose basis functions :math:`\phi^i_k` we want to evaluate. :param prefactor: Whether to include a factor of :math:`\left(\det\left(Q_i\right)\right)^{-\frac{1}{2}}`. :return: Returns a twodimensional array :math:`H` where the entry :math:`H[k,i]` is the value of the :math:`k`-th Hagedorn function evaluated at the node :math:`i`. """ H = zeros((self.basis_size[component], nodes.size), dtype=complexfloating) (P, Q, S, p, q) = self.parameters[component] Qinv = Q**(-1.0) Qbar = conj(Q) nodes = nodes.reshape((1,nodes.size)) H[0] = pi**(-0.25)*self.eps**(-0.5) * exp(1.0j/self.eps**2 * (0.5*P*Qinv*(nodes-q)**2 + p*(nodes-q))) H[1] = Qinv*sqrt(2.0/self.eps**2) * (nodes-q) * H[0] for k in xrange(2, self.basis_size[component]): H[k] = Qinv*sqrt(2.0/self.eps**2)*1.0/sqrt(k) * (nodes-q) * H[k-1] - Qinv*Qbar*sqrt((k-1.0)/k) * H[k-2] if prefactor is True: sqrtQ, self._cont_sqrt_cache[component] = cont_sqrt(Q, reference=self._cont_sqrt_cache[component]) H = 1.0/sqrtQ*H return H
def evaluate_basis_at(self, nodes, component=None, prefactor=False): r""" Evaluate the Hagedorn functions :math:`\phi_k` recursively at the given nodes :math:`\gamma`. :param nodes: The nodes :math:`\gamma` at which the Hagedorn functions are evaluated. :param component: Takes the basis size :math:`K_i` of this component :math:`i` as upper bound for :math:`K`. :param prefactor: Whether to include a factor of :math:`\left(\det\left(Q\right)\right)^{-\frac{1}{2}}`. :return: Returns a twodimensional :math:`K` times #nodes array :math:`H` where the entry :math:`H[k,i]` is the value of the :math:`k`-th Hagedorn function evaluated at the node :math:`i`. """ if component is not None: basis_size = self.basis_size[component] else: # Evaluate up to maximal :math:`K_i` and slice later if necessary basis_size = max(self.basis_size) H = zeros((basis_size, nodes.size), dtype=complexfloating) Qinv = self.Q**(-1.0) Qbar = conj(self.Q) nodes = nodes.reshape((1,nodes.size)) H[0] = pi**(-0.25)*self.eps**(-0.5) * exp(1.0j/self.eps**2 * (0.5*self.P*Qinv*(nodes-self.q)**2 + self.p*(nodes-self.q))) H[1] = Qinv*sqrt(2.0/self.eps**2) * (nodes-self.q) * H[0] for k in xrange(2, basis_size): H[k] = Qinv*sqrt(2.0/self.eps**2)*1.0/sqrt(k) * (nodes-self.q) * H[k-1] - Qinv*Qbar*sqrt((k-1.0)/k) * H[k-2] if prefactor is True: sqrtQ, self._cont_sqrt_cache = cont_sqrt(self.Q, reference=self._cont_sqrt_cache) H = 1.0/sqrtQ*H return H