@@ -147,19 +147,23 @@ end
147
147
148
148
# # Times Operator
149
149
150
- struct ConstantTimesOperator{B,T } <: Operator{T}
150
+ struct ConstantTimesOperator{T <: Number , B <: Operator{T} } <: Operator{T}
151
151
λ:: T
152
152
op:: B
153
- ConstantTimesOperator {B,T } (c,op ) where {B,T} = new {B,T } (c,op)
153
+ ConstantTimesOperator {T,B } (c:: T , op :: B ) where {T,B <: Operator{T} } = new {T,B } (c,op)
154
154
end
155
- function ConstantTimesOperator (c:: Number ,op:: Operator{TT} ) where TT<: Number
155
+
156
+ ConstantTimesOperator (c:: T , op:: Operator{T} ) where T<: Number =
157
+ ConstantTimesOperator {T, typeof(op)} (c, op)
158
+
159
+ function ConstantTimesOperator (c:: Number , op:: Operator{<:Number} )
156
160
T= promote_type (typeof (c),eltype (op))
157
161
B= strictconvert (Operator{T},op)
158
- ConstantTimesOperator {typeof(B),T} ( T (c), B)
162
+ ConstantTimesOperator ( T (c) :: T , B)
159
163
end
160
164
161
- ConstantTimesOperator (c:: Number ,op:: ConstantTimesOperator ) =
162
- ConstantTimesOperator (c* op. λ,op. op)
165
+ ConstantTimesOperator (c:: Number , op:: ConstantTimesOperator ) =
166
+ ConstantTimesOperator (c* op. λ, op. op)
163
167
164
168
@wrapperstructure ConstantTimesOperator
165
169
@wrapperspaces ConstantTimesOperator
@@ -179,7 +183,7 @@ function convert(::Type{Operator{T}},C::ConstantTimesOperator) where T
179
183
C
180
184
else
181
185
op= strictconvert (Operator{T},C. op)
182
- ConstantTimesOperator {typeof(op),T} ( T ( C. λ), op)
186
+ ConstantTimesOperator ( T ( C. λ):: T , op):: Operator{T}
183
187
end
184
188
end
185
189
0 commit comments