LevelAggregation.h
Go to the documentation of this file.
1 /*
2  * LevelAggregation.h
3  *
4  * Created on: 10.01.2015
5  * Author: Michael
6  */
7
8 #ifndef LEVELAGGREGATION_H_
9 #define LEVELAGGREGATION_H_
10
11 #include "Level.h"
12
13 namespace NetworKit {
14
18 template<class Matrix>
19 class LevelAggregation : public Level<Matrix> {
20 private:
21  Matrix P; // interpolation matrix (n x nc)
22  Matrix R; // restriction matrix (nc x n)
23
24 public:
25  LevelAggregation(const Matrix& A, const Matrix& P, const Matrix& R) : Level<Matrix>(LevelType::AGGREGATION, A), P(P), R(R) {}
26
27  void coarseType(const Vector& xf, Vector& xc) const;
28
29  void restrict(const Vector& bf, Vector& bc) const;
30
31  void interpolate(const Vector& xc, Vector& xf) const;
32 };
33
34 template<class Matrix>
35 void LevelAggregation<Matrix>::coarseType(const Vector& /*xf*/, Vector& xc) const {
36  xc = Vector(P.numberOfColumns(), 0.0);
37 }
38
39 template<class Matrix>
40 void LevelAggregation<Matrix>::restrict(const Vector& bf, Vector& bc) const {
41  bc = R * bf;
42 }
43
44 template<class Matrix>
46  xf = P * xc;
47 }
48
49 } /* namespace NetworKit */
50
51 #endif /* LEVELAGGREGATION_H_ */
void restrict(const Vector &bf, Vector &bc) const
Definition: LevelAggregation.h:40
Matrix A
Definition: Level.h:29
void coarseType(const Vector &xf, Vector &xc) const
Definition: LevelAggregation.h:35
Definition: LevelAggregation.h:19
void interpolate(const Vector &xc, Vector &xf) const
Definition: LevelAggregation.h:45
std::vector< std::vector< count > > Matrix
Definition: DynamicNMIDistance.h:16
LevelType
Definition: Level.h:15
The Vector class represents a basic vector with double coefficients.
Definition: Vector.h:25
Abstract base class for an LAMG Level.
Definition: Level.h:26
LevelAggregation(const Matrix &A, const Matrix &P, const Matrix &R)
Definition: LevelAggregation.h:25
Definition: Level.h:17