FlopCpp trunk
MP_constant.hpp
Go to the documentation of this file.
1// ******************** FlopCpp **********************************************
2// File: MP_constant.hpp
3// $Id$
4// Author: Tim Helge Hultberg (thh@mat.ua.pt)
5// Copyright (C) 2003 Tim Helge Hultberg
6// All Rights Reserved.
7// ****************************************************************************
8
9#ifndef _MP_constant_hpp_
10#define _MP_constant_hpp_
11
12#include "MP_utilities.hpp"
13
14namespace flopc {
21 friend class Constant;
22 friend class Handle<Constant_base*>;
23 public:
24 virtual double evaluate() const = 0;
25 virtual int getStage() const {
26 return 0;
27 }
28 virtual int stage() const {
29 return 0;
30 }
31 protected:
33 virtual ~Constant_base() {}
34 int count;
35
36 };
37
38 class MP_index_exp;
39 class DataRef;
40 class MP_domain;
41
48 class Constant : public Handle<Constant_base*> {
49 public:
52 Constant(const DataRef& d);
53 Constant(double d);
54 Constant(int d);
55 };
56
100 Constant minimum(const Constant& a, const Constant& b);
109 Constant maximum(const Constant& a, const Constant& b);
117 Constant operator+(const Constant& a, const Constant& b);
125 Constant operator-(const Constant& a, const Constant& b);
133 Constant operator*(const Constant& a, const Constant& b);
141 Constant operator/(const Constant& a, const Constant& b);
142
149 Constant maximum(const MP_domain& i, const Constant& e);
156 Constant minimum(const MP_domain& i, const Constant& e);
163 Constant sum(const MP_domain& i, const Constant& e);
170 Constant product(const MP_domain& i, const Constant& e);
171} // End of namespace flopc
172#endif
Base class for all "constant" types of data.
Definition: MP_constant.hpp:20
virtual ~Constant_base()
Definition: MP_constant.hpp:33
virtual double evaluate() const =0
virtual int stage() const
Definition: MP_constant.hpp:28
virtual int getStage() const
Definition: MP_constant.hpp:25
Reference counted class for all "constant" types of data.
Definition: MP_constant.hpp:48
Constant(double d)
Constant(Constant_base *r)
Definition: MP_constant.hpp:50
Constant(const DataRef &d)
Constant(const MP_index_exp &i)
Reference to a set of data.
Definition: MP_data.hpp:29
Utility for doing reference counted pointers.
Range over which some other constuct is defined.
Definition: MP_domain.hpp:61
Representation of an expression involving an index.
Definition: MP_index.hpp:145
Constant operator+(const Constant &a, const Constant &b)
Returns the sum of two constants.
Constant sum(const MP_domain &i, const Constant &e)
Returns the sum of two constants.
Constant ceil(const Constant &c)
The ceiling integral value of the input constant.
Constant operator*(const Constant &a, const Constant &b)
Returns the product of two constants.
Constant operator-(const Constant &a, const Constant &b)
Returns the difference of two constants.
Constant minimum(const Constant &a, const Constant &b)
Returns the smaller of two constants.
Constant product(const MP_domain &i, const Constant &e)
Returns the sum of two constants.
Constant operator/(const Constant &a, const Constant &b)
Returns the quotient of two constants.
Constant pos(const Constant &c)
for returning non-negative value of the constant.
Constant abs(const Constant &c)
for computing the absolute value of a constant value.
Constant maximum(const Constant &a, const Constant &b)
Returns the larger of two constants.
Constant floor(const Constant &c)
The floor integral value of the input constant.
All flopc++ code is contained within the flopc namespace.
Definition: flopc.hpp:49