Skip to content

Commit

Permalink
Merge pull request #322 from JuliaReach/mforets/321
Browse files Browse the repository at this point in the history
#321 - Vector-set multiplication
  • Loading branch information
mforets authored Apr 15, 2018
2 parents 3b87093 + 9e63118 commit 59b2036
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/LinearMap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ A lazy linear map, i.e. a `LinearMap` instance.
"""
*(M::AbstractMatrix, X::LazySet) = LinearMap(M, X)

*(M::AbstractVector, X::LazySet) = LinearMap(reshape(M, length(M), 1), X)

"""
```
Expand Down
8 changes: 8 additions & 0 deletions test/unit_LinearMap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,12 @@ for N in [Float64, Rational{Int}, Float32]
lm = N(2.) * BallInf(N[0., 0.], N(1.))
an_element(lm)
# @test an_element(lm) ∈ lm # TODO results in an error for Rational

# check linear map between vector and set
X = Interval([0.9, 1.10445])
a = [-1., 2.]
@test a * X isa LinearMap
X = BallInf(N[1.0], N(1.10445))
a = N[-1, 2.]
@test a * X isa LinearMap{N, N}
end

0 comments on commit 59b2036

Please sign in to comment.