25
25
26
26
# the following for multiplying with transpose and ctranspose map are optional:
27
27
# subtypes can overwrite nonmutating methods, implement mutating methods or do nothing
28
- Base. At_mul_B (A:: AbstractLinearMap ,x:: AbstractVector )= (@which Base. At_mul_B! (x,A,x))!= methods (Base. At_mul_B!,(AbstractVector,AbstractLinearMap,AbstractVector))[end ] ?
28
+ Base. At_mul_B (A:: AbstractLinearMap ,x:: AbstractVector )= (@which Base. At_mul_B! (x,A,x))!= methods (Base. At_mul_B!,(AbstractVector,AbstractLinearMap,AbstractVector))[end ] ?
29
29
Base. At_mul_B! (similar (x,promote_type (eltype (A),eltype (x)),size (A,2 )),A,x) : throw (MethodError (Base. At_mul_B,(A,x)))
30
30
Base. At_mul_B! (y:: AbstractVector ,A:: AbstractLinearMap ,x:: AbstractVector )= begin
31
31
length (y)== size (A,2 ) || throw (DimensionMismatch (" At_mul_B!" ))
32
32
(@which Base. At_mul_B (A,x))!= methods (Base. At_mul_B,(AbstractLinearMap,AbstractVector))[end ] ? copy! (y,Base. At_mul_B (A,x)) : throw (MethodError (Base. At_mul_B!,(y,A,x)))
33
33
end
34
- Base. Ac_mul_B (A:: AbstractLinearMap ,x:: AbstractVector )= (@which Base. Ac_mul_B! (x,A,x))!= methods (Base. Ac_mul_B!,(AbstractVector,AbstractLinearMap,AbstractVector))[end ] ?
34
+ Base. Ac_mul_B (A:: AbstractLinearMap ,x:: AbstractVector )= (@which Base. Ac_mul_B! (x,A,x))!= methods (Base. Ac_mul_B!,(AbstractVector,AbstractLinearMap,AbstractVector))[end ] ?
35
35
Base. Ac_mul_B! (similar (x,promote_type (eltype (A),eltype (x)),size (A,2 )),A,x) : throw (MethodError (Base. Ac_mul_B,(A,x)))
36
36
Base. Ac_mul_B! (y:: AbstractVector ,A:: AbstractLinearMap ,x:: AbstractVector )= begin
37
37
length (y)== size (A,2 ) || throw (DimensionMismatch (" At_mul_B!" ))
@@ -58,11 +58,11 @@ include("wrappedmap.jl") # wrap a matrix of linear map in a new type, thereby al
58
58
include (" identitymap.jl" ) # the identity map, to be able to make linear combinations of AbstractLinearMap objects and I
59
59
include (" functionmap.jl" ) # using a function as linear map
60
60
61
- LinearMap {T} (A:: Union(AbstractMatrix{T},AbstractLinearMap{T}) ;isreal:: Bool = Base. isreal (A),issym:: Bool = Base. issym (A),ishermitian:: Bool = Base. ishermitian (A),isposdef:: Bool = Base. isposdef (A)) =
61
+ LinearMap {T} (A:: Union(AbstractMatrix{T},AbstractLinearMap{T}) ;isreal:: Bool = Base. isreal (A),issym:: Bool = Base. issym (A),ishermitian:: Bool = Base. ishermitian (A),isposdef:: Bool = Base. isposdef (A)) =
62
62
WrappedMap (A;isreal= isreal,issym= issym,ishermitian= ishermitian,isposdef= isposdef)
63
- LinearMap (f:: Function ,M:: Int ,N:: Int = M;ismutating:: Bool = false ,isreal:: Bool = true ,issym:: Bool = false ,ishermitian:: Bool = (isreal && issym),isposdef:: Bool = false ,ftranspose:: OptionalFunction = nothing ,fctranspose:: OptionalFunction = nothing ) =
63
+ LinearMap (f:: Function ,M:: Int ,N:: Int = M;ismutating:: Bool = false ,isreal:: Bool = true ,issym:: Bool = false ,ishermitian:: Bool = (isreal && issym),isposdef:: Bool = false ,ftranspose:: OptionalFunction = nothing ,fctranspose:: OptionalFunction = nothing ) =
64
64
FunctionMap (f,M,N;ismutating= ismutating,isreal= isreal,issym= issym,ishermitian= ishermitian,isposdef= isposdef,ftranspose= ftranspose,fctranspose= fctranspose)
65
- LinearMap (f:: Function ,eltype:: Type ,M:: Int ,N:: Int = M;ismutating:: Bool = false ,issym:: Bool = false ,ishermitian:: Bool = (T <: Real && issym),isposdef:: Bool = false ,ftranspose:: OptionalFunction = nothing ,fctranspose:: OptionalFunction = nothing ) =
65
+ LinearMap (f:: Function ,eltype:: Type ,M:: Int ,N:: Int = M;ismutating:: Bool = false ,issym:: Bool = false ,ishermitian:: Bool = (eltype <: Real && issym),isposdef:: Bool = false ,ftranspose:: OptionalFunction = nothing ,fctranspose:: OptionalFunction = nothing ) =
66
66
FunctionMap {eltype} (f,M,N;ismutating= ismutating,issym= issym,ishermitian= ishermitian,isposdef= isposdef,ftranspose= ftranspose,fctranspose= fctranspose)
67
67
68
68
0 commit comments