OpenMEEG
Loading...
Searching...
No Matches
forward.h
Go to the documentation of this file.
1// Project Name: OpenMEEG (http://openmeeg.github.io)
2// © INRIA and ENPC under the French open source license CeCILL-B.
3// See full copyright notice in the file LICENSE.txt
4// If you make a copy of this file, you must either:
5// - provide also LICENSE.txt and modify this header to refer to it.
6// - replace this header by the LICENSE.txt content.
7
8#pragma once
9
10#include "matrix.h"
11
12namespace OpenMEEG {
13
14 class Forward : public virtual Matrix {
15 public:
16
17 Forward(const Matrix& GainMatrix,const Matrix& RealSourcesData,const double NoiseLevel) {
18
19 Matrix& SimulatedData = *this;
20 SimulatedData = GainMatrix*RealSourcesData;
21
22 if (NoiseLevel>0) {
23
24 std::random_device rd{};
25 std::mt19937 gen{rd()};
26 std::normal_distribution<> noise{0,NoiseLevel};
27
28 for (unsigned i=0; i<SimulatedData.nlin(); ++i)
29 for (unsigned j=0; j<SimulatedData.ncol(); ++j)
30 SimulatedData(i,j) += noise(gen);
31 }
32 }
33
34 virtual ~Forward() { }
35 };
36}
virtual ~Forward()
Definition: forward.h:34
Forward(const Matrix &GainMatrix, const Matrix &RealSourcesData, const double NoiseLevel)
Definition: forward.h:17
Dimension nlin() const
Definition: linop.h:48
virtual Dimension ncol() const
Definition: linop.h:51
Matrix class Matrix class.
Definition: matrix.h:28