Skip to content

Commit cdc4782

Browse files
authored
bugfix in vectorfun arithmetic (#166)
* bugfix in vectorfun arithmetic * version bump to v0.6.13 * check for approx instead of exact * Add tests
1 parent bb55ab7 commit cdc4782

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
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.6.12"
3+
version = "0.6.13"
44

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

src/Multivariate/VectorFun.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ for OP in (:*,:+,:-)
124124
$OP(f::ArrayFun, A::AbstractArray{<:Fun}) = Fun($OP(Array(f),A))
125125
$OP(A::UniformScaling, f::ArrayFun) = Fun($OP(A,Array(f)))
126126
$OP(f::ArrayFun, A::UniformScaling) = Fun($OP(Array(f),A))
127-
$OP(A::Number, f::ArrayFun) = Fun($OP(A,Array(f)))
128-
$OP(f::ArrayFun, A::Number) = Fun($OP(Array(f),A))
127+
$OP(A::Number, f::ArrayFun) = Fun($OP(A*I,Array(f)))
128+
$OP(f::ArrayFun, A::Number) = Fun($OP(Array(f),A*I))
129129

130130
$OP(f::ScalarFun, A::AbstractArray) = Fun(broadcast($OP,f,A))
131131
$OP(A::AbstractArray, f::ScalarFun) = Fun(broadcast($OP,A,f))

test/SpacesTest.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,5 +287,15 @@ using ApproxFunOrthogonalPolynomials
287287
@test newvals(f2) values(f3)
288288
@test values(f2) values(f3)
289289
end
290+
291+
@testset "Multivariate" begin
292+
@testset for S in Any[Chebyshev(), Legendre()]
293+
f = Fun(x->ones(2,2), S)
294+
@test (f+1) * f (1+f) * f f^2 + f
295+
@test (f-1) * f f^2 - f
296+
@test (1-f) * f f - f^2
297+
@test f + f 2f f*2
298+
end
299+
end
290300
end
291301
end

0 commit comments

Comments
 (0)