Skip to content
ForCADDocumentation

basis_bernstein Function

public pure function basis_bernstein(Xt, nc) result(B)

Evaluate all Bernstein basis polynomials of degree nc-1 on [0,1].

The implementation uses an adjacent-term recurrence with explicit endpoint values. nc=1 returns the constant basis.

nc>=1 is an unchecked caller precondition. Values outside [0,1] evaluate the same polynomial formula but need not be nonnegative or form a numerically stable partition. Values within 2*epsilon(rk) of zero or one are snapped to the corresponding exact endpoint basis vector.

Arguments

Type IntentOptional Attributes Name
real(kind=rk), intent(in) :: Xt

Bernstein parameter, normally in [0,1].

integer, intent(in) :: nc

Number of basis functions; the degree is nc-1.

Return Value real(kind=rk), allocatable, (:)