nurbspy.jax.nurbs_basis_functions module#
- nurbspy.jax.nurbs_basis_functions.compute_all_basis_polynomials_derivatives(n, p, U, u)[source]#
Evaluate the analytic derivatives of B-spline basis functions of degree p.
The function implements the recursive derivative relations for B-spline basis functions (following the same recursion pattern as the basis definition). Computations are vectorized across multiple u-values using jax.vmap.
- Parameters:
- nint
Highest index of the basis functions (number of functions = n+1).
- pint
Degree of the basis polynomials.
- Uarray_like
Knot vector of length n+p+2 defining the B-spline basis.
- ufloat or array_like
Scalar or array of parameter values where the derivatives are evaluated.
- derivative_orderint
Order of the derivative to compute (0 ≤ derivative_order ≤ p).
- Returns:
- N_dersndarray of shape (n+1, Nu)
Array containing the analytic derivative of each basis function at all u-values.
- nurbspy.jax.nurbs_basis_functions.compute_basis_polynomials(n, p, U, u)[source]#
Evaluate B-spline basis functions of degree p for a set of parameter values u.
The function implements the Cox-de Boor recursion formula using JAX and vectorizes the scalar evaluation over multiple u-values using jax.vmap.
- Parameters:
- nint
Highest index of the basis functions (number of functions = n+1).
- pint
Degree of the basis polynomials.
- Uarray_like
Knot vector of length n+p+2 defining the B-spline basis. The first and last knots should typically have multiplicity p+1 for clamped splines.
- ufloat or array_like
Scalar or array of parameter values where the basis functions are evaluated.
- Returns:
- Nndarray of shape (n+1, Nu)
Array containing all basis functions evaluated at each u value. The first axis spans the basis index i, the second spans the parameter samples.
- nurbspy.jax.nurbs_basis_functions.compute_basis_polynomials_derivatives(n, p, U, u, derivative_order)[source]#
Return only the specified derivative order of B-spline basis functions.
- nurbspy.jax.nurbs_basis_functions.compute_basis_polynomials_derivatives_jax(n, p, U, u, derivative_order)[source]#
Evaluate derivatives of B-spline basis functions using JAX automatic differentiation.
This method uses nested applications of jax.jacfwd on the scalar evaluation function _basis_single_u() to compute derivatives of arbitrary order. It is mathematically exact within floating-point precision and provides a useful verification of the analytic recursive formulation.
- Parameters:
- nint
Highest index of the basis functions (number of functions = n+1).
- pint
Degree of the basis polynomials.
- Uarray_like
Knot vector of length n+p+2 defining the B-spline basis.
- ufloat or array_like
Scalar or array of parameter values where the derivatives are evaluated.
- derivative_orderint
Order of the derivative to compute (0 ≤ derivative_order ≤ p).
- Returns:
- N_dersndarray of shape (n+1, Nu)
Array containing the derivatives of each basis function evaluated at all u-values.