TBTK
Need a break? Support the development by playing Polarity Puzzles
LinearEquationSolver.h
Go to the documentation of this file.
1 /* Copyright 2017 Kristofer Björnson
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
23 #ifndef COM_DAFER45_TBTK_SOLVER_LINEAR_EQUATION_SOLVER
24 #define COM_DAFER45_TBTK_SOLVER_LINEAR_EQUATION_SOLVER
25 
26 #include "TBTK/Communicator.h"
27 #include "TBTK/Matrix.h"
28 #include "TBTK/Model.h"
29 #include "TBTK/Solver/Solver.h"
30 
31 #include <complex>
32 #include <vector>
33 
34 namespace TBTK{
35 namespace Solver{
36 
37 class LinearEquationSolver : public Solver, public Communicator{
38 public:
41 
43  virtual ~LinearEquationSolver();
44 
46  void run();
47 
49  const std::complex<double> getAmplitude(const Index &index) const;
50 
52  const Matrix<std::complex<double>>& getResult() const;
53 private:
56 };
57 
58 inline const std::complex<double> LinearEquationSolver::getAmplitude(
59  const Index &index
60 ) const{
61  return source.at(getModel().getBasisIndex(index), 0);
62 }
63 
65  return source;
66 }
67 
68 }; //End of namespace Solver
69 }; //End of namespace TBTK
70 
71 #endif
Model.h
Container of Model related information.
TBTK::Matrix
Definition: Matrix.h:33
TBTK::Solver::LinearEquationSolver::~LinearEquationSolver
virtual ~LinearEquationSolver()
TBTK::Solver::LinearEquationSolver::run
void run()
TBTK::Matrix::at
const DataType & at(unsigned int row, unsigned int col) const
Definition: Matrix.h:374
Matrix.h
Custom matrix.
TBTK::Solver::LinearEquationSolver
Definition: LinearEquationSolver.h:37
Solver.h
Base class for Solvers.
TBTK::Solver::LinearEquationSolver::getAmplitude
const std::complex< double > getAmplitude(const Index &index) const
Definition: LinearEquationSolver.h:58
TBTK::Solver::LinearEquationSolver::getResult
const Matrix< std::complex< double > > & getResult() const
Definition: LinearEquationSolver.h:64
TBTK::Communicator
Base class for classes that can communicate their status during execution.
Definition: Communicator.h:56
Communicator.h
Base class for classes that can communicate their status during execution.
TBTK::Solver::Solver::getModel
Model & getModel()
Definition: Solver.h:73
TBTK::Solver::LinearEquationSolver::LinearEquationSolver
LinearEquationSolver()
TBTK::Solver::Solver
Base class for Solvers.
Definition: Solver.h:42
TBTK::Index
Physical index.
Definition: Index.h:44