31template <
class T,
class NUMBER>
36template <
class T,
class NUMBER>
44template <
class T,
class NUMBER>
45NumericVectorWithOffset<T, NUMBER>&
53template <
class T,
class NUMBER>
63template <
class T,
class NUMBER>
73template <
class T,
class NUMBER>
83template <
class T,
class NUMBER>
93template <
class T,
class NUMBER>
103template <
class T,
class NUMBER>
113template <
class T,
class NUMBER>
123template <
class T,
class NUMBER>
135template <
class T,
class NUMBER>
147 this->num[i] += v.
num[i];
153template <
class T,
class NUMBER>
166 error(
"NumericVectorWithOffset-= called with rhs that is larger in size than lhs. This is no longer supported.");
176template <
class T,
class NUMBER>
200template <
class T,
class NUMBER>
223template <
class T,
class NUMBER>
228 for (
int i = this->get_min_index(); i <= this->get_max_index(); i++)
234template <
class T,
class NUMBER>
235inline NumericVectorWithOffset<T, NUMBER>&
239 for (
int i = this->get_min_index(); i <= this->get_max_index(); i++)
245template <
class T,
class NUMBER>
250 for (
int i = this->get_min_index(); i <= this->get_max_index(); i++)
256template <
class T,
class NUMBER>
261 for (
int i = this->get_min_index(); i <= this->get_max_index(); i++)
267template <
class T,
class NUMBER>
268template <
class NUMBER2>
278template <
class T,
class NUMBER>
286 if ((this->get_min_index() != x.get_min_index()) || (this->get_min_index() != y.get_min_index())
287 || (this->get_max_index() != x.get_max_index()) || (this->get_max_index() != y.get_max_index()))
288 error(
"NumericVectorWithOffset::xapyb: index ranges don't match");
290 typename NumericVectorWithOffset::iterator this_iter = this->begin();
291 typename NumericVectorWithOffset::const_iterator x_iter = x.begin();
292 typename NumericVectorWithOffset::const_iterator y_iter = y.begin();
293 while (this_iter != this->end())
295 *this_iter++ = (*x_iter++) * a + (*y_iter++) * b;
299template <
class T,
class NUMBER>
311 error(
"NumericVectorWithOffset::xapyb: index ranges don't match");
313 typename NumericVectorWithOffset::iterator this_iter = this->
begin();
314 typename NumericVectorWithOffset::const_iterator x_iter = x.
begin();
315 typename NumericVectorWithOffset::const_iterator y_iter = y.
begin();
316 typename NumericVectorWithOffset::const_iterator a_iter = a.
begin();
317 typename NumericVectorWithOffset::const_iterator b_iter = b.
begin();
319 while (this_iter != this->
end())
321 *this_iter++ = (*x_iter++) * (*a_iter++) + (*y_iter++) * (*b_iter++);
325template <
class T,
class NUMBER>
330 this->
xapyb(*
this, a, y, b);
defines the stir::assign function to assign values to different data types
like VectorWithOffset, but with changes in various numeric operators
Definition NumericVectorWithOffset.h:48
NumericVectorWithOffset & operator=(const NumericVectorWithOffset &other)
assignment
Definition NumericVectorWithOffset.inl:46
NumericVectorWithOffset operator+(const NumericVectorWithOffset &v) const
adding vectors, element by element
Definition NumericVectorWithOffset.inl:55
NumericVectorWithOffset operator/(const NumericVectorWithOffset &v) const
dividing vectors, element by element
Definition NumericVectorWithOffset.inl:85
void xapyb(const NumericVectorWithOffset &x, const elemT a, const NumericVectorWithOffset &y, const elemT b)
set values of the array to x*a+y*b, where a and b are scalar
NumericVectorWithOffset operator*(const NumericVectorWithOffset &v) const
multiplying vectors, element by element
Definition NumericVectorWithOffset.inl:75
NumericVectorWithOffset & operator+=(const NumericVectorWithOffset &v)
adding elements of v to the current vector
Definition NumericVectorWithOffset.inl:137
NumericVectorWithOffset operator-(const NumericVectorWithOffset &v) const
subtracting vectors, element by element
Definition NumericVectorWithOffset.inl:65
NumericVectorWithOffset & operator/=(const NumericVectorWithOffset &v)
dividing all elements of the current vector by elements of v
Definition NumericVectorWithOffset.inl:202
void sapyb(const T2 &a, const NumericVectorWithOffset &y, const T2 &b)
set the values of the array to self*a+y*b, where a and b are scalar or vectors
Definition NumericVectorWithOffset.inl:328
NumericVectorWithOffset(const VectorWithOffset< T > &t)
Constructor from an object of this class' base_type.
Definition NumericVectorWithOffset.inl:32
NumericVectorWithOffset & operator-=(const NumericVectorWithOffset &v)
subtracting elements of v from the current vector
Definition NumericVectorWithOffset.inl:155
STIR_DEPRECATED void axpby(const elemT2 a, const NumericVectorWithOffset &x, const elemT2 b, const NumericVectorWithOffset &y)
NumericVectorWithOffset & operator*=(const NumericVectorWithOffset &v)
multiplying elements of the current vector with elements of v
Definition NumericVectorWithOffset.inl:178
iterator begin()
use to initialise an iterator to the first element of the vector
Definition VectorWithOffset.inl:190
VectorWithOffset & operator=(const VectorWithOffset &il)
assignment operator with another vector
Definition VectorWithOffset.inl:505
void check_state() const
Called internally to see if all variables are consistent.
Definition VectorWithOffset.inl:87
int get_max_index() const
get value of last valid index
Definition VectorWithOffset.inl:131
int get_min_index() const
get value of first valid index
Definition VectorWithOffset.inl:124
virtual void grow(const int min_index, const int max_index)
grow the range of the vector, new elements are set to T()
Definition VectorWithOffset.inl:491
int get_length() const
return number of elements in this vector
Definition VectorWithOffset.inl:538
iterator end()
iterator 'past' the last element of the vector
Definition VectorWithOffset.inl:206
VectorWithOffset()
Default constructor: creates a vector of length 0.
Definition VectorWithOffset.inl:253
T * num
pointer to (*this)[0] (taking get_min_index() into account that is).
Definition VectorWithOffset.h:370
Declaration of stir::error()
void error(const char *const s,...)
Print error with format string a la printf and throw exception.
Definition error.cxx:42