23 #ifndef PLLL_INCLUDE_GUARD__ARITHMETIC_EXPRESSIONS_HPP
24 #define PLLL_INCLUDE_GUARD__ARITHMETIC_EXPRESSIONS_HPP
70 template<
typename Context_>
79 const typename Context_::Type & d_value;
82 enum { has_evaluate =
true, has_context =
false };
83 typedef const typename Context_::Type & evaluate_type;
84 typedef Context_ Context;
86 inline Wrapper(
const typename Context_::Type & value)
101 return d_value.precision();
104 inline operator const typename Context_::Type & ()
const
114 inline void assignTo(
typename Context_::Type & x)
const
124 inline const typename Context_::Type &
evaluate() const
135 template<
class Context,
class Data>
142 enum { has_evaluate = Data::has_evaluate, has_context = Data::has_context };
143 typedef typename Data::evaluate_type evaluate_type;
145 static inline unsigned long precision(
const Data & a)
147 return a.precision();
150 static inline const Context & context(
const Data & a)
155 static inline void assignTo(
typename Context::Type & x,
const Data & a)
160 static inline evaluate_type evaluate(
const Data & a)
179 template<
typename Context,
typename Data>
186 enum { has_evaluate =
false, has_context =
false };
188 static inline unsigned long precision(
const Data & a)
190 return a.precision();
193 static inline void assignTo(
typename Context::Type & x,
const Data & a)
195 neg(x, a.evaluate());
199 template<
typename Context,
typename Data>
206 enum { has_evaluate =
false, has_context =
false };
208 static inline unsigned long precision(
const Data & d)
210 return std::max(d.first.precision(), d.second.precision());
213 static inline void assignTo(
typename Context::Type & x,
const Data & d)
215 add(x, d.first.evaluate(), d.second.evaluate());
219 template<
typename Context,
typename Data>
226 enum { has_evaluate =
false, has_context =
false };
228 static inline unsigned long precision(
const Data & d)
230 return std::max(d.first.precision(), d.second.precision());
233 static inline void assignTo(
typename Context::Type & x,
const Data & d)
235 sub(x, d.first.evaluate(), d.second.evaluate());
239 template<
typename Context,
typename Data>
246 enum { has_evaluate =
false, has_context =
false };
248 static inline unsigned long precision(
const Data & d)
250 return std::max(d.first.precision(), d.second.precision());
253 static inline void assignTo(
typename Context::Type & x,
const Data & d)
255 mul(x, d.first.evaluate(), d.second.evaluate());
259 template<
typename Context,
typename Data>
266 enum { has_evaluate =
false, has_context =
false };
268 static inline unsigned long precision(
const Data & d)
270 return std::max(d.first.precision(), d.second.precision());
273 static inline void assignTo(
typename Context::Type & x,
const Data & d)
275 div(x, d.first.evaluate(), d.second.evaluate());
279 template<
typename Context,
typename Data>
286 enum { has_evaluate =
false, has_context =
false };
288 static inline unsigned long precision(
const Data & d)
290 return std::max(d.first.precision(), d.second.precision());
293 static inline void assignTo(
typename Context::Type & x,
const Data & d)
295 mod(x, d.first.evaluate(), d.second.evaluate());
299 template<
typename Context,
typename Data>
306 enum { has_evaluate =
false, has_context =
false };
308 static inline unsigned long precision(
const Data & d)
310 return std::max(d.first.precision(), d.second.precision());
313 static inline void assignTo(
typename Context::Type & x,
const Data & d)
315 shl(x, d.first.evaluate(), d.second.evaluate());
319 template<
typename Context,
typename Data>
326 enum { has_evaluate =
false, has_context =
false };
328 static inline unsigned long precision(
const Data & d)
330 return std::max(d.first.precision(), d.second.precision());
333 static inline void assignTo(
typename Context::Type & x,
const Data & d)
335 shr(x, d.first.evaluate(), d.second.evaluate());
339 template<
typename Context,
typename Data>
351 enum { has_evaluate =
false, has_context =
false };
353 signed long shift()
const
363 static inline unsigned long precision(
const Data & a)
365 return a.precision();
368 inline void assignTo(
typename Context::Type & x,
const Data & a)
const
370 shl(x, a.evaluate(), d_v);
374 template<
typename Context,
typename Data>
381 enum { has_evaluate =
false, has_context =
false };
383 static inline unsigned long precision(
const Data & d)
385 return std::max(d.first.precision(), d.second.precision());
388 static inline void assignTo(
typename Context::Type & x,
const Data & d)
390 band(x, d.first.evaluate(), d.second.evaluate());
394 template<
typename Context,
typename Data>
401 enum { has_evaluate =
false, has_context =
false };
403 static inline unsigned long precision(
const Data & d)
405 return std::max(d.first.precision(), d.second.precision());
408 static inline void assignTo(
typename Context::Type & x,
const Data & d)
410 bor(x, d.first.evaluate(), d.second.evaluate());
414 template<
typename Context,
typename Data>
421 enum { has_evaluate =
false, has_context =
false };
423 static inline unsigned long precision(
const Data & d)
425 return std::max(d.first.precision(), d.second.precision());
428 static inline void assignTo(
typename Context::Type & x,
const Data & d)
430 bxor(x, d.first.evaluate(), d.second.evaluate());
434 template<
typename Context,
typename Data>
441 enum { has_evaluate =
false, has_context =
false };
443 static inline unsigned long precision(
const Data & d)
445 return d.precision();
448 static inline void assignTo(
typename Context::Type & x,
const Data & d)
450 bneg(x, d.evaluate());
460 template<
typename Context,
typename Data>
467 enum { has_evaluate =
false, has_context =
false };
469 static inline unsigned long precision(
const Data & d)
471 return d.precision();
474 static inline void assignTo(
typename Context::Type & x,
const Data & d)
480 template<
typename Context,
typename Data>
487 enum { has_evaluate =
false, has_context =
false };
489 static inline unsigned long precision(
const Data & d)
491 return d.precision();
494 static inline void assignTo(
typename Context::Type & x,
const Data & d)
500 template<
class Context,
class Data>
507 enum { has_evaluate =
false, has_context =
false };
509 static inline unsigned long precision(
const Data & d)
511 return std::max(d.first.precision(), d.second.precision());
514 static inline void assignTo(
typename Context::Type & x,
const Data & d)
516 GCD(x, d.first.evaluate(), d.second.evaluate());
520 template<
class Context,
class Data>
527 enum { has_evaluate =
false, has_context =
false };
529 static inline unsigned long precision(
const Data & d)
531 return std::max(d.first.precision(), d.second.precision());
534 static inline void assignTo(
typename Context::Type & x,
const Data & d)
536 LCM(x, d.first.evaluate(), d.second.evaluate());
540 template<
class Context,
class Data>
547 enum { has_evaluate =
false, has_context =
false };
549 static inline unsigned long precision(
const Data & d)
551 return std::max(d.first.precision(), d.second.precision());
554 static inline void assignTo(
typename Context::Type & x,
const Data & d)
556 floorDiv(x, d.first.evaluate(), d.second.evaluate());
560 template<
class Context,
class Data>
567 enum { has_evaluate =
false, has_context =
false };
569 static inline unsigned long precision(
const Data & d)
571 return std::max(d.first.precision(), d.second.precision());
574 static inline void assignTo(
typename Context::Type & x,
const Data & d)
576 ceilDiv(x, d.first.evaluate(), d.second.evaluate());
580 template<
class Context,
class Data>
587 enum { has_evaluate =
false, has_context =
false };
589 static inline unsigned long precision(
const Data & d)
591 return std::max(d.first.precision(), d.second.precision());
594 static inline void assignTo(
typename Context::Type & x,
const Data & d)
596 roundDiv(x, d.first.evaluate(), d.second.evaluate());
600 template<
typename Context,
typename Data>
607 enum { has_evaluate =
false, has_context =
false };
609 static inline unsigned long precision(
const Data & a)
611 return a.precision();
614 static inline void assignTo(
typename Context::Type & x,
const Data & a)
616 abs(x, a.evaluate());
620 template<
typename Context,
typename Data>
627 enum { has_evaluate =
false, has_context =
false };
629 static inline unsigned long precision(
const Data & a)
631 return a.precision();
634 static inline void assignTo(
typename Context::Type & x,
const Data & a)
640 template<
class Context,
class Data>
647 enum { has_evaluate =
false, has_context =
false };
649 static inline unsigned long precision(
const Data & a)
651 return a.precision();
654 static inline void assignTo(
typename Context::Type & x,
const Data & a)
656 sin(x, a.evaluate());
660 template<
class Context,
class Data>
667 enum { has_evaluate =
false, has_context =
false };
669 static inline unsigned long precision(
const Data & a)
671 return a.precision();
674 static inline void assignTo(
typename Context::Type & x,
const Data & a)
676 cos(x, a.evaluate());
680 template<
class Context,
class Data>
687 enum { has_evaluate =
false, has_context =
false };
689 static inline unsigned long precision(
const Data & a)
691 return a.precision();
694 static inline void assignTo(
typename Context::Type & x,
const Data & a)
696 tan(x, a.evaluate());
700 template<
class Context,
class Data>
707 enum { has_evaluate =
false, has_context =
false };
709 static inline unsigned long precision(
const Data & a)
711 return a.precision();
714 static inline void assignTo(
typename Context::Type & x,
const Data & a)
716 asin(x, a.evaluate());
720 template<
class Context,
class Data>
727 enum { has_evaluate =
false, has_context =
false };
729 static inline unsigned long precision(
const Data & a)
731 return a.precision();
734 static inline void assignTo(
typename Context::Type & x,
const Data & a)
736 acos(x, a.evaluate());
740 template<
class Context,
class Data>
747 enum { has_evaluate =
false, has_context =
false };
749 static inline unsigned long precision(
const Data & a)
751 return a.precision();
754 static inline void assignTo(
typename Context::Type & x,
const Data & a)
756 atan(x, a.evaluate());
760 template<
class Context,
class Data>
767 enum { has_evaluate =
false, has_context =
false };
769 static inline unsigned long precision(
const Data & d)
771 return std::max(d.first.precision(), d.second.precision());
774 static inline void assignTo(
typename Context::Type & x,
const Data & d)
776 atan2(x, d.first.evaluate(), d.second.evaluate());
780 template<
class Context,
class Data>
787 enum { has_evaluate =
false, has_context =
false };
789 static inline unsigned long precision(
const Data & a)
791 return a.precision();
794 static inline void assignTo(
typename Context::Type & x,
const Data & a)
796 exp(x, a.evaluate());
800 template<
class Context,
class Data>
807 enum { has_evaluate =
false, has_context =
false };
809 static inline unsigned long precision(
const Data & a)
811 return a.precision();
814 static inline void assignTo(
typename Context::Type & x,
const Data & a)
816 log(x, a.evaluate());
820 template<
class Context,
class Data>
827 enum { has_evaluate =
false, has_context =
false };
829 static inline unsigned long precision(
const Data & a)
831 return a.precision();
834 static inline void assignTo(
typename Context::Type & x,
const Data & a)
836 log2(x, a.evaluate());
840 template<
class Context,
class Data>
847 enum { has_evaluate =
false, has_context =
false };
849 static inline unsigned long precision(
const Data & a)
851 return a.precision();
854 static inline void assignTo(
typename Context::Type & x,
const Data & a)
856 log10(x, a.evaluate());
860 template<
class Context,
class Data>
867 enum { has_evaluate =
false, has_context =
false };
869 static inline unsigned long precision(
const Data & a)
871 return a.precision();
874 static inline void assignTo(
typename Context::Type & x,
const Data & a)
876 sqrt(x, a.evaluate());
880 template<
class Context,
class Data>
887 enum { has_evaluate =
false, has_context =
false };
889 static inline unsigned long precision(
const Data & a)
891 return a.precision();
894 static inline void assignTo(
typename Context::Type & x,
const Data & a)
896 gamma(x, a.evaluate());
900 template<
class Context,
class Data>
908 enum { has_evaluate =
false, has_context =
false };
910 static inline unsigned long precision(
const Data & a)
912 return a.precision();
915 static inline void assignTo(
typename Context::Type & x,
const Data & a)
921 template<
class Context,
class Data>
932 enum { has_evaluate =
false, has_context =
false };
939 static inline unsigned long precision(
const Data & a)
941 return a.precision();
944 inline void assignTo(
typename Context::Type & x,
const Data & a)
const
946 lgamma(x, d_sign, a.evaluate());
950 template<
typename Type>
959 template<
class Context,
class Data>
969 enum { has_evaluate =
false, has_context =
false };
976 static inline unsigned long precision(
const Data & a)
978 return a.precision();
981 inline void assignTo(
typename Context::Type & x,
const Data & a)
const
983 power(x, a.evaluate(), d_v);
988 template<
class Context,
class Data>
995 enum { has_evaluate =
false, has_context =
false };
997 static inline unsigned long precision(
const Data & d)
999 return d.first.precision();
1002 static inline void assignTo(
typename Context::Type & x,
const Data & d)
1004 power(x, d.first.evaluate(), d.second.evaluate());
1014 template<
typename Context,
typename Data>
1022 const Context & d_context;
1025 enum { has_evaluate =
false, has_context =
true };
1028 : d_context(context)
1032 inline unsigned long precision(
const Data & a)
1034 return d_context.getRealPrecision();
1037 static inline void assignTo(
typename Context::Type & x,
const Data & a)
1039 abs(x, a.evaluate());
1043 template<
typename Context,
typename Data>
1050 const Context & d_context;
1053 enum { has_evaluate =
false, has_context =
true };
1056 : d_context(context)
1060 inline unsigned long precision(
const Data & a)
1062 return d_context.getRealPrecision();
1065 static inline void assignTo(
typename Context::Type & x,
const Data & a)
1071 template<
class Context,
class Data>
1078 const Context & d_context;
1081 enum { has_evaluate =
false, has_context =
true };
1084 : d_context(context)
1088 inline unsigned long precision(
const Data & a)
1090 return d_context.getRealPrecision();
1093 static inline void assignTo(
typename Context::Type & x,
const Data & a)
1095 sin(x, a.evaluate());
1099 template<
class Context,
class Data>
1106 const Context & d_context;
1109 enum { has_evaluate =
false, has_context =
true };
1112 : d_context(context)
1116 inline unsigned long precision(
const Data & a)
1118 return d_context.getRealPrecision();
1121 static inline void assignTo(
typename Context::Type & x,
const Data & a)
1123 cos(x, a.evaluate());
1127 template<
class Context,
class Data>
1134 const Context & d_context;
1137 enum { has_evaluate =
false, has_context =
true };
1140 : d_context(context)
1144 inline unsigned long precision(
const Data & a)
1146 return d_context.getRealPrecision();
1149 static inline void assignTo(
typename Context::Type & x,
const Data & a)
1151 tan(x, a.evaluate());
1155 template<
class Context,
class Data>
1163 const Context & d_context;
1166 enum { has_evaluate =
false, has_context =
true };
1169 : d_context(context)
1173 inline unsigned long precision(
const Data & a)
1175 return d_context.getRealPrecision();
1178 static inline void assignTo(
typename Context::Type & x,
const Data & a)
1180 asin(x, a.evaluate());
1184 template<
class Context,
class Data>
1192 const Context & d_context;
1195 enum { has_evaluate =
false, has_context =
true };
1198 : d_context(context)
1202 inline unsigned long precision(
const Data & a)
1204 return d_context.getRealPrecision();
1207 static inline void assignTo(
typename Context::Type & x,
const Data & a)
1209 acos(x, a.evaluate());
1213 template<
class Context,
class Data>
1221 const Context & d_context;
1224 enum { has_evaluate =
false, has_context =
true };
1227 : d_context(context)
1231 inline unsigned long precision(
const Data & a)
1233 return d_context.getRealPrecision();
1236 static inline void assignTo(
typename Context::Type & x,
const Data & a)
1238 atan(x, a.evaluate());
1242 template<
class Context,
class Data>
1250 const Context & d_context;
1253 enum { has_evaluate =
false, has_context =
true };
1256 : d_context(context)
1260 inline unsigned long precision(
const Data & d)
1262 return d_context.getRealPrecision();
1265 static inline void assignTo(
typename Context::Type & x,
const Data & d)
1267 atan2(x, d.first.evaluate(), d.second.evaluate());
1271 template<
class Context,
class Data>
1279 const Context & d_context;
1282 enum { has_evaluate =
false, has_context =
true };
1285 : d_context(context)
1289 inline unsigned long precision(
const Data & a)
1291 return d_context.getRealPrecision();
1294 static inline void assignTo(
typename Context::Type & x,
const Data & a)
1296 exp(x, a.evaluate());
1300 template<
class Context,
class Data>
1308 const Context & d_context;
1311 enum { has_evaluate =
false, has_context =
true };
1314 : d_context(context)
1318 inline unsigned long precision(
const Data & a)
1320 return d_context.getRealPrecision();
1323 static inline void assignTo(
typename Context::Type & x,
const Data & a)
1325 log(x, a.evaluate());
1329 template<
class Context,
class Data>
1337 const Context & d_context;
1340 enum { has_evaluate =
false, has_context =
true };
1343 : d_context(context)
1347 inline unsigned long precision(
const Data & a)
1349 return d_context.getRealPrecision();
1352 static inline void assignTo(
typename Context::Type & x,
const Data & a)
1354 log2(x, a.evaluate());
1358 template<
class Context,
class Data>
1366 const Context & d_context;
1369 enum { has_evaluate =
false, has_context =
true };
1372 : d_context(context)
1376 inline unsigned long precision(
const Data & a)
1378 return d_context.getRealPrecision();
1381 static inline void assignTo(
typename Context::Type & x,
const Data & a)
1383 log10(x, a.evaluate());
1387 template<
class Context,
class Data>
1395 const Context & d_context;
1398 enum { has_evaluate =
false, has_context =
true };
1401 : d_context(context)
1405 inline unsigned long precision(
const Data & a)
1407 return d_context.getRealPrecision();
1410 static inline void assignTo(
typename Context::Type & x,
const Data & a)
1412 sqrt(x, a.evaluate());
1416 template<
class Context,
class Data>
1424 const Context & d_context;
1427 enum { has_evaluate =
false, has_context =
true };
1430 : d_context(context)
1434 inline unsigned long precision(
const Data & a)
1436 return d_context.getRealPrecision();
1439 static inline void assignTo(
typename Context::Type & x,
const Data & a)
1441 gamma(x, a.evaluate());
1445 template<
class Context,
class Data>
1453 const Context & d_context;
1456 enum { has_evaluate =
false, has_context =
true };
1459 : d_context(context)
1463 inline unsigned long precision(
const Data & a)
1465 return d_context.getRealPrecision();
1468 static inline void assignTo(
typename Context::Type & x,
const Data & a)
1474 template<
class Context,
class Data>
1483 const Context & d_context;
1487 enum { has_evaluate =
false, has_context =
true };
1490 : d_context(context), d_sign(sign)
1494 inline unsigned long precision(
const Data & a)
1496 return d_context.getRealPrecision();
1499 inline void assignTo(
typename Context::Type & x,
const Data & a)
const
1501 lgamma(x, d_sign, a.evaluate());
1505 template<
typename Type>
1515 template<
class Context,
class Data>
1522 const Context & d_context;
1526 enum { has_evaluate =
false, has_context =
true };
1528 inline impl(Type v,
const Context & context)
1529 : d_context(context), d_v(v)
1533 inline unsigned long precision(
const Data & a)
1535 return d_context.getRealPrecision();
1538 inline void assignTo(
typename Context::Type & x,
const Data & a)
const
1540 power(x, a.evaluate(), d_v);
1545 template<
class Context,
class Data>
1553 const Context & d_context;
1556 enum { has_evaluate =
false, has_context =
true };
1559 : d_context(context)
1563 inline unsigned long precision(
const Data & d)
1565 return d.first.precision();
1568 static inline void assignTo(
typename Context::Type & x,
const Data & d)
1570 power(x, d.first.evaluate(), d.second.evaluate());
1580 template<
typename Type>
1597 inline const Type & evaluate()
const
1603 template<
typename Context,
typename Data>
1611 const Context & d_context;
1614 enum { has_evaluate =
false, has_context =
true };
1617 : d_context(context)
1621 const Context & context(
const Data &)
const
1626 inline unsigned long precision(
const Data & a)
const
1628 return d_context.getRealPrecision();
1631 inline void assignTo(
typename Context::Type & x,
const Data & a)
const
1633 convert(x, a.evaluate(), d_context);
1637 template<
typename Context,
typename Data>
1645 const Context & d_context;
1648 enum { has_evaluate =
false, has_context =
true };
1651 : d_context(context)
1655 const Context & context(
const Data &)
const
1660 inline unsigned long precision(
const Data & a)
const
1662 return d_context.getRealPrecision();
1665 inline void assignTo(
typename Context::Type & x,
const Data & a)
const
1671 template<
typename Context,
typename Data>
1679 const Context & d_context;
1682 enum { has_evaluate =
false, has_context =
true };
1685 : d_context(context)
1689 const Context & context(
const Data &)
const
1694 inline unsigned long precision(
const Data & a)
const
1696 return d_context.getRealPrecision();
1699 inline void assignTo(
typename Context::Type & x,
const Data & a)
const
1705 template<
typename Context,
typename Data>
1714 const Context & d_context;
1715 bool & d_rounded_up;
1718 enum { has_evaluate =
false, has_context =
true };
1721 : d_context(context), d_rounded_up(rounded_up)
1725 const Context & context(
const Data &)
const
1730 inline unsigned long precision(
const Data & a)
const
1732 return d_context.getRealPrecision();
1735 inline void assignTo(
typename Context::Type & x,
const Data & a)
const
1741 template<
typename Context,
typename Data>
1749 const Context & d_context;
1752 enum { has_evaluate =
false, has_context =
true };
1755 : d_context(context)
1759 const Context & context(
const Data &)
const
1764 inline unsigned long precision(
const Data & a)
const
1766 return d_context.getRealPrecision();
1769 inline void assignTo(
typename Context::Type & x,
const Data & a)
const
1781 template<
typename Context_,
class Data,
template<
typename,
typename>
class Op>
1795 template<
bool,
class A,
class B>
1798 typedef typename A::evaluate_type result;
1801 template<
class A,
class B>
1802 struct SelectET<false, A, B>
1808 enum { has_evaluate =
true, has_context = Op<Context_, Data>::has_context };
1809 typedef typename SelectET<Op<Context_, Data>::has_evaluate,
1810 Op<Context_, Data>,
typename Context_::Type>::result evaluate_type;
1811 typedef Context_ Context;
1813 inline const Op<Context_, Data> &
op() const
1835 return Op<Context_, Data>::context(d_data);
1842 : Op<Context_, Data>(op), d_data(data)
1851 : Op<Context_, Data>(), d_data(data)
1861 return Op<Context_, Data>::precision(d_data);
1867 inline void assignTo(
typename Context::Type & x)
const;
1873 return Op<Context_, Data>::evaluate(d_data);
1878 return typename Context_::Type(*
this, Op<Context_, Data>::context(d_data));
1883 return typename Context_::Type(*
this);
1887 inline operator evaluate_type () const
1904 template<
typename Context,
class Data,
class Op>
1905 void do_assign(
typename Context::Type & x,
const Op & op,
const Data & data)
1921 op.assignTo(x, data);
1924 template<
typename Context,
class Data,
template<
typename,
typename>
class Op>
1927 do_assign<Context, Data, Op<Context, Data> >(x,
static_cast<const Op<Context, Data> &
>(*this), d_data);
1930 template<
typename Context>
1941 namespace implementation
1943 template<
class SourceContext,
class Data,
template<
typename,
typename>
class Op,
class Dest>
2023 template<
class SourceContext,
class Data,
template<
typename,
typename>
class Op>
Returns the sum of the operands.
expressions::Expression< IntegerContext, std::pair< expressions::Wrapper< IntegerContext >, expressions::Wrapper< IntegerContext > >, expressions::FloorDivOp > floorDiv(const Integer &a, const Integer &b)
Computes and returns .
Converts the argument to the destination type. Uses the context stored in the operator.
expressions::Expression< RealContext, expressions::Wrapper< RealContext >, expressions::ExpOp > exp(const Real &i)
Returns the exponential function evaluated at the given floating point number.
Returns the rounded quotient of the two operands.
Returns the ceil of the quotient of the two operands.
Simply provides the data without any modifications.
Implementation of raising to a power by a constant exponent.
A simple "no data" indicator.
Returns the ceil of the square root of the operand.
expressions::Expression< RealContext, expressions::Wrapper< RealContext >, expressions::ATanOp > atan(const Real &i)
Returns the arctangent of the given floating point number.
void assignTo(typename Context_::Type &x) const
Assigns the value to the destination variable.
Returns the tangent of the operand.
Returns the floor of the quotient of the two operands.
void shr(Integer &r, const Integer &a, long b)
Shifts a by b bits to the left and stores the result in r.
void bneg(Integer &r, const Integer &a)
Takes the bitwise complement of a and stores the result in r.
Returns the logarithm of the absolute value of the Gamma function evaluated of the operand together w...
expressions::Expression< IntegerContext, expressions::Wrapper< IntegerContext >, expressions::SqrtFloorOp > sqrtFloor(const Integer &i)
Computes and returns the floor of the square root of i.
Returns the tangent of the operand. Uses the context stored in the operator.
Returns the square root of the operand. Uses the context stored in the operator.
Returns the arcus tangent of the operand.
void do_assign(typename Context::Type &x, const Op &op, const Data &data)
Performs the assignment of the expression to x.
Returns the sine of the operand. Uses the context stored in the operator.
expressions::Expression< RealContext, expressions::Wrapper< RealContext >, expressions::TanOp > tan(const Real &i)
Returns the tangent of the given floating point number.
expressions::Expression< RealContext, expressions::Wrapper< RealContext >, expressions::GammaOp > gamma(const Real &i)
Returns the Gamma function evaluated at the given floating point number.
Returns the arcus cosine of the operand.
Returns the negative of the operand.
Expression(const Data &data)
Creates an expression from the given data. The operator object is default initialized.
Returns the sine of the operand.
expressions::Expression< IntegerContext, expressions::Wrapper< IntegerContext >, expressions::AbsOp > abs(const Integer &i)
Computes and returns the absolute value of i.
Returns the square root of the operand.
Returns the arcus cosine of the operand. Uses the context stored in the operator. ...
expressions::Expression< IntegerContext, std::pair< expressions::Wrapper< IntegerContext >, expressions::Wrapper< IntegerContext > >, expressions::LCMOp > LCM(const Integer &a, const Integer &b)
Computes and returns the non-negative Least Common Multiple of a and b.
Returns the arcus sine of the operand.
expressions::Expression< IntegerContext, std::pair< expressions::Wrapper< IntegerContext >, expressions::Wrapper< IntegerContext > >, expressions::CeilDivOp > ceilDiv(const Integer &a, const Integer &b)
Computes and returns .
unsigned long precision() const
Returns the precision of the expression. Only compiles if the expression supports this...
Returns the logarithm to base 2 of the operand.
expressions::Expression< RealContext, std::pair< expressions::Wrapper< RealContext >, expressions::Wrapper< RealContext > >, expressions::ATan2Op > atan2(const Real &y, const Real &x)
Returns the arctangent of , using the signs of x and y to determine the quadrant. ...
const Context & context() const
Allows to access the expression's context. This function only compiles if a context is stored in the ...
Expression(const Data &data, const Op< Context_, Data > &op)
Creates an expression from the given data and operator object.
Returns the bitwise AND of the operands.
Returns the exponential of the operand. Uses the context stored in the operator.
expressions::Expression< RealContext, expressions::Wrapper< RealContext >, expressions::Log2Op > log2(const Real &i)
Returns the base-2 logarithm evaluated at the given floating point number.
unsigned long precision() const
Returns the precision of the variable.
Returns the operand multiplied by 2 to the power of a constant.
void mul(Integer &r, const Integer &a, const Integer &b)
Multiplies a with b and stores the result in r.
Provides conversion implementation from type SourceType to DestContext::Type.
void div(Integer &r, const Integer &a, const Integer &b)
Divides a by b and stores the result in r.
Returns the natural logarithm of the operand. Uses the context stored in the operator.
Returns the quotient of the operands.
void convert(typename DestContext::Type &dst, const SourceType &src, const DestContext &context)
Converts the value in src to the type described by context and stores the result in dst...
const Data & data() const
Allows to access the expression's data.
Returns the arcus tangent of the quotient of the operands.
Returns the absolute value of the operand. Uses the context stored in the operator.
expressions::Expression< RealContext, expressions::Wrapper< RealContext >, expressions::LogOp > log(const Real &i)
Returns the natural logarithm evaluated at the given floating point number.
void mod(Integer &r, const Integer &a, const Integer &b)
Takes the remainder of the division of a by b and stores it in r.
Wrapper(const typename Context_::Type &value)
Initializes the wrapper object with the given variable.
Converts the argument to the destination type by rounding. Uses the context stored in the operator an...
const Context_::Type & evaluate() const
"Evaluates" (returns) the stored value.
Wraps a native type for a conversion.
Conversion from compile-time known bools to types.
Returns the cosine of the operand. Uses the context stored in the operator.
Returns the square of the operand. Uses the context stored in the operator.
Implementation backend for conversions from context types to native types.
Converts the argument to the destination type by rounding down (floor). Uses the context stored in th...
Returns the arcus tangent of the quotient of the operands. Uses the context stored in the operator...
void convert_round(typename DestContext::Type &dst, const SourceType &src, const DestContext &context)
Converts the rounded value in src to the type described by context and stores the result in dst...
Returns the logarithm of the absolute value of the Gamma function evaluated of the operand together w...
void bor(Integer &r, const Integer &a, const Integer &b)
Computes the bitwise or of a and b and stores the result in r.
expressions::Expression< IntegerContext, std::pair< expressions::Wrapper< IntegerContext >, expressions::Wrapper< IntegerContext > >, expressions::PowerOp > power(const Integer &a, const Integer &b)
Computes and returns a raised to the power of b.
expressions::Expression< IntegerContext, expressions::Wrapper< IntegerContext >, expressions::SqrtCeilOp > sqrtCeil(const Integer &i)
Computes and returns the ceil of the square root of i.
expressions::Expression< RealContext, expressions::Wrapper< RealContext >, expressions::SinOp > sin(const Real &i)
Returns the sine of the given floating point number.
Returns the floor of the square root of the operand.
void bxor(Integer &r, const Integer &a, const Integer &b)
Computes the bitwise exclusive or of a and b and stores the result in r.
expressions::Expression< RealContext, expressions::Wrapper< RealContext >, expressions::ASinOp > asin(const Real &i)
Returns the arcsine of the given floating point number.
const Op< Context_, Data > & op() const
Allows to access the operator object.
expressions::Expression< RealContext, expressions::Wrapper< RealContext >, expressions::Log10Op > log10(const Real &i)
Returns the base-10 logarithm evaluated at the given floating point number.
expressions::Expression< RealContext, expressions::Wrapper< RealContext >, expressions::ACosOp > acos(const Real &i)
Returns the arccosine of the given floating point number.
Represents an expression.
Returns the product of the operands.
Converts the argument to the destination type by rounding up (ceil). Uses the context stored in the o...
expressions::Expression< IntegerContext, std::pair< expressions::Wrapper< IntegerContext >, expressions::Wrapper< IntegerContext > >, expressions::RoundDivOp > roundDiv(const Integer &a, const Integer &b)
Computes and returns .
int sign(const Integer &) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns the sign of the given integer.
Returns the natural logarithm of the operand.
Returns the logarithm to base 10 of the operand. Uses the context stored in the operator.
Expression< Context, Wrapper< Context >, NoneOp > make_expression(const typename Context::Type &a)
Creates an expression from a type.
void shl(Integer &r, const Integer &a, long b)
Shifts a by b bits to the left and stores the result in r.
Returns the Gamma function evaluated of the operand. Uses the context stored in the operator...
void band(Integer &r, const Integer &a, const Integer &b)
Computes the bitwise and of a and b and stores the result in r.
expressions::Expression< RealContext, expressions::Wrapper< RealContext >, expressions::CosOp > cos(const Real &i)
Returns the cosine of the given floating point number.
Returns the cosine of the operand.
Returns the logarithm of the absolute value of the Gamma function evaluated of the operand...
Returns the logarithm to base 2 of the operand. Uses the context stored in the operator.
Returns the remainder of the operands.
void neg(Integer &r, const Integer &a)
Negates a and stores the result in r.
Returns the power of the first operand to the second operand.
Returns the exponential of the operand.
Returns the GCD of the two operands.
Returns the Gamma function evaluated of the operand.
Converts the argument to the destination type by rounding. Uses the context stored in the operator...
void add(Integer &r, const Integer &a, const Integer &b)
Adds a and b and stores the result in r.
Returns the power of the operand to a constant stored in the operator object.
Returns the logarithm to base 10 of the operand.
Returns the power of the first operand to the second operand. Uses the context stored in the operator...
Implementation of raising to a power by a constant exponent.
expressions::Expression< IntegerContext, expressions::Wrapper< IntegerContext >, expressions::SquareOp > square(const Integer &i)
Computes and returns the square of i.
Returns the logarithm of the absolute value of the Gamma function evaluated of the operand...
Returns the bitwise OR of the operands.
Returns the absolute value of the operand.
void convert_floor(typename DestContext::Type &dst, const SourceType &src, const DestContext &context)
Converts the floor of the value in src to the type described by context and stores the result in dst...
Returns the LCM of the two operands.
void convert_ceil(typename DestContext::Type &dst, const SourceType &src, const DestContext &context)
Converts the ceil of the value in src to the type described by context and stores the result in dst...
Returns the bitwise inversion of the operands.
Returns the square of the operand.
Returns the arcus sine of the operand. Uses the context stored in the operator.
expressions::Expression< RealContext, expressions::Wrapper< RealContext >, expressions::SqrtOp > sqrt(const Real &i)
Returns the square root of the given floating point number.
evaluate_type evaluate() const
Returns the value of the expression.
void assignTo(typename Context::Type &x) const
Evaluates the expression into the given object.
Returns the first operand divided by 2 to the power of the second operand.
expressions::Expression< RealContext, expressions::Wrapper< RealContext >, expressions::LGammaOp > lgamma(const Real &i)
Returns the natural logarithm of the absolute value of the Gamma function evaluated at the given floa...
Returns the arcus tangent of the operand. Uses the context stored in the operator.
Returns the power of the operand to a constant stored in the operator object. Uses the context stored...
Returns the bitwise XOR (exclusive or) of the operands.
Wraps a variable to behave similarly to an Expression<> object.
expressions::Expression< IntegerContext, std::pair< expressions::Wrapper< IntegerContext >, expressions::Wrapper< IntegerContext > >, expressions::GCDOp > GCD(const Integer &a, const Integer &b)
Computes and returns the non-negative Greatest Common Divisor of a and b.
Returns the difference of the operands.
Returns the first operand multiplied by 2 to the power of the second operand.
void sub(Integer &r, const Integer &a, const Integer &b)
Subtracts b from a and stores the result in r.