diff --git a/src/factor_nodes/nonlinear.jl b/src/factor_nodes/nonlinear.jl index 26a553d3..79730d45 100644 --- a/src/factor_nodes/nonlinear.jl +++ b/src/factor_nodes/nonlinear.jl @@ -5,6 +5,9 @@ Description: Nonlinear node modeling a nonlinear relation. Updates for the nonlinear node are computed through the unscented transform. + + For more details see "On Approximate Nonlinear Gaussian Message Passing on + Factor Graphs", Petersen et al. 2018. f(out, in1) = δ(out - g(in1)) @@ -15,7 +18,7 @@ Interfaces: Construction: - Nonlinear(out, in1, id=:my_node) + Nonlinear(out, in1, g, id=:my_node) """ mutable struct Nonlinear <: DeltaFactor id::Symbol @@ -26,9 +29,9 @@ mutable struct Nonlinear <: DeltaFactor g_inv::Union{Function, Nothing} # Inverse of g (optional) dims::Tuple # Dimension of breaker message on input interface - function Nonlinear(out, in1, g::Function; inverse=nothing, dims=(1,), id=ForneyLab.generateId(Nonlinear)) + function Nonlinear(out, in1, g::Function; g_inv=nothing, dims=(1,), id=ForneyLab.generateId(Nonlinear)) @ensureVariables(out, in1) - self = new(id, Vector{Interface}(undef, 2), Dict{Symbol,Interface}(), g, inverse, dims) + self = new(id, Vector{Interface}(undef, 2), Dict{Symbol,Interface}(), g, g_inv, dims) ForneyLab.addNode!(currentGraph(), self) self.i[:out] = self.interfaces[1] = associate!(Interface(self), out) self.i[:in1] = self.interfaces[2] = associate!(Interface(self), in1) diff --git a/test/factor_nodes/test_nonlinear.jl b/test/factor_nodes/test_nonlinear.jl index 73b51aff..ebf26395 100644 --- a/test/factor_nodes/test_nonlinear.jl +++ b/test/factor_nodes/test_nonlinear.jl @@ -62,7 +62,7 @@ end @RV x ~ GaussianMeanVariance(2.0, 1.0) @RV y ~ GaussianMeanVariance(2.0, 3.0) - n = Nonlinear(y, x, g, inverse=g_inv) + n = Nonlinear(y, x, g, g_inv=g_inv) # Forward; g_inv should not be present in call algo = sumProductAlgorithm(y)