Go to the documentation of this file.
23 #ifndef COM_DAFER45_TBTK_VECTOR_ND
24 #define COM_DAFER45_TBTK_VECTOR_ND
30 #include <initializer_list>
45 VectorNd(std::initializer_list<double> components);
48 VectorNd(
const std::vector<double> &components);
54 const double&
operator[](
unsigned int n)
const;
112 "VectorNd::operator+()",
113 "Incompatible dimensions. Left hand side has "
114 << data.
getSize() <<
" components, while the right hand side"
115 <<
" has " << rhs.
getSize() <<
" components.",
120 for(
unsigned int n = 0; n < data.
getSize(); n++)
121 result.data[n] = data[n] + rhs.data[n];
129 "VectorNd::operator-()",
130 "Incompatible dimensions. Left hand side has "
131 << data.
getSize() <<
" components, while the right hand side"
132 <<
" has " << rhs.data.
getSize() <<
" components.",
137 for(
unsigned int n = 0; n < data.
getSize(); n++)
138 result.data[n] = data[n] - rhs.data[n];
145 for(
unsigned int n = 0; n < data.
getSize(); n++)
146 result.data[n] = -data[n];
153 for(
unsigned int n = 0; n < data.
getSize(); n++)
154 result.data[n] = data[n]*rhs;
161 for(
unsigned int n = 0; n < rhs.data.
getSize(); n++)
162 result.data[n] = lhs*rhs.data[n];
169 for(
unsigned int n = 0; n < data.
getSize(); n++)
170 result.data[n] = data[n]/rhs;
176 return (*
this)/
norm();
182 "VectorNd::parallel()",
183 "Incompatible dimensions.",
197 "VectorNd::dotProduct()",
198 "Incompatible dimensions. Left hand side has "
199 << lhs.data.
getSize() <<
" components, while the right hand"
200 <<
" side has " << rhs.data.
getSize() <<
" components.",
205 for(
unsigned int n = 0; n < lhs.data.
getSize(); n++)
206 dp += lhs.data[n]*rhs.data[n];
212 std::vector<double> result;
213 for(
unsigned int n = 0; n < data.
getSize(); n++)
214 result.push_back(data[n]);
225 for(
unsigned int n = 0; n < v.data.
getSize(); n++){
unsigned int getSize() const
Definition: VectorNd.h:219
double & operator[](unsigned int n)
Definition: VectorNd.h:101
unsigned int getSize() const
Definition: CArray.h:313
const VectorNd unit() const
Definition: VectorNd.h:175
const VectorNd operator*(double rhs) const
Definition: VectorNd.h:151
const VectorNd operator+(const VectorNd &rhs) const
Definition: VectorNd.h:109
double norm() const
Definition: VectorNd.h:190
friend std::ostream & operator<<(std::ostream &stream, const VectorNd &v)
Definition: VectorNd.h:223
const VectorNd operator/(double rhs) const
Definition: VectorNd.h:167
Definition: VectorNd.h:36
const std::vector< double > getStdVector() const
Definition: VectorNd.h:211
const VectorNd operator-() const
Definition: VectorNd.h:143
static double dotProduct(const VectorNd &lhs, const VectorNd &rhs)
Definition: VectorNd.h:194
const VectorNd parallel(const VectorNd &v) const
Definition: VectorNd.h:179
std::ostream & operator<<(std::ostream &stream, const HoppingAmplitude &hoppingAmplitude)
Definition: HoppingAmplitude.h:315
const Vector2d operator*(double lhs, const Vector2d &rhs)
Definition: Vector2d.h:129
Container for a C style array.