MADNESS 0.10.1
|
A simple, fixed dimension vector. More...
#include <vector.h>
Public Types | |
using | arrayT = std::array< T, N > |
The underlying array type. | |
using | const_iterator = typename arrayT::const_iterator |
Const iterator type. | |
using | const_reference = typename arrayT::const_reference |
Const reference type. | |
using | const_reverse_iterator = typename arrayT::const_reverse_iterator |
Const reverse iterator type. | |
using | difference_type = typename arrayT::difference_type |
Difference type. | |
using | iterator = typename arrayT::iterator |
Iterator type. | |
using | reference = typename arrayT::reference |
Reference type. | |
using | reverse_iterator = typename arrayT::reverse_iterator |
Reverse iterator type. | |
using | size_type = typename arrayT::size_type |
Size type. | |
using | value_type = typename arrayT::value_type |
The data value type. | |
Public Member Functions | |
Vector ()=default | |
Default constructor; does not initialize vector contents. | |
template<typename Q > | |
Vector (const Q(&t)[N]) | |
Construct from a C-style array of the same dimension. | |
template<typename Q > | |
Vector (const std::array< Q, N > &t) | |
Construct from a std::array of equal length. | |
Vector (const std::initializer_list< T > &list) | |
List initialization constructor (deep copy because Vector is POD). | |
template<typename Q , typename A > | |
Vector (const std::vector< Q, A > &t) | |
Construct from an STL vector of equal or greater length. | |
template<typename Q > | |
Vector (const Vector< Q, N > &other) | |
Copy constructor is deep (because Vector is POD). | |
Vector (const Vector< T, N > &other) | |
Copy constructor is deep (because Vector is POD). | |
template<typename Q > | |
Vector (Q t) | |
Initialize all elements to value t . | |
reference | at (size_type i) |
Access element i of the Vector with bounds checking. | |
const_reference | at (size_type i) const |
Access element i of the Vector with bounds checking. | |
reference | back () |
Access the last element. | |
const_reference | back () const |
Access the last element. | |
iterator | begin () |
Iterator starting at the first element. | |
const_iterator | begin () const |
Const iterator starting at the first element. | |
T * | data () |
Direct access to the underlying array. | |
const T * | data () const |
Direct access to the underlying array. | |
bool | empty () const |
Check if the Vector is empty. | |
iterator | end () |
Iterator to the end (past the last element). | |
const_iterator | end () const |
Const iterator to the end (past the last element). | |
void | fill (const T &t) |
Fill the Vector with the specified value. | |
reference | front () |
Access the first element. | |
const_reference | front () const |
Access the first element. | |
hashT | hash () const |
Support for MADNESS hashing. | |
size_type | max_size () const |
Get the maximum size of the Vector . | |
T | normf () const |
Calculate the 2-norm of the vector elements. | |
operator std::array< T, N > () | |
Type conversion to a std::array . | |
template<typename Q > | |
Vector< T, N > & | operator*= (Q q) |
In-place, element-wise multiplcation by a scalar. | |
template<typename Q > | |
Vector< T, N > & | operator+= (const Vector< Q, N > &q) |
In-place, element-wise addition of another Vector . | |
template<typename Q > | |
Vector< T, N > & | operator-= (const Vector< Q, N > &q) |
In-place, element-wise subtraction of another Vector . | |
Vector< T, N > & | operator= (const std::initializer_list< T > &list) |
List initialization assignment (deep copy because Vector is POD). | |
template<typename Q , typename A > | |
Vector< T, N > & | operator= (const std::vector< Q, A > &other) |
Assignment is deep (because Vector is POD). | |
Vector< T, N > & | operator= (const T &t) |
Fill from a scalar value. | |
template<typename Q > | |
Vector< T, N > & | operator= (const Vector< Q, N > &other) |
Assignment is deep (because Vector is POD). | |
Vector< T, N > & | operator= (const Vector< T, N > &other) |
Assignment is deep (because a Vector is POD). | |
reference | operator[] (size_type i) |
Access element i of the Vector . | |
const_reference | operator[] (size_type i) const |
Access element i of the Vector . | |
reverse_iterator | rbegin () |
Reverse iterator starting at the last element. | |
const_reverse_iterator | rbegin () const |
Const reverse iterator starting at the last element. | |
reverse_iterator | rend () |
Reverse iterator to the beginning (before the first element). | |
const_reverse_iterator | rend () const |
Const reverse iterator to the beginning (before the first element). | |
template<typename Archive > | |
void | serialize (Archive &ar) |
Support for MADNESS serialization. | |
size_type | size () const |
Accessor for the number of elements in the Vector . | |
void | swap (Vector< T, N > &other) |
Swap the contents with another Vector . | |
Static Public Attributes | |
static const size_type | static_size = N |
The size of the Vector . | |
Private Attributes | |
arrayT | data_ |
The underlying array. | |
Friends | |
template<typename Q , std::size_t M> | |
class | Vector |
bool | operator!= (const Vector< T, N > &l, const Vector< T, N > &r) |
Check if any element is not equal to its partner in the other Vector . | |
bool | operator< (const Vector< T, N > &l, const Vector< T, N > &r) |
Compare l and r lexicographically. | |
std::ostream & | operator<< (std::ostream &s, const Vector< T, N > &v) |
Output a Vector to stream. | |
bool | operator<= (const Vector< T, N > &l, const Vector< T, N > &r) |
Compare l and r lexicographically. | |
bool | operator== (const Vector< T, N > &l, const Vector< T, N > &r) |
Check if each element is equal to its partner in the other Vector . | |
bool | operator> (const Vector< T, N > &l, const Vector< T, N > &r) |
Compare l and r lexicographically. | |
bool | operator>= (const Vector< T, N > &l, const Vector< T, N > &r) |
Compare l and r lexicographically. | |
A simple, fixed dimension vector.
This class eliminates memory allocation cost, is just POD (it can be copied easily and allocated on the stack), and the known dimension permits aggressive compiler optimizations.
Provides additional mathematical and I/O operations.
T | The type of data stored in the vector. |
N | The size of the vector. |
The underlying array type.
using madness::Vector< T, N >::const_iterator = typename arrayT::const_iterator |
Const iterator type.
using madness::Vector< T, N >::const_reference = typename arrayT::const_reference |
Const reference type.
using madness::Vector< T, N >::const_reverse_iterator = typename arrayT::const_reverse_iterator |
Const reverse iterator type.
using madness::Vector< T, N >::difference_type = typename arrayT::difference_type |
Difference type.
using madness::Vector< T, N >::iterator = typename arrayT::iterator |
Iterator type.
using madness::Vector< T, N >::reference = typename arrayT::reference |
Reference type.
using madness::Vector< T, N >::reverse_iterator = typename arrayT::reverse_iterator |
Reverse iterator type.
using madness::Vector< T, N >::size_type = typename arrayT::size_type |
Size type.
using madness::Vector< T, N >::value_type = typename arrayT::value_type |
The data value type.
|
default |
Default constructor; does not initialize vector contents.
|
inlineexplicit |
Initialize all elements to value t
.
Q | The type of t . |
[in] | t | The value used to initialized the Vector . |
References madness::Vector< T, N >::fill().
|
inlineexplicit |
Construct from a C-style array of the same dimension.
Q | The type of data in t . |
[in] | t | The C-style array. |
References madness::Vector< T, N >::data_, and N.
|
inlineexplicit |
Construct from an STL vector of equal or greater length.
Q | Type of data stored in the std::vector . |
A | Allocator type for the std::vector . |
[in] | t | The std::vector . |
References madness::Vector< T, N >::operator=().
|
inlineexplicit |
Construct from a std::array
of equal length.
Q | Type of data stored in the original std::array . |
[in] | t | The std::array . |
References madness::Vector< T, N >::data_.
|
inline |
Copy constructor is deep (because Vector
is POD).
[in] | other | The Vector to copy. |
References madness::Vector< T, N >::data_, MADNESS_PRAGMA_GCC, and madness::pop().
|
inline |
Copy constructor is deep (because Vector
is POD).
Q | Type of the Vector to copy. |
[in] | other | The Vector to copy. |
References madness::Vector< T, N >::data_.
|
inline |
List initialization constructor (deep copy because Vector
is POD).
This constructor allows initialization using, e.g.,
MadnessException | if the list does not contain exactly N elements. |
[in] | list | The initializer list; elements are copied to the Vector . |
References madness::Vector< T, N >::data_, MADNESS_ASSERT, and N.
Access element i
of the Vector
with bounds checking.
[in] | i | The index. |
i
. References madness::Vector< T, N >::data_.
|
inline |
Access element i
of the Vector
with bounds checking.
[in] | i | The index. |
i
. References madness::Vector< T, N >::data_.
|
inline |
Access the last element.
References madness::Vector< T, N >::data_.
|
inline |
Access the last element.
References madness::Vector< T, N >::data_.
|
inline |
Iterator starting at the first element.
References madness::Vector< T, N >::data_.
Referenced by main().
|
inline |
Const iterator starting at the first element.
References madness::Vector< T, N >::data_.
Direct access to the underlying array.
References madness::Vector< T, N >::data_.
Direct access to the underlying array.
References madness::Vector< T, N >::data_.
|
inline |
Check if the Vector
is empty.
Vector
is empty; false otherwise. This should be false unless N == 0
. References madness::Vector< T, N >::data_.
|
inline |
Iterator to the end (past the last element).
References madness::Vector< T, N >::data_.
|
inline |
Const iterator to the end (past the last element).
References madness::Vector< T, N >::data_.
|
inline |
Fill the Vector
with the specified value.
[in] | t | The value used to fill the Vector . |
References madness::Vector< T, N >::data_.
Referenced by madness::Vector< T, N >::Vector(), madness::cartesian_grid< NDIM >::initialize(), madness::Vector< T, N >::operator=(), test_arithmetic(), and test_lowrank_function().
|
inline |
Access the first element.
References madness::Vector< T, N >::data_.
|
inline |
Access the first element.
References madness::Vector< T, N >::data_.
|
inline |
Support for MADNESS hashing.
References madness::Vector< T, N >::data_, and madness::hash_value().
|
inline |
Get the maximum size of the Vector
.
N
. References madness::Vector< T, N >::data_.
|
inline |
Calculate the 2-norm of the vector elements.
References d, madness::Vector< T, N >::data_, N, and T().
Referenced by madness::Diamagnetic_potential_factor::Diamagnetic_potential_factor(), madness::Diamagnetic_potential_factor::apply_potential(), bend(), madness::Diamagnetic_potential_factor::compute_nabla_R_div_R(), madness::Diamagnetic_potential_factor::compute_R_times_T_commutator_scalar_term_numerically(), madness::Diamagnetic_potential_factor::compute_U2(), madness::NuclearCorrelationFactor::dsmoothed_unitvec(), madness::Diamagnetic_potential_factor::factor_with_phase(), ExactSpinor::Fvalue(), Ansatz0::make_guess(), make_Hv(), make_pw_matrix(), madness::Molecule::nuclear_attraction_potential_second_derivative(), sgl_guess::operator()(), madness::R_times_arg_div_R::operator()(), stepfunction::operator()(), ncf::operator()(), madness::NuclearCorrelationFactor::R_functor::operator()(), madness::NuclearCorrelationFactor::U1_functor::operator()(), madness::NuclearCorrelationFactor::U1_atomic_functor::operator()(), madness::NuclearCorrelationFactor::U1_dot_U1_functor::operator()(), madness::NuclearCorrelationFactor::U2_functor::operator()(), madness::NuclearCorrelationFactor::U3_functor::operator()(), madness::NuclearCorrelationFactor::U2_atomic_functor::operator()(), madness::NuclearCorrelationFactor::U3_atomic_functor::operator()(), madness::NuclearCorrelationFactor::square_times_V_functor::operator()(), madness::NuclearCorrelationFactor::square_times_V_derivative_functor::operator()(), madness::NuclearCorrelationFactor::RX_functor::operator()(), madness::NuclearCorrelationFactor::U1X_functor::operator()(), madness::NuclearCorrelationFactor::U2X_functor::operator()(), madness::NuclearCorrelationFactor::U3X_functor::operator()(), refpotfunctor::operator()(), madness::Znemo::s_orbital::operator()(), madness::Znemo::p_orbital::operator()(), madness::spherical_box< NDIM >::operator()(), p_minus(), p_plus(), ExactSpinor::psivalue(), slater(), madness::NuclearCorrelationFactor::smoothed_unitvec(), madness::Slater::Sp(), madness::Polynomial< N >::Sp(), test_add(), test_conversion(), test_inner(), test_Kcommutator(), and madness::unitvec().
|
inline |
Type conversion to a std::array
.
std::array
.
|
inline |
In-place, element-wise multiplcation by a scalar.
Q | Type of the scalar. |
[in] | q | The scalar. |
References madness::Vector< T, N >::data_, N, and q().
|
inline |
List initialization assignment (deep copy because Vector
is POD).
This assignment operator allows initialization using, e.g.,
MadnessException | if the list does not contain exactly N elements. |
[in] | list | The initializer list; elements are copied to the Vector . |
References madness::Vector< T, N >::data_, MADNESS_ASSERT, and N.
|
inline |
Assignment is deep (because Vector
is POD).
Make sure the size of other
is at least N
.
Q | The type of data in the std::vector . |
A | The allocator type for the std::vector . |
[in] | other | The std::vector to copy. |
Vector
. References madness::Vector< T, N >::data_, MADNESS_ASSERT, and N.
|
inline |
Fill from a scalar value.
[in] | t | The scalar to use for filling. |
Vector
. References madness::Vector< T, N >::fill().
|
inline |
Assignment is deep (because Vector
is POD).
Q | The type of the Vector to copy. |
[in] | other | The Vector to copy. |
Vector
. References madness::Vector< T, N >::data_.
|
inline |
Assignment is deep (because a Vector
is POD).
[in] | other | The Vector to copy. |
Vector
. References madness::Vector< T, N >::data_.
Referenced by madness::Vector< T, N >::Vector().
|
inline |
Access element i
of the Vector
.
Bounds checking is not performed.
[in] | i | The index. |
i
. References madness::Vector< T, N >::data_.
|
inline |
Access element i
of the Vector
.
Bounds checking is not performed.
[in] | i | The index. |
i
. References madness::Vector< T, N >::data_.
|
inline |
Reverse iterator starting at the last element.
References madness::Vector< T, N >::data_.
|
inline |
Const reverse iterator starting at the last element.
References madness::Vector< T, N >::data_.
|
inline |
Reverse iterator to the beginning (before the first element).
References madness::Vector< T, N >::data_.
|
inline |
Const reverse iterator to the beginning (before the first element).
References madness::Vector< T, N >::data_.
|
inline |
Support for MADNESS serialization.
Archive | The archive type. |
[in,out] | ar | The archive. |
References madness::Vector< T, N >::data_.
|
inline |
Accessor for the number of elements in the Vector
.
References madness::Vector< T, N >::data_.
Referenced by madness::PlotParameters::origin().
|
inline |
Swap the contents with another Vector
.
[in] | other | The other vector. |
References madness::Vector< T, N >::data_.
Referenced by madness::swap().
|
friend |
|
private |
The underlying array.
Referenced by madness::Vector< T, N >::Vector(), madness::Vector< T, N >::Vector(), madness::Vector< T, N >::Vector(), madness::Vector< T, N >::Vector(), madness::Vector< T, N >::Vector(), madness::Vector< T, N >::at(), madness::Vector< T, N >::at(), madness::Vector< T, N >::back(), madness::Vector< T, N >::back(), madness::Vector< T, N >::begin(), madness::Vector< T, N >::begin(), madness::Vector< T, N >::data(), madness::Vector< T, N >::data(), madness::Vector< T, N >::empty(), madness::Vector< T, N >::end(), madness::Vector< T, N >::end(), madness::Vector< T, N >::fill(), madness::Vector< T, N >::front(), madness::Vector< T, N >::front(), madness::Vector< T, N >::hash(), madness::Vector< T, N >::max_size(), madness::Vector< T, N >::normf(), madness::Vector< double, NDIM >::operator std::array< double, N >(), madness::Vector< T, N >::operator*=(), madness::Vector< T, N >::operator+=(), madness::Vector< T, N >::operator-=(), madness::Vector< T, N >::operator=(), madness::Vector< T, N >::operator=(), madness::Vector< T, N >::operator=(), madness::Vector< T, N >::operator=(), madness::Vector< T, N >::operator[](), madness::Vector< T, N >::operator[](), madness::Vector< T, N >::rbegin(), madness::Vector< T, N >::rbegin(), madness::Vector< T, N >::rend(), madness::Vector< T, N >::rend(), madness::Vector< T, N >::serialize(), madness::Vector< T, N >::size(), and madness::Vector< T, N >::swap().
|
static |
The size of the Vector
.