32 #ifndef MADNESS_WORLD_VECTOR_H__INCLUDED
33 #define MADNESS_WORLD_VECTOR_H__INCLUDED
63 template <
typename T, std::
size_t N>
68 template <
typename Q,std::
size_t M>
105 template <
typename Q>
115 template <
typename Q,
typename A>
116 explicit Vector(
const std::vector<Q, A>& t) {
124 template <
typename Q>
125 explicit Vector(
const std::array<Q, N>& t) {
144 template <
typename Q>
159 Vector(
const std::initializer_list<T>& list) :
180 template <
typename Q>
193 template <
typename Q,
typename A>
228 operator std::array<T,N> () {
return data_; }
365 template <
typename Q>
377 template <
typename Q>
389 template <
typename Q>
402 for(std::size_t i=0; i<
N; ++i)
411 template <
typename Archive>
484 using madness::operators::operator<<;
496 template <
typename T, std::
size_t N>
514 template <
typename T, std::
size_t N,
typename U>
517 for (std::size_t i = 0; i <
N; ++i)
533 template <
typename T,
typename U, std::
size_t N>
536 for (std::size_t i = 0; i <
N; ++i)
551 template <
typename T, std::
size_t N,
typename U>
554 for (std::size_t i = 0; i <
N; ++i)
568 template <
typename T, std::
size_t N,
typename U>
571 for (std::size_t i = 0; i <
N; ++i)
586 template <
typename T, std::
size_t N,
typename U>
589 for (std::size_t i = 0; i <
N; ++i)
603 template <
typename T, std::
size_t N,
typename U>
606 for (std::size_t i = 0; i <
N; ++i)
621 template <
typename T, std::
size_t N,
typename U>
624 for (std::size_t i = 0; i <
N; ++i)
639 template <
typename T, std::
size_t N>
642 for (std::size_t i = 0; i <
N; ++i)
655 template <
typename T, std::
size_t N>
656 typename std::enable_if<N==3, Vector<T,N> >
::type
659 result[0]=l[1]*r[2] - r[1]*l[2];
660 result[1]=l[2]*r[0] - r[2]*l[0];
661 result[2]=l[0]*r[1] - r[0]*l[1];
710 template<
typename T,
typename... Ts>
712 return Vector<
T,
sizeof...(Ts) + 1> {
713 std::array<
T,
sizeof...(Ts) + 1>
714 {{ t,
static_cast<T>(ts)... }}
728 template<
typename T, std::
size_t N>
733 return r * (1.0/
norm);
double q(double t)
Definition: DKops.h:18
Interface templates for the archives (serialization).
Supplements to the std::array class, such as I/O operations, for convenience.
A simple, fixed dimension vector.
Definition: vector.h:64
friend 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.
Definition: vector.h:438
typename arrayT::reverse_iterator reverse_iterator
Reverse iterator type.
Definition: vector.h:79
typename arrayT::iterator iterator
Iterator type.
Definition: vector.h:77
typename arrayT::const_reference const_reference
Const reference type.
Definition: vector.h:82
Vector< T, N > & operator=(const T &t)
Fill from a scalar value.
Definition: vector.h:220
Vector< T, N > & operator=(const Vector< Q, N > &other)
Assignment is deep (because Vector is POD).
Definition: vector.h:181
bool empty() const
Check if the Vector is empty.
Definition: vector.h:282
typename arrayT::value_type value_type
The data value type.
Definition: vector.h:76
const_reference front() const
Access the first element.
Definition: vector.h:324
friend std::ostream & operator<<(std::ostream &s, const Vector< T, N > &v)
Output a Vector to stream.
Definition: vector.h:483
Vector< T, N > & operator=(const std::vector< Q, A > &other)
Assignment is deep (because Vector is POD).
Definition: vector.h:194
Vector(Q t)
Initialize all elements to value t.
Definition: vector.h:97
T normf() const
Calculate the 2-norm of the vector elements.
Definition: vector.h:400
const_reference back() const
Access the last element.
Definition: vector.h:334
friend bool operator<=(const Vector< T, N > &l, const Vector< T, N > &r)
Compare l and r lexicographically.
Definition: vector.h:465
reverse_iterator rbegin()
Reverse iterator starting at the last element.
Definition: vector.h:255
friend bool operator<(const Vector< T, N > &l, const Vector< T, N > &r)
Compare l and r lexicographically.
Definition: vector.h:447
Vector(const std::initializer_list< T > &list)
List initialization constructor (deep copy because Vector is POD).
Definition: vector.h:159
T * data()
Direct access to the underlying array.
Definition: vector.h:339
iterator begin()
Iterator starting at the first element.
Definition: vector.h:234
const_reference at(size_type i) const
Access element i of the Vector with bounds checking.
Definition: vector.h:314
Vector(const Q(&t)[N])
Construct from a C-style array of the same dimension.
Definition: vector.h:106
Vector(const std::vector< Q, A > &t)
Construct from an STL vector of equal or greater length.
Definition: vector.h:116
iterator end()
Iterator to the end (past the last element).
Definition: vector.h:244
Vector< T, N > & operator=(const std::initializer_list< T > &list)
List initialization assignment (deep copy because Vector is POD).
Definition: vector.h:210
Vector< T, N > & operator*=(Q q)
In-place, element-wise multiplcation by a scalar.
Definition: vector.h:366
void fill(const T &t)
Fill the Vector with the specified value.
Definition: vector.h:355
reference at(size_type i)
Access element i of the Vector with bounds checking.
Definition: vector.h:308
reference front()
Access the first element.
Definition: vector.h:319
reverse_iterator rend()
Reverse iterator to the beginning (before the first element).
Definition: vector.h:265
Vector(const Vector< T, N > &other)
Copy constructor is deep (because Vector is POD).
Definition: vector.h:132
const_reference operator[](size_type i) const
Access element i of the Vector.
Definition: vector.h:302
const_iterator begin() const
Const iterator starting at the first element.
Definition: vector.h:239
size_type size() const
Accessor for the number of elements in the Vector.
Definition: vector.h:276
void swap(Vector< T, N > &other)
Swap the contents with another Vector.
Definition: vector.h:350
size_type max_size() const
Get the maximum size of the Vector.
Definition: vector.h:287
typename arrayT::const_reverse_iterator const_reverse_iterator
Const reverse iterator type.
Definition: vector.h:80
void serialize(Archive &ar)
Support for MADNESS serialization.
Definition: vector.h:412
const_iterator end() const
Const iterator to the end (past the last element).
Definition: vector.h:249
Vector()=default
Default constructor; does not initialize vector contents.
friend bool operator>(const Vector< T, N > &l, const Vector< T, N > &r)
Compare l and r lexicographically.
Definition: vector.h:456
friend 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.
Definition: vector.h:429
Vector< T, N > & operator+=(const Vector< Q, N > &q)
In-place, element-wise addition of another Vector.
Definition: vector.h:378
const_reverse_iterator rbegin() const
Const reverse iterator starting at the last element.
Definition: vector.h:260
typename arrayT::const_iterator const_iterator
Const iterator type.
Definition: vector.h:78
Vector(const Vector< Q, N > &other)
Copy constructor is deep (because Vector is POD).
Definition: vector.h:145
hashT hash() const
Support for MADNESS hashing.
Definition: vector.h:419
typename arrayT::difference_type difference_type
Difference type.
Definition: vector.h:84
Vector< T, N > & operator=(const Vector< T, N > &other)
Assignment is deep (because a Vector is POD).
Definition: vector.h:170
Vector< T, N > & operator-=(const Vector< Q, N > &q)
In-place, element-wise subtraction of another Vector.
Definition: vector.h:390
typename arrayT::reference reference
Reference type.
Definition: vector.h:81
reference back()
Access the last element.
Definition: vector.h:329
reference operator[](size_type i)
Access element i of the Vector.
Definition: vector.h:295
static const size_type static_size
The size of the Vector.
Definition: vector.h:87
arrayT data_
The underlying array.
Definition: vector.h:72
const T * data() const
Direct access to the underlying array.
Definition: vector.h:344
const_reverse_iterator rend() const
Const reverse iterator to the beginning (before the first element).
Definition: vector.h:270
std::array< T, N > arrayT
The underlying array type.
Definition: vector.h:66
Vector(const std::array< Q, N > &t)
Construct from a std::array of equal length.
Definition: vector.h:125
friend bool operator>=(const Vector< T, N > &l, const Vector< T, N > &r)
Compare l and r lexicographically.
Definition: vector.h:474
typename arrayT::size_type size_type
Size type.
Definition: vector.h:83
Fcwf copy(Fcwf psi)
Definition: fcwf.cc:338
auto T(World &world, response_space &f) -> response_space
Definition: global_functions.cc:34
static const double v
Definition: hatom_sf_dirac.cc:20
Macros and tools pertaining to the configuration of MADNESS.
#define MADNESS_PRAGMA_GCC(x)
Definition: madness_config.h:205
Defines madness::MadnessException for exception handling.
#define MADNESS_ASSERT(condition)
Assert a condition that should be free of side-effects since in release builds this might be a no-op.
Definition: madness_exception.h:134
double norm(const T &t)
Definition: adquad.h:42
File holds all helper structures necessary for the CC_Operator and CC2 class.
Definition: DFParameters.h:10
std::vector< CCPairFunction< T, NDIM > > operator+(const std::vector< CCPairFunction< T, NDIM >> c1, const std::vector< CCPairFunction< T, NDIM > > &c2)
Definition: ccpairfunction.h:1047
std::vector< CCPairFunction< T, NDIM > > operator-(const std::vector< CCPairFunction< T, NDIM >> c1, const std::vector< CCPairFunction< T, NDIM > > &c2)
Definition: ccpairfunction.h:1055
static double pop(std::vector< double > &v)
Definition: SCF.cc:113
std::vector< CCPairFunction< T, NDIM > > operator*(const double fac, const std::vector< CCPairFunction< T, NDIM > > &arg)
Definition: ccpairfunction.h:1084
Vector< T, N > unitvec(const Vector< T, N > &r, const double eps=1.e-6)
Construct a unit-Vector that has the same direction as r.
Definition: vector.h:729
std::size_t hashT
The hash value type.
Definition: worldhash.h:145
double inner(response_space &a, response_space &b)
Definition: response_functions.h:442
std::string type(const PairType &n)
Definition: PNOParameters.h:18
madness::hashT hash_value(const std::array< T, N > &a)
Hash std::array with madness hash.
Definition: array_addons.h:78
Vector< T, sizeof...(Ts)+1 > vec(T t, Ts... ts)
Factory function for creating a madness::Vector.
Definition: vector.h:711
void swap(Vector< T, N > &l, Vector< T, N > &r)
Swap the contents of two Vectors.
Definition: vector.h:497
std::vector< Function< TENSOR_RESULT_TYPE(T, R), NDIM > > cross(const std::vector< Function< T, NDIM > > &f, const std::vector< Function< R, NDIM > > &g, bool do_refine=false, bool fence=true)
shorthand cross operator
Definition: vmra.h:2013
double Q(double a)
Definition: relops.cc:20
void d()
Definition: test_sig.cc:79
#define N
Definition: testconv.cc:37
Defines hash functions for use in distributed containers.