The definition of variables,
|
MP.variables(p::AbstractArray{<:PolyType}) = mergevars(MP.variables.(p))[1] |
is supposed to work on (abstract) arrays of any shape. However, by broadcasting the variables, the shape is retained, and
mergevars actually expects a Vector of Vectors:
|
function mergevars(varsvec::Vector{Vector{PV}}) where {PV<:Variable} |
So calling
variables on, say, a matrix, won't work.
mergevars should probably also accept
AbstractArray{Vector{PV}} (as well as
mergevars_to!)? Or
variables should work only on
Vectors (even
AbstractVector would be problematic, I guess, since the output type of broadcasting is created via
similar, which need not give a
Vector)? Or since it is not in the MP specification,
variables shouldn't support any array input at all?
The definition of
variables,DynamicPolynomials.jl/src/DynamicPolynomials.jl
Line 63 in f8fe686
is supposed to work on (abstract) arrays of any shape. However, by broadcasting the variables, the shape is retained, and
mergevarsactually expects a Vector of Vectors:DynamicPolynomials.jl/src/var.jl
Line 283 in f8fe686
So calling
variableson, say, a matrix, won't work.mergevarsshould probably also acceptAbstractArray{Vector{PV}}(as well asmergevars_to!)? Orvariablesshould work only onVectors(evenAbstractVectorwould be problematic, I guess, since the output type of broadcasting is created viasimilar, which need not give aVector)? Or since it is not in the MP specification,variablesshouldn't support any array input at all?