Closed nossleinad closed 2 weeks ago
FelNode has the following message type declaration: message::Vector{Partition}.
FelNode
message::Vector{Partition}
copy_message
The current implementation of copy_message
copy_message(msg::Vector{<:Partition}) = [copy_partition(x) for x in msg]
doesn't always return ::Vector{Partition}. For example:
::Vector{Partition}
julia> node.message = [NucleotidePartition(1)]; julia> copy_message(node.message) 1-element Vector{NucleotidePartition}: NucleotidePartition([0.0; 0.0; 0.0; 0.0;;], 4, 1, [0.0])
Notice the difference between ::Vector{<:Partition} and ::Vector{Partition}.
::Vector{<:Partition}
This is the function head for internal_message_init:
internal_message_init
internal_message_init!(tree::FelNode, empty_message::Vector{<:Partition})
This is the function head for an internal version of branchlength_optim!:
branchlength_optim!
function branchlength_optim!( temp_message::Vector{Partition}, message_to_set::Vector{Partition}, node::FelNode, models, partition_list, tol; bl_optimizer::UnivariateOpt = GoldenSectionOpt() )
temp_message and message_to_set are initialized through copy_message which can cause a MethodError, since
temp_message
message_to_set
MethodError
julia> Vector{NucleotidePartition} <: Vector{Partition} false
Either
Vector{Partition}
Background
FelNode
has the following message type declaration:message::Vector{Partition}
.Problem
Return type of
copy_message
The current implementation of
copy_message
doesn't always return
::Vector{Partition}
. For example:Inconsistent message type declaration
Notice the difference between
::Vector{<:Partition}
and::Vector{Partition}
.This is the function head for
internal_message_init
:This is the function head for an internal version of
branchlength_optim!
:temp_message
andmessage_to_set
are initialized throughcopy_message
which can cause aMethodError
, sinceResolution
Either
::Vector{<:Partition}
as message type declaration. orcopy_message
to beVector{Partition}
.