From 7e21a0976aef28807de9ccbefd5c135e526be327 Mon Sep 17 00:00:00 2001 From: Alexej Jordan Date: Wed, 27 Nov 2024 03:42:12 +0100 Subject: [PATCH] added hash method for RayVector; fixed wrong test --- src/PolyhedralGeometry/iterators.jl | 2 ++ test/PolyhedralGeometry/cone.jl | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/PolyhedralGeometry/iterators.jl b/src/PolyhedralGeometry/iterators.jl index d7b56e325448..646a24f0d7c7 100644 --- a/src/PolyhedralGeometry/iterators.jl +++ b/src/PolyhedralGeometry/iterators.jl @@ -106,6 +106,8 @@ Base.:(==)(::PointVector, ::RayVector) = Base.:(==)(::RayVector, ::PointVector) = throw(ArgumentError("Cannot compare PointVector to RayVector")) +Base.hash(x::RayVector, h::UInt) = hash(collect(sign.(x)), hash(coefficient_field(x), h)) + ################################################################################ ######## Halfspaces and Hyperplanes ################################################################################ diff --git a/test/PolyhedralGeometry/cone.jl b/test/PolyhedralGeometry/cone.jl index 8adcfc125b94..80f50d4eb566 100644 --- a/test/PolyhedralGeometry/cone.jl +++ b/test/PolyhedralGeometry/cone.jl @@ -28,7 +28,7 @@ if T == QQFieldElem @test hilbert_basis(Cone1) isa SubObjectIterator{PointVector{ZZRingElem}} @test length(hilbert_basis(Cone1)) == 2 - @test issetequal(hilbert_basis(Cone1), ray_vector.(Ref(ZZ), [[1, 0], [0, 1]])) + @test issetequal(hilbert_basis(Cone1), point_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