Zoltan2
|
The StridedData class manages lists of weights or coordinates. More...
#include <Zoltan2_StridedData.hpp>
Public Member Functions | |
StridedData (ArrayRCP< const scalar_t > x, int stride) | |
Constructor. More... | |
StridedData () | |
Default constructor. A zero-length strided array. More... | |
lno_t | size () const |
Return the length of the strided array. More... | |
scalar_t | operator[] (lno_t idx) const |
Access an element of the input array. More... | |
template<typename T > | |
void | getInputArray (ArrayRCP< const T > &array) const |
Create a contiguous array of the required type, perhaps for a TPL. More... | |
void | getStridedList (ArrayRCP< const scalar_t > &vec, int &stride) const |
Get a reference counted pointer to the input. More... | |
void | getStridedList (size_t &len, const scalar_t *&vec, int &stride) const |
Get the raw input information. More... | |
StridedData & | operator= (const StridedData &sInput) |
Assignment operator. More... | |
The StridedData class manages lists of weights or coordinates.
A likely representation for multi-dimensional weights or coordinates is an array ordered by identifier by dimension, or vice versa. The purposes of this class:
If we need to modify weights (say convert floating point weights to integers for a third party library) methods to do this could be added here.
Definition at line 41 of file Zoltan2_StridedData.hpp.
|
inline |
Constructor.
x | x[0] is the first element of the array. The subsequent elements are at x[i * stride ]. |
stride | the stride of the elements in the strided array. |
Definition at line 54 of file Zoltan2_StridedData.hpp.
|
inline |
Default constructor. A zero-length strided array.
Definition at line 60 of file Zoltan2_StridedData.hpp.
|
inline |
Return the length of the strided array.
The length may be longer than the number of values because the stride may be greater than one.
Definition at line 68 of file Zoltan2_StridedData.hpp.
|
inline |
Access an element of the input array.
idx | The logical index of the element in the strided array. |
For performance, this is inline and no error checking.
Definition at line 76 of file Zoltan2_StridedData.hpp.
void Zoltan2::StridedData< lno_t, scalar_t >::getInputArray | ( | ArrayRCP< const T > & | array | ) | const |
Create a contiguous array of the required type, perhaps for a TPL.
TODO: if are there particular conversions we would like to do for TPLs, we can add methods to do that. Here we just essentially cast. If the cast is not valid (like double to float) an exception is thrown.
Definition at line 166 of file Zoltan2_StridedData.hpp.
|
inline |
Get a reference counted pointer to the input.
vec | on return is a reference counted pointer to the input. Element k is at vec[k*stride] . |
stride | is describes the layout of the input in vec . |
Definition at line 94 of file Zoltan2_StridedData.hpp.
|
inline |
Get the raw input information.
len | on return is the length of storage at vec . This will be some multiple of stride. |
vec | on return is a pointer to the input. Element k is at vec[k*stride] . |
stride | is describes the layout of the input in vec . |
Definition at line 107 of file Zoltan2_StridedData.hpp.
|
inline |
Assignment operator.
Definition at line 117 of file Zoltan2_StridedData.hpp.