TBTK
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
Base class for Solvers.
Definition: Solver.h:32
Model & getModel()
Definition: Solver.h:63
Container of Model related information.
Definition: LinearEquationSolver.h:37
const std::complex< double > getAmplitude(const Index &index) const
Definition: LinearEquationSolver.h:58
Base class for Solvers.
Custom matrix.
const DataType & at(unsigned int row, unsigned int col) const
Definition: Matrix.h:359
Definition: Matrix.h:33
Flexible physical index.
Definition: Index.h:69
Definition: ModelFactory.h:35
Base class that communicate their current status during execution.
const Matrix< std::complex< double > > & getResult() const
Definition: LinearEquationSolver.h:64
Definition: Communicator.h:28