Skip to content
Snippets Groups Projects
Commit a41af436 authored by Uli Sack's avatar Uli Sack Committed by usack
Browse files

tabs->spaces, fix include guard, add editor hints

[[Imported from SVN: r12071]]
parent 8f730428
No related branches found
No related tags found
No related merge requests found
#ifndef __SUMNORM__HH__ // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
#define __SUMNORM__HH__ // vi: set et ts=4 sw=4 sts=4:
#ifndef SUMNORM_HH
#define SUMNORM_HH
#include <cmath> #include <cmath>
...@@ -8,40 +10,40 @@ ...@@ -8,40 +10,40 @@
template <class VectorType> template <class VectorType>
class SumNorm: public Norm<VectorType> class SumNorm: public Norm<VectorType>
{ {
public: public:
SumNorm(double _alpha1, const Norm<VectorType> &_norm1, double _alpha2, const Norm<VectorType> &_norm2) : SumNorm(double _alpha1, const Norm<VectorType> &_norm1, double _alpha2, const Norm<VectorType> &_norm2) :
alpha1(_alpha1), alpha1(_alpha1),
norm1(_norm1), norm1(_norm1),
alpha2(_alpha2), alpha2(_alpha2),
norm2(_norm2) norm2(_norm2)
{} {}
//! Compute the norm of the given vector //! Compute the norm of the given vector
double operator()(const VectorType &v) const double operator()(const VectorType &v) const
{ {
double r1 = norm1.normSquared(v); double r1 = norm1.normSquared(v);
double r2 = norm2.normSquared(v); double r2 = norm2.normSquared(v);
return std::sqrt(alpha1 * r1 + alpha2 * r2); return std::sqrt(alpha1 * r1 + alpha2 * r2);
} }
//! Compute the norm of the difference of two vectors //! Compute the norm of the difference of two vectors
double diff(const VectorType &v1, const VectorType &v2) const double diff(const VectorType &v1, const VectorType &v2) const
{ {
double r1 = norm1.diff(v1,v2); double r1 = norm1.diff(v1,v2);
double r2 = norm2.diff(v1,v2); double r2 = norm2.diff(v1,v2);
return std::sqrt(alpha1 * r1 * r1 + alpha2 * r2 *r2); return std::sqrt(alpha1 * r1 * r1 + alpha2 * r2 *r2);
} }
private: private:
const double alpha1; const double alpha1;
const Norm<VectorType> &norm1; const Norm<VectorType> &norm1;
const double alpha2; const double alpha2;
const Norm<VectorType> &norm2; const Norm<VectorType> &norm2;
}; };
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment