NANA
polynomialevaluation.hpp
浏览该文件的文档.
1#pragma once
15#include "NANA\core/error.h"
16#include "NANA\core/matrix.h"
17namespace NANA {
18namespace MATH {
26template<typename _Tp>
27_Tp PolynomialEvaluation1D(const _Tp* a, int n, _Tp x) {
28 NA_Assert(n > 0);
29 _Tp ret = a[0];
30 for (int i = 1; i < n; i++) {
31 ret = ret * x + a[i];
32 }
33 return ret;
34}
35
36
45double NA_API PolynomialEvaluation2D(const Matrix& mat, double x, double y, int n);
46
47
48
49
50}
51
52
53
54}
简单矩阵类
Definition: matrix.h:31
#define NA_API
兼容windows系统与linux系统
Definition: core_global.h:24
#define NA_Assert(expr)
当表达式非法,抛出异常
Definition: error.h:56
_Tp PolynomialEvaluation1D(const _Tp *a, int n, _Tp x)
一维多项式求值