You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

302 lines
11 KiB

// Public rational number operations.
#ifndef _CL_RATIONAL_H
#define _CL_RATIONAL_H
#include "cln/number.h"
#include "cln/rational_class.h"
#include "cln/integer_class.h"
namespace cln {
CL_DEFINE_AS_CONVERSION(cl_RA)
// numerator(r) liefert den Zähler der rationalen Zahl r.
extern const cl_I numerator (const cl_RA& r);
// denominator(r) liefert den Nenner (> 0) der rationalen Zahl r.
extern const cl_I denominator (const cl_RA& r);
// Liefert (- r), wo r eine rationale Zahl ist.
extern const cl_RA operator- (const cl_RA& r);
// (+ r s), wo r und s rationale Zahlen sind.
extern const cl_RA operator+ (const cl_RA& r, const cl_RA& s);
// Dem C++-Compiler muß man auch das Folgende sagen:
inline const cl_RA operator+ (const int x, const cl_RA& y)
{ return cl_I(x) + y; }
inline const cl_RA operator+ (const unsigned int x, const cl_RA& y)
{ return cl_I(x) + y; }
inline const cl_RA operator+ (const long x, const cl_RA& y)
{ return cl_I(x) + y; }
inline const cl_RA operator+ (const unsigned long x, const cl_RA& y)
{ return cl_I(x) + y; }
inline const cl_RA operator+ (const cl_RA& x, const int y)
{ return x + cl_I(y); }
inline const cl_RA operator+ (const cl_RA& x, const unsigned int y)
{ return x + cl_I(y); }
inline const cl_RA operator+ (const cl_RA& x, const long y)
{ return x + cl_I(y); }
inline const cl_RA operator+ (const cl_RA& x, const unsigned long y)
{ return x + cl_I(y); }
// (- r s), wo r und s rationale Zahlen sind.
extern const cl_RA operator- (const cl_RA& r, const cl_RA& s);
// Dem C++-Compiler muß man auch das Folgende sagen:
inline const cl_RA operator- (const int x, const cl_RA& y)
{ return cl_I(x) - y; }
inline const cl_RA operator- (const unsigned int x, const cl_RA& y)
{ return cl_I(x) - y; }
inline const cl_RA operator- (const long x, const cl_RA& y)
{ return cl_I(x) - y; }
inline const cl_RA operator- (const unsigned long x, const cl_RA& y)
{ return cl_I(x) - y; }
inline const cl_RA operator- (const cl_RA& x, const int y)
{ return x - cl_I(y); }
inline const cl_RA operator- (const cl_RA& x, const unsigned int y)
{ return x - cl_I(y); }
inline const cl_RA operator- (const cl_RA& x, const long y)
{ return x - cl_I(y); }
inline const cl_RA operator- (const cl_RA& x, const unsigned long y)
{ return x - cl_I(y); }
// (1+ r), wo r eine rationale Zahl ist.
extern const cl_RA plus1 (const cl_RA& r);
// (1- r), wo r eine rationale Zahl ist.
extern const cl_RA minus1 (const cl_RA& r);
// (abs r), wo r eine rationale Zahl ist.
extern const cl_RA abs (const cl_RA& r);
// equal(r,s) vergleicht zwei rationale Zahlen r und s auf Gleichheit.
extern cl_boolean equal (const cl_RA& r, const cl_RA& s);
// equal_hashcode(r) liefert einen equal-invarianten Hashcode für r.
extern uint32 equal_hashcode (const cl_RA& r);
// compare(r,s) vergleicht zwei rationale Zahlen r und s.
// Ergebnis: 0 falls r=s, +1 falls r>s, -1 falls r<s.
extern cl_signean compare (const cl_RA& r, const cl_RA& s);
inline bool operator== (const cl_RA& x, const cl_RA& y)
{ return equal(x,y); }
inline bool operator!= (const cl_RA& x, const cl_RA& y)
{ return !equal(x,y); }
inline bool operator<= (const cl_RA& x, const cl_RA& y)
{ return compare(x,y)<=0; }
inline bool operator< (const cl_RA& x, const cl_RA& y)
{ return compare(x,y)<0; }
inline bool operator>= (const cl_RA& x, const cl_RA& y)
{ return compare(x,y)>=0; }
inline bool operator> (const cl_RA& x, const cl_RA& y)
{ return compare(x,y)>0; }
// minusp(x) == (< x 0)
extern cl_boolean minusp (const cl_RA& x);
// zerop(x) stellt fest, ob eine rationale Zahl = 0 ist.
extern cl_boolean zerop (const cl_RA& x);
// plusp(x) == (> x 0)
extern cl_boolean plusp (const cl_RA& x);
// Kehrwert (/ r), wo r eine rationale Zahl ist.
extern const cl_RA recip (const cl_RA& r);
// Liefert (* r s), wo r und s rationale Zahlen sind.
extern const cl_RA operator* (const cl_RA& r, const cl_RA& s);
// Dem C++-Compiler muß man auch das Folgende sagen:
inline const cl_RA operator* (const int x, const cl_RA& y)
{ return cl_I(x) * y; }
inline const cl_RA operator* (const unsigned int x, const cl_RA& y)
{ return cl_I(x) * y; }
inline const cl_RA operator* (const long x, const cl_RA& y)
{ return cl_I(x) * y; }
inline const cl_RA operator* (const unsigned long x, const cl_RA& y)
{ return cl_I(x) * y; }
inline const cl_RA operator* (const cl_RA& x, const int y)
{ return x * cl_I(y); }
inline const cl_RA operator* (const cl_RA& x, const unsigned int y)
{ return x * cl_I(y); }
inline const cl_RA operator* (const cl_RA& x, const long y)
{ return x * cl_I(y); }
inline const cl_RA operator* (const cl_RA& x, const unsigned long y)
{ return x * cl_I(y); }
// Quadrat (* r r), wo r eine rationale Zahl ist.
extern const cl_RA square (const cl_RA& r);
// Liefert (/ r s), wo r und s rationale Zahlen sind.
extern const cl_RA operator/ (const cl_RA& r, const cl_RA& s);
// Dem C++-Compiler muß man auch das Folgende sagen:
inline const cl_RA operator/ (const int x, const cl_RA& y)
{ return cl_I(x) / y; }
inline const cl_RA operator/ (const unsigned int x, const cl_RA& y)
{ return cl_I(x) / y; }
inline const cl_RA operator/ (const long x, const cl_RA& y)
{ return cl_I(x) / y; }
inline const cl_RA operator/ (const unsigned long x, const cl_RA& y)
{ return cl_I(x) / y; }
inline const cl_RA operator/ (const cl_RA& x, const int y)
{ return x / cl_I(y); }
inline const cl_RA operator/ (const cl_RA& x, const unsigned int y)
{ return x / cl_I(y); }
inline const cl_RA operator/ (const cl_RA& x, const long y)
{ return x / cl_I(y); }
inline const cl_RA operator/ (const cl_RA& x, const unsigned long y)
{ return x / cl_I(y); }
// Return type for rounding operators.
// x / y --> (q,r) with x = y*q+r.
struct cl_RA_div_t {
cl_I quotient;
cl_RA remainder;
// Constructor.
cl_RA_div_t () {}
cl_RA_div_t (const cl_I& q, const cl_RA& r) : quotient(q), remainder(r) {}
};
// Liefert ganzzahligen und gebrochenen Anteil einer rationalen Zahl.
// (q,r) := (floor x)
// floor2(x)
// > x: rationale Zahl
// < q,r: Quotient q, ein Integer, Rest r, eine rationale Zahl
extern const cl_RA_div_t floor2 (const cl_RA& x);
extern const cl_I floor1 (const cl_RA& x);
// Liefert ganzzahligen und gebrochenen Anteil einer rationalen Zahl.
// (q,r) := (ceiling x)
// ceiling2(x)
// > x: rationale Zahl
// < q,r: Quotient q, ein Integer, Rest r, eine rationale Zahl
extern const cl_RA_div_t ceiling2 (const cl_RA& x);
extern const cl_I ceiling1 (const cl_RA& x);
// Liefert ganzzahligen und gebrochenen Anteil einer rationalen Zahl.
// (q,r) := (truncate x)
// truncate2(x)
// > x: rationale Zahl
// < q,r: Quotient q, ein Integer, Rest r, eine rationale Zahl
extern const cl_RA_div_t truncate2 (const cl_RA& x);
extern const cl_I truncate1 (const cl_RA& x);
// Liefert ganzzahligen und gebrochenen Anteil einer rationalen Zahl.
// (q,r) := (round x)
// round2(x)
// > x: rationale Zahl
// < q,r: Quotient q, ein Integer, Rest r, eine rationale Zahl
extern const cl_RA_div_t round2 (const cl_RA& x);
extern const cl_I round1 (const cl_RA& x);
// floor2(x,y) liefert (floor x y).
extern const cl_RA_div_t floor2 (const cl_RA& x, const cl_RA& y);
extern const cl_I floor1 (const cl_RA& x, const cl_RA& y);
// ceiling2(x,y) liefert (ceiling x y).
extern const cl_RA_div_t ceiling2 (const cl_RA& x, const cl_RA& y);
extern const cl_I ceiling1 (const cl_RA& x, const cl_RA& y);
// truncate2(x,y) liefert (truncate x y).
extern const cl_RA_div_t truncate2 (const cl_RA& x, const cl_RA& y);
extern const cl_I truncate1 (const cl_RA& x, const cl_RA& y);
// round2(x,y) liefert (round x y).
extern const cl_RA_div_t round2 (const cl_RA& x, const cl_RA& y);
extern const cl_I round1 (const cl_RA& x, const cl_RA& y);
// max(x,y) liefert (max x y), wo x und y rationale Zahlen sind.
extern const cl_RA max (const cl_RA& x, const cl_RA& y);
// min(x,y) liefert (min x y), wo x und y rationale Zahlen sind.
extern const cl_RA min (const cl_RA& x, const cl_RA& y);
// signum(x) liefert (signum x), wo x eine rationale Zahl ist.
extern const cl_RA signum (const cl_RA& x);
// (expt x y), wo x eine rationale Zahl und y ein Integer >0 ist.
extern const cl_RA expt_pos (const cl_RA& x, uintL y);
extern const cl_RA expt_pos (const cl_RA& x, const cl_I& y);
// (expt x y), wo x eine rationale Zahl und y ein Integer ist.
extern const cl_RA expt (const cl_RA& x, sintL y);
extern const cl_RA expt (const cl_RA& x, const cl_I& y);
// Stellt fest, ob eine rationale Zahl >=0 das Quadrat einer rationalen Zahl
// ist.
// sqrtp(x,&w)
// > x: eine rationale Zahl >=0
// < w: rationale Zahl (sqrt x) falls x Quadratzahl
// < ergebnis: cl_true ..................., cl_false sonst
extern cl_boolean sqrtp (const cl_RA& x, cl_RA* w);
// Stellt fest, ob eine rationale Zahl >=0 die n-te Potenz einer rationalen Zahl
// ist.
// rootp(x,n,&w)
// > x: eine rationale Zahl >=0
// > n: ein Integer >0
// < w: exakte n-te Wurzel (expt x (/ n)) falls x eine n-te Potenz
// < ergebnis: cl_true ........................, cl_false sonst
extern cl_boolean rootp (const cl_RA& x, uintL n, cl_RA* w);
extern cl_boolean sp/tempestpy - tempestpy - Gitea: Git with a cup of tea
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

194 lines
7.1 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. language: cpp
  2. sudo: false
  3. matrix:
  4. include:
  5. - os: linux
  6. env: PYTHON=2.7 CPP=11 GCC=4.8
  7. addons:
  8. apt:
  9. sources: [ubuntu-toolchain-r-test, kubuntu-backports]
  10. packages: [g++-4.8, cmake]
  11. - os: linux
  12. env: PYTHON=3.5 CPP=11 GCC=4.8
  13. addons:
  14. apt:
  15. sources: [ubuntu-toolchain-r-test, kubuntu-backports, deadsnakes]
  16. packages: [g++-4.8, cmake, python3.5-dev]
  17. - sudo: true
  18. services: docker
  19. env: PYTHON=2.7 CPP=14 GCC=6
  20. - sudo: true
  21. services: docker
  22. env: PYTHON=3.5 CPP=14 GCC=6 DEBUG=1
  23. - sudo: true
  24. services: docker
  25. env: PYTHON=3.5 CPP=17 GCC=7
  26. - sudo: true
  27. services: docker
  28. env: PYTHON=3.5 CPP=17 CLANG=4.0
  29. - os: osx
  30. osx_image: xcode7.3
  31. env: PYTHON=2.7 CPP=14 CLANG
  32. - os: osx
  33. osx_image: xcode7.3
  34. env: PYTHON=3.6 CPP=14 CLANG
  35. # Test a PyPy 2.7 build
  36. - os: linux
  37. dist: trusty
  38. env: PYPY=5.7 PYTHON=2.7 CPP=11 GCC=4.8
  39. addons:
  40. apt:
  41. packages: [g++-4.8, cmake]
  42. - sudo: true
  43. services: docker
  44. env: ARCH=i386 PYTHON=3.5 CPP=14 GCC=6
  45. # This next one does a make install *before* testing, then builds the tests against the installed version:
  46. - sudo: true
  47. services: docker
  48. env: PYTHON=3.5 CPP=14 CLANG=3.9 INSTALL=1
  49. script:
  50. - |
  51. $SCRIPT_RUN_PREFIX sh -c "set -e
  52. cmake ${CMAKE_EXTRA_ARGS} -DPYBIND11_INSTALL=1 -DPYBIND11_TEST=0
  53. make install
  54. cp -a tests /pybind11-tests
  55. mkdir /build-tests && cd /build-tests
  56. cmake ../pybind11-tests ${CMAKE_EXTRA_ARGS} -DPYBIND11_WERROR=ON
  57. make pytest -j 2"
  58. # A barebones build makes sure everything still works without optional deps (numpy/scipy/eigen)
  59. # and also tests the automatic discovery functions in CMake (Python version, C++ standard).
  60. - os: linux
  61. env: BAREBONES
  62. addons:
  63. apt:
  64. sources: [ubuntu-toolchain-r-test, kubuntu-backports]
  65. packages: [g++-4.8, cmake]
  66. install: pip install pytest
  67. # Documentation build:
  68. - os: linux
  69. language: docs
  70. env: DOCS STYLE LINT
  71. install:
  72. - pip install --upgrade sphinx sphinx_rtd_theme flake8 pep8-naming
  73. - |
  74. curl -fsSL ftp://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.12.linux.bin.tar.gz | tar xz
  75. export PATH="$PWD/doxygen-1.8.12/bin:$PATH"
  76. pip install https://github.com/michaeljones/breathe/archive/master.zip
  77. script:
  78. - make -C docs html SPHINX_OPTIONS=-W
  79. - tools/check-style.sh
  80. - flake8
  81. allow_failures:
  82. - env: PYTHON=3.5 CPP=17 GCC=7
  83. - env: PYTHON=3.5 CPP=17 CLANG=4.0
  84. cache:
  85. directories:
  86. - $HOME/.cache/pip
  87. - $HOME/Library/Caches/pip
  88. before_install:
  89. - |
  90. # Configure build variables
  91. if [ "$TRAVIS_OS_NAME" = "linux" ]; then
  92. if [ -n "$CLANG" ]; then
  93. export CXX=clang++-$CLANG CC=clang-$CLANG COMPILER_PACKAGES="clang-$CLANG llvm-$CLANG-dev"
  94. if [ "$CLANG" = "4.0" ]; then export CXXFLAGS="-stdlib=libc++"; fi
  95. else
  96. if [ -z "$GCC" ]; then export GCC=4.8
  97. else export COMPILER_PACKAGES=g++-$GCC
  98. fi
  99. export CXX=g++-$GCC CC=gcc-$GCC
  100. fi
  101. if [ "$CLANG" = "4.0" ]; then export DOCKER=debian:sid
  102. elif [ "$GCC" = "6" ] || [ -n "$CLANG" ]; then export DOCKER=${ARCH:+$ARCH/}debian:testing
  103. elif [ "$GCC" = "7" ]; then export DOCKER=debian:experimental APT_GET_EXTRA="-t experimental"
  104. fi
  105. elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
  106. export CXX=clang++ CC=clang;
  107. fi
  108. if [ -n "$CPP" ]; then export CPP=-std=c++$CPP; fi
  109. if [ "${PYTHON:0:1}" = "3" ]; then export PY=3; fi
  110. if [ "$PYPY" = "5.7" ]; then
  111. curl -fSL https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.7.0-linux64.tar.bz2 | tar -xj
  112. export PYPY_BINARY=$(echo `pwd`/pypy2-v5.7.0-linux64/bin/pypy)
  113. export CMAKE_EXTRA_ARGS="-DPYTHON_EXECUTABLE:FILEPATH=$PYPY_BINARY"
  114. fi
  115. if [ -n "$DEBUG" ]; then export CMAKE_EXTRA_ARGS="-DCMAKE_BUILD_TYPE=Debug"; fi
  116. - |
  117. # Initialize environment
  118. if [ -n "$PYPY" ]; then
  119. $PYPY_BINARY -m ensurepip
  120. $PYPY_BINARY -m pip install pytest
  121. elif [ -n "$DOCKER" ]; then
  122. docker pull $DOCKER
  123. # Disable LTO with gcc until gcc 79296 is fixed:
  124. if [ -n "$GCC" ]; then export CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DPYBIND11_LTO_CXX_FLAGS="; fi
  125. export containerid=$(docker run --detach --tty \
  126. --volume="$PWD":/pybind11 --workdir=/pybind11 \
  127. --env="CXXFLAGS=$CXXFLAGS" \
  128. --env="CC=$CC" --env="CXX=$CXX" --env="DEBIAN_FRONTEND=$DEBIAN_FRONTEND" \
  129. --env=GCC_COLORS=\ \
  130. $DOCKER)
  131. export SCRIPT_RUN_PREFIX="docker exec --tty $containerid"
  132. $SCRIPT_RUN_PREFIX sh -c 'for s in 0 15; do sleep $s; apt-get update && apt-get -qy dist-upgrade && break; done'
  133. # gcc-7 currently generates warnings; some are upstream bugs, so just turn off -Werror for now
  134. if [ "$GCC" = "7" ]; then WERROR=off; fi
  135. else
  136. if [ "$TRAVIS_OS_NAME" = "linux" ]; then
  137. pip install --user --upgrade pip virtualenv
  138. virtualenv -p python$PYTHON venv
  139. elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
  140. if [ "$PY" = "3" ]; then
  141. brew update; brew install python$PY;
  142. else
  143. curl -fsSL -O https://bootstrap.pypa.io/get-pip.py
  144. sudo -H python get-pip.py
  145. fi
  146. pip$PY install --user --upgrade pip virtualenv
  147. python$PY -m virtualenv venv
  148. fi
  149. source venv/bin/activate
  150. fi
  151. install:
  152. - |
  153. # Install dependencies
  154. if [ -n "$DOCKER" ]; then
  155. if [ -n "$DEBUG" ]; then
  156. PY_DEBUG="python$PY-dbg python$PY-scipy-dbg"
  157. export CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DPYTHON_EXECUTABLE=/usr/bin/python${PYTHON}dm"
  158. fi
  159. $SCRIPT_RUN_PREFIX sh -c "for s in 0 15; do sleep \$s; \
  160. apt-get -qy --no-install-recommends $APT_GET_EXTRA install \
  161. $PY_DEBUG python$PY-dev python$PY-pytest python$PY-scipy \
  162. libeigen3-dev cmake make ${COMPILER_PACKAGES} && break; done"
  163. if [ "$CLANG" = "4.0" ]; then
  164. # Neither debian nor llvm provide a libc++ deb; luckily it's fairly quick
  165. # to build and install, so do it ourselves:
  166. git clone --depth=1 https://github.com/llvm-mirror/llvm.git llvm-source
  167. git clone https://github.com/llvm-mirror/libcxx.git llvm-source/projects/libcxx -b release_40
  168. git clone https://github.com/llvm-mirror/libcxxabi.git llvm-source/projects/libcxxabi -b release_40
  169. $SCRIPT_RUN_PREFIX sh -c "mkdir llvm-build && cd llvm-build && \
  170. CXXFLAGS= cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ../llvm-source && \
  171. make -j2 install-cxxabi install-cxx && \
  172. cp -a include/c++/v1/*cxxabi*.h /usr/include/c++/v1"
  173. if [ "$CPP" = "-std=c++17" ]; then export CPP="-std=c++1z"; fi
  174. fi
  175. elif [ -z "$PYPY" ]; then
  176. pip install numpy scipy pytest
  177. wget -q -O eigen.tar.gz https://bitbucket.org/eigen/eigen/get/3.3.0.tar.gz
  178. tar xzf eigen.tar.gz
  179. export CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DCMAKE_INCLUDE_PATH=$PWD/eigen-eigen-26667be4f70b"
  180. fi
  181. script:
  182. - $SCRIPT_RUN_PREFIX cmake ${CMAKE_EXTRA_ARGS}
  183. -DPYBIND11_PYTHON_VERSION=$PYTHON
  184. -DPYBIND11_CPP_STANDARD=$CPP
  185. -DPYBIND11_WERROR=${WERROR:-ON}
  186. - $SCRIPT_RUN_PREFIX make pytest -j 2
  187. - $SCRIPT_RUN_PREFIX make test_cmake_build
  188. after_failure: cat tests/test_cmake_build/*.log
  189. after_script:
  190. - if [ -n "$DOCKER" ]; then docker stop "$containerid"; docker rm "$containerid"; fi
0 HTTP/1.1 200 OK Content-Type: text/html; charset=UTF-8 Set-Cookie: i_like_gitea=c99447c50a038bd9; Path=/; HttpOnly; SameSite=Lax Set-Cookie: _csrf=Cml3sC5wdLbP2zSJgX0ocgt7vTM6MTczNzYzMzk4ODc2NTQ2MTMzOQ; Path=/; Expires=Fri, 24 Jan 2025 12:06:28 GMT; HttpOnly; SameSite=Lax Set-Cookie: macaron_flash=; Path=/; Max-Age=0; HttpOnly; SameSite=Lax X-Frame-Options: SAMEORIGIN Date: Thu, 23 Jan 2025 12:06:31 GMT Transfer-Encoding: chunked 93f4 sp/tempest - tempest - Gitea: Git with a cup of tea

1 Commits (bec28d55c602b71c93a6f289b02821054cdcf355)

Author SHA1 Message Date
sjunges f1c151be26 cudd 3.0 added to resources 9 years ago
sjunges 14639525b6 Revert "xerces on gitignore fix" 9 years ago
dehnert 82f2927500 xerces on gitignore fix 9 years ago
PBerger d42a2151c5 Added a CMakeLists.txt for CUDD 12 years ago
Lanchid ec91dcbe2e Merge branch master into LTLParser 12 years ago
PBerger 02cc706525 Added cudd-2.5.0 patched for Win32/Win64 incl. static lib builds for MSVC2012 12 years ago
Harold Bruintjes 6aea8de7ba Readded cudd 2.5.0 from prismparser 12 years ago
dehnert 9fbebb9349 Added CUDD to the repository. 12 years ago
0