Lines Matching defs:polynomial
32 #include "ceres/polynomial.h"
49 // Return the constant polynomial p(x) = 1.23.
56 // Return the polynomial p(x) = poly(x) * (x - root).
65 // Return the polynomial
85 // Run a test with the polynomial defined by the N real roots in roots_real.
118 TEST(Polynomial, InvalidPolynomialOfZeroLengthIsRejected) {
129 TEST(Polynomial, ConstantPolynomialReturnsNoRoots) {
140 TEST(Polynomial, LinearPolynomialWithPositiveRootWorks) {
145 TEST(Polynomial, LinearPolynomialWithNegativeRootWorks) {
150 TEST(Polynomial, QuadraticPolynomialWithPositiveRootsWorks) {
155 TEST(Polynomial, QuadraticPolynomialWithOneNegativeRootWorks) {
160 TEST(Polynomial, QuadraticPolynomialWithTwoNegativeRootsWorks) {
165 TEST(Polynomial, QuadraticPolynomialWithCloseRootsWorks) {
170 TEST(Polynomial, QuadraticPolynomialWithComplexRootsWorks) {
188 TEST(Polynomial, QuarticPolynomialWorks) {
193 TEST(Polynomial, QuarticPolynomialWithTwoClustersOfCloseRootsWorks) {
198 TEST(Polynomial, QuarticPolynomialWithTwoZeroRootsWorks) {
203 TEST(Polynomial, QuarticMonomialWorks) {
208 TEST(Polynomial, NullPointerAsImaginaryPartWorks) {
213 TEST(Polynomial, NullPointerAsRealPartWorks) {
218 TEST(Polynomial, BothOutputArgumentsNullWorks) {
223 TEST(Polynomial, DifferentiateConstantPolynomial) {
225 Vector polynomial(1);
226 polynomial(0) = 1.0;
227 const Vector derivative = DifferentiatePolynomial(polynomial);
232 TEST(Polynomial, DifferentiateQuadraticPolynomial) {
234 Vector polynomial(3);
235 polynomial(0) = 1.0;
236 polynomial(1) = 2.0;
237 polynomial(2) = 3.0;
239 const Vector derivative = DifferentiatePolynomial(polynomial);
245 TEST(Polynomial, MinimizeConstantPolynomial) {
247 Vector polynomial(1);
248 polynomial(0) = 1.0;
254 MinimizePolynomial(polynomial, min_x, max_x, &optimal_x, &optimal_value);
261 TEST(Polynomial, MinimizeLinearPolynomial) {
263 Vector polynomial(2);
265 polynomial(0) = 1.0;
266 polynomial(1) = 2.0;
272 MinimizePolynomial(polynomial, min_x, max_x, &optimal_x, &optimal_value);
279 TEST(Polynomial, MinimizeQuadraticPolynomial) {
283 Vector polynomial(3);
284 polynomial(0) = 1.0;
285 polynomial(1) = -3.0;
286 polynomial(2) = 2.0;
292 MinimizePolynomial(polynomial, min_x, max_x, &optimal_x, &optimal_value);
298 MinimizePolynomial(polynomial, min_x, max_x, &optimal_x, &optimal_value);
304 MinimizePolynomial(polynomial, min_x, max_x, &optimal_x, &optimal_value);
321 const Vector polynomial = FindInterpolatingPolynomial(samples);
322 EXPECT_NEAR((true_polynomial - polynomial).norm(), 0.0, 1e-15);
325 TEST(Polynomial, LinearInterpolatingPolynomial) {
339 const Vector polynomial = FindInterpolatingPolynomial(samples);
340 EXPECT_NEAR((true_polynomial - polynomial).norm(), 0.0, 1e-15);
343 TEST(Polynomial, QuadraticInterpolatingPolynomial) {
367 Vector polynomial = FindInterpolatingPolynomial(samples);
368 EXPECT_NEAR((true_polynomial - polynomial).norm(), 0.0, 1e-15);
371 TEST(Polynomial, DeficientCubicInterpolatingPolynomial) {
397 const Vector polynomial = FindInterpolatingPolynomial(samples);
398 EXPECT_NEAR((true_polynomial - polynomial).norm(), 0.0, 1e-14);
402 TEST(Polynomial, CubicInterpolatingPolynomialFromValues) {
440 const Vector polynomial = FindInterpolatingPolynomial(samples);
441 EXPECT_NEAR((true_polynomial - polynomial).norm(), 0.0, 1e-14);
444 TEST(Polynomial, CubicInterpolatingPolynomialFromValuesAndOneGradient) {
477 const Vector polynomial = FindInterpolatingPolynomial(samples);
478 EXPECT_NEAR((true_polynomial - polynomial).norm(), 0.0, 1e-14);
481 TEST(Polynomial, CubicInterpolatingPolynomialFromValuesAndGradients) {
508 const Vector polynomial = FindInterpolatingPolynomial(samples);
509 EXPECT_NEAR((true_polynomial - polynomial).norm(), 0.0, 1e-14);