#include <arr.h>
template<typename T>
class arr_ref< T >
View of a 1D array
Definition at line 46 of file arr.h.
◆ arr_ref()
Constructs an arr_ref of size s_, starting at d_.
Definition at line 54 of file arr.h.
◆ size()
Returns the current array size.
Definition at line 57 of file arr.h.
◆ fill()
template<typename T>
void arr_ref< T >::fill |
( |
const T & |
val | ) |
|
|
inline |
Writes val into every element of the array.
Definition at line 60 of file arr.h.
◆ operator[]() [1/2]
template<typename T>
template<typename T2 >
T& arr_ref< T >::operator[] |
( |
T2 |
n | ) |
|
|
inline |
Returns a reference to element n
Definition at line 64 of file arr.h.
◆ operator[]() [2/2]
template<typename T>
template<typename T2 >
const T& arr_ref< T >::operator[] |
( |
T2 |
n | ) |
const |
|
inline |
Returns a constant reference to element n
Definition at line 66 of file arr.h.
◆ begin() [1/2]
Returns a pointer to the first array element, or NULL if the array is zero-sized.
Definition at line 70 of file arr.h.
◆ end() [1/2]
Returns a pointer to the one-past-last array element, or NULL if the array is zero-sized.
Definition at line 73 of file arr.h.
◆ begin() [2/2]
template<typename T>
const T* arr_ref< T >::begin |
( |
| ) |
const |
|
inline |
Returns a constant pointer to the first array element, or NULL if the array is zero-sized.
Definition at line 76 of file arr.h.
◆ end() [2/2]
template<typename T>
const T* arr_ref< T >::end |
( |
| ) |
const |
|
inline |
Returns a constant pointer to the one-past-last array element, or NULL if the array is zero-sized.
Definition at line 79 of file arr.h.
◆ copyToPtr()
template<typename T>
template<typename T2 >
void arr_ref< T >::copyToPtr |
( |
T * |
ptr | ) |
const |
|
inline |
Copies all array elements to ptr.
Definition at line 82 of file arr.h.
◆ sort() [1/2]
Sorts the elements in the array, in ascending order.
Definition at line 86 of file arr.h.
◆ sort() [2/2]
template<typename T>
template<typename Comp >
void arr_ref< T >::sort |
( |
Comp |
comp | ) |
|
|
inline |
Sorts the elements in the array, such that comp(d[i],d[j])==true for i<j.
Definition at line 91 of file arr.h.
◆ interpol_helper() [1/2]
template<typename T>
void arr_ref< T >::interpol_helper |
( |
const T & |
val, |
|
|
tsize & |
idx, |
|
|
double & |
frac |
|
) |
| const |
|
inline |
Helper function for linear interpolation (or extrapolation). idx and val are computed such that val=d[idx]+frac*(d[idx+1]-d[idx]). If val<d[0], frac will be negative, if val>d[s-1], frac will be larger than 1. In all other cases 0<=frac<=1.
The array must be ordered in ascending order; no two values may be equal.
Definition at line 102 of file arr.h.
◆ interpol_helper() [2/2]
template<typename T>
template<typename Comp >
void arr_ref< T >::interpol_helper |
( |
const T & |
val, |
|
|
Comp |
comp, |
|
|
tsize & |
idx, |
|
|
double & |
frac |
|
) |
| const |
|
inline |
Helper function for linear interpolation (or extrapolation). idx and val are computed such that val=d[idx]+frac*(d[idx+1]-d[idx]). If comp(val,d[0])==true, frac will be negative, if comp(val,d[s-1])==false, frac will be larger than 1. In all other cases 0<=frac<=1.
The array must be ordered such that comp(d[i],d[j])==true for i<j; no two values may be equal.
Definition at line 113 of file arr.h.
◆ minmax()
template<typename T>
void arr_ref< T >::minmax |
( |
T & |
minv, |
|
|
T & |
maxv |
|
) |
| const |
|
inline |
Returns the minimum and maximum entry in minv and maxv, respectively. Throws an exception if the array is zero-sized.
Definition at line 119 of file arr.h.
◆ contains()
template<typename T>
bool arr_ref< T >::contains |
( |
const T & |
val | ) |
const |
|
inline |
Returns true, if val is found in the array, else false.
Definition at line 131 of file arr.h.
◆ find()
Returns the index of the first occurrence of val in the array. If it is not found, an exception is thrown.
Definition at line 140 of file arr.h.
◆ contentsEqual()
Returns true if the array has the same size as other and all elements of both arrays are equal, else false.
Definition at line 149 of file arr.h.
The documentation for this class was generated from the following file: