Skip to content

Commit 8639162

Browse files
authored
Merge pull request #63 from oscar-system/bl/moretake
add more take methods
2 parents 77a69c4 + 2ff7b3c commit 8639162

File tree

11 files changed

+25
-6
lines changed

11 files changed

+25
-6
lines changed

.github/workflows/test-polymake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
strategy:
2828
matrix:
2929
os: [ubuntu-latest, macOS-latest]
30-
julia-version: ['1.6', '~1.10.0-0', '~1.11.0-0', 'nightly']
30+
julia-version: ['1.6', '~1.10.0-0', '~1.11.0-0', '1.12-nightly']
3131

3232
fail-fast: false
3333

OscarCI.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ os = [ "ubuntu-latest", "macos-latest" ]
55
# 1.6 is done with some extra combinations in include
66
# also to avoid some weird behaviour by github actions which seems to merge
77
# the includes with the normal matrix entries
8-
julia-version = [ "~1.10.0-0", "nightly" ]
8+
julia-version = [ "~1.10.0-0", "1.12-nightly" ]
99
branches = [ "release", "<matching>" ]
1010

1111
[pkgs]

include/jlpolymake/containers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ struct WrapPolynomialBase
624624
wrapped.method("_add", [](const WrappedT& a, const WrappedT& b) { return a + b; });
625625
wrapped.method("_sub", [](const WrappedT& a, const WrappedT& b) { return a - b; });
626626
wrapped.method("_mul", [](const WrappedT& a, const WrappedT& b) { return a * b; });
627-
wrapped.method("^", [](const WrappedT& a, int64_t b) { return a ^ b; });
627+
wrapped.method("^", [](const WrappedT& a, int64_t b) { return a ^ static_cast<pm::Int>(b); });
628628
wrapped.method("/", [](const WrappedT& a, const coeffT& c) { return a / c; });
629629
wrapped.method("coefficients_as_vector", &WrappedT::coefficients_as_vector);
630630
wrapped.method("set_var_names", [](const WrappedT& a, const Array<std::string>& names) { a.set_var_names(names); });

include/jlpolymake/jlpolymake.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
#define JLPOLYMAKE_VERSION_MAJOR 0
4646
#define JLPOLYMAKE_VERSION_MINOR 13
47-
#define JLPOLYMAKE_VERSION_PATCH 0
47+
#define JLPOLYMAKE_VERSION_PATCH 1
4848

4949
#define __JLPOLYMAKE_STR_HELPER(x) #x
5050
#define __JLPOLYMAKE_STR(x) __JLPOLYMAKE_STR_HELPER(x)

src/polymake/type_setup.pl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,12 @@ sub EdgeMap {
255255
UniPolynomial(Int,Int),
256256
UniPolynomial(Integer,Int),
257257
UniPolynomial(Rational,Int),
258+
UniPolynomial(Rational,Rational),
258259
UniPolynomial(QuadraticExtension(Rational),Int),
259260
Polynomial(Int,Int),
260261
Polynomial(Integer,Int),
261262
Polynomial(Rational,Int),
263+
Polynomial(Rational,Rational),
262264
Polynomial(double,Int),
263265
Polynomial(QuadraticExtension(Rational),Int),
264266

src/type_bigobject.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ void add_bigobject(jlcxx::Module& jlpolymake)
120120
});
121121
jlpolymake.method("take", [](pm::perl::BigObject& p, const std::string& s,
122122
const std::string& t) { p.take(s) << t; });
123+
jlpolymake.method("take",
124+
[](pm::perl::BigObject& p, const std::string& s,
125+
double n) { p.take(s) << n; });
123126
jlpolymake.method("take",
124127
[](pm::perl::BigObject& p, const std::string& s,
125128
int64_t n) { p.take(s) << static_cast<pm::Int>(n); });

src/type_integer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ void add_integer(jlcxx::Module& jlpolymake)
8282
[](const pm::Integer& i) {
8383
return show_small_object<pm::Integer>(i, false);
8484
})
85+
.method("take",
86+
[](pm::perl::BigObject& p, const std::string& s, const pm::Integer& i) {
87+
p.take(s) << i;
88+
})
8589
.method("isfinite", [](const pm::Integer& i) { return isfinite(i); })
8690
.method("Float64", [](const pm::Integer& a) { return double(a); })
8791
.method("-", [](const pm::Integer& a, const pm::Integer& b) { return a - b; })

src/type_quadraticextension.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ void add_quadraticextension(jlcxx::Module& jlpolymake)
3939
wrapped.method("show_small_obj", [](const WrappedT& S) {
4040
return show_small_object<WrappedT>(S);
4141
});
42+
wrapped.method("take",
43+
[](pm::perl::BigObject& p, const std::string& s, const WrappedT& q) {
44+
p.take(s) << q;
45+
});
4246
});
4347

4448
}

src/type_rational.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ void add_rational(jlcxx::Module& jlpolymake)
109109
[](const pm::Rational& r) {
110110
return show_small_object<pm::Rational>(r, false);
111111
})
112+
.method("take",
113+
[](pm::perl::BigObject& p, const std::string& s, const pm::Rational& r) {
114+
p.take(s) << r;
115+
})
112116
.method("isfinite", [](const pm::Rational& r) { return isfinite(r); })
113117
.method("Float64", [](const pm::Rational& a) { return double(a); })
114118
.method("-", [](const pm::Rational& a, const pm::Rational& b) { return a - b; })

src/type_tropicalnumber.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ void add_tropicalnumber(jlcxx::Module& jlpolymake)
3737
wrapped.method("show_small_obj", [](const tropType& S) {
3838
return show_small_object<tropType>(S);
3939
});
40+
wrapped.method("take", [](pm::perl::BigObject& p, const std::string& s,
41+
const tropType& v) { p.take(s) << v; });
4042
});
4143
}
4244

0 commit comments

Comments
 (0)