From 77d09431c791b40375bd3f2acd76f7232b30773b Mon Sep 17 00:00:00 2001 From: Hans Schoenemann Date: Thu, 26 Sep 2024 09:38:42 +0200 Subject: [PATCH] add length for svector (#833) --- src/module/vector.jl | 3 +++ test/module/svector-test.jl | 1 + 2 files changed, 4 insertions(+) diff --git a/src/module/vector.jl b/src/module/vector.jl index 558917915..a4b019e32 100644 --- a/src/module/vector.jl +++ b/src/module/vector.jl @@ -310,6 +310,9 @@ function Base.iterate(p::svector{spluralg{T}}, state) where T end Base.IteratorSize(::svector{spoly{T}}) where {T} = Base.SizeUnknown() + +length(p::svector) = Int(libSingular.pLength(p.ptr)) + ############################################################################### # # Vector constructors diff --git a/test/module/svector-test.jl b/test/module/svector-test.jl index 10007acc9..1b831d61c 100644 --- a/test/module/svector-test.jl +++ b/test/module/svector-test.jl @@ -29,6 +29,7 @@ @test gen(M,1) == gens(M)[1] @test_throws ErrorException gen(M,0) @test_throws ErrorException gen(M,ngens(M)+1) + @test length(v2) == 5 end @testset "svector.jet" begin