lagrange#

Implementations of the transformation classes of from LagrangePolynomial (polynomials in the Lagrange basis) to:

class minterpy.transformations.lagrange.LagrangeToNewton(origin_poly)[source]#

Bases: TransformationABC

Transformation from the Lagrange basis to the Newton basis.

Properties

grid

The grid of the origin polynomial.

multi_index

The multi index set of the origin polynomial (and also the target polynomial).

transformation_operator

The polynomial basis transformation operator.

Parameters:

origin_poly (MultivariatePolynomialSingleABC)

origin_type#

alias of LagrangePolynomial

target_type#

alias of NewtonPolynomial

_get_transformation_operator()#

Construct the Lagrange-to-Newton transformation operator.

Parameters:

transformation (TransformationABC) – The transformer instance with information about the origin polynomial (an instance of LagrangePolynomial) and the target type (NewtonPolynomial).

Returns:

The Lagrange-to-Newton transformation operator.

Return type:

OperatorABC

Notes

  • The barycentric transformation operator is employed if the multi-indices are downward-closed.

  • The naive transformation operator is inefficient due to the following inversion: inv(nwt2lag_matrix).

__call__(origin_poly=None)#

Transformation of polynomial.

This function is called when an instance of transformation is called T() or T(x). If called without any arguments, the transformation is applied on the origin_poly used to construct the transformation. If an argument is passed, the transformation is applied on the instance passed.

Parameters:

origin_poly (MultivariatePolynomialSingleABC | None) – (optional) an instance of the polynomial to be transformed.

Returns:

an instance of the polynomial in the target basis.

__init__(origin_poly)#
Parameters:

origin_poly (MultivariatePolynomialSingleABC)

classmethod __init_subclass__(**kwargs)#

Add a concrete implementation to the registry of available transformations

__weakref__#

list of weak references to the object (if defined)

_apply_transformation(origin_poly)#

Transforms the polynomial to the target type of the transformation.

Parameters:

origin_poly – instance of the polynomial to be transformed

Returns:

an instance of the transformed polynomial in the target basis

property _target_indices: MultiIndexSet#

The MultiIndexSet of the target_poly.

Returns:

the indices the target polynomial will have

property grid: Grid#

The grid of the origin polynomial.

property multi_index: MultiIndexSet#

The multi index set of the origin polynomial (and also the target polynomial).

property transformation_operator: OperatorABC#

The polynomial basis transformation operator.

Returns:

instance of the transformation operator

Notes

The transformation operator once constructed can be reused for transforming other polynomial instance of the origin_poly type, which have the same basis (and grid) as the origin_poly, to the target_poly type.

class minterpy.transformations.lagrange.LagrangeToCanonical(origin_poly)[source]#

Bases: TransformationABC

Transformation from the Lagrange basis to the canonical basis.

Properties

grid

The grid of the origin polynomial.

multi_index

The multi index set of the origin polynomial (and also the target polynomial).

transformation_operator

The polynomial basis transformation operator.

Parameters:

origin_poly (MultivariatePolynomialSingleABC)

origin_type#

alias of LagrangePolynomial

target_type#

alias of CanonicalPolynomial

_get_transformation_operator()#

Construct the Lagrange-to-Canonical transformation operator.

The transformation is the chain: Lagrange-to-Newton then Newton-to-Canonical.

Parameters:

transformation (TransformationABC) – The transformer instance with information about the origin polynomial (an instance of LagrangePolynomial) and the target type (CanonicalPolynomial).

Returns:

The Lagrange-to-Canonical transformation operator.

Return type:

OperatorABC

Notes

  • Barycentric transformation operator is employed if the multi-indices are downward-closed.

__call__(origin_poly=None)#

Transformation of polynomial.

This function is called when an instance of transformation is called T() or T(x). If called without any arguments, the transformation is applied on the origin_poly used to construct the transformation. If an argument is passed, the transformation is applied on the instance passed.

Parameters:

origin_poly (MultivariatePolynomialSingleABC | None) – (optional) an instance of the polynomial to be transformed.

Returns:

an instance of the polynomial in the target basis.

__init__(origin_poly)#
Parameters:

origin_poly (MultivariatePolynomialSingleABC)

classmethod __init_subclass__(**kwargs)#

Add a concrete implementation to the registry of available transformations

__weakref__#

list of weak references to the object (if defined)

_apply_transformation(origin_poly)#

Transforms the polynomial to the target type of the transformation.

Parameters:

origin_poly – instance of the polynomial to be transformed

Returns:

an instance of the transformed polynomial in the target basis

property _target_indices: MultiIndexSet#

The MultiIndexSet of the target_poly.

Returns:

the indices the target polynomial will have

property grid: Grid#

The grid of the origin polynomial.

property multi_index: MultiIndexSet#

The multi index set of the origin polynomial (and also the target polynomial).

property transformation_operator: OperatorABC#

The polynomial basis transformation operator.

Returns:

instance of the transformation operator

Notes

The transformation operator once constructed can be reused for transforming other polynomial instance of the origin_poly type, which have the same basis (and grid) as the origin_poly, to the target_poly type.

class minterpy.transformations.lagrange.LagrangeToChebyshev(origin_poly)[source]#

Bases: TransformationABC

Transformation from the Lagrange basis to the Chebyshev basis.

Properties

grid

The grid of the origin polynomial.

multi_index

The multi index set of the origin polynomial (and also the target polynomial).

transformation_operator

The polynomial basis transformation operator.

Parameters:

origin_poly (MultivariatePolynomialSingleABC)

origin_type#

alias of LagrangePolynomial

target_type#

alias of ChebyshevPolynomial

_get_transformation_operator()#

Compute the Lagrange-to-Chebyshev transformation.

Parameters:

transformation (TransformationABC) – The transformer instance with information about the origin polynomial (an instance of LagrangePolynomial) and the target type (ChebyshevPolynomial).

Returns:

The Lagrange-to-Chebyshev transformation operator.

Return type:

OperatorABC

Notes

  • The transformation is carried out by inverting the evaluation at the unisolvent nodes; this is not a sparse transformation operator.

__call__(origin_poly=None)#

Transformation of polynomial.

This function is called when an instance of transformation is called T() or T(x). If called without any arguments, the transformation is applied on the origin_poly used to construct the transformation. If an argument is passed, the transformation is applied on the instance passed.

Parameters:

origin_poly (MultivariatePolynomialSingleABC | None) – (optional) an instance of the polynomial to be transformed.

Returns:

an instance of the polynomial in the target basis.

__init__(origin_poly)#
Parameters:

origin_poly (MultivariatePolynomialSingleABC)

classmethod __init_subclass__(**kwargs)#

Add a concrete implementation to the registry of available transformations

__weakref__#

list of weak references to the object (if defined)

_apply_transformation(origin_poly)#

Transforms the polynomial to the target type of the transformation.

Parameters:

origin_poly – instance of the polynomial to be transformed

Returns:

an instance of the transformed polynomial in the target basis

property _target_indices: MultiIndexSet#

The MultiIndexSet of the target_poly.

Returns:

the indices the target polynomial will have

property grid: Grid#

The grid of the origin polynomial.

property multi_index: MultiIndexSet#

The multi index set of the origin polynomial (and also the target polynomial).

property transformation_operator: OperatorABC#

The polynomial basis transformation operator.

Returns:

instance of the transformation operator

Notes

The transformation operator once constructed can be reused for transforming other polynomial instance of the origin_poly type, which have the same basis (and grid) as the origin_poly, to the target_poly type.