@@ -337,7 +337,7 @@ struct ComposedScalarOperator{T, O} <: AbstractSciMLScalarOperator{T}
337337
338338 function ComposedScalarOperator (ops:: NTuple{N, AbstractSciMLScalarOperator} ) where {N}
339339 @assert ! isempty (ops)
340- T = promote_type ( eltype .( ops) ... )
340+ T = reduce (Base . promote_eltype, ops)
341341 new {T, typeof(ops)} (ops)
342342 end
343343end
395395
396396function Base. convert (T:: Type{<:Number} , α:: ComposedScalarOperator )
397397 iszero (α) && return zero (T)
398- prod (convert .(T , α. ops) )
398+ prod (concretize , α. ops)
399399end
400400
401401function Base. show (io:: IO , α:: ComposedScalarOperator )
@@ -410,20 +410,22 @@ end
410410Base. conj (L:: ComposedScalarOperator ) = ComposedScalarOperator (conj .(L. ops))
411411Base.:- (α:: AbstractSciMLScalarOperator{T} ) where {T} = (- one (T)) * α
412412
413- function update_coefficients (L:: ComposedScalarOperator , u, p, t; kwargs... )
414- ops = ()
415- for op in L. ops
416- ops = (ops... , update_coefficients (op, u, p, t; kwargs... ))
413+ @generated function update_coefficients (L:: ComposedScalarOperator , u, p, t; kwargs... )
414+ N = length (L. parameters[2 ]. parameters)
415+ quote
416+ ops = Base. @ntuple $ N i -> update_coefficients (L. ops[i], u, p, t; kwargs... )
417+ ComposedScalarOperator (ops)
417418 end
418-
419- ComposedScalarOperator (ops)
420419end
421- function update_coefficients! (L:: ComposedScalarOperator , u, p, t; kwargs... )
422- for op in L. ops
423- update_coefficients! (op, u, p, t; kwargs... )
420+
421+ @generated function update_coefficients! (L:: ComposedScalarOperator , u, p, t; kwargs... )
422+ N = length (L. parameters[2 ]. parameters)
423+ quote
424+ Base. @nexprs $ N i -> update_coefficients! (L. ops[i], u, p, t; kwargs... )
425+ nothing
424426 end
425- nothing
426427end
428+
427429function (α:: ComposedScalarOperator )(v:: AbstractArray , u, p, t; kwargs... )
428430 α = update_coefficients (α, u, p, t; kwargs... )
429431 convert (Number, α) * v
0 commit comments