DistributedFactorGraphs.jl icon indicating copy to clipboard operation
DistributedFactorGraphs.jl copied to clipboard

VariableNodeData discussion for upgrading to Manifolds.jl

Open Affie opened this issue 3 years ago • 7 comments

To start a discussion on how best to deprecate the val and bw types of Array{Float64,2} to a vector of type P where P is the type of a point on a manifold. Or possibly something different?

Serialization should also be considered.

A possible way is to use a Union as a temporary transition (although it might be slower) and then change to a type

mutable struct VariableNodeData{T<:InferenceVariable}
    """#TODO will become Vector of a point on the manifold, 
          but should be backward compatible with Array{Float64,2}"""
    val::Union{<:AbstractVector, Matrix{Float64}}
    """#TODO will become Vector of a bandwidth/covariance of a point, 
          but should be backward compatible with Array{Float64,2}"""
    bw::Union{<:AbstractVector, Matrix{Float64}}
    ...
end

And then it can become:

mutable struct VariableNodeData{T<:InferenceVariable, P, B}
    "Vector of a point on the manifold"
    val::Vector{P}
    "Vector of a bandwith/covariance of a point"
    bw::Vector{B}
    ...
end

We can also 2 more fields and then just swop over from the one to the other.

I looked at TensorCast, but the Manifold points do not fit in with the Array{Float64,2} e.g. SO(2) is a Vector of 2x2 matrices.

Affie avatar May 17 '21 09:05 Affie