[libcxx-commits] [libcxx] [libc++][math] Mathematical Special Functions: Hermite Polynomial (PR #89982)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Apr 26 14:33:02 PDT 2024


================
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This file contains the internal implementations of std::hermite.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_EXPERIMENTAL___MATH_HERMITE_H
+#define _LIBCPP_EXPERIMENTAL___MATH_HERMITE_H
+
+#include <cmath> // std::isnan
+#include <experimental/__config>
+#include <limits> // std::numeric_limits
+
+/// \return the hermite polynomial \f$ H_{n}(x) \f$
+/// \note The implementation is based on the recurrence formula
+/// \f[
+/// H_{n+1}(x) = 2x H_{n}(x) - 2 n H_{n-1}
+/// \f]
+/// Press, William H., et al. Numerical recipes 3rd edition: The art of
+/// scientific computing. Cambridge university press, 2007, p. 183.
+template <class _Real>
+_Real __libcpp_hermite_recurrence(const unsigned __n, const _Real __x) {
+  if (0 == __n)
+    return 1;
----------------
PaulXiCao wrote:

Fixed in c9fa9b4fdd63d1feb94e1d5fc29145649df01107.

https://github.com/llvm/llvm-project/pull/89982


More information about the libcxx-commits mailing list