Skip to content

Commit

Permalink
Removed workarounds for LinearMap projection
Browse files Browse the repository at this point in the history
  • Loading branch information
kpotomkin committed Jun 5, 2019
1 parent 9f0a8ce commit 6160bee
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/concrete_intersection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -806,8 +806,8 @@ function intersection(X::CartesianProductArray{N},
oa=Hyperrectangle) where {N}

low_set, vars, block_structure = initialize_vars(X, blocks)

low_intersection = intersection(low_set, Approximations.project(Y, vars, LinearMap))
low_intersection = intersection(low_set, Approximations.project(Y, vars))

if isempty(low_intersection)
return EmptySet()
Expand Down
12 changes: 6 additions & 6 deletions src/helper_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ export _At_mul_B
const DEFAULT_COND_TOL = 1e6

# matrix-matrix multiplication and division
@inline _At_mul_B(A, B) = transpose(Matrix(A)) * B
@inline _At_ldiv_B(A, B) = transpose(Matrix(A)) \ B
@inline _At_mul_B(A, B) = transpose(A) * B
@inline _At_ldiv_B(A, B) = transpose(A) \ B

"""
dot_zero(x::AbstractVector{N}, y::AbstractVector{N}) where{N<:Real}
Expand Down Expand Up @@ -159,13 +159,13 @@ We check whether the matrix is square and whether the
`cond(M)` is below some prescribed tolerance.
"""
function isinvertible(M::Matrix; cond_tol::Number=DEFAULT_COND_TOL)
return cond(M) < cond_tol
return issquare(M) && cond(M) < cond_tol
end

# cond is not available for sparse matrices; see JuliaLang#6485 and related issues
function isinvertible(M::AbstractSparseMatrix;
cond_tol::Number=DEFAULT_COND_TOL)
return isinvertible(Matrix(M), cond_tol=cond_tol)
return issquare(M) && isinvertible(Matrix(M), cond_tol=cond_tol)
end

function isinvertible(M::Diagonal; cond_tol=nothing)
Expand Down Expand Up @@ -542,9 +542,9 @@ julia> subtypes(AbstractPolytope, true)
function subtypes(interface, concrete::Bool)

subtypes_to_test = subtypes(interface)

# do not seek the concrete subtypes further
if !concrete
if !concrete
return sort(subtypes_to_test, by=string)
end

Expand Down
1 change: 0 additions & 1 deletion test/unit_CartesianProduct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ end

for N in [Float64, Float32]
#intersection and is_intersection_empty
intersection and is_intersection_empty
i1 = Interval(N[0, 1])
i2 = Interval(N[2, 3])
h1 = Hyperrectangle(low=N[3, 4], high=N[5, 7])
Expand Down

0 comments on commit 6160bee

Please sign in to comment.