Skip to content

Variables on non-vector arrays breaks #171

@projekter

Description

@projekter

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions