MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / polynomial

Function polynomial

src/jit/impl/mlir/ir/numerical.cpp:9–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7namespace jit {
8
9mlir::Value polynomial(
10 ValueBuilderHelper& helper, mlir::Value x, std::vector<mlir::Value>& coeff) {
11 size_t n = coeff.size();
12 if (n == 0) {
13 return helper.const_f32(0);
14 }
15
16 mlir::Value r = coeff[0];
17 for (size_t i = 1; i < n; i++) {
18 r = helper.add(helper.mul(r, x), coeff[i]);
19 }
20 return r;
21}
22
23// polynomial approximation of arctangent
24// atan(t) = t + c3 * t^3 + c5 * t^5 + ... + c17 * t^17

Callers 3

atan2_approxFunction · 0.85
erf_approxFunction · 0.85
ndtri_approxFunction · 0.85

Calls 4

const_f32Method · 0.80
mulMethod · 0.80
sizeMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected