1#ifndef CHI_MATH_DYNAMIC_VECTOR_H
2#define CHI_MATH_DYNAMIC_VECTOR_H
15template <
class NumberFormat>
21template <
class NumberFormat>
30 static_assert(std::is_floating_point<NumberFormat>::value,
31 "Only floating point number formats are "
32 "supported for DVectorNX.");
38 static_assert(std::is_floating_point<NumberFormat>::value,
39 "Only floating point number formats are "
40 "supported for DVectorNX.");
46 static_assert(std::is_floating_point<NumberFormat>::value,
47 "Only floating point number formats are "
48 "supported for DVectorNX.");
109 void resize(
size_t dim,
const NumberFormat& val)
124 typename std::vector<NumberFormat>::iterator
begin()
129 typename std::vector<NumberFormat>::iterator
end() {
return elements_.end(); }
135 if (a != b) {
throw std::length_error(
"Mismatched sizes of DVectorNX"); }
145 for (
int i = 0; i <
size(); ++i)
156 for (
int i = 0; i <
size(); ++i)
169 for (
int i = 0; i <
size(); ++i)
180 for (
int i = 0; i <
size(); ++i)
192 for (
int i = 0; i <
size(); ++i)
202 for (
int i = 0; i <
size(); ++i)
214 for (
int i = 0; i <
size(); ++i)
225 for (
int i = 0; i <
size(); ++i)
237 for (
int i = 0; i <
size(); ++i)
247 for (
int i = 0; i <
size(); ++i)
259 for (
int i = 0; i <
size(); ++i)
270 for (
int i = 0; i <
size(); ++i)
282 NumberFormat value = 0.0;
283 for (
int i = 0; i <
size(); ++i)
293 NumberFormat value = 0.0;
294 for (
int i = 0; i <
size(); ++i)
306 NumberFormat value = 0.0;
307 for (
int i = 0; i <
size(); ++i)
316 NumberFormat norm = this->
Norm();
317 for (
int i = 0; i <
size(); ++i)
324 NumberFormat norm = this->
Norm();
326 for (
int i = 0; i <
size(); ++i)
333 void Set(NumberFormat value)
335 for (
int i = 0; i <
size(); ++i)
342 std::stringstream out;
344 for (
int i = 0; i < (
size() - 1); ++i)
353template <
class NumberFormat>
358 for (
int i = 0; i < that.
size(); ++i)
DynamicVector operator+(const DynamicVector &rhs) const
NumberFormat & at(size_t i)
DynamicVector Normalized() const
DynamicVector & operator=(const std::vector< double > &in)
DynamicVector & operator-=(const DynamicVector &rhs)
DynamicVector & operator=(std::initializer_list< NumberFormat > in)
DynamicVector & operator=(const DynamicVector &other)
DynamicVector(DynamicVector &&other) noexcept
DynamicVector & operator=(DynamicVector &&other) noexcept
DynamicVector(size_t N, NumberFormat value)
void bounds_check(const size_t a, const size_t b) const
DynamicVector operator-(const DynamicVector &rhs) const
DynamicVector & operator+=(const DynamicVector &rhs)
std::vector< NumberFormat > elements_
void resize(size_t dim, const NumberFormat &val)
void Set(NumberFormat value)
std::vector< NumberFormat >::iterator begin()
DynamicVector operator*(const NumberFormat value) const
DynamicVector operator/(const NumberFormat value) const
DynamicVector operator/(const DynamicVector &rhs) const
DynamicVector & operator/=(const DynamicVector &rhs)
NumberFormat & operator[](size_t i)
DynamicVector & operator*=(const NumberFormat value)
DynamicVector & operator/=(const NumberFormat value)
NumberFormat NormSquare() const
std::vector< NumberFormat >::iterator end()
DynamicVector & operator*=(const DynamicVector &rhs)
DynamicVector(std::initializer_list< NumberFormat > in)
bool empty() const noexcept
NumberFormat Norm() const
DynamicVector(const std::vector< double > &in)
const NumberFormat & operator[](size_t i) const
DynamicVector(const DynamicVector &other)
DynamicVector operator*(const DynamicVector &rhs) const
NumberFormat Dot(const DynamicVector &rhs) const
std::string PrintStr() const
void push_back(const NumberFormat &val)
chi_math::DynamicVector< NumberFormat > operator*(const double value, const chi_math::DynamicVector< NumberFormat > &that)