Alien  1.3.0
Developer documentation
Loading...
Searching...
No Matches
IInternalLinearAlgebraT.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7#pragma once
8
9#include <alien/utils/Precomp.h>
10#include <string>
11
12/*---------------------------------------------------------------------------*/
13/*---------------------------------------------------------------------------*/
14
15namespace Alien
16{
17
18class Space;
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
32template <class M, class V>
34{
35 public:
37 typedef M Matrix;
39 typedef V Vector;
42
43 using MatrixType = Matrix ;
44 using VectorType = Vector ;
45 using ValueType = Real ;
46
47 public:
50
51 public:
57 virtual Real norm0(const Vector& x) const = 0;
58
64 virtual Real norm1(const Vector& x) const = 0;
65
71 virtual Real norm2(const Vector& x) const = 0;
72
73
79 virtual Real normInf(const Vector& x) const = 0;
80
90 virtual void mult(const Matrix& a, const Vector& x, Vector& r) const = 0;
91
102 virtual void axpy(Real alpha, const Vector& x, Vector& y) const = 0;
103
113 virtual void aypx(Real alpha, Vector& y, const Vector& x) const = 0;
114
121 virtual void copy(const Vector& x, Vector& r) const = 0;
122
129 virtual Real dot(const Vector& x, const Vector& y) const = 0;
130
136 virtual void scal(Real alpha, Vector& x) const = 0;
137
143 virtual void diagonal(const Matrix& a, Vector& x) const = 0;
144
149 virtual void reciprocal(Vector& x) const = 0;
150
158 virtual void pointwiseMult(const Vector& x, const Vector& y, Vector& w) const = 0;
159
166 virtual void dump([[maybe_unused]] Matrix const& a, [[maybe_unused]] std::string const& filename) const
167 {
168 throw NotImplementedException(
169 A_FUNCINFO, "IInternalLinearAlgebra::dump not implemented");
170 }
171
178 virtual void dump([[maybe_unused]] Vector const& x, [[maybe_unused]] std::string const& filename) const
179 {
180 throw NotImplementedException(
181 A_FUNCINFO, "IInternalLinearAlgebra::dump not implemented");
182 }
183};
184
185/*---------------------------------------------------------------------------*/
186/*---------------------------------------------------------------------------*/
187
188} // namespace Alien
189
190/*---------------------------------------------------------------------------*/
191/*---------------------------------------------------------------------------*/
Internal linear algebra interface.
virtual void dump(Matrix const &a, std::string const &filename) const
Dumps a matrix to a file.
virtual Real normInf(const Vector &x) const =0
Compute LInf norm of a vector.
virtual Real dot(const Vector &x, const Vector &y) const =0
Compute the dot product of two vectors.
virtual void axpy(Real alpha, const Vector &x, Vector &y) const =0
Scale a vector by a factor and adds the result to another vector.
virtual Real norm0(const Vector &x) const =0
Compute L0 norm of a vector.
virtual void mult(const Matrix &a, const Vector &x, Vector &r) const =0
Compute a matrix vector product.
virtual void scal(Real alpha, Vector &x) const =0
Scale a vector by a factor.
virtual void reciprocal(Vector &x) const =0
Compute the reciprocal of a vector.
virtual ~IInternalLinearAlgebra()
Free resources.
virtual void pointwiseMult(const Vector &x, const Vector &y, Vector &w) const =0
Compute the point wise multiplication of two vectors and store the result in another one.
virtual Real norm1(const Vector &x) const =0
Compute L1 norm of a vector.
virtual void dump(Vector const &x, std::string const &filename) const
Dumps a vector to a file.
virtual Real norm2(const Vector &x) const =0
Compute L2 norm of a vector.
virtual void aypx(Real alpha, Vector &y, const Vector &x) const =0
Scale a vector by a factor and adds the result to another vector.
virtual void diagonal(const Matrix &a, Vector &x) const =0
Extract the diagonal of a matrix in a vector.
virtual void copy(const Vector &x, Vector &r) const =0
Copy a vector in another one.
Implementation of an algebraic space.
Definition Space.h:47
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17