25 #ifndef FIBER_NORMALIZE_H_
26 #define FIBER_NORMALIZE_H_
34 template <
typename Scalar,
class Exp>
40 template <
typename Scalar,
class Exp>
46 template <
typename Scalar,
class Exp>
49 for (
int i = 0; i < A.
size(); i++) {
50 r += std::pow(A[i], n);
52 return std::pow(r, 1.0/n);
57 template <
typename Scalar,
class Exp>
86 template <
typename Scalar,
class Exp>
94 #endif // FIBER_NORMALIZE_H_
expression template for rvalues
Scalar SquaredNorm(_RValue< Scalar, Exp > const &A)
Return the squared 2-norm of a vector.
Scalar operator()(Index i, Index j) const
Exp const & v_
underlying expression
_Normalize< Scalar, Exp > Normalize(_RValue< Scalar, Exp > const &A)
Prresents a view of a matrix or vector where each element is normalized, such that the sum of the ele...
Expression template presents a view of a matrix where each element is normalized, such that the sum o...
Scalar Norm(_RValue< Scalar, Exp > const &A)
Return the 2-norm of a vector.
Scalar operator[](Index i) const
Scalar Dot(_RValue< Scalar, Exp1 > const &A, _RValue< Scalar, Exp2 > const &B)
Dot product of two vectors.
Scalar norm_
2-norm of elements in the expression