STIR  6.2.0
NumericVectorWithOffset.h
Go to the documentation of this file.
1 //
2 //
3 /*
4  Copyright (C) 2000 PARAPET partners
5  Copyright (C) 2000 - 2005-06-03, Hammersmith Imanet Ltd
6  Copyright (C) 2011-07-01 - 2012, Kris Thielemans
7  Copyright (C) 2020, 2023 University College London
8  This file is part of STIR.
9 
10  SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license
11 
12  See STIR/LICENSE.txt for details
13 */
14 
15 #ifndef __NumericVectorWithOffset_H__
16 #define __NumericVectorWithOffset_H__
17 
28 #include "stir/VectorWithOffset.h"
29 #include "stir/deprecated.h"
30 
31 START_NAMESPACE_STIR
46 template <class T, class elemT>
48 {
49 #ifdef SWIG
50 public: // needs to be public for SWIG to be able to parse the "using" statement below
51 #endif
52 
54 
55 public:
56  using base_type::base_type;
57 
60 
63  : NumericVectorWithOffset(static_cast<const base_type&>(t))
64  {}
65 
67  // implementation in .h because of templates/friends/whatever, see https://stackoverflow.com/a/61020224
68  friend inline void swap(NumericVectorWithOffset& first, NumericVectorWithOffset& second) // nothrow
69  {
70  swap(static_cast<base_type&>(first), static_cast<base_type&>(second));
71  }
72 
74 
76 
78  NumericVectorWithOffset& operator=(const NumericVectorWithOffset& other);
79 
80  // arithmetic operations with a vector, combining element by element
81 
83  inline NumericVectorWithOffset operator+(const NumericVectorWithOffset& v) const;
84 
86  inline NumericVectorWithOffset operator-(const NumericVectorWithOffset& v) const;
87 
89  inline NumericVectorWithOffset operator*(const NumericVectorWithOffset& v) const;
90 
92  inline NumericVectorWithOffset operator/(const NumericVectorWithOffset& v) const;
93 
94  // arithmetic operations with a elemT
95  // TODO??? use member templates
96 
98  inline NumericVectorWithOffset operator+(const elemT& v) const;
99 
101  inline NumericVectorWithOffset operator-(const elemT& v) const;
102 
104  inline NumericVectorWithOffset operator*(const elemT& v) const;
105 
107  inline NumericVectorWithOffset operator/(const elemT& v) const;
108 
109  // corresponding assignment operators
110 
112  inline NumericVectorWithOffset& operator+=(const NumericVectorWithOffset& v);
113 
115  inline NumericVectorWithOffset& operator-=(const NumericVectorWithOffset& v);
116 
118  inline NumericVectorWithOffset& operator*=(const NumericVectorWithOffset& v);
119 
121  inline NumericVectorWithOffset& operator/=(const NumericVectorWithOffset& v);
122 
124  inline NumericVectorWithOffset& operator+=(const elemT& v);
125 
127  inline NumericVectorWithOffset& operator-=(const elemT& v);
128 
130  inline NumericVectorWithOffset& operator*=(const elemT& v);
131 
133  inline NumericVectorWithOffset& operator/=(const elemT& v);
134 
136  template <typename elemT2>
137  STIR_DEPRECATED inline void
138  axpby(const elemT2 a, const NumericVectorWithOffset& x, const elemT2 b, const NumericVectorWithOffset& y);
139 
141  inline void xapyb(const NumericVectorWithOffset& x, const elemT a, const NumericVectorWithOffset& y, const elemT b);
142 
144  inline void xapyb(const NumericVectorWithOffset& x,
145  const NumericVectorWithOffset& a,
146  const NumericVectorWithOffset& y,
147  const NumericVectorWithOffset& b);
148 
150  template <class T2>
151  inline void sapyb(const T2& a, const NumericVectorWithOffset& y, const T2& b);
152 };
153 
154 END_NAMESPACE_STIR
155 
157 
158 #endif // __NumericVectorWithOffset_H__
friend void swap(NumericVectorWithOffset &first, NumericVectorWithOffset &second)
Swap content/members of 2 objects.
Definition: NumericVectorWithOffset.h:68
#define STIR_DEPRECATED
Deprecation macro.
Definition: deprecated.h:19
inline implementations for stir::NumericVectorWithOffset
A templated class for vectors, but with indices starting not from 0.
Definition: ArrayFilter1DUsingConvolution.h:31
This file declares a deprecation macro.
NumericVectorWithOffset(const NumericVectorWithOffset &t)
Constructor from an object of this class&#39; base_type.
Definition: NumericVectorWithOffset.h:62
like VectorWithOffset, but with changes in various numeric operators
Definition: NumericVectorWithOffset.h:47
defines the stir::VectorWithOffset class