Skip to content

Commit 136e652

Browse files
committed
revert AbstractQ-related changes
1 parent da97265 commit 136e652

File tree

4 files changed

+20
-26
lines changed

4 files changed

+20
-26
lines changed

src/LinearMaps.jl

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export LinearMap, FunctionMap, FillMap, InverseMap
44
export , squarekron, kronsum, , sumkronsum, khatrirao, facesplitting
55

66
using LinearAlgebra
7-
using LinearAlgebra: AbstractQ
87
import LinearAlgebra: mul!
98
using SparseArrays
109

@@ -17,9 +16,8 @@ using Base: require_one_based_indexing
1716

1817
abstract type LinearMap{T} end
1918

20-
const AbstractVecOrMatOrQ{T} = Union{AbstractVecOrMat{T}, AbstractQ{T}}
21-
const MapOrVecOrMat{T} = Union{LinearMap{T}, AbstractVecOrMatOrQ{T}}
22-
const MapOrMatrix{T} = Union{LinearMap{T}, AbstractMatrix{T}, AbstractQ{T}}
19+
const MapOrVecOrMat{T} = Union{LinearMap{T}, AbstractVecOrMat{T}}
20+
const MapOrMatrix{T} = Union{LinearMap{T}, AbstractMatrix{T}}
2321
const TransposeAbsVecOrMat{T} = Transpose{T,<:AbstractVecOrMat}
2422
const RealOrComplex = Union{Real, Complex}
2523

@@ -31,7 +29,7 @@ Base.eltype(::LinearMap{T}) where {T} = T
3129

3230
# conversion to LinearMap
3331
Base.convert(::Type{LinearMap}, A::LinearMap) = A
34-
Base.convert(::Type{LinearMap}, A::AbstractVecOrMatOrQ) = LinearMap(A)
32+
Base.convert(::Type{LinearMap}, A::AbstractVecOrMat) = LinearMap(A)
3533

3634
convert_to_lmaps() = ()
3735
convert_to_lmaps(A) = (convert(LinearMap, A),)
@@ -49,7 +47,6 @@ MulStyle(::FiveArg, ::ThreeArg) = ThreeArg()
4947
MulStyle(::ThreeArg, ::ThreeArg) = ThreeArg()
5048
MulStyle(::LinearMap) = ThreeArg() # default
5149
MulStyle(::AbstractVecOrMat) = FiveArg()
52-
MulStyle(::AbstractQ) = ThreeArg()
5350
MulStyle(A::LinearMap, As::LinearMap...) = MulStyle(MulStyle(A), MulStyle(As...))
5451

5552
Base.isreal(A::LinearMap) = eltype(A) <: Real
@@ -356,19 +353,19 @@ include("chainrules.jl") # AD rules through ChainRulesCore
356353

357354
"""
358355
LinearMap(A::LinearMap; kwargs...)::WrappedMap
359-
LinearMap(A::AbstractVecOrMatOrQ; kwargs...)::WrappedMap
356+
LinearMap(A::AbstractVecOrMat; kwargs...)::WrappedMap
360357
LinearMap(J::UniformScaling, M::Int)::UniformScalingMap
361358
LinearMap{T=Float64}(f, [fc,], M::Int, N::Int = M; kwargs...)::FunctionMap
362359
LinearMap(A::MapOrVecOrMat, dims::Dims{2}, index::NTuple{2, AbstractVector{Int}})::EmbeddedMap
363360
LinearMap(A::MapOrVecOrMat, dims::Dims{2}; offset::Dims{2})::EmbeddedMap
364361
365362
Construct a linear map object, either
366363
367-
1. from an existing `LinearMap` or `AbstractVecOrMat`/`AbstractQ` `A`, with the purpose of
364+
1. from an existing `LinearMap` or `AbstractVecOrMat` `A`, with the purpose of
368365
redefining its properties via the keyword arguments `kwargs`, see below;
369366
2. a `UniformScaling` object `J` with specified (square) dimension `M`;
370367
3. from a function or callable object `f`;
371-
4. from an existing `LinearMap` or `AbstractVecOrMat`/`AbstractQ` `A`, embedded in a larger
368+
4. from an existing `LinearMap` or `AbstractVecOrMat` `A`, embedded in a larger
372369
zero map.
373370
374371
In the case of item 3, one also needs to specify the size of the equivalent matrix

src/blockmap.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Base.size(A::BlockMap) = (last(last(A.rowranges)), last(last(A.colranges)))
6363
# hcat
6464
############
6565
"""
66-
hcat(As::Union{LinearMap,UniformScaling,AbstractVecOrMatOrQ}...)::BlockMap
66+
hcat(As::Union{LinearMap,UniformScaling,AbstractVecOrMat}...)::BlockMap
6767
6868
Construct a (lazy) representation of the horizontal concatenation of the arguments.
6969
All arguments are promoted to `LinearMap`s automatically.
@@ -81,7 +81,7 @@ julia> L * ones(Int, 6)
8181
6
8282
```
8383
"""
84-
function Base.hcat(As::Union{LinearMap, UniformScaling, AbstractVecOrMatOrQ}...)
84+
function Base.hcat(As::Union{LinearMap, UniformScaling, AbstractVecOrMat}...)
8585
T = promote_type(map(eltype, As)...)
8686
nbc = length(As)
8787

@@ -98,7 +98,7 @@ end
9898
# vcat
9999
############
100100
"""
101-
vcat(As::Union{LinearMap,UniformScaling,AbstractVecOrMatOrQ}...)::BlockMap
101+
vcat(As::Union{LinearMap,UniformScaling,AbstractVecOrMat}...)::BlockMap
102102
103103
Construct a (lazy) representation of the vertical concatenation of the arguments.
104104
All arguments are promoted to `LinearMap`s automatically.
@@ -119,7 +119,7 @@ julia> L * ones(Int, 3)
119119
3
120120
```
121121
"""
122-
function Base.vcat(As::Union{LinearMap,UniformScaling,AbstractVecOrMatOrQ}...)
122+
function Base.vcat(As::Union{LinearMap,UniformScaling,AbstractVecOrMat}...)
123123
T = promote_type(map(eltype, As)...)
124124
nbr = length(As)
125125

@@ -137,7 +137,7 @@ end
137137
# hvcat
138138
############
139139
"""
140-
hvcat(rows::Tuple{Vararg{Int}}, As::Union{LinearMap,UniformScaling,AbstractVecOrMatOrQ}...)::BlockMap
140+
hvcat(rows::Tuple{Vararg{Int}}, As::Union{LinearMap,UniformScaling,AbstractVecOrMat}...)::BlockMap
141141
142142
Construct a (lazy) representation of the horizontal-vertical concatenation of the arguments.
143143
The first argument specifies the number of arguments to concatenate in each block row.
@@ -165,7 +165,7 @@ julia> L * ones(Int, 6)
165165
Base.hvcat
166166

167167
function Base.hvcat(rows::Tuple{Vararg{Int}},
168-
As::Union{LinearMap, UniformScaling, AbstractVecOrMatOrQ}...)
168+
As::Union{LinearMap, UniformScaling, AbstractVecOrMat}...)
169169
nr = length(rows)
170170
T = promote_type(map(eltype, As)...)
171171
sum(rows) == length(As) ||
@@ -221,7 +221,7 @@ function check_dim(A, dim, n)
221221
return nothing
222222
end
223223

224-
promote_to_lmaps_(n::Int, dim, A::AbstractVecOrMatOrQ) = (check_dim(A, dim, n); LinearMap(A))
224+
promote_to_lmaps_(n::Int, dim, A::AbstractVecOrMat) = (check_dim(A, dim, n); LinearMap(A))
225225
promote_to_lmaps_(n::Int, dim, J::UniformScaling) = UniformScalingMap(J.λ, n)
226226
promote_to_lmaps_(n::Int, dim, A::LinearMap) = (check_dim(A, dim, n); A)
227227
promote_to_lmaps(n, k, dim) = ()
@@ -322,7 +322,7 @@ end
322322
# provide one global intermediate storage vector if necessary
323323
__blockmul!(::FiveArg, y, A, x::AbstractVecOrMat, α, β) = ___blockmul!(y, A, x, α, β, nothing)
324324
__blockmul!(::ThreeArg, y, A, x::AbstractVecOrMat, α, β) = ___blockmul!(y, A, x, α, β, similar(y))
325-
function ___blockmul!(y, A, x, α, β, ::Nothing)
325+
function ___blockmul!(y, A, x::AbstractVecOrMat, α, β, ::Nothing)
326326
maps, rows, yinds, xinds = A.maps, A.rows, A.rowranges, A.colranges
327327
mapind = 0
328328
for (row, yi) in zip(rows, yinds)
@@ -336,7 +336,7 @@ function ___blockmul!(y, A, x, α, β, ::Nothing)
336336
end
337337
return y
338338
end
339-
function ___blockmul!(y, A, x, α, β, z)
339+
function ___blockmul!(y, A, x::AbstractVecOrMat, α, β, z)
340340
maps, rows, yinds, xinds = A.maps, A.rows, A.rowranges, A.colranges
341341
mapind = 0
342342
for (row, yi) in zip(rows, yinds)
@@ -497,7 +497,7 @@ BlockDiagonalMap(maps::LinearMap...) =
497497
# since the below methods are more specific than the Base method,
498498
# they would redefine Base/SparseArrays behavior
499499
for k in 1:8 # is 8 sufficient?
500-
Is = ntuple(n->:($(Symbol(:A, n))::AbstractVecOrMatOrQ), Val(k-1))
500+
Is = ntuple(n->:($(Symbol(:A, n))::AbstractVecOrMat), Val(k-1))
501501
# yields (:A1, :A2, :A3, ..., :A(k-1))
502502
L = :($(Symbol(:A, k))::LinearMap)
503503
# yields :Ak
@@ -524,7 +524,7 @@ for k in 1:8 # is 8 sufficient?
524524
end
525525

526526
"""
527-
blockdiag(As::Union{LinearMap,AbstractVecOrMatOrQ}...)::BlockDiagonalMap
527+
blockdiag(As::Union{LinearMap,AbstractVecOrMat}...)::BlockDiagonalMap
528528
529529
Construct a (lazy) representation of the diagonal concatenation of the arguments.
530530
To avoid fallback to the generic `SparseArrays.blockdiag`, there must be a `LinearMap`
@@ -533,7 +533,7 @@ object among the first 8 arguments.
533533
SparseArrays.blockdiag
534534

535535
"""
536-
cat(As::Union{LinearMap,AbstractVecOrMatOrQ}...; dims=(1,2))::BlockDiagonalMap
536+
cat(As::Union{LinearMap,AbstractVecOrMat}...; dims=(1,2))::BlockDiagonalMap
537537
538538
Construct a (lazy) representation of the diagonal concatenation of the arguments.
539539
To avoid fallback to the generic `Base.cat`, there must be a `LinearMap`

src/show.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ end
88
Base.show(io::IO, A::LinearMap) = print(io, map_show(io, A, 0))
99

1010
map_show(io::IO, A::LinearMap, i) = ' '^i * map_summary(A) * _show(io, A, i)
11-
map_show(io::IO, A::AbstractVecOrMatOrQ, i) = ' '^i * summary(A)
11+
map_show(io::IO, A::AbstractVecOrMat, i) = ' '^i * summary(A)
1212
_show(io::IO, ::LinearMap, _) = ""
1313
function _show(io::IO, A::FunctionMap{T,F,Nothing}, _) where {T,F}
1414
"($(A.f); issymmetric=$(A._issymmetric), ishermitian=$(A._ishermitian), isposdef=$(A._isposdef))"

src/wrappedmap.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,21 @@ WrappedMap(lmap::MapOrVecOrMat{T}; kwargs...) where {T} = WrappedMap{T}(lmap; kw
2323

2424
# cheap property checks (usually by type)
2525
_issymmetric(A::AbstractMatrix) = false
26-
_issymmetric(A::AbstractQ) = false
2726
_issymmetric(A::AbstractSparseMatrix) = issymmetric(A)
2827
_issymmetric(A::LinearMap) = issymmetric(A)
2928
_issymmetric(A::LinearAlgebra.RealHermSymComplexSym) = issymmetric(A)
3029
_issymmetric(A::Union{Bidiagonal,Diagonal,SymTridiagonal,Tridiagonal}) = issymmetric(A)
3130

3231
_ishermitian(A::AbstractMatrix) = false
33-
_ishermitian(A::AbstractQ) = false
3432
_ishermitian(A::AbstractSparseMatrix) = ishermitian(A)
3533
_ishermitian(A::LinearMap) = ishermitian(A)
3634
_ishermitian(A::LinearAlgebra.RealHermSymComplexHerm) = ishermitian(A)
3735
_ishermitian(A::Union{Bidiagonal,Diagonal,SymTridiagonal,Tridiagonal}) = ishermitian(A)
3836

3937
_isposdef(A::AbstractMatrix) = false
40-
_isposdef(A::AbstractQ) = false
4138
_isposdef(A::LinearMap) = isposdef(A)
4239

43-
const VecOrMatMap{T} = WrappedMap{T,<:Union{AbstractVecOrMatOrQ}}
40+
const VecOrMatMap{T} = WrappedMap{T,<:Union{AbstractVecOrMat}}
4441

4542
MulStyle(A::VecOrMatMap) = MulStyle(A.lmap)
4643

0 commit comments

Comments
 (0)