Skip to content

Commit

Permalink
Fix documentation by adding ndims(::AbstractJuMPScalar) (#2608)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored May 19, 2021
1 parent f392b0e commit 1abc179
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 6 additions & 5 deletions src/JuMP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -374,11 +374,11 @@ See also: [`backend`](@ref).
This function is unsafe for two main reasons.
First, the formulation and order of variables and constraints in the unsafe
backend may be different to the variables and constraints in `model`. This
can happen because of bridges, or because the solver requires the variables or
constraints in a specific order. In addition, the variable or constraint index
returned by [`index`](@ref) at the JuMP level may be different to the index of
the corresponding variable or constraint in the `unsafe_backend`. There is no
backend may be different to the variables and constraints in `model`. This
can happen because of bridges, or because the solver requires the variables or
constraints in a specific order. In addition, the variable or constraint index
returned by [`index`](@ref) at the JuMP level may be different to the index of
the corresponding variable or constraint in the `unsafe_backend`. There is no
solution to this. Use the alternative suggested below instead.
Second, the `unsafe_backend` may be empty, or lack some modifications made to
Expand Down Expand Up @@ -1027,6 +1027,7 @@ work for JuMP types) and exploits the mutability of `AffExpr` and `QuadExpr`.
"""
abstract type AbstractJuMPScalar <: _MA.AbstractMutable end
Base.ndims(::Type{<:AbstractJuMPScalar}) = 0
Base.ndims(::AbstractJuMPScalar) = 0

# These are required to create symmetric containers of AbstractJuMPScalars.
LinearAlgebra.symmetric_type(::Type{T}) where {T<:AbstractJuMPScalar} = T
Expand Down
2 changes: 0 additions & 2 deletions src/quad_expr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ mutable struct GenericQuadExpr{CoefType,VarType} <: AbstractJuMPScalar
terms::OrderedDict{UnorderedPair{VarType},CoefType}
end

Base.ndims(::GenericQuadExpr) = 0

"""
GenericQuadExpr(
aff::GenericAffExpr{V,K},
Expand Down

0 comments on commit 1abc179

Please sign in to comment.