@@ -50,44 +50,24 @@ Base.:(==)(A::LinearMap, B::TransposeMap) = issymmetric(A) && B.lmap == A
5050Base.:(== )(A:: LinearMap , B:: AdjointMap ) = ishermitian (A) && B. lmap == A
5151
5252# multiplication with vector/matrices
53- # # TransposeMap
54- _unsafe_mul! (y:: AbstractVecOrMat , A:: TransposeMap , x:: AbstractVector ) =
55- issymmetric (A. lmap) ?
56- _unsafe_mul! (y, A. lmap, x) : error (" transpose not implemented for $(A. lmap) " )
57- _unsafe_mul! (y:: AbstractMatrix , A:: TransposeMap , x:: AbstractMatrix ) =
58- issymmetric (A. lmap) ?
59- _unsafe_mul! (y, A. lmap, x) : _generic_mapmat_mul! (y, A, x)
60- _unsafe_mul! (y:: AbstractMatrix , A:: TransposeMap , x:: Number ) =
61- issymmetric (A. lmap) ?
62- _unsafe_mul! (y, A. lmap, x) : _generic_mapnum_mul! (y, A, x)
63- _unsafe_mul! (y:: AbstractVecOrMat , A:: TransposeMap , x:: AbstractVector , α:: Number , β:: Number )=
64- issymmetric (A. lmap) ?
65- _unsafe_mul! (y, A. lmap, x, α, β) : _generic_mapvec_mul! (y, A, x, α, β)
66- _unsafe_mul! (y:: AbstractMatrix , A:: TransposeMap , x:: AbstractMatrix , α:: Number , β:: Number ) =
67- issymmetric (A. lmap) ?
68- _unsafe_mul! (y, A. lmap, x, α, β) : _generic_mapmat_mul! (y, A, x, α, β)
69- _unsafe_mul! (y:: AbstractMatrix , A:: TransposeMap , x:: Number , α:: Number , β:: Number ) =
70- issymmetric (A. lmap) ?
71- _unsafe_mul! (y, A. lmap, x, α, β) : _generic_mapnum_mul! (y, A, x, α, β)
72- # # AdjointMap
73- _unsafe_mul! (y:: AbstractVecOrMat , A:: AdjointMap , x:: AbstractVector ) =
74- ishermitian (A. lmap) ?
75- _unsafe_mul! (y, A. lmap, x) : error (" adjoint not implemented for $(A. lmap) " )
76- _unsafe_mul! (y:: AbstractMatrix , A:: AdjointMap , x:: AbstractMatrix ) =
77- ishermitian (A. lmap) ?
78- _unsafe_mul! (y, A. lmap, x) : _generic_mapmat_mul! (y, A, x)
79- _unsafe_mul! (y:: AbstractMatrix , A:: AdjointMap , x:: Number ) =
80- ishermitian (A. lmap) ?
81- _unsafe_mul! (y, A. lmap, x) : _generic_mapnum_mul! (y, A, x)
82- _unsafe_mul! (y:: AbstractVecOrMat , A:: AdjointMap , x:: AbstractVector , α:: Number , β:: Number ) =
83- ishermitian (A. lmap) ?
84- _unsafe_mul! (y, A. lmap, x, α, β) : _generic_mapvec_mul! (y, A, x, α, β)
85- _unsafe_mul! (y:: AbstractMatrix , A:: AdjointMap , x:: AbstractMatrix , α:: Number , β:: Number ) =
86- ishermitian (A. lmap) ?
87- _unsafe_mul! (y, A. lmap, x, α, β) : _generic_mapmat_mul! (y, A, x, α, β)
88- _unsafe_mul! (y:: AbstractMatrix , A:: AdjointMap , x:: Number , α:: Number , β:: Number ) =
89- ishermitian (A. lmap) ?
90- _unsafe_mul! (y, A. lmap, x, α, β) : _generic_mapnum_mul! (y, A, x, α, β)
53+ for (Typ, prop, text) in ((AdjointMap, ishermitian, " adjoint" ), (TransposeMap, issymmetric, " transpose" ))
54+ @eval _unsafe_mul! (y:: AbstractVecOrMat , A:: $Typ , x:: AbstractVector ) =
55+ $ prop (A. lmap) ?
56+ _unsafe_mul! (y, A. lmap, x) : error ($ text * " not implemented for $(A. lmap) " )
57+ @eval _unsafe_mul! (y:: AbstractVecOrMat , A:: $Typ , x:: AbstractVector , α:: Number , β:: Number ) =
58+ $ prop (A. lmap) ?
59+ _unsafe_mul! (y, A. lmap, x, α, β) : _generic_map_mul! (y, A, x, α, β)
60+
61+ for In in (Number, AbstractMatrix)
62+ @eval _unsafe_mul! (y:: AbstractMatrix , A:: $Typ , x:: $In ) =
63+ $ prop (A. lmap) ?
64+ _unsafe_mul! (y, A. lmap, x) : _generic_map_mul! (y, A, x)
65+
66+ @eval _unsafe_mul! (y:: AbstractMatrix , A:: $Typ , x:: $In , α:: Number , β:: Number ) =
67+ ishermitian (A. lmap) ?
68+ _unsafe_mul! (y, A. lmap, x, α, β) : _generic_map_mul! (y, A, x, α, β)
69+ end
70+ end
9171
9272# # ConjugateMap
9373const ConjugateMap = AdjointMap{<: Any , <: TransposeMap }
@@ -104,9 +84,10 @@ for (In, Out) in ((AbstractVector, AbstractVecOrMat), (AbstractMatrix, AbstractM
10484 end
10585 end
10686end
87+ _unsafe_mul! (y:: AbstractMatrix , Ac:: ConjugateMap , x:: Number ) = _conjmul! (y, Ac. lmap. lmap, x)
10788
10889# multiplication helper function
109- _conjmul! (y, A, x) = conj! (mul ! (y, A, conj (x)))
90+ _conjmul! (y, A, x) = conj! (_unsafe_mul ! (y, A, conj (x)))
11091function _conjmul! (y, A, x:: AbstractVector , α, β)
11192 xca = conj! (x * α)
11293 z = A * xca
0 commit comments