| 1532 | } |
| 1533 | |
| 1534 | static XlaOp I1eImpl64(XlaOp x) { |
| 1535 | static const std::array<double, 29> kI1eCoeffsA{ |
| 1536 | 2.77791411276104639959E-18, -2.11142121435816608115E-17, |
| 1537 | 1.55363195773620046921E-16, -1.10559694773538630805E-15, |
| 1538 | 7.60068429473540693410E-15, -5.04218550472791168711E-14, |
| 1539 | 3.22379336594557470981E-13, -1.98397439776494371520E-12, |
| 1540 | 1.17361862988909016308E-11, -6.66348972350202774223E-11, |
| 1541 | 3.62559028155211703701E-10, -1.88724975172282928790E-9, |
| 1542 | 9.38153738649577178388E-9, -4.44505912879632808065E-8, |
| 1543 | 2.00329475355213526229E-7, -8.56872026469545474066E-7, |
| 1544 | 3.47025130813767847674E-6, -1.32731636560394358279E-5, |
| 1545 | 4.78156510755005422638E-5, -1.61760815825896745588E-4, |
| 1546 | 5.12285956168575772895E-4, -1.51357245063125314899E-3, |
| 1547 | 4.15642294431288815669E-3, -1.05640848946261981558E-2, |
| 1548 | 2.47264490306265168283E-2, -5.29459812080949914269E-2, |
| 1549 | 1.02643658689847095384E-1, -1.76416518357834055153E-1, |
| 1550 | 2.52587186443633654823E-1}; |
| 1551 | |
| 1552 | static const std::array<double, 25> kI1eCoeffsB{ |
| 1553 | 7.51729631084210481353E-18, 4.41434832307170791151E-18, |
| 1554 | -4.65030536848935832153E-17, -3.20952592199342395980E-17, |
| 1555 | 2.96262899764595013876E-16, 3.30820231092092828324E-16, |
| 1556 | -1.88035477551078244854E-15, -3.81440307243700780478E-15, |
| 1557 | 1.04202769841288027642E-14, 4.27244001671195135429E-14, |
| 1558 | -2.10154184277266431302E-14, -4.08355111109219731823E-13, |
| 1559 | -7.19855177624590851209E-13, 2.03562854414708950722E-12, |
| 1560 | 1.41258074366137813316E-11, 3.25260358301548823856E-11, |
| 1561 | -1.89749581235054123450E-11, -5.58974346219658380687E-10, |
| 1562 | -3.83538038596423702205E-9, -2.63146884688951950684E-8, |
| 1563 | -2.51223623787020892529E-7, -3.88256480887769039346E-6, |
| 1564 | -1.10588938762623716291E-4, -9.76109749136146840777E-3, |
| 1565 | 7.78576235018280120474E-1}; |
| 1566 | |
| 1567 | XlaOp z = Abs(x); |
| 1568 | auto half = xla::ScalarLike(x, 0.5); |
| 1569 | auto two = xla::ScalarLike(x, 2.0); |
| 1570 | auto thirty_two = xla::ScalarLike(x, 32.0); |
| 1571 | auto result_le_8 = |
| 1572 | z * EvaluateChebyshevPolynomial<double>(half * z - two, kI1eCoeffsA); |
| 1573 | auto result_gt_8 = |
| 1574 | EvaluateChebyshevPolynomial<double>(thirty_two / z - two, kI1eCoeffsB) / |
| 1575 | Sqrt(z); |
| 1576 | return Sign(x) * |
| 1577 | Select(Le(z, xla::ScalarLike(x, 8.0)), result_le_8, result_gt_8); |
| 1578 | } |
| 1579 | |
| 1580 | XlaOp BesselI1e(XlaOp x) { |
| 1581 | auto& b = *x.builder(); |