Skip to content

Commit

Permalink
Merge pull request #236 from oscar-system/array_array_rational
Browse files Browse the repository at this point in the history
Add Array<Array<Rational>>
  • Loading branch information
benlorenz authored Mar 11, 2020
2 parents 336fe65 + 6de9840 commit 1e41ef1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions deps/src/polymake_arrays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ tparametric1 polymake_module_add_array(jlcxx::Module& polymake)
pm::Array<std::string>, pm::Array<pm::Set<pm::Int>>,
pm::Array<pm::Array<pm::Int>>,
pm::Array<pm::Array<pm::Integer>>,
pm::Array<pm::Array<pm::Rational>>,
pm::Array<pm::Matrix<pm::Integer>>>([](auto wrapped) {
typedef typename decltype(wrapped)::type WrappedT;
typedef typename decltype(wrapped)::type::value_type elemType;
Expand Down Expand Up @@ -92,6 +93,10 @@ tparametric1 polymake_module_add_array(jlcxx::Module& polymake)
"to_array_array_integer", [](const pm::perl::PropertyValue& pv) {
return to_SmallObject<pm::Array<pm::Array<pm::Integer>>>(pv);
});
polymake.method(
"to_array_array_rational", [](const pm::perl::PropertyValue& pv) {
return to_SmallObject<pm::Array<pm::Array<pm::Rational>>>(pv);
});
polymake.method(
"to_array_set_int", [](const pm::perl::PropertyValue& pv) {
return to_SmallObject<pm::Array<pm::Set<pm::Int>>>(pv);
Expand Down
1 change: 1 addition & 0 deletions deps/type_setup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type_tuples = let NT = NamedTuple{(:type_string, :ctype, :jltype, :convert_f)}
( "Array_Set_Int", "pm::Array<pm::Set<long>>", "Array{Set{CxxWrap.CxxLong}}", "to_array_set_int" ),
( "Array_Array_Int", "pm::Array<pm::Array<long>>", "Array{Array{CxxWrap.CxxLong}}", "to_array_array_int" ),
( "Array_Array_Integer", "pm::Array<pm::Array<pm::Integer>>", "Array{Array{Integer}}", "to_array_array_integer" ),
( "Array_Array_Rational", "pm::Array<pm::Array<pm::Rational>>", "Array{Array{Rational}}", "to_array_array_rational" ),
( "Array_Matrix_Integer", "pm::Array<pm::Matrix<pm::Integer>>", "Array{Matrix{Integer}}", "to_array_matrix_integer" ),
( "Array_BigObject", "pm::Array<pm::perl::BigObject>", "Array{BigObject}", "to_array_bigobject" ),
( "Array_Polynomial_Integer_Int", "pm::Array<pm::Polynomial<pm::Integer,long>>", "Array{Polynomial{Integer,CxxWrap.CxxLong}}", "to_array_polynomial_integer_int"),
Expand Down
2 changes: 1 addition & 1 deletion src/arrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const Array_suppT = Union{Int64, CxxWrap.CxxLong,
String, CxxWrap.StdString,
Set{Int64}, Set{CxxWrap.CxxLong},
Array{Int64}, Array{CxxWrap.CxxLong},
Array{Integer}, Matrix{Integer}}
Array{Integer}, Array{Rational}, Matrix{Integer}}

function Array{T}(::UndefInitializer, n::Base.Integer) where
T <: Array_suppT
Expand Down
1 change: 1 addition & 0 deletions test/arrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
(Polymake.Matrix{Polymake.Integer}, Polymake.Matrix{Polymake.Integer}([1 0; 2 1])),
(Polymake.Array{Polymake.to_cxx_type(Int)}, Polymake.Array{Int64}(Int64[1, 2, 3])),
(Polymake.Array{Polymake.Integer}, Polymake.Array{Polymake.Integer}(Polymake.Integer[1, 2, 3])),
(Polymake.Array{Polymake.Rational}, Polymake.Array{Polymake.Rational}(Polymake.Rational[1, 2, 3])),
]
@test Polymake.Array{T} <: AbstractVector
@test Polymake.Array{T}(undef, 3) isa AbstractVector
Expand Down

2 comments on commit 1e41ef1

@benlorenz
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/10831

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.1 -m "<description of version>" 1e41ef16dd504da5044ea3d15b5e3ee7d47e5130
git push origin v0.3.1

Please sign in to comment.