STIR 6.5.0
stir::Array< 1, elemT > Class Template Reference

The 1-dimensional (partial) specialisation of Array. More...

#include "stir/Array.h"

Inheritance diagram for stir::Array< 1, elemT >:

Public Types

typedef base_type::value_type value_type
 typedefs such that we do not need to have typename wherever we use these types defined in the base class
typedef base_type::reference reference
typedef base_type::const_reference const_reference
typedef base_type::difference_type difference_type
typedef base_type::size_type size_type
typedef base_type::iterator iterator
typedef base_type::const_iterator const_iterator
typedef iterator full_iterator
 Iterator type for going through all elements.
typedef const_iterator const_full_iterator
 Iterator type for going through all elements of a const object.
typedefs for full_iterator support

Full iterators provide a 1-dimensional view on a multi-dimensional Array.

typedef elemT full_value_type
typedef full_value_type * full_pointer
typedef const full_value_type * const_full_pointer
typedef full_value_type & full_reference
typedef const full_value_type & const_full_reference
typedef T value_type
typedef value_type & reference
typedef const value_type & const_reference
typedef ptrdiff_t difference_type
typedef T * iterator
typedef T const * const_iterator
typedef std::reverse_iterator< iterator > reverse_iterator
typedef std::reverse_iterator< const_iterator > const_reverse_iterator
typedef size_t size_type
typedef elemT value_type
typedef value_type & reference
typedef const value_type & const_reference
typedef ptrdiff_t difference_type
typedef elemT * iterator
typedef elemT const * const_iterator
typedef std::reverse_iterator< iterator > reverse_iterator
typedef std::reverse_iterator< const_iterator > const_reverse_iterator
typedef size_t size_type

Public Member Functions

 Array ()
 default constructor: array of length 0
 Array (const IndexRange< 1 > &range)
 constructor given an IndexRange<1>, initialising elements to 0
 Array (const int min_index, const int max_index)
 constructor given first and last indices, initialising elements to 0
 Array (const IndexRange< 1 > &range, shared_ptr< elemT[]> data_sptr)
 constructor given an IndexRange<1>, pointing to existing contiguous data
 Array (const IndexRange< 1 > &range, const elemT *const data_ptr)
 constructor given an IndexRange<1> from existing contiguous data (will copy)
 Array (const NumericVectorWithOffset< elemT, elemT > &il)
 constructor from basetype
 Array (const self &t)
 Copy constructor.
 Array (Array &&other) noexcept
 move constructor
 ~Array () override
 virtual destructor
Array & operator= (const Array &other)
 assignment
 Array (Array< num_dimensions, elemT > &&other) noexcept
void axpby (const elemT2 a, const Array &x, const elemT2 b, const Array &y)
template<class elemT>
 Array (const base_type &il)
template<typename elemT>
 Array (const Array< 1, elemT > &other)
template<typename elemT>
 Array (Array< 1, elemT > &&other) noexcept
functions returning full_iterators
full_iterator begin_all ()
 start value for iterating through all elements in the array, see full_iterator
const_full_iterator begin_all () const
 start value for iterating through all elements in the (const) array, see full_iterator
const_full_iterator begin_all_const () const
 start value for iterating through all elements in the array, see full_iterator
full_iterator end_all ()
 end value for iterating through all elements in the array, see full_iterator
const_full_iterator end_all () const
 end value for iterating through all elements in the (const) array, see full_iterator
const_full_iterator end_all_const () const
 end value for iterating through all elements in the array, see full_iterator
IndexRange< 1 > get_index_range () const
 return the range of indices used
size_t size_all () const
 return the total number of elements in this array
virtual void grow (const IndexRange< 1 > &range)
 Array::grow initialises new elements to 0.
void grow (const int min_index, const int max_index) override
 grow the range of the vector, new elements are set to T()
virtual void resize (const IndexRange< 1 > &range)
 Array::resize initialises new elements to 0.
void resize (const int min_index, const int max_index, bool initialise_with_0)
void resize (const int min_index, const int max_index) override
 resize, initialising new elements to 0
access to the data via a pointer
bool is_contiguous () const
 return if the array is contiguous in memory (always true)
elemT * get_full_data_ptr ()
 member function for access to the data via a elemT*
const elemT * get_const_full_data_ptr () const
 member function for access to the data via a const elemT*
void release_full_data_ptr ()
 signal end of access to elemT*
void release_const_full_data_ptr () const
 signal end of access to const elemT*
elemT sum () const
 return sum of all elements
elemT sum_positive () const
 add up all positive elemTs in the vector
elemT find_max () const
 return maximum value of all elements
elemT find_min () const
 return minimum value of all elements
bool is_regular () const
 checks if the index range is 'regular' (always true as this is the 1D case)
bool get_regular_range (BasicCoordinate< 1, int > &min, BasicCoordinate< 1, int > &max) const
 find regular range, returns false if the range is not regular
self operator+ (const base_type &iv) const
 elem by elem addition
self operator- (const base_type &iv) const
 elem by elem subtraction
self operator* (const base_type &iv) const
 elem by elem multiplication
self operator/ (const base_type &iv) const
 elem by elem division
self operator+ (const elemT a) const
 addition with an 'elemT'
self operator- (const elemT a) const
 subtraction with an 'elemT'
self operator* (const elemT a) const
 multiplication with an 'elemT'
self operator/ (const elemT a) const
 division with an 'elemT'
elemT & operator[] (int i)
 allow array-style access, read/write
const elemT & operator[] (int i) const
 array access, read-only
const elemT & operator[] (const BasicCoordinate< 1, int > &c) const
 allow array-style access giving its BasicCoordinate, read/write
elemT & operator[] (const BasicCoordinate< 1, int > &c)
 array access giving its BasicCoordinate, read-only
functions returning full_iterators
void fill (const elemT &n)
 Fill elements with value n.
void apply_lower_threshold (const elemT &l)
 Sets elements below value to the value.
void apply_upper_threshold (const elemT &u)
 Sets elements above value to the value.
Numerical operations
self & operator+= (const self &x)
self & operator-= (const self &x)
self & operator*= (const self &x)
self & operator/= (const self &x)
void xapyb (const Array &x, const elemT a, const Array &y, const elemT b)
 set values of the array to x*a+y*b, where a and b are scalar
void sapyb (const T &a, const Array &y, const T &b)
 set values of the array to self*a+y*b where a and b are scalar or arrays
Public Member Functions inherited from stir::NumericVectorWithOffset< Array< num_dimensions - 1, elemT >, elemT >
 NumericVectorWithOffset (const VectorWithOffset< Array< num_dimensions - 1, elemT > > &t)
 Constructor from an object of this class' base_type.
 NumericVectorWithOffset (const NumericVectorWithOffset &t)
 Constructor from an object of this class' base_type.
 NumericVectorWithOffset (NumericVectorWithOffset &&other) noexcept
 move constructor
NumericVectorWithOffset & operator= (const NumericVectorWithOffset &other)
 assignment
NumericVectorWithOffset operator+ (const NumericVectorWithOffset &v) const
 adding vectors, element by element
NumericVectorWithOffset operator- (const NumericVectorWithOffset &v) const
 subtracting vectors, element by element
NumericVectorWithOffset operator* (const NumericVectorWithOffset &v) const
 multiplying vectors, element by element
NumericVectorWithOffset operator/ (const NumericVectorWithOffset &v) const
 dividing vectors, element by element
NumericVectorWithOffset operator+ (const elemT &v) const
 return a new vector with elements equal to the sum of the elements in the original and the elemT
NumericVectorWithOffset operator- (const elemT &v) const
 return a new vector with elements equal to the difference of the elements in the original and the elemT
NumericVectorWithOffset operator* (const elemT &v) const
 return a new vector with elements equal to the multiplication of the elements in the original and the elemT
NumericVectorWithOffset operator/ (const elemT &v) const
 return a new vector with elements equal to the division of the elements in the original and the elemT
NumericVectorWithOffset & operator+= (const NumericVectorWithOffset &v)
 adding elements of v to the current vector
NumericVectorWithOffset & operator-= (const NumericVectorWithOffset &v)
 subtracting elements of v from the current vector
NumericVectorWithOffset & operator*= (const NumericVectorWithOffset &v)
 multiplying elements of the current vector with elements of v
NumericVectorWithOffset & operator/= (const NumericVectorWithOffset &v)
 dividing all elements of the current vector by elements of v
NumericVectorWithOffset & operator+= (const elemT &v)
 adding an elemT to the elements of the current vector
NumericVectorWithOffset & operator-= (const elemT &v)
 subtracting an elemT from the elements of the current vector
NumericVectorWithOffset & operator*= (const elemT &v)
 multiplying the elements of the current vector with an elemT
NumericVectorWithOffset & operator/= (const elemT &v)
 dividing the elements of the current vector by an elemT
STIR_DEPRECATED void axpby (const elemT2 a, const NumericVectorWithOffset &x, const elemT2 b, const NumericVectorWithOffset &y)
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
void xapyb (const NumericVectorWithOffset &x, const NumericVectorWithOffset &a, const NumericVectorWithOffset &y, const NumericVectorWithOffset &b)
 set the values of the array to x*a+y*b, where a and b are vectors
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
void axpby (const NUMBER2 a, const NumericVectorWithOffset &x, const NUMBER2 b, const NumericVectorWithOffset &y)
Public Member Functions inherited from stir::VectorWithOffset< T >
int get_length () const
 return number of elements in this vector
size_t size () const
 return number of elements in this vector
int get_min_index () const
 get value of first valid index
int get_max_index () const
 get value of last valid index
void set_offset (const int min_index)
 change value of starting index
void set_min_index (const int min_index)
 identical to set_offset()
void grow (const unsigned int new_size)
 grow the range of the vector from 0 to new_size-1, new elements are set to T()
void resize (const unsigned int new_size)
 change the range of the vector from 0 to new_size-1, new elements are set to T()
void reserve (const int min_index, const int max_index)
 make the allocated range at least from min_index to max_index
void reserve (const unsigned int new_size)
 make the allocated range at least from 0 to new_size-1
size_t capacity () const
 get allocated size
bool owns_memory_for_data () const
 check if this object owns the memory for the data
int get_capacity_min_index () const
 get min_index within allocated range
int get_capacity_max_index () const
 get max_index within allocated range
T & operator[] (int i)
 allow array-style access, read/write
const T & operator[] (int i) const
 array access, read-only
T & at (int i)
 allow array-style access, read/write, but with range checking (throws std::out_of_range)
const T & at (int i) const
 array access, read-only, but with range checking (throws std::out_of_range)
bool empty () const
 checks if the vector is empty
bool operator== (const VectorWithOffset &iv) const
bool operator!= (const VectorWithOffset &iv) const
void fill (const T &n)
 fill elements with value n
void apply_lower_threshold (const T &lower)
 Sets elements below value to the value.
void apply_upper_threshold (const T &upper)
 Sets elements above value to the value.
T * get_data_ptr ()
 member function for access to the data via a T*
const T * get_const_data_ptr () const
 member function for access to the data via a const T*
void release_data_ptr ()
 signal end of access to T*
void release_const_data_ptr () const
 signal end of access to const T*
iterator begin ()
 use to initialise an iterator to the first element of the vector
const_iterator begin () const
 use to initialise an iterator to the first element of the (const) vector
iterator end ()
 iterator 'past' the last element of the vector
const_iterator end () const
 iterator 'past' the last element of the (const) vector
reverse_iterator rbegin ()
reverse_iterator rend ()
const_reverse_iterator rbegin () const
const_reverse_iterator rend () const
VectorWithOffset & operator+= (const VectorWithOffset &v)
 adding elements of v to the current vector
VectorWithOffset & operator-= (const VectorWithOffset &v)
 subtracting elements of v from the current vector
VectorWithOffset & operator*= (const VectorWithOffset &v)
 multiplying elements of the current vector with elements of v
VectorWithOffset & operator/= (const VectorWithOffset &v)
 dividing all elements of the current vector by elements of v
 VectorWithOffset ()
 Default constructor: creates a vector of length 0.
 VectorWithOffset (const int hsz)
 Construct a VectorWithOffset of given length (initialised with T()).
 VectorWithOffset (const int min_index, const int max_index)
 Construct a VectorWithOffset with offset min_index (initialised with T()).
STIR_DEPRECATED VectorWithOffset (const int hsz, T *const data_ptr, T *const end_of_data_ptr)
 Construct a VectorWithOffset of given length pointing to existing data.
STIR_DEPRECATED VectorWithOffset (const int min_index, const int max_index, T *const data_ptr, T *const end_of_data_ptr)
 Construct a VectorWithOffset with offset min_index pointing to existing data.
 VectorWithOffset (const int hsz, const T *const data_ptr)
 Construct a VectorWithOffset of given length from a bare pointer (copying data).
 VectorWithOffset (const int min_index, const int max_index, const T *const data_ptr)
 Construct a VectorWithOffset with offset min_index from a bare pointer (copying data).
 VectorWithOffset (const int min_index, const int max_index, shared_ptr< T[]> data_sptr)
 Construct a VectorWithOffset sharing existing data.
 VectorWithOffset (const int sz, shared_ptr< T[]> data_sptr)
 Construct a VectorWithOffset sharing existing data.
 VectorWithOffset (const VectorWithOffset &il)
 copy constructor
virtual ~VectorWithOffset ()
 Destructor.
 VectorWithOffset (VectorWithOffset &&other) noexcept
 move constructor
void recycle ()
 Free all memory and make object as if default-constructed.
VectorWithOffset & operator= (const VectorWithOffset &il)
 assignment operator with another vector
VectorWithOffset operator+ (const VectorWithOffset &v) const
 adding vectors, element by element
VectorWithOffset operator- (const VectorWithOffset &v) const
 subtracting vectors, element by element
VectorWithOffset operator* (const VectorWithOffset &v) const
 multiplying vectors, element by element
VectorWithOffset operator/ (const VectorWithOffset &v) const
 dividing vectors, element by element
Public Member Functions inherited from stir::NumericVectorWithOffset< elemT, elemT >
 NumericVectorWithOffset (const VectorWithOffset< elemT > &t)
 Constructor from an object of this class' base_type.
 NumericVectorWithOffset (const NumericVectorWithOffset &t)
 Constructor from an object of this class' base_type.
 NumericVectorWithOffset (NumericVectorWithOffset &&other) noexcept
 move constructor
NumericVectorWithOffset & operator= (const NumericVectorWithOffset &other)
 assignment
NumericVectorWithOffset operator+ (const NumericVectorWithOffset &v) const
 adding vectors, element by element
NumericVectorWithOffset operator- (const NumericVectorWithOffset &v) const
 subtracting vectors, element by element
NumericVectorWithOffset operator* (const NumericVectorWithOffset &v) const
 multiplying vectors, element by element
NumericVectorWithOffset operator/ (const NumericVectorWithOffset &v) const
 dividing vectors, element by element
NumericVectorWithOffset operator+ (const elemT &v) const
 return a new vector with elements equal to the sum of the elements in the original and the elemT
NumericVectorWithOffset operator- (const elemT &v) const
 return a new vector with elements equal to the difference of the elements in the original and the elemT
NumericVectorWithOffset operator* (const elemT &v) const
 return a new vector with elements equal to the multiplication of the elements in the original and the elemT
NumericVectorWithOffset operator/ (const elemT &v) const
 return a new vector with elements equal to the division of the elements in the original and the elemT
NumericVectorWithOffset & operator+= (const NumericVectorWithOffset &v)
 adding elements of v to the current vector
NumericVectorWithOffset & operator-= (const NumericVectorWithOffset &v)
 subtracting elements of v from the current vector
NumericVectorWithOffset & operator*= (const NumericVectorWithOffset &v)
 multiplying elements of the current vector with elements of v
NumericVectorWithOffset & operator/= (const NumericVectorWithOffset &v)
 dividing all elements of the current vector by elements of v
NumericVectorWithOffset & operator+= (const elemT &v)
 adding an elemT to the elements of the current vector
NumericVectorWithOffset & operator-= (const elemT &v)
 subtracting an elemT from the elements of the current vector
NumericVectorWithOffset & operator*= (const elemT &v)
 multiplying the elements of the current vector with an elemT
NumericVectorWithOffset & operator/= (const elemT &v)
 dividing the elements of the current vector by an elemT
STIR_DEPRECATED void axpby (const elemT2 a, const NumericVectorWithOffset &x, const elemT2 b, const NumericVectorWithOffset &y)
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
void xapyb (const NumericVectorWithOffset &x, const NumericVectorWithOffset &a, const NumericVectorWithOffset &y, const NumericVectorWithOffset &b)
 set the values of the array to x*a+y*b, where a and b are vectors
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
void axpby (const NUMBER2 a, const NumericVectorWithOffset &x, const NUMBER2 b, const NumericVectorWithOffset &y)
Public Member Functions inherited from stir::VectorWithOffset< elemT >
int get_length () const
 return number of elements in this vector
size_t size () const
 return number of elements in this vector
int get_min_index () const
 get value of first valid index
int get_max_index () const
 get value of last valid index
void set_offset (const int min_index)
 change value of starting index
void set_min_index (const int min_index)
 identical to set_offset()
void reserve (const int min_index, const int max_index)
 make the allocated range at least from min_index to max_index
size_t capacity () const
 get allocated size
bool owns_memory_for_data () const
 check if this object owns the memory for the data
int get_capacity_min_index () const
 get min_index within allocated range
int get_capacity_max_index () const
 get max_index within allocated range
elemT & operator[] (int i)
 allow array-style access, read/write
elemT & at (int i)
 allow array-style access, read/write, but with range checking (throws std::out_of_range)
bool empty () const
 checks if the vector is empty
bool operator== (const VectorWithOffset &iv) const
bool operator!= (const VectorWithOffset &iv) const
void fill (const elemT &n)
 fill elements with value n
void apply_lower_threshold (const elemT &lower)
 Sets elements below value to the value.
void apply_upper_threshold (const elemT &upper)
 Sets elements above value to the value.
elemT * get_data_ptr ()
 member function for access to the data via a T*
const elemT * get_const_data_ptr () const
 member function for access to the data via a const T*
void release_data_ptr ()
 signal end of access to T*
void release_const_data_ptr () const
 signal end of access to const T*
iterator begin ()
 use to initialise an iterator to the first element of the vector
iterator end ()
 iterator 'past' the last element of the vector
reverse_iterator rbegin ()
reverse_iterator rend ()
VectorWithOffset & operator+= (const VectorWithOffset &v)
 adding elements of v to the current vector
VectorWithOffset & operator-= (const VectorWithOffset &v)
 subtracting elements of v from the current vector
VectorWithOffset & operator*= (const VectorWithOffset &v)
 multiplying elements of the current vector with elements of v
VectorWithOffset & operator/= (const VectorWithOffset &v)
 dividing all elements of the current vector by elements of v
 VectorWithOffset ()
 Default constructor: creates a vector of length 0.
virtual ~VectorWithOffset ()
 Destructor.
void recycle ()
 Free all memory and make object as if default-constructed.
VectorWithOffset & operator= (const VectorWithOffset &il)
 assignment operator with another vector
VectorWithOffset operator+ (const VectorWithOffset &v) const
 adding vectors, element by element
VectorWithOffset operator- (const VectorWithOffset &v) const
 subtracting vectors, element by element
VectorWithOffset operator* (const VectorWithOffset &v) const
 multiplying vectors, element by element
VectorWithOffset operator/ (const VectorWithOffset &v) const
 dividing vectors, element by element

Friends

void swap (Array &first, Array &second)
 Swap content/members of 2 objects.

indexed access with range checking (throw std:out_of_range)

elemT & at (int i)
const elemT & at (int i) const
elemT & at (const BasicCoordinate< 1, int > &c)
const elemT & at (const BasicCoordinate< 1, int > &c) const

Additional Inherited Members

void check_state () const
 Called internally to see if all variables are consistent.
void init_with_copy (const int min_index, const int max_index, T const *const data_ptr)
 change vector to the new index range and copy data from data_ptr
void init (const int min_index, const int max_index, T *const data_ptr, bool copy_data)
 initialise vector to the given index range and either copy from or point to data_ptr
void check_state () const
 Called internally to see if all variables are consistent.
void init_with_copy (const int min_index, const int max_index, elemT const *const data_ptr)
 change vector to the new index range and copy data from data_ptr
void init (const int min_index, const int max_index, elemT *const data_ptr, bool copy_data)
 initialise vector to the given index range and either copy from or point to data_ptr
T * num
 pointer to (*this)[0] (taking get_min_index() into account that is).
elemT * num
 pointer to (*this)[0] (taking get_min_index() into account that is).

Detailed Description

template<class elemT>
class stir::Array< 1, elemT >

The 1-dimensional (partial) specialisation of Array.

Member Typedef Documentation

◆ full_iterator

template<class elemT>
typedef iterator stir::Array< 1, elemT >::full_iterator

Iterator type for going through all elements.

for 1D arrays, full iterators are equal to normal iterators

Constructor & Destructor Documentation

◆ Array() [1/6]

template<class elemT>
stir::Array< 1, elemT >::Array ( const IndexRange< 1 > & range)
inlineexplicit

constructor given an IndexRange<1>, initialising elements to 0

References grow().

◆ Array() [2/6]

template<class elemT>
stir::Array< 1, elemT >::Array ( const int min_index,
const int max_index )
inline

constructor given first and last indices, initialising elements to 0

References grow().

◆ Array() [3/6]

template<class elemT>
stir::Array< 1, elemT >::Array ( const IndexRange< 1 > & range,
shared_ptr< elemT[]> data_sptr )
inline

constructor given an IndexRange<1>, pointing to existing contiguous data

  • data_ptr should point to a contiguous block of correct size. The constructed Array will essentially be a "view" of the data_sptr block. Therefore, any modifications to the array will modify the data at data_sptr. This will be the case until the Array is resized.

References stir::VectorWithOffset< T >::get_max_index(), and stir::VectorWithOffset< T >::get_min_index().

◆ Array() [4/6]

template<class elemT>
stir::Array< 1, elemT >::Array ( const IndexRange< 1 > & range,
const elemT *const data_ptr )
inline

constructor given an IndexRange<1> from existing contiguous data (will copy)

  • data_ptr should point to a contiguous block of correct size.

References stir::VectorWithOffset< T >::get_max_index(), and stir::VectorWithOffset< T >::get_min_index().

◆ Array() [5/6]

template<class elemT>
stir::Array< 1, elemT >::Array ( const NumericVectorWithOffset< elemT, elemT > & il)
inline

◆ Array() [6/6]

template<class elemT>
stir::Array< 1, elemT >::Array ( Array< 1, elemT > && other)
noexcept

move constructor

implementation uses the copy-and-swap idiom, see e.g. https://stackoverflow.com/a/3279550

Member Function Documentation

◆ operator=()

template<class elemT>
Array< 1, elemT > & stir::Array< 1, elemT >::operator= ( const Array< 1, elemT > & other)
inline

◆ begin_all() [1/2]

template<typename elemT>
Array< 1, elemT >::full_iterator stir::Array< 1, elemT >::begin_all ( )
inline

start value for iterating through all elements in the array, see full_iterator

References stir::VectorWithOffset< T >::begin().

◆ begin_all() [2/2]

template<typename elemT>
Array< 1, elemT >::const_full_iterator stir::Array< 1, elemT >::begin_all ( ) const
inline

start value for iterating through all elements in the (const) array, see full_iterator

References stir::VectorWithOffset< T >::begin().

◆ begin_all_const()

template<typename elemT>
Array< 1, elemT >::const_full_iterator stir::Array< 1, elemT >::begin_all_const ( ) const
inline

start value for iterating through all elements in the array, see full_iterator

References stir::VectorWithOffset< T >::begin().

◆ end_all() [1/2]

template<typename elemT>
Array< 1, elemT >::full_iterator stir::Array< 1, elemT >::end_all ( )
inline

end value for iterating through all elements in the array, see full_iterator

References stir::VectorWithOffset< T >::end().

◆ end_all() [2/2]

template<typename elemT>
Array< 1, elemT >::const_full_iterator stir::Array< 1, elemT >::end_all ( ) const
inline

end value for iterating through all elements in the (const) array, see full_iterator

References stir::VectorWithOffset< T >::end().

◆ end_all_const()

template<typename elemT>
Array< 1, elemT >::const_full_iterator stir::Array< 1, elemT >::end_all_const ( ) const
inline

end value for iterating through all elements in the array, see full_iterator

References stir::VectorWithOffset< T >::end().

◆ get_index_range()

template<typename elemT>
IndexRange< 1 > stir::Array< 1, elemT >::get_index_range ( ) const
inline

◆ size_all()

template<typename elemT>
size_t stir::Array< 1, elemT >::size_all ( ) const
inline

return the total number of elements in this array

References stir::VectorWithOffset< T >::size().

◆ grow() [1/2]

template<class elemT>
void stir::Array< 1, elemT >::grow ( const IndexRange< 1 > & range)
inlinevirtual

◆ grow() [2/2]

template<class elemT>
void stir::Array< 1, elemT >::grow ( const int min_index,
const int max_index )
inlineoverridevirtual

grow the range of the vector, new elements are set to T()

Currently, it is only checked with assert() if old range is a subinterval of the new range.

grow() currently simply calls resize(). However, if you overload resize() in a derived class, it is probably safest to overload grow() as well.

Reimplemented from stir::VectorWithOffset< T >.

References resize().

◆ resize() [1/2]

template<class elemT>
void stir::Array< 1, elemT >::resize ( const IndexRange< 1 > & range)
inlinevirtual

◆ resize() [2/2]

template<class elemT>
void stir::Array< 1, elemT >::resize ( const int min_index,
const int max_index )
inlineoverridevirtual

resize, initialising new elements to 0

Reimplemented from stir::VectorWithOffset< T >.

References resize().

◆ get_full_data_ptr()

template<class elemT>
elemT * stir::Array< 1, elemT >::get_full_data_ptr ( )
inline

member function for access to the data via a elemT*

References stir::VectorWithOffset< T >::get_data_ptr().

◆ get_const_full_data_ptr()

template<class elemT>
const elemT * stir::Array< 1, elemT >::get_const_full_data_ptr ( ) const
inline

member function for access to the data via a const elemT*

References stir::VectorWithOffset< T >::get_const_data_ptr().

◆ release_full_data_ptr()

template<class elemT>
void stir::Array< 1, elemT >::release_full_data_ptr ( )
inline

signal end of access to elemT*

References stir::VectorWithOffset< T >::release_data_ptr().

◆ release_const_full_data_ptr()

template<class elemT>
void stir::Array< 1, elemT >::release_const_full_data_ptr ( ) const
inline

signal end of access to const elemT*

References stir::VectorWithOffset< T >::release_const_data_ptr().

◆ sum()

◆ sum_positive()

template<class elemT>
elemT stir::Array< 1, elemT >::sum_positive ( ) const
inline

◆ find_max()

template<class elemT>
elemT stir::Array< 1, elemT >::find_max ( ) const
inline

◆ find_min()

template<class elemT>
elemT stir::Array< 1, elemT >::find_min ( ) const
inline

◆ get_regular_range()

template<typename elemT>
bool stir::Array< 1, elemT >::get_regular_range ( BasicCoordinate< 1, int > & min,
BasicCoordinate< 1, int > & max ) const

find regular range, returns false if the range is not regular

References get_index_range(), and stir::IndexRange< num_dimensions >::get_regular_range().

◆ operator+() [1/2]

template<class elemT>
Array< 1, elemT > stir::Array< 1, elemT >::operator+ ( const base_type & iv) const
inline

elem by elem addition

References stir::VectorWithOffset< T >::check_state().

◆ operator-() [1/2]

template<class elemT>
Array< 1, elemT > stir::Array< 1, elemT >::operator- ( const base_type & iv) const
inline

elem by elem subtraction

References stir::VectorWithOffset< T >::check_state().

◆ operator*() [1/2]

template<class elemT>
Array< 1, elemT > stir::Array< 1, elemT >::operator* ( const base_type & iv) const
inline

elem by elem multiplication

References stir::VectorWithOffset< T >::check_state().

◆ operator/() [1/2]

template<class elemT>
Array< 1, elemT > stir::Array< 1, elemT >::operator/ ( const base_type & iv) const
inline

elem by elem division

References stir::VectorWithOffset< T >::check_state().

◆ operator+() [2/2]

template<class elemT>
Array< 1, elemT > stir::Array< 1, elemT >::operator+ ( const elemT a) const
inline

addition with an 'elemT'

References stir::VectorWithOffset< T >::check_state().

◆ operator-() [2/2]

template<class elemT>
Array< 1, elemT > stir::Array< 1, elemT >::operator- ( const elemT a) const
inline

subtraction with an 'elemT'

References stir::VectorWithOffset< T >::check_state().

◆ operator*() [2/2]

template<class elemT>
Array< 1, elemT > stir::Array< 1, elemT >::operator* ( const elemT a) const
inline

multiplication with an 'elemT'

References stir::VectorWithOffset< T >::check_state().

◆ operator/() [2/2]

template<class elemT>
Array< 1, elemT > stir::Array< 1, elemT >::operator/ ( const elemT a) const
inline

division with an 'elemT'

References stir::VectorWithOffset< T >::check_state().

◆ operator[]() [1/2]

template<typename elemT>
elemT & stir::Array< 1, elemT >::operator[] ( int i)
inline

allow array-style access, read/write

References stir::VectorWithOffset< elemT >::operator[]().

◆ operator[]() [2/2]

template<typename elemT>
const elemT & stir::Array< 1, elemT >::operator[] ( int i) const
inline

array access, read-only

References stir::VectorWithOffset< elemT >::operator[]().

◆ fill()

void stir::Array< num_dimensions, elemT >::fill ( const elemT & n)
inline

Fill elements with value n.

hides VectorWithOffset::fill

◆ swap

template<class elemT>
void swap ( Array< 1, elemT > & first,
Array< 1, elemT > & second )
friend

Swap content/members of 2 objects.

References swap.

Referenced by swap.


The documentation for this class was generated from the following files: