Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve stability of tests in PolyhedralGeometry #4197

Merged
merged 16 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/PolyhedralGeometry/iterators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,27 @@ Return a `RayVector` resembling a ray from the origin through the point whose co
"""
ray_vector

function Base.:(==)(x::RayVector, y::RayVector)
ix = findfirst(!is_zero, x)
iy = findfirst(!is_zero, y)
ix == iy || return false
isnothing(ix) && return true
sign(x[ix]) == sign(y[iy]) || return false
return y[iy] * x.p == x[ix] * y.p
end

function Base.:(==)(x::RayVector, y::AbstractVector)
ry = ray_vector(coefficient_field(x), y)
return x == ry
end

Base.:(==)(x::AbstractVector, y::RayVector) = y == x

Base.:(==)(::PointVector, ::RayVector) =
throw(ArgumentError("Cannot compare PointVector to RayVector"))
Base.:(==)(::RayVector, ::PointVector) =
throw(ArgumentError("Cannot compare PointVector to RayVector"))

################################################################################
######## Halfspaces and Hyperplanes
################################################################################
Expand Down
82 changes: 33 additions & 49 deletions test/PolyhedralGeometry/cone.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,43 +28,38 @@
if T == QQFieldElem
@test hilbert_basis(Cone1) isa SubObjectIterator{PointVector{ZZRingElem}}
@test length(hilbert_basis(Cone1)) == 2
@test hilbert_basis(Cone1) == [[1, 0], [0, 1]]
@test generator_matrix(hilbert_basis(Cone1)) == matrix(QQ, [1 0; 0 1])
@test issetequal(hilbert_basis(Cone1), ray_vector.(Ref(ZZ), [[1, 0], [0, 1]]))
@test generator_matrix(hilbert_basis(Cone1)) == _oscar_matrix_from_property(ZZ, hilbert_basis(Cone1))
end
@test n_rays(Cone1) == 2
@test rays(RayVector{T}, Cone1) isa SubObjectIterator{RayVector{T}}
@test rays(Cone1) isa SubObjectIterator{RayVector{T}}
@test rays(RayVector, Cone1) isa SubObjectIterator{RayVector{T}}
@test vector_matrix(rays(Cone1)) == matrix(f, [1 0; 0 1])
@test issetequal(rays(Cone1), ray_vector.(Ref(f), [[1, 0], [0, 1]]))
@test vector_matrix(rays(Cone1)) == _oscar_matrix_from_property(f, rays(Cone1))
if T == QQFieldElem
@test matrix(QQ, rays(Cone1)) == matrix(QQ, [1 0; 0 1])
@test matrix(ZZ, rays(Cone6)) == matrix(ZZ, [2 3; 2 5])
alexej-jordan marked this conversation as resolved.
Show resolved Hide resolved
@test matrix(QQ, rays(Cone1)) == _oscar_matrix_from_property(f, rays(Cone1))
let r = rays(Cone6)
m = matrix(ZZ, r[1] == [1//3, 1//2] ? [2 3; 2 5] : [2 5; 2 3])
@test matrix(ZZ, rays(Cone6)) == m
end
end
@test length(rays(Cone1)) == 2
@test rays(Cone1) == [[1, 0], [0, 1]]
for S in [LinearHalfspace{T}, Cone{T}]
for S in [LinearHalfspace{T},
Cone{T}]
@test facets(S, Cone1) isa SubObjectIterator{S}
@test length(facets(S, Cone1)) == 2
if T == QQFieldElem
@test linear_inequality_matrix(facets(S, Cone1)) == matrix(QQ, [-1 0; 0 -1])
@test Oscar.linear_matrix_for_polymake(facets(S, Cone1)) == [-1 0; 0 -1]
@test ray_indices(facets(S, Cone1)) == IncidenceMatrix([[2], [1]])
@test IncidenceMatrix(facets(S, Cone1)) == IncidenceMatrix([[2], [1]])
if S == LinearHalfspace{T}
@test facets(S, Cone1) == linear_halfspace.([f], [[-1, 0], [0, -1]])
end
if S == LinearHalfspace{T}
@test issetequal(facets(S, Cone1), linear_halfspace.(Ref(f), [[-1, 0], [0, -1]]))
else
@test linear_inequality_matrix(facets(S, Cone1)) == matrix(f, [0 -1; -1 0])
@test Oscar.linear_matrix_for_polymake(facets(S, Cone1)) == [0 -1; -1 0]
@test ray_indices(facets(S, Cone1)) == IncidenceMatrix([[1], [2]])
@test IncidenceMatrix(facets(S, Cone1)) == IncidenceMatrix([[1], [2]])
if S == LinearHalfspace{T}
@test facets(S, Cone1) == linear_halfspace.([f], [[0, -1], [-1, 0]])
end
@test issetequal(facets(S, Cone1), positive_hull.(Ref(f), [[1 0], [0 1]]))
end
@test linear_inequality_matrix(facets(S, Cone1)) == _oscar_matrix_from_property(f, facets(S, Cone1))
@test Oscar.linear_matrix_for_polymake(facets(S, Cone1)) == _polymake_matrix_from_property(facets(S, Cone1))
@test _check_im_perm_rows(ray_indices(facets(S, Cone1)), [[1], [2]])
@test _check_im_perm_rows(IncidenceMatrix(facets(S, Cone1)), [[1], [2]])
end
@test facets(IncidenceMatrix, Cone1) ==
IncidenceMatrix(T == QQFieldElem ? [[2], [1]] : [[1], [2]])
@test _check_im_perm_rows(facets(IncidenceMatrix, Cone1), [[1], [2]])
@test facets(Halfspace, Cone1) isa SubObjectIterator{LinearHalfspace{T}}
@test facets(Cone1) isa SubObjectIterator{LinearHalfspace{T}}
@test linear_span(Cone4) isa SubObjectIterator{LinearHyperplane{T}}
Expand Down Expand Up @@ -92,43 +87,32 @@
end
@test length(lineality_space(Cone2)) == 1
@test lineality_space(Cone2) == [L[1, :]]
@test vector_matrix(rays(Cone4)) == matrix(f, R)
@test vector_matrix(rays(Cone4)) == _oscar_matrix_from_property(f, rays(Cone4))
@test codim(Cone4) == 1
@test codim(Cone3) == 0
@test faces(Cone2, 2) isa SubObjectIterator{Cone{T}}
@test length(faces(Cone2, 2)) == 2
@test faces(Cone4, 1) isa SubObjectIterator{Cone{T}}
@test length(faces(Cone4, 1)) == 2
if T == QQFieldElem
@test faces(Cone2, 2) == positive_hull.(T, [[0 0 1], [1 0 0]], [[0 1 0]])
@test ray_indices(faces(Cone2, 2)) == IncidenceMatrix([[2], [1]])
@test IncidenceMatrix(faces(Cone2, 2)) == IncidenceMatrix([[2], [1]])
@test faces(IncidenceMatrix, Cone2, 2) == IncidenceMatrix([[2], [1]])
@test faces(Cone4, 1) == positive_hull.(T, [[0 0 1], [1 0 0]])
@test ray_indices(faces(Cone4, 1)) == IncidenceMatrix([[2], [1]])
@test IncidenceMatrix(faces(Cone4, 1)) == IncidenceMatrix([[2], [1]])
@test faces(IncidenceMatrix, Cone4, 1) == IncidenceMatrix([[2], [1]])
else
@test faces(Cone2, 2) == positive_hull.([f], [[1 0 0], [0 0 1]], [[0 1 0]])
@test ray_indices(faces(Cone2, 2)) == IncidenceMatrix([[1], [2]])
@test IncidenceMatrix(faces(Cone2, 2)) == IncidenceMatrix([[1], [2]])
@test faces(IncidenceMatrix, Cone2, 2) == IncidenceMatrix([[1], [2]])
@test faces(Cone4, 1) == positive_hull.([f], [[1 0 0], [0 0 1]])
@test ray_indices(faces(Cone4, 1)) == IncidenceMatrix([[1], [2]])
@test IncidenceMatrix(faces(Cone4, 1)) == IncidenceMatrix([[1], [2]])
@test faces(IncidenceMatrix, Cone4, 1) == IncidenceMatrix([[1], [2]])
end
@test IncidenceMatrix(faces(Cone5, 1)) == IncidenceMatrix([[1], [2], [3], [4]])
@test issetequal(faces(Cone2, 2), positive_hull.(Ref(f), [[1 0 0], [0 0 1]], [[0 1 0]]))
@test _check_im_perm_rows(ray_indices(faces(Cone2, 2)), [[1], [2]])
@test _check_im_perm_rows(IncidenceMatrix(faces(Cone2, 2)), [[1], [2]])
@test _check_im_perm_rows(faces(IncidenceMatrix, Cone2, 2), [[1], [2]])
@test issetequal(faces(Cone4, 1), positive_hull.(Ref(f), [[0 0 1], [1 0 0]]))
@test _check_im_perm_rows(ray_indices(faces(Cone4, 1)), [[1], [2]])
@test _check_im_perm_rows(IncidenceMatrix(faces(Cone4, 1)), [[1], [2]])
@test _check_im_perm_rows(faces(IncidenceMatrix, Cone4, 1), [[1], [2]])
@test _check_im_perm_rows(IncidenceMatrix(faces(Cone5, 1)), [[1], [2], [3], [4]])
@test isnothing(faces(Cone2, 1))

@test f_vector(Cone5) == [4, 4]
@test f_vector(Cone2) == [0, 2]
@test lineality_dim(Cone5) == 0
@test lineality_dim(Cone2) == 1
@test facet_degrees(Cone5)[1] == 2
@test facet_degrees(Cone6)[1] == 1
@test ray_degrees(Cone5)[1] == 2
@test ray_degrees(Cone6)[1] == 1
@test facet_degrees(Cone5) == fill(2, 4)
@test facet_degrees(Cone6) == fill(1, 2)
@test ray_degrees(Cone5) == fill(2, 4)
@test ray_degrees(Cone6) == fill(1, 2)

@test n_facets(Cone5) == 4
@test relative_interior_point(Cone1) == f.([1//2, 1//2])
Expand Down
14 changes: 5 additions & 9 deletions test/PolyhedralGeometry/extended.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,29 +83,25 @@
f = sum([x; 1])^2 + x[1]^4 * x[2] * 3
newt = newton_polytope(f)
@test dim(newt) == 2
@test point_matrix(vertices(newt)) == matrix(QQ, [4 1; 2 0; 0 2; 0 0])
@test issetequal(vertices(newt), point_vector.(Ref(QQ), [[4, 1], [2, 0], [0, 2], [0, 0]]))
end

@testset "Construct from QQFieldElem" begin
A = zeros(Oscar.QQ, 3, 2)
A[1, 1] = 1
A[3, 2] = 4
@test point_matrix(vertices(convex_hull(A))) == matrix(QQ, [1 0; 0 0; 0 4])
@test issetequal(vertices(convex_hull(A)), point_vector.(Ref(QQ), [[1, 0], [0, 0], [0, 4]]))

lhs, rhs = halfspace_matrix_pair(facets(polyhedron(A, [1, 2, -3])))
@test lhs == matrix(QQ, [1 0; 0 4])
@test rhs == [1, -3]
@test issetequal(facets(polyhedron(A, [1, 2, -3])), [affine_halfspace(QQ, [1, 0], 1), affine_halfspace(QQ, [0, 4], -3)])
end

@testset "Construct from ZZRingElem" begin
A = zeros(Oscar.ZZ, 3, 2)
A[1, 1] = 1
A[3, 2] = 4
@test point_matrix(vertices(convex_hull(A))) == matrix(QQ, [1 0; 0 0; 0 4])
@test issetequal(vertices(convex_hull(A)), point_vector.(Ref(QQ), [[1, 0], [0, 0], [0, 4]]))

lhs, rhs = halfspace_matrix_pair(facets(polyhedron(A, [1, 2, -3])))
@test lhs == matrix(QQ, [1 0; 0 4])
@test rhs == [1, -3]
@test issetequal(facets(polyhedron(A, [1, 2, -3])), [affine_halfspace(QQ, [1, 0], 1), affine_halfspace(QQ, [0, 4], -3)])
end

@testset "SubObjectIterator/Matrix compatibility" begin
Expand Down
30 changes: 11 additions & 19 deletions test/PolyhedralGeometry/polyhedral_complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,44 +34,36 @@

# test constructor with re-arranged arguments
let PCF2 = polyhedral_complex(f, -P[1:3, :], I[:, 1:3], -P[4:4, :], I[:, 4:4])
@test vertices(PCF) == vertices(PCF2)
@test rays(PCF) == rays(PCF2)
@test IncidenceMatrix(maximal_polyhedra(PCF)) ==
IncidenceMatrix(maximal_polyhedra(PCF2))
@test issetequal(vertices(PCF), vertices(PCF2))
@test issetequal(rays(PCF), rays(PCF2))
@test issetequal(maximal_polyhedra(PCF), maximal_polyhedra(PCF2))
end

@testset "core functionality" begin
@test ambient_dim(PC) == 2
@test vertices(PC) isa SubObjectIterator{PointVector{T}}
@test length(vertices(PC)) == 4
@test point_matrix(vertices(PC)) == matrix(f, P)
@test vertices(PC) == [[0, 0], [1, 0], [0, 1], [1, 1]]
@test issetequal(vertices(PC), point_vector.(Ref(f), [[0, 0], [1, 0], [0, 1], [1, 1]]))
@test point_matrix(vertices(PC)) == _oscar_matrix_from_property(f, vertices(PC))
@test rays(PCF) isa SubObjectIterator{RayVector{T}}
@test length(rays(PCF)) == 1
@test rays(PCF) == [[-1, -1]]
@test vector_matrix(rays(PCF)) == matrix(f, [-1 -1])
@test vertices_and_rays(PCFL) isa SubObjectIterator{Union{RayVector{T},PointVector{T}}}
@test length(vertices_and_rays(PCFL)) == 4
@test vertices_and_rays(PCFL) == [[0, 0, 0], [1, 0, 0], [0, 1, 0], [1, 1, 0]]
@test typeof.(vertices_and_rays(PCFL)) ==
[PointVector{T}, PointVector{T}, PointVector{T}, RayVector{T}]
@test vector_matrix(vertices_and_rays(PCFL)) == matrix(f, P2)
@test issetequal(vertices_and_rays(PCFL), [point_vector(f, [0, 0, 0]), point_vector(f, [1, 0, 0]), point_vector(f, [0, 1, 0]), ray_vector(f, [1, 1, 0])])
@test vector_matrix(vertices_and_rays(PCFL)) == _oscar_matrix_from_property(f, vertices_and_rays(PCFL))
@test maximal_polyhedra(PC) isa SubObjectIterator{Polyhedron{T}}
@test length(maximal_polyhedra(PC)) == 2
@test maximal_polyhedra(PC) == convex_hull.([f], [P[1:3, :], P[[2, 4], :]])
@test issetequal(maximal_polyhedra(PC), convex_hull.([f], [P[1:3, :], P[[2, 4], :]]))
@test number_of_maximal_polyhedra(PC) == 2
@test is_simplicial(PC)
@test !is_pure(PCL)
@test dim(PCL) == 3
@test polyhedra_of_dim(PC, 1) isa SubObjectIterator{Polyhedron{T}}
@test length(polyhedra_of_dim(PC, 1)) == 4
if T == QQFieldElem
@test polyhedra_of_dim(PC, 1) ==
convex_hull.(T, [P[[2, 4], :], P[[1, 3], :], P[[1, 2], :], P[[2, 3], :]])
else
@test polyhedra_of_dim(PC, 1) ==
convex_hull.([f], [P[[2, 4], :], P[[1, 3], :], P[[2, 3], :], P[[1, 2], :]])
end
@test issetequal(polyhedra_of_dim(PC, 1),
convex_hull.(Ref(f), [P[[2, 4], :], P[[1, 3], :], P[[2, 3], :], P[[1, 2], :]]))
@test lineality_space(PCL) isa SubObjectIterator{RayVector{T}}
@test length(lineality_space(PCL)) == 1
@test lineality_space(PCL) == [L[:]]
Expand Down Expand Up @@ -125,7 +117,7 @@
@test dim(F) == dim(PC)
@test ambient_dim(F) == ambient_dim(PC)
@test lineality_dim(F) == lineality_dim(PC)
@test matrix(f, rays(F)) == matrix(f, rays(PC))
@test issetequal(rays(F), rays(PC))
@test n_maximal_cones(F) == n_maximal_polyhedra(PC)
vrep = PolyhedralComplex{T}(
Polymake.fan.PolyhedralComplex(;
Expand Down
30 changes: 14 additions & 16 deletions test/PolyhedralGeometry/polyhedral_fan.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
if T == QQFieldElem
@test is_smooth(NFsquare)
end
@test vector_matrix(rays(NFsquare)) == matrix(f, [1 0; -1 0; 0 1; 0 -1])
@test rays(NFsquare) isa SubObjectIterator{RayVector{T}}
@test length(rays(NFsquare)) == 4
@test rays(NFsquare) == [[1, 0], [-1, 0], [0, 1], [0, -1]]
@test issetequal(rays(NFsquare), ray_vector.(Ref(f), [[1, 0], [-1, 0], [0, 1], [0, -1]]))
@test vector_matrix(rays(NFsquare)) == _oscar_matrix_from_property(f, rays(NFsquare))
@test is_regular(NFsquare)
@test is_complete(NFsquare)
@test !is_complete(F0)
Expand All @@ -45,25 +45,23 @@
@test length(RMLF2[:rays_modulo_lineality]) == 2
@test maximal_cones(F1) isa SubObjectIterator{Cone{T}}
@test dim.(maximal_cones(F1)) == [2, 2]
@test ray_indices(maximal_cones(F1)) == incidence1
@test IncidenceMatrix(maximal_cones(F1)) == incidence1
@test maximal_cones(IncidenceMatrix, F1) == incidence1
@test _check_im_perm_rows(ray_indices(maximal_cones(F1)), incidence1)
@test _check_im_perm_rows(IncidenceMatrix(maximal_cones(F1)), incidence1)
@test _check_im_perm_rows(maximal_cones(IncidenceMatrix, F1), incidence1)
@test number_of_maximal_cones(F1) == 2
@test lineality_space(F2) isa SubObjectIterator{RayVector{T}}
@test generator_matrix(lineality_space(F2)) == matrix(f, L)
if T == QQFieldElem
@test matrix(QQ, lineality_space(F2)) == matrix(QQ, L)
end
@test length(lineality_space(F2)) == 1
@test lineality_space(F2) == [L[:]]
@test generator_matrix(lineality_space(F2)) == matrix(f, L)
@test matrix(f, lineality_space(F2)) == matrix(f, L)
@test cones(F2, 2) isa SubObjectIterator{Cone{T}}
@test size(cones(F2, 2)) == (2,)
@test lineality_space(cones(F2, 2)[1]) == [[0, 1, 0]]
@test rays.(cones(F2, 2)) == [[], []]
@test isnothing(cones(F2, 1))
@test ray_indices(cones(F1, 2)) == incidence1
@test IncidenceMatrix(cones(F1, 2)) == incidence1
@test cones(IncidenceMatrix, F1, 2) == incidence1
@test _check_im_perm_rows(ray_indices(cones(F1, 2)), incidence1)
@test _check_im_perm_rows(IncidenceMatrix(cones(F1, 2)), incidence1)
@test _check_im_perm_rows(cones(IncidenceMatrix, F1, 2), incidence1)

II = ray_indices(maximal_cones(NFsquare))
NF0 = polyhedral_fan(II, rays(NFsquare))
Expand All @@ -75,16 +73,16 @@
end
@test f_vector(NFsquare) == [4, 4]
@test rays(F1NR) == collect(eachrow(I3))
@test ray_indices(maximal_cones(F1NR)) == incidence1
@test IncidenceMatrix(maximal_cones(F1NR)) == incidence1
@test _check_im_perm_rows(ray_indices(maximal_cones(F1NR)), incidence1)
@test _check_im_perm_rows(IncidenceMatrix(maximal_cones(F1NR)), incidence1)
@test n_rays(F2NR) == 0
@test lineality_dim(F2NR) == 1
RMLF2NR = rays_modulo_lineality(F2NR)
@test length(RMLF2NR[:rays_modulo_lineality]) == 2
@test RMLF2NR[:rays_modulo_lineality] == collect(eachrow(R))
@test lineality_space(F2NR) == collect(eachrow(L))
@test ray_indices(maximal_cones(F2NR)) == incidence2
@test IncidenceMatrix(maximal_cones(F2NR)) == incidence2
@test _check_im_perm_rows(ray_indices(maximal_cones(F2NR)), incidence2)
@test _check_im_perm_rows(IncidenceMatrix(maximal_cones(F2NR)), incidence2)

C = positive_hull(f, identity_matrix(ZZ, 0))
pf = polyhedral_fan(C)
Expand Down
24 changes: 7 additions & 17 deletions test/PolyhedralGeometry/polyhedron.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@
@test nrows(Oscar.pm_object(pf3).INEQUALITIES) == 4
@test n_vertices(pf3) == 1

function _check_im_perm_rows(inc::IncidenceMatrix, o)
oinc = IncidenceMatrix(o)
nr = nrows(inc)
nr == nrows(oinc) &&
issetequal(Polymake.row.(Ref(inc), 1:nr),
Polymake.row.(Ref(oinc), 1:nr))
end

@testset "core functionality" begin
@test matrix(f, rays(Q1)) * v == T[f(2)]
@test issetequal(matrix(f, vertices(Q1)) * v, T[f(1), f(0), f(1)])
Expand All @@ -55,20 +47,20 @@
@test n_vertices(Q0) == 3
@test n_vertices.(faces(Q0, 1)) == [2, 2, 2]
@test lattice_points(Q0) isa SubObjectIterator{PointVector{ZZRingElem}}
@test point_matrix(lattice_points(Q0)) isa MatElem{ZZRingElem}
@test matrix(ZZ, lattice_points(Q0)) isa MatElem{ZZRingElem}
@test length(lattice_points(Q0)) == 3
@test issetequal(lattice_points(Q0), point_vector.(Ref(ZZ), [[0, 0], [0, 1], [1, 0]]))
@test point_matrix(lattice_points(Q0)) == _oscar_matrix_from_property(ZZ, lattice_points(Q0))
@test matrix(ZZ, lattice_points(Q0)) == _oscar_matrix_from_property(ZZ, lattice_points(Q0))
@test interior_lattice_points(square) isa SubObjectIterator{PointVector{ZZRingElem}}
@test point_matrix(interior_lattice_points(square)) == matrix(ZZ, [0 0])
@test matrix(ZZ, interior_lattice_points(square)) == matrix(ZZ, [0 0])
@test length(interior_lattice_points(square)) == 1
@test interior_lattice_points(square) == [[0, 0]]
@test boundary_lattice_points(square) isa SubObjectIterator{PointVector{ZZRingElem}}
@test point_matrix(boundary_lattice_points(square)) isa MatElem{ZZRingElem}
@test length(boundary_lattice_points(square)) == 8
@test issetequal(boundary_lattice_points(square),
point_vector.(Ref(ZZ), [[-1, -1], [-1, 0], [-1, 1], [0, -1], [0, 1], [1, -1], [1, 0], [1, 1]]))
@test point_matrix(boundary_lattice_points(square)) == _oscar_matrix_from_property(ZZ, boundary_lattice_points(square))
if T == QQFieldElem
@test is_smooth(Q0)
@test is_normal(Q0)
Expand Down Expand Up @@ -111,8 +103,8 @@
@test rays(RayVector, Pos) isa SubObjectIterator{RayVector{T}}
@test rays(Pos) isa SubObjectIterator{RayVector{T}}
@test length(rays(Pos)) == 3
@test vector_matrix(rays(Pos)) isa MatElem{T}
@test issetequal(rays(Pos), ray_vector.(Ref(f), [[1, 0, 0], [0, 1, 0], [0, 0, 1]]))
@test vector_matrix(rays(Pos)) == _oscar_matrix_from_property(f, rays(Pos))
@test lineality_space(L) isa SubObjectIterator{RayVector{T}}
@test generator_matrix(lineality_space(L)) == matrix(f, [0 0 1])
if T == QQFieldElem
Expand Down Expand Up @@ -151,7 +143,7 @@
v = vertices(minkowski_sum(Q0, square))
@test length(v) == 5
@test issetequal(v, point_vector.(Ref(f), [[2, -1], [2, 1], [-1, -1], [-1, 2], [1, 2]]))
@test point_matrix(v) isa MatElem{T}
@test point_matrix(v) == _oscar_matrix_from_property(f, v)
let S = Pair{Matrix{T},T}
@test issetequal(facets(S, Pos), S.([f.([-1 0 0]), f.([0 -1 0]), f.([0 0 -1])], [f(0)]))
end
Expand Down Expand Up @@ -190,13 +182,11 @@
@test facets(Pos) isa SubObjectIterator{AffineHalfspace{T}}
@test facets(Halfspace, Pos) isa SubObjectIterator{AffineHalfspace{T}}
@test affine_hull(point) isa SubObjectIterator{AffineHyperplane{T}}
@test affine_equation_matrix(affine_hull(point)) isa MatElem{T}
@test size(affine_equation_matrix(affine_hull(point))) == (3, 4)
@test Oscar.affine_matrix_for_polymake(affine_hull(point)) isa Polymake.Matrix{Oscar._scalar_type_to_polymake(T)}
@test size(Oscar.affine_matrix_for_polymake(affine_hull(point))) == (3, 4)
@test length(affine_hull(point)) == 3
@test issetequal(affine_hull(point),
[hyperplane(f, [1 0 0], 0), hyperplane(f, [0 1 0], 1), hyperplane(f, [0 0 1], 0)])
@test affine_equation_matrix(affine_hull(point)) == _oscar_matrix_from_property(f, affine_hull(point))
@test Oscar.affine_matrix_for_polymake(affine_hull(point)) == _polymake_matrix_from_property(affine_hull(point))
@test n_facets(square) == 4
@test lineality_dim(Q0) == 0
@test n_rays(Q1) == 1
Expand Down
Loading
Loading