12#ifndef MFEM_BATCHED_LINALG
13#define MFEM_BATCHED_LINALG
61 std::array<std::unique_ptr<class BatchedLinAlgBase>,
128 Op op = Op::N)
const = 0;
Abstract base clase for batched linear algebra operations.
virtual void Mult(const DenseTensor &A, const Vector &x, Vector &y) const
See BatchedLinAlg::Mult.
virtual ~BatchedLinAlgBase()
Virtual destructor.
virtual void Invert(DenseTensor &A) const =0
See BatchedLinAlg::Invert.
virtual void LUFactor(DenseTensor &A, Array< int > &P) const =0
See BatchedLinAlg::LUFactor.
virtual void MultTranspose(const DenseTensor &A, const Vector &x, Vector &y) const
See BatchedLinAlg::MultTranspose.
virtual void LUSolve(const DenseTensor &LU, const Array< int > &P, Vector &x) const =0
See BatchedLinAlg::LUSolve.
virtual void AddMult(const DenseTensor &A, const Vector &x, Vector &y, real_t alpha=1.0, real_t beta=1.0, Op op=Op::N) const =0
See BatchedLinAlg::AddMult.
Class for performing batched linear algebra operations, potentially using accelerated algorithms (GPU...
static void Mult(const DenseTensor &A, const Vector &x, Vector &y)
Computes (e.g. by calling AddMult(A,x,y,1,0,Op::N)).
Backend
Available backends for implementations of batched algorithms.
@ GPU_BLAS
Either cuBLAS or hipBLAS, depending on whether MFEM is using CUDA or HIP. Not available otherwise.
@ MAGMA
MAGMA backend, only available if MFEM is compiled with MAGMA support.
@ NUM_BACKENDS
Counter for the number of backends.
@ NATIVE
The standard MFEM backend, implemented using mfem::forall kernels. Not as performant as the other ker...
static const BatchedLinAlgBase & Get(Backend backend)
Get the BatchedLinAlgBase object associated with a specific backend.
static void MultTranspose(const DenseTensor &A, const Vector &x, Vector &y)
Computes (e.g. by calling AddMult(A,x,y,1,0,Op::T)).
static Backend GetActiveBackend()
Get the default backend for batched linear algebra operations.
static bool IsAvailable(Backend backend)
Returns true if the requested backend is available.
static void LUFactor(DenseTensor &A, Array< int > &P)
Replaces the block diagonal matrix with its LU factors. The pivots are stored in P.
static void AddMult(const DenseTensor &A, const Vector &x, Vector &y, real_t alpha=1.0, real_t beta=1.0, Op op=Op::N)
Computes .
static void SetActiveBackend(Backend backend)
Set the default backend for batched linear algebra operations.
Op
Operation type (transposed or not transposed)
static void LUSolve(const DenseTensor &A, const Array< int > &P, Vector &x)
Replaces with , given the LU factors A and pivots P of the block-diagonal matrix .
static void Invert(DenseTensor &A)
Replaces the block diagonal matrix with its inverse .
Rank 3 tensor (array of matrices)