Skip to contents

PostconditionSpecifier(corrector, space) declares in which coordinates the iterate corrector corrector(u, u_prev, p, cache) of the postcondition solver option is written when the problem has bounds: PostconditionSpace$Original (the default) or PostconditionSpace$Transformed, the unconstrained variable of solvers that reparameterize the bounds. The R solvers handle bounds natively, in the original coordinates, so both spaces refer to the original variable (as for the native bounded solvers of NonlinearSolve). The result is a function that can be passed as postcondition.

Usage

PostconditionSpace

PostconditionSpecifier(corrector, space = PostconditionSpace$Original)

Arguments

corrector

A function (u, u_prev, p, cache).

space

A value of PostconditionSpace.

Value

PostconditionSpace is a list of the two spaces; PostconditionSpecifier() returns a corrector function.

Examples

H <- function(u, u_prev, p, cache) pmax(u, 0)
post <- PostconditionSpecifier(H, space = PostconditionSpace$Transformed)
attr(post, "space")
#> [1] "Transformed"
prob <- NonlinearProblem(function(u, p) u * u - 2, u0 = 1)
solve(prob, BoundedTrustRegion(), postcondition = post)$u
#> [1] 1.414214