29template <
typename po
int,
typename value>
56 constexpr __HOST__ __DEVICE__ void operator*=(
const double& x) { std::array<T, 3>::operator[](0)*=x; std::array<T, 3>::operator[](1)*=x; std::array<T, 3>::operator[](2)*=x;}
57 constexpr __HOST__ __DEVICE__ void operator/=(
const double& x) { std::array<T, 3>::operator[](0)/=x; std::array<T, 3>::operator[](1)/=x; std::array<T, 3>::operator[](2)/=x;}
59 constexpr __HOST__ __DEVICE__ bool operator==(
const Vector3<T>& rhs)
const {
return std::array<T, 3>::operator[](0) == rhs[0] && std::array<T, 3>::operator[](1) == rhs[1] && std::array<T, 3>::operator[](2) == rhs[2]; }
86 lhs[0].real(lhs[0].
real() + rhs[0]);
87 lhs[1].real(lhs[1].
real() + rhs[1]);
88 lhs[2].real(lhs[2].
real() + rhs[2]);
97template <
typename complex>
102template <
typename complex>
113inline std::ostream&
operator<<(std::ostream& os,
const Vector3<T>& rhs) { os << rhs[0] <<
" " << rhs[1] <<
" " << rhs[2];
return os; }
116inline std::istream&
operator>>(std::istream& is,
Vector3<T>& rhs) {is >> rhs[0] >> rhs[1] >> rhs[2];
return is;}
126 return int(val * 100);
131 return 100 * int(val1 * 100) + int(val2 * 100);
142 constexpr treevector(
int n) : std::vector<T>(n * (n + 1) / 2) {}
145 return this->operator[](n * (n + 1) / 2 + m);
149 return this->operator[](n * (n + 1) / 2 + m);
Описание базовых вспомогательных функций
constexpr Vector3< T > & operator=(Vector3< T > &&other)=default
constexpr void operator+=(const Vector3< T > &rhs)
constexpr bool operator==(const Vector3< T > &rhs) const
constexpr bool operator!=(const Vector3< T > &rhs) const
constexpr Vector3< T > operator/(const double &x) const
constexpr Vector3()=default
constexpr Vector3(const Vector3< T > &other)=default
constexpr void operator/=(const double &x)
constexpr Vector3< T > & operator=(const Vector3< T > &other)=default
constexpr Vector3< T > operator+(const Vector3< T > &rhs) const
constexpr Vector3< T > operator-(const Vector3< T > &rhs) const
constexpr Vector3< T > operator*(const double &x) const
constexpr void operator*=(const double &x)
constexpr Vector3(Vector3< T > &&other)=default
constexpr void operator-=(const Vector3< T > &rhs)
constexpr Vector3(T x, T y, T z)
Vector3< std::complex< double > > Vector3cd
void operator*=(Vector3cd &lhs, const std::complex< double > &x)
std::ostream & operator<<(std::ostream &os, const Vector3< T > &rhs)
constexpr Vector3d imag(const Vector3cd &rhs)
std::array< Vector3d, 3 > Matrix3d
constexpr Vector3d real(const Vector3cd &rhs)
double norm(const Vector3< T > &vec)
double abs(const Vector3< T > &vec)
std::istream & operator>>(std::istream &is, Vector3< T > &rhs)
int doublehash(double val)
constexpr double dot(const Vector3d &lhs, const Vector3d &rhs)
std::complex< double > point2d
constexpr Vector3< T > operator*(const double x, const Vector3< T > &rhs)
Vector3< double > Vector3d
constexpr Vector3< T > cross(const Vector3< T > &lhs, const Vector3< T > &rhs)
particle< point3d, point3d > particle3d3
void operator+=(Vector3cd &lhs, const Vector3d &rhs)
particle< point3d, double > particle3d
const T & operator()(int n, int m) const
treevector & operator=(treevector &&)=default
T & operator()(int n, int m)
constexpr treevector(int n)
treevector(treevector &&)=default
treevector & operator=(const treevector &)=default
treevector(const treevector &)=default