GQCP
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | List of all members
GQCP::StorageArray< _Element, _Vectorizer > Class Template Reference

#include <StorageArray.hpp>

Collaboration diagram for GQCP::StorageArray< _Element, _Vectorizer >:
Collaboration graph

Public Types

using Element = _Element
 
using Vectorizer = _Vectorizer
 
using Self = StorageArray< Element, Vectorizer >
 

Public Member Functions

 StorageArray (const std::vector< Element > &elements, const Vectorizer &vectorizer)
 
 StorageArray (const Element &element, const Vectorizer &vectorizer)
 
 StorageArray (const Vectorizer &vectorizer)
 
template<size_t N>
 StorageArray (const std::array< Element, N > &elements, const Vectorizer &vectorizer)
 
template<typename Z = Vectorizer, typename = typename std::enable_if<std::is_same<Z, ScalarVectorizer>::value>::type>
 operator Element () const
 
template<typename... Indices>
const Elementoperator() (const Indices &... indices) const
 
template<typename... Indices>
Elementoperator() (const Indices &... indices)
 
const std::vector< Element > & elements () const
 
std::vector< Element > & elements ()
 
const Vectorizervectorizer () const
 
template<typename Z = Vectorizer>
enable_if_t< std::is_same< Z, VectorVectorizer >::value, VectorX< Element > > asVector ()
 

Static Public Attributes

static constexpr auto NumberOfAxes = Vectorizer::NumberOfAxes
 

Detailed Description

template<typename _Element, typename _Vectorizer>
class GQCP::StorageArray< _Element, _Vectorizer >

A simple array data structure.

Template Parameters
_ElementThe type of element that this array stores.
_VectorizerThe type of the vectorizer that relates multiple tuple coordinates to a one-dimensional index.

Member Typedef Documentation

◆ Element

template<typename _Element , typename _Vectorizer >
using GQCP::StorageArray< _Element, _Vectorizer >::Element = _Element

◆ Self

template<typename _Element , typename _Vectorizer >
using GQCP::StorageArray< _Element, _Vectorizer >::Self = StorageArray<Element, Vectorizer>

◆ Vectorizer

template<typename _Element , typename _Vectorizer >
using GQCP::StorageArray< _Element, _Vectorizer >::Vectorizer = _Vectorizer

Constructor & Destructor Documentation

◆ StorageArray() [1/4]

template<typename _Element , typename _Vectorizer >
GQCP::StorageArray< _Element, _Vectorizer >::StorageArray ( const std::vector< Element > &  elements,
const Vectorizer vectorizer 
)
inline

Create an array.

Parameters
elementsThe one-dimensional representation of the elements of the array.
vectorizerThe vectorizer that relates multiple tuple coordinates to a one-dimensional index.

◆ StorageArray() [2/4]

template<typename _Element , typename _Vectorizer >
GQCP::StorageArray< _Element, _Vectorizer >::StorageArray ( const Element element,
const Vectorizer vectorizer 
)
inline

Create an array with equal elements.

Parameters
elementsThe one-dimensional representation of the elements of the array.
vectorizerThe vectorizer that relates multiple tuple coordinates to a one-dimensional index.

◆ StorageArray() [3/4]

template<typename _Element , typename _Vectorizer >
GQCP::StorageArray< _Element, _Vectorizer >::StorageArray ( const Vectorizer vectorizer)
inline

Create an array with defaultly initialized elements.

Parameters
vectorizerThe vectorizer that relates multiple tuple coordinates to a one-dimensional index.

◆ StorageArray() [4/4]

template<typename _Element , typename _Vectorizer >
template<size_t N>
GQCP::StorageArray< _Element, _Vectorizer >::StorageArray ( const std::array< Element, N > &  elements,
const Vectorizer vectorizer 
)
inline

Create an array from a std::array and a vectorizer.

Parameters
elementsThe one-dimensional representation of the elements of the array.
vectorizerThe vectorizer that relates multiple tuple coordinates to a one-dimensional index.
Template Parameters
NThe number of elements in the std::array.

Member Function Documentation

◆ asVector()

template<typename _Element , typename _Vectorizer >
template<typename Z = Vectorizer>
enable_if_t< std::is_same< Z, VectorVectorizer >::value, VectorX< Element > > GQCP::StorageArray< _Element, _Vectorizer >::asVector ( )
inline

Convert this StorageArray to a Vector, if possible.

Note
This method is only available for StorageArrays that admit vector-like storage.

◆ elements() [1/2]

template<typename _Element , typename _Vectorizer >
std::vector< Element > & GQCP::StorageArray< _Element, _Vectorizer >::elements ( )
inline
Returns
A writable vector of all elements that this array stores.

◆ elements() [2/2]

template<typename _Element , typename _Vectorizer >
const std::vector< Element > & GQCP::StorageArray< _Element, _Vectorizer >::elements ( ) const
inline
Returns
A read-only vector of all elements that this array stores.

◆ operator Element()

template<typename _Element , typename _Vectorizer >
template<typename Z = Vectorizer, typename = typename std::enable_if<std::is_same<Z, ScalarVectorizer>::value>::type>
GQCP::StorageArray< _Element, _Vectorizer >::operator Element ( ) const
inline

A conversion operator between a scalar array and the underlying scalar.

For the enable_if-part, check https://stackoverflow.com/a/18101382.

◆ operator()() [1/2]

template<typename _Element , typename _Vectorizer >
template<typename... Indices>
Element & GQCP::StorageArray< _Element, _Vectorizer >::operator() ( const Indices &...  indices)
inline
Parameters
indicesA set of coordinates that accesses this array.
Returns
The element that is stored at the given coordinate indices.

◆ operator()() [2/2]

template<typename _Element , typename _Vectorizer >
template<typename... Indices>
const Element & GQCP::StorageArray< _Element, _Vectorizer >::operator() ( const Indices &...  indices) const
inline
Parameters
indicesA set of coordinates that accesses this array.
Returns
The element that is stored at the given coordinate indices.

◆ vectorizer()

template<typename _Element , typename _Vectorizer >
const Vectorizer & GQCP::StorageArray< _Element, _Vectorizer >::vectorizer ( ) const
inline
Returns
The vectorizer that relates multiple tuple coordinates to a one-dimensional index.

Member Data Documentation

◆ NumberOfAxes

template<typename _Element , typename _Vectorizer >
constexpr auto GQCP::StorageArray< _Element, _Vectorizer >::NumberOfAxes = Vectorizer::NumberOfAxes
staticconstexpr

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