pub struct PiecewiseFirstDegreePolynomial {
    polynomials: Vec<FirstDegreePolynomial>,
    interval_breakpoints: Vec<f64>,
}
Expand description

General Information

A piecewise definition of a first-degree polynomial function. Carries both a vector of functions and the intervals on which each must be evaluated. It is always supposed the points in the interval are in ascending order. Giving the function in any other order will result in erratic behaviour.

Fields

  • polynomials - A vector of first-degree polynomials. Must be the same length as interval_breakpoints + 1.
  • interval_breakpoints - A vector of 1D points in ascending order to know which function to evaluate. Must be the same length as polynomials - 1

Fields§

§polynomials: Vec<FirstDegreePolynomial>§interval_breakpoints: Vec<f64>

Implementations§

General Information

Creates a new instance from raw values for coefficients and independent terms.

Parameters
  • coefficients - Values that multiply variable.
  • independent_terms - Values that are added to variable.
  • interval_breakpoints - Points in ascending order to know which function to evaluate.
General Information

Creates a step-like function given a vector of constants.

Parameters
  • independent_terms - Vector of constants to create function.
  • interval_breakpoints - Points in ascending order to know which constant to return.
General Information

Given a vector of polynomials, creates a piecewise function with all of them.

Parameters
  • polynomials - A vector with all the polynomials to use for piecewise definition.
  • interval_breakpoints - Points in ascending order to know which function to evaluate.

Trait Implementations§

Formats the value using the given formatter. Read more
Specific implementation

The derivative of a piecewise first degree polynomial is a step-like function. Resulting function is obtained via differentiation of every linear polynomial in instance.

Specific implementation

The derivative of a piecewise second degree polynomial is a pieewise first degree polynomial. Resulting function is obtained via differentiation of every second degree polynomial in instance.

Specific implementation

Remember that number of functions = number of breakpoints + 1. Evaluates the function supposing that interval_breakpoints is in ascending order. Every breakpoint coincides with a function (except for the last one). That is, given the breakpoint vector index i, breakpoint i coincides with function i. Evaluation is made via checking if variable x is less than current breakpoint. If x is bigger than every breakpoint, then the last function is evaluated.

This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.