File: polynomial.py

package info (click to toggle)
sasmodels 1.0.12-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,828 kB
  • sloc: python: 32,065; ansic: 8,036; makefile: 153; sh: 50
file content (13 lines) | stat: -rw-r--r-- 335 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
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;
    """