Alien  1.3.0
User documentation
Loading...
Searching...
No Matches
ILinearAlgebra.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
19/*!
20 * \file ILinearAlgebra.h
21 * \brief ILinearAlgebra.h
22 */
23
24#pragma once
25
26#include <alien/utils/Precomp.h>
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31namespace Alien
32{
33
34/*---------------------------------------------------------------------------*/
35/*---------------------------------------------------------------------------*/
36
37class IVector;
38class IMatrix;
39
40/*---------------------------------------------------------------------------*/
41/*---------------------------------------------------------------------------*/
42
43/*!
44 * \ingroup expression
45 * \brief Interface for linear algebra
46 */
48{
49 public:
50 //! Free resources
51 virtual ~ILinearAlgebra() {}
52
53 public:
54 /*!
55 * \brief Computes norm 0 of a vector
56 * \param[in] x The vector
57 * \returns The norm0 of the vector
58 */
59 virtual Arccore::Real norm0(const IVector& x) const = 0;
60
61 /*!
62 * \brief Computes norm 1 of a vector
63 * \param[in] x The vector
64 * \returns The norm1 of the vector
65 */
66 virtual Arccore::Real norm1(const IVector& x) const = 0;
67
68 /*!
69 * \brief Computes norm 2 of a vector
70 * \param[in] x The vector
71 * \returns The norm2 of the vector
72 */
73 virtual Arccore::Real norm2(const IVector& x) const = 0;
74
75 /*!
76 * \brief Computes a matrix vector product
77 * \param[in] a The matrix to multiply
78 * \param[in] x The vector to multiply
79 * \param[in,out] r The vector to store the result
80 */
81 virtual void mult(const IMatrix& a, const IVector& x, IVector& r) const = 0;
82
83 /*!
84 * \brief Computes y += alpa * x
85 * \param[in] alpha The real value to scale the vector
86 * \param[in] x The vector to scale
87 * \param[in, out] y The vector to store the result
88 */
89 virtual void axpy(Real alpha, const IVector& x, IVector& y) const = 0;
90
91 /*!
92 * \brief Copy a vector
93 * \param[in] x The vector to copy
94 * \param[in,out] r The copied vector
95 */
96 virtual void copy(const IVector& x, IVector& r) const = 0;
97
98 /*!
99 * \brief Computes the dot product of two vectors
100 * \param[in] x The first vector
101 * \param[in] y The second vector
102 * \returns The dot product
103 */
104 virtual Arccore::Real dot(const IVector& x, const IVector& y) const = 0;
105};
106
107/*---------------------------------------------------------------------------*/
108/*---------------------------------------------------------------------------*/
109
110} // namespace Alien
111
112/*---------------------------------------------------------------------------*/
113/*---------------------------------------------------------------------------*/
Interface for linear algebra.
virtual Arccore::Real norm0(const IVector &x) const =0
Computes norm 0 of a vector.
virtual void mult(const IMatrix &a, const IVector &x, IVector &r) const =0
Computes a matrix vector product.
virtual Arccore::Real dot(const IVector &x, const IVector &y) const =0
Computes the dot product of two vectors.
virtual Arccore::Real norm2(const IVector &x) const =0
Computes norm 2 of a vector.
virtual ~ILinearAlgebra()
Free resources.
virtual Arccore::Real norm1(const IVector &x) const =0
Computes norm 1 of a vector.
virtual void copy(const IVector &x, IVector &r) const =0
Copy a vector.
virtual void axpy(Real alpha, const IVector &x, IVector &y) const =0
Computes y += alpa * x.
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