Eigen-Contrib  5.0.1
 
Loading...
Searching...
No Matches
GpuSparseLU.h
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2026 Rasmus Munk Larsen <rmlarsen@gmail.com>
5//
6// This Source Code Form is subject to the terms of the Mozilla
7// Public License v. 2.0. If a copy of the MPL was not distributed
8// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9// SPDX-License-Identifier: MPL-2.0
10
11// GPU sparse LU factorization via cuDSS, with pivoting, for general
12// (non-symmetric) matrices.
13
14#ifndef EIGEN_GPU_SPARSE_LU_H
15#define EIGEN_GPU_SPARSE_LU_H
16
17// IWYU pragma: private
18#include "./InternalHeaderCheck.h"
19
20#include "./GpuSparseSolverBase.h"
21
22namespace Eigen {
23namespace gpu {
24
33template <typename Scalar_>
34class SparseLU : public internal::SparseSolverBase<Scalar_, SparseLU<Scalar_>> {
36 friend Base;
37
38 public:
39 using Scalar = Scalar_;
40
41 SparseLU() = default;
42
45 explicit SparseLU(Context& ctx) : Base(ctx) {}
46
47 template <typename InputType>
48 explicit SparseLU(const SparseMatrixBase<InputType>& A) {
49 this->compute(A);
50 }
51
53 template <typename InputType>
54 SparseLU(Context& ctx, const SparseMatrixBase<InputType>& A) : Base(ctx) {
55 this->compute(A);
56 }
57
58 static constexpr bool needs_csr_conversion() { return true; }
59 static constexpr cudssMatrixType_t cudss_matrix_type() { return CUDSS_MTYPE_GENERAL; }
60 static constexpr cudssMatrixViewType_t cudss_matrix_view() { return CUDSS_MVIEW_FULL; }
61};
62
63} // namespace gpu
64} // namespace Eigen
65
66#endif // EIGEN_GPU_SPARSE_LU_H
Unified GPU execution context owning a CUDA stream and library handles.
Definition GpuContext.h:81
Definition GpuSparseLU.h:34
SparseLU(Context &ctx, const SparseMatrixBase< InputType > &A)
Definition GpuSparseLU.h:54
SparseLU(Context &ctx)
Definition GpuSparseLU.h:45
Definition GpuSparseSolverBase.h:139
SparseLU< Scalar_ > & compute(const SparseMatrixBase< InputType > &A)
Definition GpuSparseSolverBase.h:223
Namespace containing all symbols from the Eigen library.