Reference/API

BaseUtilities.bernsteinFunction
y = bernstein(q, i, x)
y = bernstein(Val(q), i, x)

Evaluate i-th (univariate) Bernstein polynomial of degree q at x for i in 0:q.

ys = bernstein(q, x)
ys = bernstein(Val(q), x)

@assert sum(ys) ≈ 1

Evaluate all Bernstein polynomials of degree q at x to tuple.

See also mvbernstein, monomial

source
BaseUtilities.monomialFunction
y = monomial(q, i, x)
y = monomial(Val(q), i, x)

Evaluate i-th (univariate) monomials x^i of degree q at x for i in 0:q.

ys = monomial(q, x)
ys = monomial(Val(q), x)

Evaluate all monomials of degree q at x to tuple.

See also mvmonomial, bernstein

source
BaseUtilities.multiindicesMethod
i = multiindices(d, q)

Generate sequence of d-dimensional multi-indices which sum to q. d and q can be integers nn or Val(n).

Example: multiindices(3, 2) yields the sequence

(2,0,0), (1,1,0), (0,2,0),
      (1,0,1), (0,1,1),
           (0,0,2)

See also domainpoints, mvbernstein

source
BaseUtilities.mvbernsteinFunction
values = mvbernstein(Val(Q), λ₁, λ₂, ...)
values = mvbernstein(Val(Q), λ::NTuple)
values = mvbernstein(Val(Q), λ::SVector)
values = mvbernstein(q, ...)

Evaluate multivariate Bernstein polynomials of total degree q at barycentric coordinates λ. The sequence of basis functions correspond to multiindices or domainpoints, likewise.

Note

In contrast to mvmonomials, mvbernstein takes barycentric coordinates λ as input! Prefer passing a tuple or an SVector (with sum(λ) = 1).

As an exception, univariate Bernstein polynomials can be evaluated at x::Real as

values = mvbernstein(q, x)

This call is equal to

values = mvbernstein(q, 1-x, x)  # pass barycentric coordinates

and to

values = bernstein(q, x)

See also mvbernstein!, domainpoints, mvmonomials, bernstein, mvpdim

source
BaseUtilities.mvbernstein!Function
mvbernstein!(Val(Q), v, λ...)
mvbernstein!(q, v, λ...)

Evaluate the multivariate Bernstein polynomials of total degree Q or q at barycentric coordinates λ as for mvbernstein and store the computed values in v.

precondition

v must have the appropriate size mvpdim.

Note

In contrast to mvmonomials, mvbernstein takes barycentric coordinates λ as input! Prefer passing a tuple or an SVector (with sum(λ) = 1).

As an exception, univariate Bernstein polynomials can be evaluated at x::Real as

values = mvbernstein!(q, x)

This call is equal to

values = mvbernstein!(q, 1-x, x)  # pass barycentric coordinates

See also mvbernstein, bvmdim

source
BaseUtilities.mvmonomialsFunction
values = mvmonomial(Val(Q), v, x...)
values = mvmonomials(q, v, x...)

Evaluate multivariate monomials of total degree Q or q. Evaluates

  • univariate polynomials 1, x, x^2, ... if x is a number
  • bivariate polynomials 1, x, y, x^2, x*y, y^2, x^3, x^2*y, ... if x... is x, y or a 2-tuple or SVector{2}
  • trivariate polynomials 1, x, y, z, x^2, x*y, y^2, y*z, z^2, ... if x... is x, y, z or a 3-tuple or SVector{3}
  • etc.

The polynomial basis is evaluated inthis canonical order and the result is returned as an n-tuple of values.

Note

Prefer "static dispatch" by type Val(Q). This calls the appropriate method without branching over the polynomial degree.

See also mvmonomials!, mvpdim

source