Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sunset linalg jazz #25217

Merged
merged 3 commits into from
Dec 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,557 changes: 890 additions & 667 deletions base/deprecated.jl

Large diffs are not rendered by default.

30 changes: 0 additions & 30 deletions base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export
ComplexF64,
ComplexF32,
ComplexF16,
ConjArray,
ConjVector,
ConjMatrix,
DenseMatrix,
Expand Down Expand Up @@ -98,7 +97,6 @@ export
RoundUp,
Adjoint,
Transpose,
RowVector,
AbstractSerializer,
SerializationState,
Set,
Expand Down Expand Up @@ -220,34 +218,6 @@ export
:,
=>,
∘,
A_ldiv_B!,
A_ldiv_Bc,
A_ldiv_Bt,
A_mul_B!,
A_mul_Bc,
A_mul_Bc!,
A_mul_Bt,
A_mul_Bt!,
A_rdiv_Bc,
A_rdiv_Bt,
Ac_ldiv_B,
Ac_ldiv_B!,
Ac_ldiv_Bc,
Ac_mul_B,
Ac_mul_B!,
Ac_mul_Bc,
Ac_mul_Bc!,
Ac_rdiv_B,
Ac_rdiv_Bc,
At_ldiv_B,
At_ldiv_B!,
At_ldiv_Bt,
At_mul_B,
At_mul_B!,
At_mul_Bt,
At_mul_Bt!,
At_rdiv_B,
At_rdiv_Bt,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, man. That is satisfying.


# scalar math
@evalpoly,
Expand Down
36 changes: 2 additions & 34 deletions base/linalg/conjarray.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

# TODO: remove this type stub between 0.7 and 1.0

"""
ConjArray(array)

Expand All @@ -19,39 +21,5 @@ julia> ConjArray([1+im 0; 0 1-im])
struct ConjArray{T,N,A<:AbstractArray} <: AbstractArray{T,N}
parent::A
end

@inline ConjArray(a::AbstractArray{T,N}) where {T,N} = ConjArray{conj_type(T),N,typeof(a)}(a)

const ConjVector{T,V<:AbstractVector} = ConjArray{T,1,V}
@inline ConjVector(v::AbstractVector{T}) where {T} = ConjArray{conj_type(T),1,typeof(v)}(v)

const ConjMatrix{T,M<:AbstractMatrix} = ConjArray{T,2,M}
@inline ConjMatrix(m::AbstractMatrix{T}) where {T} = ConjArray{conj_type(T),2,typeof(m)}(m)

# This type can cause the element type to change under conjugation - e.g. an array of complex arrays.
@inline conj_type(x) = conj_type(typeof(x))
@inline conj_type(::Type{T}) where {T} = promote_op(conj, T)

@inline parent(c::ConjArray) = c.parent
@inline parent_type(c::ConjArray) = parent_type(typeof(c))
@inline parent_type(::Type{ConjArray{T,N,A}}) where {T,N,A} = A

@inline size(a::ConjArray) = size(a.parent)
IndexStyle(::CA) where {CA<:ConjArray} = IndexStyle(parent_type(CA))
IndexStyle(::Type{CA}) where {CA<:ConjArray} = IndexStyle(parent_type(CA))

@propagate_inbounds getindex(a::ConjArray{T,N}, i::Int) where {T,N} = conj(getindex(a.parent, i))
@propagate_inbounds getindex(a::ConjArray{T,N}, i::Vararg{Int,N}) where {T,N} = conj(getindex(a.parent, i...))
@propagate_inbounds setindex!(a::ConjArray{T,N}, v, i::Int) where {T,N} = setindex!(a.parent, conj(v), i)
@propagate_inbounds setindex!(a::ConjArray{T,N}, v, i::Vararg{Int,N}) where {T,N} = setindex!(a.parent, conj(v), i...)

@inline similar(a::ConjArray, ::Type{T}, dims::Dims{N}) where {T,N} = similar(parent(a), T, dims)

# Currently, this is default behavior for RowVector only
@inline conj(a::ConjArray) = parent(a)

# Helper functions, currently used by RowVector
@inline _conj(a::AbstractArray) = ConjArray(a)
@inline _conj(a::AbstractArray{T}) where {T<:Real} = a
@inline _conj(a::ConjArray) = parent(a)
@inline _conj(a::ConjArray{T}) where {T<:Real} = parent(a)
98 changes: 32 additions & 66 deletions base/linalg/linalg.jl
Original file line number Diff line number Diff line change
@@ -1,26 +1,5 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

# shims to maintain existence of names in Base module in A_mul_B deprecation process
function Ac_ldiv_Bt end
function At_ldiv_Bt end
function A_ldiv_Bt end
function At_ldiv_B end
function Ac_ldiv_Bc end
function A_ldiv_Bc end
function Ac_ldiv_B end
function At_rdiv_Bt end
function A_rdiv_Bt end
function At_rdiv_B end
function Ac_rdiv_Bc end
function A_rdiv_Bc end
function Ac_rdiv_B end
function At_mul_Bt end
function A_mul_Bt end
function At_mul_B end
function Ac_mul_Bc end
function A_mul_Bc end
function Ac_mul_B end

"""
Linear algebra module. Provides array arithmetic,
matrix factorizations and other linear algebra related
Expand All @@ -29,8 +8,6 @@ functionality.
module LinAlg

import Base: \, /, *, ^, +, -, ==
import Base: A_mul_Bt, At_ldiv_Bt, A_rdiv_Bc, At_ldiv_B, Ac_mul_Bc, A_mul_Bc, Ac_mul_B,
Ac_ldiv_B, Ac_ldiv_Bc, At_mul_Bt, A_rdiv_Bt, At_mul_B
import Base: USE_BLAS64, abs, acos, acosh, acot, acoth, acsc, acsch, adjoint, asec, asech,
asin, asinh, atan, atanh, axes, big, broadcast, ceil, conj, convert, copy, copyto!, cos,
cosh, cot, coth, csc, csch, eltype, exp, findmax, findmin, fill!, floor, getindex, hcat,
Expand All @@ -51,10 +28,6 @@ export
# Types
Adjoint,
Transpose,
RowVector,
ConjArray,
ConjVector,
ConjMatrix,
SymTridiagonal,
Tridiagonal,
Bidiagonal,
Expand Down Expand Up @@ -171,34 +144,6 @@ export
# Operators
\,
/,
A_ldiv_B!,
A_ldiv_Bc,
A_ldiv_Bt,
A_mul_B!,
A_mul_Bc,
A_mul_Bc!,
A_mul_Bt,
A_mul_Bt!,
A_rdiv_Bc,
A_rdiv_Bt,
Ac_ldiv_B,
Ac_ldiv_Bc,
Ac_ldiv_B!,
Ac_mul_B,
Ac_mul_B!,
Ac_mul_Bc,
Ac_mul_Bc!,
Ac_rdiv_B,
Ac_rdiv_Bc,
At_ldiv_B,
At_ldiv_Bt,
At_ldiv_B!,
At_mul_B,
At_mul_B!,
At_mul_Bt,
At_mul_Bt!,
At_rdiv_B,
At_rdiv_Bt,

# Constants
I
Expand Down Expand Up @@ -261,23 +206,44 @@ function char_uplo(uplo::Symbol)
end
end

# shims to maintain existence of names in LinAlg module in A_mul_B deprecation process
function A_mul_B! end
function Ac_mul_B! end
function Ac_mul_B! end
function At_mul_B! end
function A_ldiv_B! end
function At_ldiv_B! end
function Ac_ldiv_B! end
function A_rdiv_B! end
function A_rdiv_Bc! end
"""
ldiv!([Y,] A, B) -> Y

Compute `A \\ B` in-place and store the result in `Y`, returning the result.
If only two arguments are passed, then `ldiv!(A, B)` overwrites `B` with
the result.

The argument `A` should *not* be a matrix. Rather, instead of matrices it should be a
factorization object (e.g. produced by [`factorize`](@ref) or [`cholfact`](@ref)).
The reason for this is that factorization itself is both expensive and typically allocates memory
(although it can also be done in-place via, e.g., [`lufact!`](@ref)),
and performance-critical situations requiring `ldiv!` usually also require fine-grained
control over the factorization of `A`.
"""
ldiv!(Y, A, B)

"""
rdiv!([Y,] A, B) -> Y

Compute `A / B` in-place and store the result in `Y`, returning the result.
If only two arguments are passed, then `rdiv!(A, B)` overwrites `A` with
the result.

The argument `B` should *not* be a matrix. Rather, instead of matrices it should be a
factorization object (e.g. produced by [`factorize`](@ref) or [`cholfact`](@ref)).
The reason for this is that factorization itself is both expensive and typically allocates memory
(although it can also be done in-place via, e.g., [`lufact!`](@ref)),
and performance-critical situations requiring `rdiv!` usually also require fine-grained
control over the factorization of `B`.
"""
rdiv!(Y, A, B)

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

include("adjtrans.jl")
include("conjarray.jl")
include("transpose.jl")
include("conjarray.jl")
include("rowvector.jl")

include("exceptions.jl")
Expand Down
Loading