1#ifndef CLASSIC_FVector_HH
2#define CLASSIC_FVector_HH
37template<
class T,
int N>
77template<
class T,
int N>
81template<
class T,
int N>
85template<
class T,
int N>
89template<
class T,
int N>
93template<
class T,
int N>
97template<
class T,
int N>
101template<
class T,
int N>
105template<
class T,
int N>
111template<
class T,
int N>
116template<
class T,
int N>
121template<
class T,
int N>
126template<
class T,
int N>
131template<
class T,
int N>
134 std::transform(this->
begin(), this->
end(), result.
begin(), std::negate<T>());
138template<
class T,
int N>
141 std::bind(std::multiplies<T>(), std::placeholders::_1, val));
145template<
class T,
int N>
148 std::bind(std::divides<T>(), std::placeholders::_1, val));
152template<
class T,
int N>
154 std::transform(this->
begin(), this->
end(), rhs.
begin(), this->begin(),
159template<
class T,
int N>
161 std::transform(this->
begin(), this->
end(), rhs.
begin(), this->begin(),
168template<
class T,
int N>
172 result.
begin(), std::plus<T>());
176template<
class T,
int N>
180 result.
begin(), std::minus<T>());
186template<
class T,
int N>
188 return std::inner_product(lhs.
begin(), lhs.
end(), rhs.
begin(), T(0));
191template<
class T,
int N>
197template<
class T,
int N>
204template<
class T,
int N>
208 std::bind(std::multiplies<T>(), std::placeholders::_1, x));
212template<
class T,
int N>
214 return std::sqrt(std::inner_product(V.
begin(), V.
end(), V.
begin(), T(0)));
217template<
class T,
int N>
221 for(
int i = 0; i < V.
size(); ++i) {
222 double dv = D[i] * V[i];
226 return std::sqrt(
sum);
PartBunchBase< T, Dim >::ConstIterator end(PartBunchBase< T, Dim > const &bunch)
PartBunchBase< T, Dim >::ConstIterator begin(PartBunchBase< T, Dim > const &bunch)
FVector< T, N > operator-(const FVector< T, N > &, const FVector< T, N > &)
Subtract.
T scaled_norm(const FArray1D< T, N > D, const FVector< T, N > &V)
Euclidean norm of diagonal matrix D times FVector V.
T euclidean_norm(const FVector< T, N > &)
Euclidean norm.
FVector< T, N > operator/(const FVector< T, N > &, const T &)
Divide.
FVector< T, N > operator+(const FVector< T, N > &, const FVector< T, N > &)
Add.
T operator*(const FVector< T, N > &, const FVector< T, N > &)
Dot product.
T::PETE_Expr_t::PETE_Return_t sum(const PETE_Expr< T > &expr)
A templated representation for one-dimensional arrays.
int size() const
Get array size.
iterator end()
Get iterator pointing past end of array.
iterator begin()
Get iterator pointing to beginning of array.
A templated representation for vectors.
FVector & operator*=(const T &)
Multiply by scalar and assign.
FVector(const T *t)
Constructor.
FVector(const T &t)
Constructor.
FVector(const FArray1D< T, N > &)
Conversion from one-dimensional array.
FVector & operator+=(const FVector &)
Add FVector and assign.
FVector & operator-=(const FVector &)
Subtract FVector and assign.
FVector & operator/=(const T &)
Divide by scalar and assign.
FVector operator-() const
Change sign.