Skip to content

Commit

Permalink
Edited Nonlinear node docstring and constructor parameter name.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-bocharov committed Aug 28, 2019
1 parent eb70424 commit 0f80e33
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/factor_nodes/nonlinear.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/factor_nodes/test_nonlinear.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0f80e33

Please sign in to comment.