@@ -61,10 +61,18 @@ getindex(L::DiffEqOperatorCombination, i::Int) = sum(op -> op[i], L.ops)
6161function getindex (L:: DiffEqOperatorCombination , I:: Vararg{Int, N} ) where {N}
6262 sum (op -> op[I... ], L. ops)
6363end
64+ Base.:* (L:: DiffEqOperatorCombination , x:: AbstractVecOrMat ) = sum (op -> op * x, L. ops)
6465Base.:* (L:: DiffEqOperatorCombination , x:: AbstractArray ) = sum (op -> op * x, L. ops)
66+
67+ Base.:* (x:: AbstractVecOrMat , L:: DiffEqOperatorCombination ) = sum (op -> x * op, L. ops)
6568Base.:* (x:: AbstractArray , L:: DiffEqOperatorCombination ) = sum (op -> x * op, L. ops)
69+
70+ / (L:: DiffEqOperatorCombination , x:: AbstractVecOrMat ) = sum (op -> op / x, L. ops)
6671/ (L:: DiffEqOperatorCombination , x:: AbstractArray ) = sum (op -> op / x, L. ops)
72+
73+ \ (x:: AbstractVecOrMat , L:: DiffEqOperatorCombination ) = sum (op -> x \ op, L. ops)
6774\ (x:: AbstractArray , L:: DiffEqOperatorCombination ) = sum (op -> x \ op, L. ops)
75+
6876function mul! (y:: AbstractVector , L:: DiffEqOperatorCombination , b:: AbstractVector )
6977 mul! (y, L. ops[1 ], b)
7078 for op in L. ops[2 : end ]
@@ -138,24 +146,49 @@ SparseArrays.sparse(L::DiffEqOperatorComposition) = prod(sparse1, reverse(L.ops)
138146size (L:: DiffEqOperatorComposition ) = (size (L. ops[end ], 1 ), size (L. ops[1 ], 2 ))
139147size (L:: DiffEqOperatorComposition , m:: Integer ) = size (L)[m]
140148opnorm (L:: DiffEqOperatorComposition ) = prod (opnorm, L. ops)
149+
150+ function Base.:* (L:: DiffEqOperatorComposition , x:: AbstractVecOrMat )
151+ foldl ((acc, op) -> op * acc, L. ops; init = x)
152+ end
141153function Base.:* (L:: DiffEqOperatorComposition , x:: AbstractArray )
142154 foldl ((acc, op) -> op * acc, L. ops; init = x)
143155end
156+
157+ function Base.:* (x:: AbstractVecOrMat , L:: DiffEqOperatorComposition )
158+ foldl ((acc, op) -> acc * op, reverse (L. ops); init = x)
159+ end
144160function Base.:* (x:: AbstractArray , L:: DiffEqOperatorComposition )
145161 foldl ((acc, op) -> acc * op, reverse (L. ops); init = x)
146162end
163+
164+ function / (L:: DiffEqOperatorComposition , x:: AbstractVecOrMat )
165+ foldl ((acc, op) -> op / acc, L. ops; init = x)
166+ end
147167function / (L:: DiffEqOperatorComposition , x:: AbstractArray )
148168 foldl ((acc, op) -> op / acc, L. ops; init = x)
149169end
170+
171+ function / (x:: AbstractVecOrMat , L:: DiffEqOperatorComposition )
172+ foldl ((acc, op) -> acc / op, L. ops; init = x)
173+ end
150174function / (x:: AbstractArray , L:: DiffEqOperatorComposition )
151175 foldl ((acc, op) -> acc / op, L. ops; init = x)
152176end
177+
178+ function \ (L:: DiffEqOperatorComposition , x:: AbstractVecOrMat )
179+ foldl ((acc, op) -> op \ acc, reverse (L. ops); init = x)
180+ end
153181function \ (L:: DiffEqOperatorComposition , x:: AbstractArray )
154182 foldl ((acc, op) -> op \ acc, reverse (L. ops); init = x)
155183end
184+
185+ function \ (x:: AbstractVecOrMat , L:: DiffEqOperatorComposition )
186+ foldl ((acc, op) -> acc \ op, reverse (L. ops); init = x)
187+ end
156188function \ (x:: AbstractArray , L:: DiffEqOperatorComposition )
157189 foldl ((acc, op) -> acc \ op, reverse (L. ops); init = x)
158190end
191+
159192function mul! (y:: AbstractVector , L:: DiffEqOperatorComposition , b:: AbstractVector )
160193 mul! (L. caches[1 ], L. ops[1 ], b)
161194 for i in 2 : (length (L. ops) - 1 )
0 commit comments