Alien  1.3.0
Developer documentation
Loading...
Searching...
No Matches
IEigenSolver.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 IFPEN-CEA
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * SPDX-License-Identifier: Apache-2.0
17 */
18
23
24#pragma once
25
26#include <alien/utils/Precomp.h>
27#include <vector>
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31
32namespace Alien
33{
34
35/*---------------------------------------------------------------------------*/
36/*---------------------------------------------------------------------------*/
37
38class IMatrix;
39
40class IVector;
41
42/*---------------------------------------------------------------------------*/
43/*---------------------------------------------------------------------------*/
44
50{
51 public:
57 : m_A(A)
58 {}
59
61 virtual ~EigenProblem() {}
62
67 IMatrix const& getA() const { return m_A; }
68
73 std::vector<Arccore::Real> const& getRealEigenValues() const
74 {
76 }
77
82 std::vector<Arccore::Real>& getRealEigenValues() { return m_real_eigen_values; }
83
88 std::vector<Arccore::Real> const& getImaginaryEigenValues() const
89 {
91 }
92
97 std::vector<Arccore::Real>& getImaginaryEigenValues()
98 {
100 }
101
106 virtual Arccore::Integer getNbEigenVectors() const = 0;
107
108 protected:
110 IMatrix const& m_A;
112 std::vector<Arccore::Real> m_real_eigen_values;
114 std::vector<Arccore::Real> m_imaginary_eigen_values;
115};
116
117/*---------------------------------------------------------------------------*/
118/*---------------------------------------------------------------------------*/
119
125{
126 public:
133 : EigenProblem(A)
134 , m_B(B)
135 {}
136
139
144 IMatrix const& getB() const { return m_B; }
145
146 protected:
148 IMatrix const& m_B;
149};
150
151/*---------------------------------------------------------------------------*/
152/*---------------------------------------------------------------------------*/
153
159{
160 public:
162 struct Status
163 {
164 bool m_succeeded = false;
165 Integer m_nconv = 0;
166 Real m_residual = -1.;
167 Integer m_iteration_count = 0;
168 Integer m_error = 0;
169 };
170
172 typedef enum
173 {
174 SmallestMagnitude,
175 LargestMagnitude,
176 SmallestReal,
177 LargestReal,
178 SmallestImaginary,
179 LargestImaginary
181
182 public:
185
187 virtual ~IEigenSolver(){};
188
189 public:
194 virtual Arccore::String getBackEndName() const = 0;
195
197 virtual void init() = 0;
198
204 virtual bool solve(EigenProblem& problem) = 0;
205
206 /*
207 * \brief Whether or not the solver is parallel
208 * \returns Parallel support of the solver
209 */
210 virtual bool hasParallelSupport() const = 0;
211
216 virtual const Status& getStatus() const = 0;
217};
218
219/*---------------------------------------------------------------------------*/
220/*---------------------------------------------------------------------------*/
221
227{
228 public:
233
236
237 public:
243 virtual bool solve(EigenProblem& problem) = 0;
244
250 virtual bool solve(GeneralizedEigenProblem& problem) = 0;
251};
252
253/*---------------------------------------------------------------------------*/
254/*---------------------------------------------------------------------------*/
255
256} // namespace Alien
257
258/*---------------------------------------------------------------------------*/
259/*---------------------------------------------------------------------------*/
Defines an eigen problem.
virtual Arccore::Integer getNbEigenVectors() const =0
Get the number of eigen vectors.
std::vector< Arccore::Real > & getRealEigenValues()
Get real eigen values.
IMatrix const & m_A
The eigen matrix.
std::vector< Arccore::Real > const & getImaginaryEigenValues() const
Get imaginary eigen values.
IMatrix const & getA() const
Get the matrix.
virtual ~EigenProblem()
Free resources.
std::vector< Arccore::Real > m_imaginary_eigen_values
The imaginary eigen values.
std::vector< Arccore::Real > m_real_eigen_values
The real eigen values.
std::vector< Arccore::Real > & getImaginaryEigenValues()
Get imaginary eigen values.
std::vector< Arccore::Real > const & getRealEigenValues() const
Get real eigen values.
EigenProblem(IMatrix const &A)
Constructor.
Defines a generalized eigen problem.
IMatrix const & getB() const
Get the second matrix.
IMatrix const & m_B
The second matrix.
GeneralizedEigenProblem(IMatrix const &A, IMatrix const &B)
Constructor.
virtual ~GeneralizedEigenProblem()
Free resources.
virtual Arccore::String getBackEndName() const =0
Get back end name.
virtual void init()=0
Initialization.
IEigenSolver()
Constructor.
eEigenValuesOrder
Eigen values order.
virtual bool solve(EigenProblem &problem)=0
Solves an eigen problem.
virtual ~IEigenSolver()
Free resources.
virtual const Status & getStatus() const =0
Get solves status.
virtual bool solve(EigenProblem &problem)=0
Solve an eigen problem.
virtual bool solve(GeneralizedEigenProblem &problem)=0
Solve a generalized eigen problem.
virtual ~IGeneralizedEigenSolver()
Free resources.
Interface for all matrices.
Definition IMatrix.h:51
Interface for all vectors.
Definition IVector.h:51
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17
Eigen solver status.