|
1 |
| - |
2 |
| - |
3 | 1 | export HermitianOperator, SymmetricOperator, AdjointOperator, TransposeOperator
|
4 | 2 |
|
| 3 | +function char_to_symbol(uplo::Char) |
| 4 | + if uplo == 'U' |
| 5 | + return :U |
| 6 | + elseif uplo == 'L' |
| 7 | + return :L |
| 8 | + else |
| 9 | + throw(ArgumentError("invalid uplo $uplo")) |
| 10 | + end |
| 11 | +end |
5 | 12 |
|
6 | 13 | struct HermitianOperator{T<:Number,B<:Operator} <: Operator{T}
|
7 | 14 | op::B
|
8 | 15 | uplo::Char
|
9 | 16 | end
|
10 | 17 |
|
11 | 18 | HermitianOperator(B::Operator{T}, uplo::Symbol=:U) where {T<:Number} = HermitianOperator{T,typeof(B)}(B, char_uplo(uplo))
|
12 |
| -convert(::Type{Operator{T}},A::HermitianOperator) where {T}=HermitianOperator(strictconvert(Operator{T},A.op), A.uplo) |
| 19 | +function convert(::Type{Operator{T}},A::HermitianOperator) where {T} |
| 20 | + HermitianOperator(strictconvert(Operator{T},A.op), char_to_symbol(A.uplo)) |
| 21 | +end |
13 | 22 |
|
14 | 23 | domainspace(P::HermitianOperator)=domainspace(P.op)
|
15 | 24 | rangespace(P::HermitianOperator)=rangespace(P.op)
|
@@ -42,7 +51,9 @@ struct SymmetricOperator{T<:Number,B<:Operator} <: Operator{T}
|
42 | 51 | end
|
43 | 52 |
|
44 | 53 | SymmetricOperator(B::Operator{T}, uplo::Symbol=:U) where {T<:Number} = SymmetricOperator{T,typeof(B)}(B, char_uplo(uplo))
|
45 |
| -convert(::Type{Operator{T}},A::SymmetricOperator) where {T}=SymmetricOperator(strictconvert(Operator{T},A.op), A.uplo) |
| 54 | +function convert(::Type{Operator{T}},A::SymmetricOperator) where {T} |
| 55 | + SymmetricOperator(strictconvert(Operator{T},A.op), char_to_symbol(A.uplo)) |
| 56 | +end |
46 | 57 |
|
47 | 58 | domainspace(P::SymmetricOperator)=domainspace(P.op)
|
48 | 59 | rangespace(P::SymmetricOperator)=rangespace(P.op)
|
|
0 commit comments