|
26 | 26 |
|
27 | 27 | # TODO: LinearAlgebra should have a documented function so that we don't have to |
28 | 28 | # overload an internal function |
29 | | -if VERSION >= v"1.5.0-rc1.23" |
30 | | - function LinearAlgebra._dot_nonrecursive( |
31 | | - lhs::AbstractArray{<:AbstractMutable}, |
32 | | - rhs::AbstractArray, |
33 | | - ) |
34 | | - return fused_map_reduce(add_mul, lhs, rhs) |
35 | | - end |
36 | | - function LinearAlgebra._dot_nonrecursive( |
37 | | - lhs::AbstractArray, |
38 | | - rhs::AbstractArray{<:AbstractMutable}, |
39 | | - ) |
40 | | - return fused_map_reduce(add_mul, lhs, rhs) |
41 | | - end |
42 | | - function LinearAlgebra._dot_nonrecursive( |
43 | | - lhs::AbstractArray{<:AbstractMutable}, |
44 | | - rhs::AbstractArray{<:AbstractMutable}, |
45 | | - ) |
46 | | - return fused_map_reduce(add_mul, lhs, rhs) |
47 | | - end |
| 29 | +function LinearAlgebra._dot_nonrecursive( |
| 30 | + lhs::AbstractArray{<:AbstractMutable}, |
| 31 | + rhs::AbstractArray, |
| 32 | +) |
| 33 | + return fused_map_reduce(add_mul, lhs, rhs) |
| 34 | +end |
| 35 | +function LinearAlgebra._dot_nonrecursive( |
| 36 | + lhs::AbstractArray, |
| 37 | + rhs::AbstractArray{<:AbstractMutable}, |
| 38 | +) |
| 39 | + return fused_map_reduce(add_mul, lhs, rhs) |
| 40 | +end |
| 41 | +function LinearAlgebra._dot_nonrecursive( |
| 42 | + lhs::AbstractArray{<:AbstractMutable}, |
| 43 | + rhs::AbstractArray{<:AbstractMutable}, |
| 44 | +) |
| 45 | + return fused_map_reduce(add_mul, lhs, rhs) |
48 | 46 | end |
49 | 47 |
|
50 | 48 | function LinearAlgebra.dot( |
|
72 | 70 | # fill!(::Array{AbstractVariableRef}, zero(GenericAffExpr{Float64,eltype(x)})) |
73 | 71 | _one_indexed(A) = all(x -> isa(x, Base.OneTo), axes(A)) |
74 | 72 |
|
75 | | -if VERSION <= v"1.2" |
76 | | - function LinearAlgebra.diagm_container( |
77 | | - kv::Pair{<:Integer,<:AbstractVector{<:AbstractMutable}}..., |
78 | | - ) |
79 | | - T = promote_type(map(x -> eltype(x.second), kv)...) |
80 | | - U = promote_type(T, promote_operation(zero, T)) |
81 | | - n = mapreduce(x -> length(x.second) + abs(x.first), max, kv) |
82 | | - return zeros(U, n, n) |
83 | | - end |
84 | | -else |
85 | | - function LinearAlgebra.diagm_container( |
86 | | - size, |
87 | | - kv::Pair{<:Integer,<:AbstractVector{<:AbstractMutable}}..., |
88 | | - ) |
89 | | - T = promote_type(map(x -> promote_type(eltype(x.second)), kv)...) |
90 | | - U = promote_type(T, promote_operation(zero, T)) |
91 | | - return zeros(U, LinearAlgebra.diagm_size(size, kv...)...) |
92 | | - end |
| 73 | +function LinearAlgebra.diagm_container( |
| 74 | + size, |
| 75 | + kv::Pair{<:Integer,<:AbstractVector{<:AbstractMutable}}..., |
| 76 | +) |
| 77 | + T = promote_type(map(x -> promote_type(eltype(x.second)), kv)...) |
| 78 | + U = promote_type(T, promote_operation(zero, T)) |
| 79 | + return zeros(U, LinearAlgebra.diagm_size(size, kv...)...) |
93 | 80 | end |
94 | 81 |
|
95 | 82 | function LinearAlgebra.diagm(x::AbstractVector{<:AbstractMutable}) |
|
0 commit comments