Skip to content

Commit a65570e

Browse files
committed
Fix WrappedMap constructor for vectors
1 parent fc23bae commit a65570e

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "LinearMaps"
22
uuid = "7a12625a-238d-50fd-b39a-03d52299707e"
3-
version = "3.11.3"
3+
version = "3.12.1"
44

55
[deps]
66
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"

src/wrappedmap.jl

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,30 @@ struct WrappedMap{T, A<:MapOrVecOrMat} <: LinearMap{T}
44
_ishermitian::Bool
55
_isposdef::Bool
66
end
7-
function WrappedMap{T}(lmap::MapOrMatrix;
7+
function WrappedMap{T}(lmap::MapOrVecOrMat;
88
issymmetric::Bool = _issymmetric(lmap),
99
ishermitian::Bool = _ishermitian(lmap),
1010
isposdef::Bool = _isposdef(lmap)) where {T}
1111
WrappedMap{T, typeof(lmap)}(lmap, issymmetric, ishermitian, isposdef)
1212
end
13-
function WrappedMap{T}(lmap::AbstractVector;
14-
issym::Bool = false,
15-
isherm::Bool = false,
16-
ispd::Bool = false) where {T}
17-
WrappedMap{T, typeof(lmap)}(lmap,
18-
length(lmap) == 1 && issymmetric(first(lmap)),
19-
length(lmap) == 1 && ishermitian(first(lmap)),
20-
length(lmap) == 1 && isposdef(first(lmap)))
21-
end
2213
WrappedMap(lmap::MapOrVecOrMat{T}; kwargs...) where {T} = WrappedMap{T}(lmap; kwargs...)
2314

2415
# cheap property checks (usually by type)
16+
_issymmetric(A::AbstractVector) = length(A) == 1 && issymmetric(first(A))
2517
_issymmetric(A::AbstractMatrix) = false
2618
_issymmetric(A::AbstractQ) = false
2719
_issymmetric(A::LinearMap) = issymmetric(A)
2820
_issymmetric(A::LinearAlgebra.RealHermSymComplexSym) = issymmetric(A)
2921
_issymmetric(A::Union{Bidiagonal,Diagonal,SymTridiagonal,Tridiagonal}) = issymmetric(A)
3022

23+
_ishermitian(A::AbstractVector) = length(A) == 1 && ishermitian(first(A))
3124
_ishermitian(A::AbstractMatrix) = false
3225
_ishermitian(A::AbstractQ) = false
3326
_ishermitian(A::LinearMap) = ishermitian(A)
3427
_ishermitian(A::LinearAlgebra.RealHermSymComplexHerm) = ishermitian(A)
3528
_ishermitian(A::Union{Bidiagonal,Diagonal,SymTridiagonal,Tridiagonal}) = ishermitian(A)
3629

30+
_isposdef(A::AbstractVector) = length(A) == 1 && isposdef(first(A))
3731
_isposdef(A::AbstractMatrix) = false
3832
_isposdef(A::AbstractQ) = false
3933
_isposdef(A::LinearMap) = isposdef(A)

test/wrappedmap.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Test, LinearMaps, LinearAlgebra
1+
using Test, LinearMaps, LinearAlgebra, SparseArrays
22

33
@testset "wrapped maps" begin
44
A = rand(10, 20)

0 commit comments

Comments
 (0)