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

adapted to more general low rank operators

[[Imported from SVN: r5642]]
parent 5c96f55a
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@ template <class LowRankFactor, class VectorType>
class FullNorm: public Norm<VectorType>
{
public:
FullNorm(double alpha, const LowRankFactor &lowRankFactor) :
FullNorm(const double alpha, const LowRankFactor &lowRankFactor) :
lowRankFactor_(lowRankFactor),
alpha(alpha)
{}
......@@ -60,43 +60,43 @@ class FullNorm: public Norm<VectorType>
};
template<>
class FullNorm<Dune::BlockVector<Dune::FieldVector<double,1> >, Dune::BlockVector<Dune::FieldVector<double,1> > >:
public Norm<Dune::BlockVector<Dune::FieldVector<double,1> > >
{
typedef <Dune::BlockVector<Dune::FieldVector<double,1> > VectorType;
public:
FullNorm(double alpha, const VectorType &m) :
m(m),
alpha(alpha)
{}
//! Compute the norm of the given vector
double operator()(const VectorType &v) const
{
double r = 0.0;
for(int row = 0; row < v.size(); ++row)
r += m[row] * v[row];
return sqrt(fabs(alpha*r*r));
}
typedef Dune::BlockVector<Dune::FieldVector<double,1> > VectorType;
public:
FullNorm(const double alpha, const VectorType &m) :
m(m),
alpha(alpha)
{}
//! Compute the norm of the given vector
double operator()(const VectorType &v) const
{
double r = 0.0;
for(int row = 0; row < v.size(); ++row)
r += m[row] * v[row];
return sqrt(fabs(alpha*r*r));
}
//! Compute the norm of the difference of two vectors
double diff(const VectorType &v1, const VectorType &v2) const
{
double r = 0.0;
for(int row = 0; row < v1.size(); ++row)
r += (double)m[row] * (v1[row] - v2[row]);
return sqrt(fabs(alpha*r*r));
}
private:
const VectorType &m;
const double alpha;
//! Compute the norm of the difference of two vectors
double diff(const VectorType &v1, const VectorType &v2) const
{
double r = 0.0;
for(int row = 0; row < v1.size(); ++row)
r += (double)m[row] * (v1[row] - v2[row]);
return sqrt(fabs(alpha*r*r));
}
private:
const VectorType &m;
const double alpha;
};
#endif
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment