Generated on Sat Nov 9 2013 19:18:25 for Gecode by doxygen 1.8.4
arithmetic.cpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Christian Schulte <schulte@gecode.org>
5  * Vincent Barichard <Vincent.Barichard@univ-angers.fr>
6  *
7  * Copyright:
8  * Christian Schulte, 2002
9  * Vincent Barichard, 2012
10  *
11  * Last modified:
12  * $Date: 2013-01-29 20:40:12 +0100 (Tue, 29 Jan 2013) $ by $Author: schulte $
13  * $Revision: 13246 $
14  *
15  * This file is part of Gecode, the generic constraint
16  * development environment:
17  * http://www.gecode.org
18  *
19  * Permission is hereby granted, free of charge, to any person obtaining
20  * a copy of this software and associated documentation files (the
21  * "Software"), to deal in the Software without restriction, including
22  * without limitation the rights to use, copy, modify, merge, publish,
23  * distribute, sublicense, and/or sell copies of the Software, and to
24  * permit persons to whom the Software is furnished to do so, subject to
25  * the following conditions:
26  *
27  * The above copyright notice and this permission notice shall be
28  * included in all copies or substantial portions of the Software.
29  *
30  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
34  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
35  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
36  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37  *
38  */
39 
41 #ifdef GECODE_HAS_MPFR
44 #endif
45 
46 namespace Gecode {
47 
48  void
49  abs(Home home, FloatVar x0, FloatVar x1) {
50  using namespace Float;
51  if (home.failed()) return;
53  }
54 
55 
56  void
57  max(Home home, FloatVar x0, FloatVar x1, FloatVar x2) {
58  using namespace Float;
59  if (home.failed()) return;
61  }
62 
63  void
64  max(Home home, const FloatVarArgs& x, FloatVar y) {
65  using namespace Float;
66  if (x.size() == 0)
67  throw TooFewArguments("Float::max");
68  if (home.failed()) return;
69  ViewArray<FloatView> xv(home,x);
71  }
72 
73 
74  void
75  min(Home home, FloatVar x0, FloatVar x1, FloatVar x2) {
76  using namespace Float;
77  if (home.failed()) return;
79  }
80 
81  void
82  min(Home home, const FloatVarArgs& x, FloatVar y) {
83  using namespace Float;
84  if (x.size() == 0)
85  throw TooFewArguments("Float::min");
86  if (home.failed()) return;
87  ViewArray<MinusView> m(home,x.size());
88  for (int i=x.size(); i--; )
89  m[i] = MinusView(x[i]);
90  MinusView my(y);
92  }
93 
94 
95  void
96  mult(Home home, FloatVar x0, FloatVar x1, FloatVar x2) {
97  using namespace Float;
98  if (home.failed()) return;
100  }
101 
102  void
103  sqr(Home home, FloatVar x0, FloatVar x1) {
104  using namespace Float;
105  if (home.failed()) return;
107  }
108 
109  void
110  sqrt(Home home, FloatVar x0, FloatVar x1) {
111  using namespace Float;
112  if (home.failed()) return;
114  }
115 
116  void
117  pow(Home home, FloatVar x0, int n, FloatVar x1) {
118  using namespace Float;
119  if (n < 0)
120  throw OutOfLimits("nroot");
121  if (home.failed()) return;
123  }
124 
125  void
126  nroot(Home home, FloatVar x0, int n, FloatVar x1) {
127  using namespace Float;
128  if (n < 0)
129  throw OutOfLimits("nroot");
130  if (home.failed()) return;
132  }
133 
134  void
135  div(Home home, FloatVar x0, FloatVar x1, FloatVar x2) {
136  using namespace Float;
137  if (home.failed()) return;
140  }
141 
142 #ifdef GECODE_HAS_MPFR
143  void
144  exp(Home home, FloatVar x0, FloatVar x1) {
145  using namespace Float;
146  if (home.failed()) return;
148  }
149 
150  void
151  log(Home home, FloatVar x0, FloatVar x1) {
152  using namespace Float;
153  if (home.failed()) return;
154  GECODE_ES_FAIL((Transcendental::Exp<FloatView,FloatView>
155  ::post(home,x1,x0)));
156  }
157 
158  void
159  log(Home home, FloatNum base, FloatVar x0, FloatVar x1) {
160  using namespace Float;
161  if (home.failed()) return;
162  GECODE_ES_FAIL((Transcendental::Pow<FloatView,FloatView>
163  ::post(home,base,x1,x0)));
164  }
165 
166  void
167  pow(Home home, FloatNum base, FloatVar x0, FloatVar x1) {
168  using namespace Float;
169  if (home.failed()) return;
170  GECODE_ES_FAIL((Transcendental::Pow<FloatView,FloatView>
171  ::post(home,base,x0,x1)));
172  }
173 
174  void
175  asin(Home home, FloatVar x0, FloatVar x1) {
176  using namespace Float;
177  if (home.failed()) return;
179  }
180 
181  void
182  sin(Home home, FloatVar x0, FloatVar x1) {
183  using namespace Float;
184  if (home.failed()) return;
186  }
187 
188  void
189  acos(Home home, FloatVar x0, FloatVar x1) {
190  using namespace Float;
191  if (home.failed()) return;
193  }
194 
195  void
196  cos(Home home, FloatVar x0, FloatVar x1) {
197  using namespace Float;
198  if (home.failed()) return;
200  }
201 
202  void
203  atan(Home home, FloatVar x0, FloatVar x1) {
204  using namespace Float;
205  if (home.failed()) return;
207  }
208 
209  void
210  tan(Home home, FloatVar x0, FloatVar x1) {
211  using namespace Float;
212  if (home.failed()) return;
214  }
215 #endif
216 
217  void
218  channel(Home home, FloatVar x0, IntVar x1) {
219  using namespace Float;
220  using namespace Int;
221  if (home.failed()) return;
223  }
224 
225  void
226  channel(Home home, IntVar x0, FloatVar x1) {
227  using namespace Float;
228  using namespace Int;
229  if (home.failed()) return;
231  }
232 
233 }
234 
235 // STATISTICS: float-post