MPSolve 3.2.1
Loading...
Searching...
No Matches
mps::NRootsPolynomial Class Reference

This class is a brief example of how one could implement a custom polynomial type using C++ classes. More...

#include <nroots-polynomial.h>

Inheritance diagram for mps::NRootsPolynomial:
mps::Polynomial

Public Member Functions

 NRootsPolynomial (mps_context *ctx, int n)
 Create the polynomial $x^n - 1$.
 
mps_boolean eval (mps_context *ctx, cplx_t x, cplx_t value, double *error)
 Evaluate the polynomial at a point.
 
mps_boolean eval (mps_context *ctx, cdpe_t x, cdpe_t value, rdpe_t error)
 Evaluate the polynomial at a point.
 
mps_boolean eval (mps_context *ctx, mpc_t x, mpc_t value, rdpe_t error)
 Evaluate the polynomial at a point.
 
void newton (mps_context *ctx, mps_approximation *a, cplx_t x)
 
void newton (mps_context *ctx, mps_approximation *a, cdpe_t x)
 
void newton (mps_context *ctx, mps_approximation *a, mpc_t x, long int wp)
 

Detailed Description

This class is a brief example of how one could implement a custom polynomial type using C++ classes.

It's not really meant to be of any practical use or to be efficient. The main purpose of its implementation is to be straightforward so anyone can use it a a "tutorial" for creating custom polynomial types.

Constructor & Destructor Documentation

◆ NRootsPolynomial()

NRootsPolynomial::NRootsPolynomial ( mps_context * ctx,
int n )
explicit

Create the polynomial $x^n - 1$.

Parameters
nThe degree of the polynomial that should be created.

Member Function Documentation

◆ eval() [1/3]

mps_boolean NRootsPolynomial::eval ( mps_context * ctx,
cdpe_t x,
cdpe_t value,
rdpe_t error )
virtual

Evaluate the polynomial at a point.

This method should be overloaded by subclasses of Polynomial in order to provide the necessary methods to MPSolve.

Parameters
xThe point where the Polynomial should be evaluted.
valueThe storage where the result of the evaluation will be stored.
errorAn upper bound to the error that has been computed in this operation.
Returns
true if the operation was successful, false in case an exception has been encountered.

Implements mps::Polynomial.

◆ eval() [2/3]

mps_boolean NRootsPolynomial::eval ( mps_context * ctx,
cplx_t x,
cplx_t value,
double * error )
virtual

Evaluate the polynomial at a point.

This method should be overloaded by subclasses of Polynomial in order to provide the necessary methods to MPSolve.

Parameters
xThe point where the Polynomial should be evaluted.
valueThe storage where the result of the evaluation will be stored.
errorAn upper bound to the error that has been computed in this operation.
Returns
true if the operation was successful, false in case an exception has been encountered.

Implements mps::Polynomial.

◆ eval() [3/3]

mps_boolean NRootsPolynomial::eval ( mps_context * ctx,
mpc_t x,
mpc_t value,
rdpe_t error )
virtual

Evaluate the polynomial at a point.

This method should be overloaded by subclasses of Polynomial in order to provide the necessary methods to MPSolve.

Parameters
xThe point where the Polynomial should be evaluted.
valueThe storage where the result of the evaluation will be stored.
errorAn upper bound to the error that has been computed in this operation.
Returns
true if the operation was successful, false in case an exception has been encountered.

Implements mps::Polynomial.

◆ newton() [1/3]

void NRootsPolynomial::newton ( mps_context * ctx,
mps_approximation * a,
cdpe_t x )
virtual

Implements mps::Polynomial.

◆ newton() [2/3]

void NRootsPolynomial::newton ( mps_context * ctx,
mps_approximation * a,
cplx_t x )
virtual

Implements mps::Polynomial.

◆ newton() [3/3]

void NRootsPolynomial::newton ( mps_context * ctx,
mps_approximation * a,
mpc_t x,
long int wp )
virtual

Implements mps::Polynomial.


The documentation for this class was generated from the following files: