tatami
C++ API for different matrix representations
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
tatami::SomeNumericArray< Value_ > Class Template Reference

Array of some numeric type, determined at runtime. More...

#include <SomeNumericArray.hpp>

Classes

struct  Iterator
 Random-access iterator class. More...
 

Public Member Functions

 SomeNumericArray (void *ptr, size_t number, SomeNumericType type)
 
 SomeNumericArray (const int8_t *ptr, size_t number)
 
 SomeNumericArray (const uint8_t *ptr, size_t number)
 
 SomeNumericArray (const int16_t *ptr, size_t number)
 
 SomeNumericArray (const uint16_t *ptr, size_t number)
 
 SomeNumericArray (const int32_t *ptr, size_t number)
 
 SomeNumericArray (const uint32_t *ptr, size_t number)
 
 SomeNumericArray (const int64_t *ptr, size_t number)
 
 SomeNumericArray (const uint64_t *ptr, size_t number)
 
 SomeNumericArray (const float *ptr, size_t number)
 
 SomeNumericArray (const double *ptr, size_t number)
 
Value_ operator[] (size_t i) const
 
size_t size () const
 
Iterator begin () const
 
Iterator end () const
 

Detailed Description

template<typename Value_ = double>
class tatami::SomeNumericArray< Value_ >

Array of some numeric type, determined at runtime.

This holds a pointer to an existing array of some numeric type, mimicking the behavior of std::vector<Value_> for tatami use cases. The aim is to support inputs of variable types without multiple template specializations, especially in cases where there are combinations of such arrays (e.g., CompressedSparseMatrix). Of course, this comes with a mild performance penalty as the type must be checked upon extracting any value.

Template Parameters
Value_Type to return when values are extracted. This is allowed to differ from the internal storage type.

Constructor & Destructor Documentation

◆ SomeNumericArray() [1/11]

template<typename Value_ = double>
tatami::SomeNumericArray< Value_ >::SomeNumericArray ( void ptr,
size_t  number,
SomeNumericType  type 
)
inline
Parameters
[in]ptrPointer to the array of interest, of run-time type specified by type. The lifetime of the array should exceed that of the constructed SomeNumericArray and any of its copies.
numberLength of the array pointed to by ptr.
typeType of the array.

◆ SomeNumericArray() [2/11]

template<typename Value_ = double>
tatami::SomeNumericArray< Value_ >::SomeNumericArray ( const int8_t ptr,
size_t  number 
)
inline
Parameters
ptrPointer to an existing array of int8_ts.
numberLength of the array pointed to by ptr.

◆ SomeNumericArray() [3/11]

template<typename Value_ = double>
tatami::SomeNumericArray< Value_ >::SomeNumericArray ( const uint8_t ptr,
size_t  number 
)
inline
Parameters
ptrPointer to an existing array of uint8_ts.
numberLength of the array pointed to by ptr.

◆ SomeNumericArray() [4/11]

template<typename Value_ = double>
tatami::SomeNumericArray< Value_ >::SomeNumericArray ( const int16_t ptr,
size_t  number 
)
inline
Parameters
ptrPointer to an existing array of int16_ts.
numberLength of the array pointed to by ptr.

◆ SomeNumericArray() [5/11]

template<typename Value_ = double>
tatami::SomeNumericArray< Value_ >::SomeNumericArray ( const uint16_t ptr,
size_t  number 
)
inline
Parameters
ptrPointer to an existing array of uint16_ts.
numberLength of the array pointed to by ptr.

◆ SomeNumericArray() [6/11]

template<typename Value_ = double>
tatami::SomeNumericArray< Value_ >::SomeNumericArray ( const int32_t ptr,
size_t  number 
)
inline
Parameters
ptrPointer to an existing array of int32_ts.
numberLength of the array pointed to by ptr.

◆ SomeNumericArray() [7/11]

template<typename Value_ = double>
tatami::SomeNumericArray< Value_ >::SomeNumericArray ( const uint32_t ptr,
size_t  number 
)
inline
Parameters
ptrPointer to an existing array of uint32_ts.
numberLength of the array pointed to by ptr.

◆ SomeNumericArray() [8/11]

template<typename Value_ = double>
tatami::SomeNumericArray< Value_ >::SomeNumericArray ( const int64_t ptr,
size_t  number 
)
inline
Parameters
ptrPointer to an existing array of int64_ts.
numberLength of the array pointed to by ptr.

◆ SomeNumericArray() [9/11]

template<typename Value_ = double>
tatami::SomeNumericArray< Value_ >::SomeNumericArray ( const uint64_t ptr,
size_t  number 
)
inline
Parameters
ptrPointer to an existing array of uint64_ts.
numberLength of the array pointed to by ptr.

◆ SomeNumericArray() [10/11]

template<typename Value_ = double>
tatami::SomeNumericArray< Value_ >::SomeNumericArray ( const float ptr,
size_t  number 
)
inline
Parameters
ptrPointer to an existing array of floats.
numberLength of the array pointed to by ptr.

◆ SomeNumericArray() [11/11]

template<typename Value_ = double>
tatami::SomeNumericArray< Value_ >::SomeNumericArray ( const double ptr,
size_t  number 
)
inline
Parameters
ptrPointer to an existing array of doubles.
numberLength of the array pointed to by ptr.

Member Function Documentation

◆ operator[]()

template<typename Value_ = double>
Value_ tatami::SomeNumericArray< Value_ >::operator[] ( size_t  i) const
inline
Parameters
iPositional index on the array.
Returns
Value of the i-th element as a Value_.

◆ size()

template<typename Value_ = double>
size_t tatami::SomeNumericArray< Value_ >::size ( ) const
inline
Returns
Length of the array, in terms of the number of elements of the specified type.

◆ begin()

template<typename Value_ = double>
Iterator tatami::SomeNumericArray< Value_ >::begin ( ) const
inline
Returns
An iterator to the start of the SomeNumericArray.

◆ end()

template<typename Value_ = double>
Iterator tatami::SomeNumericArray< Value_ >::end ( ) const
inline
Returns
An iterator to the end of the SomeNumericArray.

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