@@ -498,47 +498,8 @@ function _fill_scalar_affine_terms!(
498498 return
499499end
500500
501- struct _CanonicalVector{T} <: AbstractVector{T}
502- index:: Int
503- n:: Int
504- end
505-
506- Base. eltype (:: Type{_CanonicalVector{T}} ) where {T} = T
507-
508- Base. length (v:: _CanonicalVector ) = v. n
509-
510- Base. size (v:: _CanonicalVector ) = (v. n,)
511-
512- function Base. getindex (v:: _CanonicalVector{T} , i:: Integer ) where {T}
513- return convert (T, i == v. index)
514- end
515-
516- # This is much faster than the default implementation that goes
517- # through all entries even if only one is nonzero.
518- function LinearAlgebra. dot (
519- x:: _CanonicalVector{T} ,
520- y:: _CanonicalVector{T} ,
521- ) where {T}
522- return convert (T, x. index == y. index)
523- end
524-
525- function MOI. Utilities. triangle_dot (
526- x:: _CanonicalVector{T} ,
527- y:: _CanonicalVector{T} ,
528- dim:: Int ,
529- offset:: Int ,
530- ) where {T}
531- if x. index != y. index || x. index <= offset
532- return zero (T)
533- elseif MOI. Utilities. is_diagonal_vectorized_index (x. index - offset)
534- return one (T)
535- else
536- return 2 one (T)
537- end
538- end
539-
540501function set_dot (i:: Integer , s:: MOI.AbstractVectorSet , T:: Type )
541- vec = _CanonicalVector {T} (i, MOI. dimension (s))
502+ vec = MOI . Utilities . CanonicalVector {T} (i, MOI. dimension (s))
542503 return MOI. Utilities. set_dot (vec, vec, s)
543504end
544505
0 commit comments