The Conley-Morse Graphs Software
m_differ.h
Go to the documentation of this file.
1/////////////////////////////////////////////////////////////////////////////
2///
3/// @file m_differ.h
4///
5/// A sample difference equation.
6///
7/// @author Pawel Pilarczyk
8///
9/////////////////////////////////////////////////////////////////////////////
10
11// Copyright (C) 1997-2014 by Pawel Pilarczyk.
12//
13// This file is part of my research software package. This is free software:
14// you can redistribute it and/or modify it under the terms of the GNU
15// General Public License as published by the Free Software Foundation,
16// either version 3 of the License, or (at your option) any later version.
17//
18// This software is distributed in the hope that it will be useful,
19// but WITHOUT ANY WARRANTY; without even the implied warranty of
20// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21// GNU General Public License for more details.
22//
23// You should have received a copy of the GNU General Public License
24// along with this software; see the file "license.txt". If not,
25// please, see <https://www.gnu.org/licenses/>.
26
27// Started on April 10, 2008. Last revision: April 10, 2008.
28
29
30#ifndef _CMGRAPHS_DIFFERENCE_H_
31#define _CMGRAPHS_DIFFERENCE_H_
32
33// the generic class for the type of a map
34#include "maptype.h"
35
36// the interval arithmetic data types
37#include "typeintv.h"
38
39
40// --------------------------------------------------
41// -------- a sample difference equation map --------
42// --------------------------------------------------
43
44/// This class defines a map derived from a sample difference equation.
45/// There are only two parameters of this map: 'b' and 'h'.
47{
48public:
49 /// The default constructor.
51
52 /// Computes the image of a box whose left and right coordinates
53 /// are given. Fills in the images with the left and right
54 /// coordinates of the image box.
55 void compute (const double *xleft, const double *xright,
56 double *yleft, double *yright, int dim,
57 const spcCoord *coord, int subdiv) const;
58
59}; /* class MapDifference */
60
61// --------------------------------------------------
62
64{
66 return;
67} /* MapDifference::MapDifference */
68
69inline void MapDifference::compute (const double *xleft, const double *xright,
70 double *yleft, double *yright, int dim, const spcCoord *, int) const
71{
74 for (int i = 0; i < dim - 1; ++ i)
75 {
76 yleft [i] = xleft [i + 1];
77 yright [i] = xright [i + 1];
78 }
79
80 IntervalType x (xleft [0], xright [0]);
81 IntervalType y (xleft [1], xright [1]);
82 IntervalType result = (b * y) / (1 + x) - h;
83 double left = result. leftBound ();
84 yleft [dim - 1] = (left <= 0) ? 0 : left;
85 double right = result. rightBound ();
86 yright [dim - 1] = (right <= 0) ? 0 : right;
87
88 // swich the rounding direction to the neutral one
90 return;
91} /* MapDifference::compute */
92
93
94#endif // _CMGRAPHS_DIFFERENCE_H_
95
This class defines a map derived from a sample difference equation.
Definition: m_differ.h:47
void compute(const double *xleft, const double *xright, double *yleft, double *yright, int dim, const spcCoord *coord, int subdiv) const
Computes the image of a box whose left and right coordinates are given.
Definition: m_differ.h:69
MapDifference()
The default constructor.
Definition: m_differ.h:63
This is an abstract class which defines the interface to other classes that describe maps for the use...
Definition: maptype.h:59
const double & getLeftParam(int n) const
Returns the left value of the given parameter.
Definition: maptype.h:196
const double & getRightParam(int n) const
Returns the right value of the given parameter.
Definition: maptype.h:203
An abstract map type.
Data types for interval arithmetic.
void resetRounding()
This function resets rounding switches of the processor and sets rounding to the nearest.
Definition: typeintv.h:65
bool testIntervals(bool throwException=false)
Testing interval arithmetic.
Definition: typeintv.h:82
capd::DInterval IntervalType
The type of an interval (from the CAPD library 2.9/3.0 beta).
Definition: typeintv.h:49
int spcCoord
The type of coordinates of cubes in the phase space.
Definition: typespace.h:50