StrctTerm.constrain()#
- StrctTerm.constrain(constraint)[source]#
Apply a linear constraint to the term’s basis and corresponding penalty.
- Parameters:
constraint (
Array|ndarray|bool|number|bool|int|float|complex|Literal['sumzero_term','sumzero_coef','constant_and_linear']) – Type of constraint or custom linear constraint matrix to apply. If an array is supplied, the constraint will beA @ coef == 0, whereAis the supplied constraint matrix.- Return type:
Self- Returns:
The modified term instance (self).
See also
Basis.constrainThe term calls this method internally. More details are documented there.
Examples
>>> x = jnp.linspace(0.0, 1.0, 4) >>> basis = Basis( ... jnp.column_stack([jnp.ones_like(x), x]), ... xname="x", ... penalty=jnp.eye(2), ... ) >>> term = StrctTerm.f(basis, scale=1.0).constrain(jnp.ones((1, 2))) >>> term.nbases 1