Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
index.h
1 /*
2 This file is distributed as part of the BIAS library (Basic ImageAlgorithmS)
3 but it has not been developed by the authors of BIAS.
4 
5 For copyright, author and license information see below.
6 */
7 
8 
9 /*
10 *
11 * Template Numerical Toolkit (TNT): Linear Algebra Module
12 *
13 * Mathematical and Computational Sciences Division
14 * National Institute of Technology,
15 * Gaithersburg, MD USA
16 *
17 *
18 * This software was developed at the National Institute of Standards and
19 * Technology (NIST) by employees of the Federal Government in the course
20 * of their official duties. Pursuant to title 17 Section 105 of the
21 * United States Code, this software is not subject to copyright protection
22 * and is in the public domain. The Template Numerical Toolkit (TNT) is
23 * an experimental system. NIST assumes no responsibility whatsoever for
24 * its use by other parties, and makes no guarantees, expressed or implied,
25 * about its quality, reliability, or any other characteristic.
26 *
27 * BETA VERSION INCOMPLETE AND SUBJECT TO CHANGE
28 * see http://math.nist.gov/tnt for latest updates.
29 *
30 */
31 
32 
33 
34 // Vector/Matrix/Array Index Module
35 
36 #ifndef INDEX_H
37 #define INDEX_H
38 
39 #include "subscript.h"
40 
41 namespace TNT
42 {
43 
44  class Index1D
45  {
46  Subscript lbound_;
47  Subscript ubound_;
48 
49  public:
50 
51  Subscript lbound() const { return lbound_; }
52  Subscript ubound() const { return ubound_; }
53 
54  Index1D(const Index1D &D) : lbound_(D.lbound_), ubound_(D.ubound_) {}
55  Index1D(Subscript i1, Subscript i2) : lbound_(i1), ubound_(i2) {}
56 
58  {
59  lbound_ = D.lbound_;
60  ubound_ = D.ubound_;
61  return *this;
62  }
63 
64  };
65 
66  inline Index1D operator+(const Index1D &D, Subscript i)
67  {
68  return Index1D(i+D.lbound(), i+D.ubound());
69  }
70 
71  inline Index1D operator+(Subscript i, const Index1D &D)
72  {
73  return Index1D(i+D.lbound(), i+D.ubound());
74  }
75 
76 
77 
79  {
80  return Index1D(D.lbound()-i, D.ubound()-i);
81  }
82 
84  {
85  return Index1D(i-D.lbound(), i-D.ubound());
86  }
87 
88 } // namespace TNT
89 
90 #endif
91 
Subscript lbound() const
Definition: index.h:51
Fortran_Matrix< T > operator-(const Fortran_Matrix< T > &A, const Fortran_Matrix< T > &B)
Definition: fmat.h:392
Subscript ubound() const
Definition: index.h:52
Index1D(const Index1D &D)
Definition: index.h:54
TNT_SUBSCRIPT_TYPE Subscript
Definition: subscript.h:55
Index1D(Subscript i1, Subscript i2)
Definition: index.h:55
Index1D & operator=(const Index1D &D)
Definition: index.h:57
Fortran_Matrix< T > operator+(const Fortran_Matrix< T > &A, const Fortran_Matrix< T > &B)
Definition: fmat.h:372