Skip to content

Commit eb91796

Browse files
authored
Merge pull request #25217 from Sacha0/sunsetjazz
sunset linalg jazz
2 parents 58f7961 + 3ed7386 commit eb91796

File tree

13 files changed

+938
-1441
lines changed

13 files changed

+938
-1441
lines changed

base/deprecated.jl

Lines changed: 890 additions & 667 deletions
Large diffs are not rendered by default.

base/exports.jl

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ export
4747
ComplexF64,
4848
ComplexF32,
4949
ComplexF16,
50-
ConjArray,
5150
ConjVector,
5251
ConjMatrix,
5352
DenseMatrix,
@@ -98,7 +97,6 @@ export
9897
RoundUp,
9998
Adjoint,
10099
Transpose,
101-
RowVector,
102100
AbstractSerializer,
103101
SerializationState,
104102
Set,
@@ -220,34 +218,6 @@ export
220218
:,
221219
=>,
222220
,
223-
A_ldiv_B!,
224-
A_ldiv_Bc,
225-
A_ldiv_Bt,
226-
A_mul_B!,
227-
A_mul_Bc,
228-
A_mul_Bc!,
229-
A_mul_Bt,
230-
A_mul_Bt!,
231-
A_rdiv_Bc,
232-
A_rdiv_Bt,
233-
Ac_ldiv_B,
234-
Ac_ldiv_B!,
235-
Ac_ldiv_Bc,
236-
Ac_mul_B,
237-
Ac_mul_B!,
238-
Ac_mul_Bc,
239-
Ac_mul_Bc!,
240-
Ac_rdiv_B,
241-
Ac_rdiv_Bc,
242-
At_ldiv_B,
243-
At_ldiv_B!,
244-
At_ldiv_Bt,
245-
At_mul_B,
246-
At_mul_B!,
247-
At_mul_Bt,
248-
At_mul_Bt!,
249-
At_rdiv_B,
250-
At_rdiv_Bt,
251221

252222
# scalar math
253223
@evalpoly,

base/linalg/conjarray.jl

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# This file is a part of Julia. License is MIT: https://julialang.org/license
22

3+
# TODO: remove this type stub between 0.7 and 1.0
4+
35
"""
46
ConjArray(array)
57
@@ -19,39 +21,5 @@ julia> ConjArray([1+im 0; 0 1-im])
1921
struct ConjArray{T,N,A<:AbstractArray} <: AbstractArray{T,N}
2022
parent::A
2123
end
22-
23-
@inline ConjArray(a::AbstractArray{T,N}) where {T,N} = ConjArray{conj_type(T),N,typeof(a)}(a)
24-
2524
const ConjVector{T,V<:AbstractVector} = ConjArray{T,1,V}
26-
@inline ConjVector(v::AbstractVector{T}) where {T} = ConjArray{conj_type(T),1,typeof(v)}(v)
27-
2825
const ConjMatrix{T,M<:AbstractMatrix} = ConjArray{T,2,M}
29-
@inline ConjMatrix(m::AbstractMatrix{T}) where {T} = ConjArray{conj_type(T),2,typeof(m)}(m)
30-
31-
# This type can cause the element type to change under conjugation - e.g. an array of complex arrays.
32-
@inline conj_type(x) = conj_type(typeof(x))
33-
@inline conj_type(::Type{T}) where {T} = promote_op(conj, T)
34-
35-
@inline parent(c::ConjArray) = c.parent
36-
@inline parent_type(c::ConjArray) = parent_type(typeof(c))
37-
@inline parent_type(::Type{ConjArray{T,N,A}}) where {T,N,A} = A
38-
39-
@inline size(a::ConjArray) = size(a.parent)
40-
IndexStyle(::CA) where {CA<:ConjArray} = IndexStyle(parent_type(CA))
41-
IndexStyle(::Type{CA}) where {CA<:ConjArray} = IndexStyle(parent_type(CA))
42-
43-
@propagate_inbounds getindex(a::ConjArray{T,N}, i::Int) where {T,N} = conj(getindex(a.parent, i))
44-
@propagate_inbounds getindex(a::ConjArray{T,N}, i::Vararg{Int,N}) where {T,N} = conj(getindex(a.parent, i...))
45-
@propagate_inbounds setindex!(a::ConjArray{T,N}, v, i::Int) where {T,N} = setindex!(a.parent, conj(v), i)
46-
@propagate_inbounds setindex!(a::ConjArray{T,N}, v, i::Vararg{Int,N}) where {T,N} = setindex!(a.parent, conj(v), i...)
47-
48-
@inline similar(a::ConjArray, ::Type{T}, dims::Dims{N}) where {T,N} = similar(parent(a), T, dims)
49-
50-
# Currently, this is default behavior for RowVector only
51-
@inline conj(a::ConjArray) = parent(a)
52-
53-
# Helper functions, currently used by RowVector
54-
@inline _conj(a::AbstractArray) = ConjArray(a)
55-
@inline _conj(a::AbstractArray{T}) where {T<:Real} = a
56-
@inline _conj(a::ConjArray) = parent(a)
57-
@inline _conj(a::ConjArray{T}) where {T<:Real} = parent(a)

base/linalg/linalg.jl

Lines changed: 32 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,5 @@
11
# This file is a part of Julia. License is MIT: https://julialang.org/license
22

3-
# shims to maintain existence of names in Base module in A_mul_B deprecation process
4-
function Ac_ldiv_Bt end
5-
function At_ldiv_Bt end
6-
function A_ldiv_Bt end
7-
function At_ldiv_B end
8-
function Ac_ldiv_Bc end
9-
function A_ldiv_Bc end
10-
function Ac_ldiv_B end
11-
function At_rdiv_Bt end
12-
function A_rdiv_Bt end
13-
function At_rdiv_B end
14-
function Ac_rdiv_Bc end
15-
function A_rdiv_Bc end
16-
function Ac_rdiv_B end
17-
function At_mul_Bt end
18-
function A_mul_Bt end
19-
function At_mul_B end
20-
function Ac_mul_Bc end
21-
function A_mul_Bc end
22-
function Ac_mul_B end
23-
243
"""
254
Linear algebra module. Provides array arithmetic,
265
matrix factorizations and other linear algebra related
@@ -29,8 +8,6 @@ functionality.
298
module LinAlg
309

3110
import Base: \, /, *, ^, +, -, ==
32-
import Base: A_mul_Bt, At_ldiv_Bt, A_rdiv_Bc, At_ldiv_B, Ac_mul_Bc, A_mul_Bc, Ac_mul_B,
33-
Ac_ldiv_B, Ac_ldiv_Bc, At_mul_Bt, A_rdiv_Bt, At_mul_B
3411
import Base: USE_BLAS64, abs, acos, acosh, acot, acoth, acsc, acsch, adjoint, asec, asech,
3512
asin, asinh, atan, atanh, axes, big, broadcast, ceil, conj, convert, copy, copyto!, cos,
3613
cosh, cot, coth, csc, csch, eltype, exp, findmax, findmin, fill!, floor, getindex, hcat,
@@ -51,10 +28,6 @@ export
5128
# Types
5229
Adjoint,
5330
Transpose,
54-
RowVector,
55-
ConjArray,
56-
ConjVector,
57-
ConjMatrix,
5831
SymTridiagonal,
5932
Tridiagonal,
6033
Bidiagonal,
@@ -171,34 +144,6 @@ export
171144
# Operators
172145
\,
173146
/,
174-
A_ldiv_B!,
175-
A_ldiv_Bc,
176-
A_ldiv_Bt,
177-
A_mul_B!,
178-
A_mul_Bc,
179-
A_mul_Bc!,
180-
A_mul_Bt,
181-
A_mul_Bt!,
182-
A_rdiv_Bc,
183-
A_rdiv_Bt,
184-
Ac_ldiv_B,
185-
Ac_ldiv_Bc,
186-
Ac_ldiv_B!,
187-
Ac_mul_B,
188-
Ac_mul_B!,
189-
Ac_mul_Bc,
190-
Ac_mul_Bc!,
191-
Ac_rdiv_B,
192-
Ac_rdiv_Bc,
193-
At_ldiv_B,
194-
At_ldiv_Bt,
195-
At_ldiv_B!,
196-
At_mul_B,
197-
At_mul_B!,
198-
At_mul_Bt,
199-
At_mul_Bt!,
200-
At_rdiv_B,
201-
At_rdiv_Bt,
202147

203148
# Constants
204149
I
@@ -261,23 +206,44 @@ function char_uplo(uplo::Symbol)
261206
end
262207
end
263208

264-
# shims to maintain existence of names in LinAlg module in A_mul_B deprecation process
265-
function A_mul_B! end
266-
function Ac_mul_B! end
267-
function Ac_mul_B! end
268-
function At_mul_B! end
269-
function A_ldiv_B! end
270-
function At_ldiv_B! end
271-
function Ac_ldiv_B! end
272-
function A_rdiv_B! end
273-
function A_rdiv_Bc! end
209+
"""
210+
ldiv!([Y,] A, B) -> Y
211+
212+
Compute `A \\ B` in-place and store the result in `Y`, returning the result.
213+
If only two arguments are passed, then `ldiv!(A, B)` overwrites `B` with
214+
the result.
215+
216+
The argument `A` should *not* be a matrix. Rather, instead of matrices it should be a
217+
factorization object (e.g. produced by [`factorize`](@ref) or [`cholfact`](@ref)).
218+
The reason for this is that factorization itself is both expensive and typically allocates memory
219+
(although it can also be done in-place via, e.g., [`lufact!`](@ref)),
220+
and performance-critical situations requiring `ldiv!` usually also require fine-grained
221+
control over the factorization of `A`.
222+
"""
223+
ldiv!(Y, A, B)
224+
225+
"""
226+
rdiv!([Y,] A, B) -> Y
227+
228+
Compute `A / B` in-place and store the result in `Y`, returning the result.
229+
If only two arguments are passed, then `rdiv!(A, B)` overwrites `A` with
230+
the result.
231+
232+
The argument `B` should *not* be a matrix. Rather, instead of matrices it should be a
233+
factorization object (e.g. produced by [`factorize`](@ref) or [`cholfact`](@ref)).
234+
The reason for this is that factorization itself is both expensive and typically allocates memory
235+
(although it can also be done in-place via, e.g., [`lufact!`](@ref)),
236+
and performance-critical situations requiring `rdiv!` usually also require fine-grained
237+
control over the factorization of `B`.
238+
"""
239+
rdiv!(Y, A, B)
274240

275241
copy_oftype(A::AbstractArray{T}, ::Type{T}) where {T} = copy(A)
276242
copy_oftype(A::AbstractArray{T,N}, ::Type{S}) where {T,N,S} = convert(AbstractArray{S,N}, A)
277243

278244
include("adjtrans.jl")
279-
include("conjarray.jl")
280245
include("transpose.jl")
246+
include("conjarray.jl")
281247
include("rowvector.jl")
282248

283249
include("exceptions.jl")

0 commit comments

Comments
 (0)