Skip to content

Commit ac3fd11

Browse files
authored
mul_coefficients for ConstantOperator (#382)
1 parent f519bdf commit ac3fd11

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ApproxFunBase"
22
uuid = "fbd15aa5-315a-5a7d-a8a4-24992e37be05"
3-
version = "0.7.72"
3+
version = "0.7.73"
44

55
[deps]
66
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"

src/Operators/banded/ConstantOperator.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ for op in (:+,:-)
6060
@eval ($op)(A::ConstantOperator,B::ConstantOperator) = ConstantOperator($op(A.λ,B.λ))
6161
end
6262

63+
mul_coefficients(A::ConstantOperator, b) = A.λ * b
64+
mul_coefficients!(A::ConstantOperator, b) = b .*= A.λ
65+
6366

6467
## Basis Functional
6568

test/runtests.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,13 @@ end
348348
C2 = C * C
349349
@test domainspace(C2) == PointSpace(1:4)
350350
@test convert(Number, C2) == 1
351+
352+
v = Float64[i^2 for i in 1:4]
353+
f = Fun(PointSpace(1:4), v)
354+
g = C * f
355+
@test g f
356+
ApproxFunBase.mul_coefficients!(Operator(2I), v)
357+
@test v Float64[2i^2 for i in 1:4]
351358
end
352359
end
353360

0 commit comments

Comments
 (0)