Skip to content
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "LinearMaps"
uuid = "7a12625a-238d-50fd-b39a-03d52299707e"
version = "3.11.3"
version = "3.12.1"

[deps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Expand Down
14 changes: 4 additions & 10 deletions src/wrappedmap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,30 @@ struct WrappedMap{T, A<:MapOrVecOrMat} <: LinearMap{T}
_ishermitian::Bool
_isposdef::Bool
end
function WrappedMap{T}(lmap::MapOrMatrix;
function WrappedMap{T}(lmap::MapOrVecOrMat;
issymmetric::Bool = _issymmetric(lmap),
ishermitian::Bool = _ishermitian(lmap),
isposdef::Bool = _isposdef(lmap)) where {T}
WrappedMap{T, typeof(lmap)}(lmap, issymmetric, ishermitian, isposdef)
end
function WrappedMap{T}(lmap::AbstractVector;
issym::Bool = false,
isherm::Bool = false,
ispd::Bool = false) where {T}
WrappedMap{T, typeof(lmap)}(lmap,
length(lmap) == 1 && issymmetric(first(lmap)),
length(lmap) == 1 && ishermitian(first(lmap)),
length(lmap) == 1 && isposdef(first(lmap)))
end
WrappedMap(lmap::MapOrVecOrMat{T}; kwargs...) where {T} = WrappedMap{T}(lmap; kwargs...)

# cheap property checks (usually by type)
_issymmetric(A::AbstractVector) = length(A) == 1 && issymmetric(first(A))
_issymmetric(A::AbstractMatrix) = false
_issymmetric(A::AbstractQ) = false
_issymmetric(A::LinearMap) = issymmetric(A)
_issymmetric(A::LinearAlgebra.RealHermSymComplexSym) = issymmetric(A)
_issymmetric(A::Union{Bidiagonal,Diagonal,SymTridiagonal,Tridiagonal}) = issymmetric(A)

_ishermitian(A::AbstractVector) = length(A) == 1 && ishermitian(first(A))
_ishermitian(A::AbstractMatrix) = false
_ishermitian(A::AbstractQ) = false
_ishermitian(A::LinearMap) = ishermitian(A)
_ishermitian(A::LinearAlgebra.RealHermSymComplexHerm) = ishermitian(A)
_ishermitian(A::Union{Bidiagonal,Diagonal,SymTridiagonal,Tridiagonal}) = ishermitian(A)

_isposdef(A::AbstractVector) = length(A) == 1 && isposdef(first(A))
_isposdef(A::AbstractMatrix) = false
_isposdef(A::AbstractQ) = false
_isposdef(A::LinearMap) = isposdef(A)
Expand Down
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
Aqua = "0.8"
BlockArrays = "0.16"
BlockArrays = "1"
ChainRulesCore = "1"
ChainRulesTestUtils = "1.9"
Documenter = "1"
Expand Down
16 changes: 8 additions & 8 deletions test/nontradaxes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using Test, LinearMaps, LinearAlgebra, BlockArrays
@testset "Non-traditional axes" begin

A = rand(ComplexF64,2,4)
B = PseudoBlockMatrix{ComplexF64}(undef, [2,3], [3,4])
B = BlockMatrix{ComplexF64}(undef, [2,3], [3,4])

ax1 = axes(B)[1]
ax2 = axes(B)[2]
Expand All @@ -19,7 +19,7 @@ using Test, LinearMaps, LinearAlgebra, BlockArrays
@test eltype(N) == eltype(B)

u = similar(Array{ComplexF64}, ax2)
v = PseudoBlockVector{ComplexF64}(undef, [3,5])
v = BlockVector{ComplexF64}(undef, [3,5])
w = similar(Array{ComplexF64}, ax1)

for i in eachindex(u) u[i] = rand(ComplexF64) end
Expand Down Expand Up @@ -54,7 +54,7 @@ using Test, LinearMaps, LinearAlgebra, BlockArrays
@test blocklengths(axes(C)[1]) == blocklengths(ax1)

A = rand(ComplexF64,2,2)
B = PseudoBlockMatrix{ComplexF64}(undef, [2,2], [2,2])
B = BlockMatrix{ComplexF64}(undef, [2,2], [2,2])
ax1 = axes(B)[1]
ax2 = axes(B)[2]
fill!(B,0)
Expand All @@ -75,12 +75,12 @@ using Test, LinearMaps, LinearAlgebra, BlockArrays
D2 = rand(5,3)
D3 = rand(3,6)
D4 = rand(6,6)
A1 = PseudoBlockMatrix(D1, [1,3], [2,3])
A2 = PseudoBlockMatrix(D2, [2,3], [2,1])
A3 = PseudoBlockMatrix(D3, [2,1], [3,2,1])
A4 = PseudoBlockMatrix(D4, [3,2,1], [3,2,1])
A1 = BlockMatrix(D1, [1,3], [2,3])
A2 = BlockMatrix(D2, [2,3], [2,1])
A3 = BlockMatrix(D3, [2,1], [3,2,1])
A4 = BlockMatrix(D4, [3,2,1], [3,2,1])
u = rand(6)
x = PseudoBlockVector(u, [3,2,1])
x = BlockVector(u, [3,2,1])
L = LinearMap(A1) * LinearMap(A2) * LinearMap(A3) * LinearMap(A4)
y = L * x
v = Vector(y)
Expand Down
2 changes: 1 addition & 1 deletion test/wrappedmap.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Test, LinearMaps, LinearAlgebra
using Test, LinearMaps, LinearAlgebra, SparseArrays

@testset "wrapped maps" begin
A = rand(10, 20)
Expand Down
Loading