File: polynomial.py

package info (click to toggle)
sasmodels 1.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 15,888 kB
  • sloc: python: 25,392; ansic: 7,377; makefile: 149; sh: 61
file content (12 lines) | stat: -rw-r--r-- 333 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
from numpy import inf
parameters = [
    ["n", "", 1, [1,5], "", "number of coefficients (or degree+1)"],
    ["c[n]", "", 0, [-inf, inf], "", "coefficients to c_n x^n"],
]

Iq = r"""
    int int_n = (int)n;
    double result = c[int_n-1];
    for (int k=int_n-2; k >= 0; k--) { result = result*q + c[k]; }
    return result;
    """