TDLS 0.2.0
Tiny Device-callable Linear Solvers
Loading...
Searching...
No Matches
adaptors.hpp File Reference

TFEL adaptors: call the TiledLUpp solvers directly on the tfel::math objects (matrices, vectors, views) instead of raw pointers. More...

#include <cstddef>
#include <type_traits>
#include <tdls/core/macros.hpp>
#include <tdls/solvers/tiled_lupp/solver_dynamic.hpp>
#include <tdls/solvers/tiled_lupp/solver_static.hpp>
Include dependency graph for adaptors.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tdls::detail::has_data< T, typename >
 Detects a data() member returning a pointer. More...
 
struct  tdls::detail::has_data< T, std::void_t< decltype(std::declval< const T & >().data())> >
 
struct  tdls::detail::has_pair_data< T, typename >
 Detects a data() member returning a (pointer, stride) pair: the shape of strided views, whose data pointer must not be mistaken for contiguous storage. More...
 
struct  tdls::detail::has_pair_data< T, std::void_t< decltype(std::declval< const T & >().data().first), decltype(std::declval< const T & >().data().second)> >
 
struct  tdls::detail::const_data_pointer< T, bool >
 Element pointer type of a dense object, const flavour. More...
 
struct  tdls::detail::const_data_pointer< T, true >
 Element pointer type of a dense object whose data() returns a (pointer, stride) pair, const flavour. More...
 
struct  tdls::detail::mutable_data_pointer< T, bool >
 Element pointer type of a dense object, mutable flavour. More...
 
struct  tdls::detail::mutable_data_pointer< T, true >
 Element pointer type of a dense object whose data() returns a (pointer, stride) pair, mutable flavour. More...
 
struct  tdls::detail::has_stride< T, typename >
 Detects a stride() member. More...
 
struct  tdls::detail::has_stride< T, std::void_t< decltype(std::declval< const T & >().stride())> >
 
struct  tdls::detail::has_get_stride< T, typename >
 Detects a getStride() member. More...
 
struct  tdls::detail::has_get_stride< T, std::void_t< decltype(std::declval< const T & >().getStride())> >
 
struct  tdls::detail::has_indexing_policy< T, typename >
 Detects a nested indexing_policy type. More...
 
struct  tdls::detail::has_indexing_policy< T, std::void_t< typename T::indexing_policy > >
 
struct  tdls::storage_traits< DenseType, std::enable_if_t< detail::is_dense_v< DenseType > > >
 Storage description of dense objects matching the structural contract: a data() member (plain pointer or (pointer, stride) pair) and an indexing_policy type with constexpr extents. More...
 
struct  tdls::detail::has_storage_traits< T, typename >
 Detects a complete storage_traits: the structural contract or a user specialization. More...
 
struct  tdls::detail::has_storage_traits< T, std::void_t< typename storage_traits< T >::value_type > >
 
struct  tdls::detail::matrix_scalar_of< MatrixType >
 Scalar type of a dense matrix argument, read from its storage description; a matrix argument without storage_traits is rejected here with an explicit message. More...
 
struct  tdls::detail::is_solver_config< ConfigType >
 Detects the configuration value types accepted by the entry points. Only the TiledLUpp family exists today; a specialization per family can join when another one lands. More...
 
struct  tdls::detail::is_solver_config< TiledLUppConfig< Scalar > >
 TiledLUppConfig values are accepted. More...
 
struct  tdls::detail::adaptor_context< MatrixType, Config >
 Common compile-time context of the adaptor entry points: resolves the scalar type, the dimension and the TiledLUpp solvers from the matrix argument and the configuration value. More...
 
struct  tdls::detail::pivot_access< PivotType, N >
 Pivot argument unwrapping: accepts a raw int pointer/array (treated as contiguous caller-local storage) or any int object with storage_traits, vector-like and of the system dimension when both are fixed-size. More...
 

Concepts

concept  tdls::detail::solver_config
 Concept gating the explicit-configuration entry points.
 

Typedefs

template<typename MatrixType >
using tdls::detail::matrix_scalar = typename matrix_scalar_of<MatrixType>::type
 Scalar type of a dense matrix argument, see matrix_scalar_of.
 

Functions

template<typename MatrixType , auto UserConfig>
consteval auto tdls::detail::checked_config ()
 Validates a user configuration value against the matrix scalar type and returns it with its concrete type.
 
template<typename VectorType , typename Scalar , int N>
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr void tdls::detail::check_vector ()
 Checks that a vector-like argument matches the system: arity 1, extent N, same scalar type. The extent is only checkable when both the matrix and the vector are fixed-size; when either side is runtime-sized (N == 0, or a runtime-sized vector), the extent match is an unchecked precondition, as everywhere in the raw API.
 
template<typename RhsType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr void tdls::detail::check_rhs_pair ()
 Checks that the right-hand side and the solution share one residency and one compile-time stride: the raw API carries a single rhs_stride for both. Their extents must match whenever both are fixed-size. With runtime-strided views, both must be mapped on the same batch (equal runtime strides), which is the caller's responsibility.
 
template<typename RhsType , typename SolutionType , typename Scalar , int N>
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr void tdls::detail::check_multirhs_pair ()
 Checks a matrix-like right-hand-side block pair (B, X): matching scalar, matching extents where compile-time knowledge allows, one shared layout. On any runtime-sized side the extents are unchecked preconditions, as everywhere in the raw API: B and X must have N rows and the same column count.
 
template<typename Ctx , int pass_width, bool inplace, typename MatrixType , typename PivotType , typename RhsType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr void tdls::detail::substitute_multirhs_dispatch (const MatrixType &A, const PivotType &piv, const RhsType &b, SolutionType &x)
 Shared translator of the matrix right-hand-side entry points: reduces the dense objects to raw arguments and forwards to the _multirhs entry points, which do the pass cutting themselves. Matrix right-hand sides are always routed through the external addressing of the raw API: the register convention of its internal mode is not the row-major layout of dense matrix objects.
 
template<auto UserConfig, bool oot_diagnostics, typename MatrixType , typename PivotType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::detail::factorize_dispatch (MatrixType &A, PivotType &piv, int &oot_count)
 Shared engine of the factorize entry points: reduces the dense objects to raw arguments and forwards to the raw factorize, with or without the out-of-tile counter.
 
template<auto UserConfig, int pass_width, bool oot_diagnostics, typename MatrixType , typename PivotType , typename RhsType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::detail::solve_dispatch (MatrixType &A, PivotType &piv, const RhsType &b, SolutionType &x, int &oot_count)
 Shared engine of the solve entry points: factorize + substitute on dense objects, with or without the out-of-tile counter.
 
template<auto UserConfig, int pass_width, bool oot_diagnostics, typename MatrixType , typename PivotType , typename VectorType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::detail::solve_inplace_dispatch (MatrixType &A, PivotType &piv, VectorType &y, int &oot_count)
 Shared engine of the solve_inplace entry points: fused factorization on dense objects, with or without the out-of-tile counter.
 
template<detail::solver_config auto UserConfig, typename MatrixType , typename PivotType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::factorize (MatrixType &A, PivotType &piv)
 Factor a dense matrix object in place, A := P*L*U.
 
template<typename MatrixType , typename PivotType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::factorize (MatrixType &A, PivotType &piv)
 Default-configuration overload of factorize.
 
template<detail::solver_config auto UserConfig, typename MatrixType , typename PivotType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::factorize (MatrixType &A, PivotType &piv, int &oot_count)
 Counting overload of factorize: also reports the number of columns whose best in-tile pivot fell below oot_threshold.
 
template<typename MatrixType , typename PivotType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::factorize (MatrixType &A, PivotType &piv, int &oot_count)
 Default-configuration counting overload of factorize.
 
template<detail::solver_config auto UserConfig, int pass_width = 0, typename MatrixType , typename PivotType , typename RhsType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::solve (MatrixType &A, PivotType &piv, const RhsType &b, SolutionType &x)
 Solve A x = b on dense objects: factorize + substitute.
 
template<int pass_width = 0, typename MatrixType , typename PivotType , typename RhsType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::solve (MatrixType &A, PivotType &piv, const RhsType &b, SolutionType &x)
 Default-configuration overload of solve.
 
template<detail::solver_config auto UserConfig, int pass_width = 0, typename MatrixType , typename PivotType , typename RhsType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::solve (MatrixType &A, PivotType &piv, const RhsType &b, SolutionType &x, int &oot_count)
 Counting overload of solve: also reports the number of columns whose best in-tile pivot fell below oot_threshold.
 
template<int pass_width = 0, typename MatrixType , typename PivotType , typename RhsType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::solve (MatrixType &A, PivotType &piv, const RhsType &b, SolutionType &x, int &oot_count)
 Default-configuration counting overload of solve.
 
template<detail::solver_config auto UserConfig, int pass_width = 0, typename MatrixType , typename PivotType , typename VectorType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::solve_inplace (MatrixType &A, PivotType &piv, VectorType &y)
 Solve A y = y on dense objects with the fused factorization (forward substitution folded into factorize, backward pass after).
 
template<int pass_width = 0, typename MatrixType , typename PivotType , typename VectorType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::solve_inplace (MatrixType &A, PivotType &piv, VectorType &y)
 Default-configuration overload of solve_inplace.
 
template<detail::solver_config auto UserConfig, int pass_width = 0, typename MatrixType , typename PivotType , typename VectorType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::solve_inplace (MatrixType &A, PivotType &piv, VectorType &y, int &oot_count)
 Counting overload of solve_inplace: also reports the number of columns whose best in-tile pivot fell below oot_threshold.
 
template<int pass_width = 0, typename MatrixType , typename PivotType , typename VectorType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::solve_inplace (MatrixType &A, PivotType &piv, VectorType &y, int &oot_count)
 Default-configuration counting overload of solve_inplace.
 
template<detail::solver_config auto UserConfig, int pass_width = 0, typename MatrixType , typename PivotType , typename RhsType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr void tdls::substitute (const MatrixType &A, const PivotType &piv, const RhsType &b, SolutionType &x)
 Solve x := U^-1 L^-1 P b on dense objects, from a prior factorize. b and x must not alias.
 
template<int pass_width = 0, typename MatrixType , typename PivotType , typename RhsType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr void tdls::substitute (const MatrixType &A, const PivotType &piv, const RhsType &b, SolutionType &x)
 Default-configuration overload of substitute.
 
template<detail::solver_config auto UserConfig, int pass_width = 0, typename MatrixType , typename PivotType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr void tdls::substitute_inplace (const MatrixType &A, const PivotType &piv, SolutionType &x)
 Solve in place on dense objects: x holds the unpermuted right-hand side on entry and the solution on exit.
 
template<int pass_width = 0, typename MatrixType , typename PivotType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr void tdls::substitute_inplace (const MatrixType &A, const PivotType &piv, SolutionType &x)
 Default-configuration overload of substitute_inplace.
 
template<detail::solver_config auto UserConfig, int pass_width = 0, typename MatrixType , typename PivotType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr void tdls::substitute_canonical (const MatrixType &A, const PivotType &piv, const int col, SolutionType &x)
 Solve A x = e_col on dense objects, from a prior factorize: the consistent-tangent-operator path.
 
template<int pass_width = 0, typename MatrixType , typename PivotType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr void tdls::substitute_canonical (const MatrixType &A, const PivotType &piv, const int col, SolutionType &x)
 Default-configuration overload of substitute_canonical.
 

Variables

template<typename T >
constexpr bool tdls::detail::is_dense_v
 A type is "dense" when it exposes both a data pointer and an indexing policy, the structural core of the TFEL protocol.
 

Detailed Description

TFEL adaptors: call the TiledLUpp solvers directly on the tfel::math objects (matrices, vectors, views) instead of raw pointers.

Author
Tristan Chenaille

The adaptors are designed for the TFEL math types, recognized STRUCTURALLY: TFEL is never named or included, so the library stays dependency-free, and any type following the TFEL protocol is accepted. Three families are recognized:

  • contiguous fixed-size objects and views, tfel::math tmatrix / tvector / View: expose data() and an indexing_policy type whose extents are constexpr;
  • element-strided views, tfel::math StridedCoalescedView, i.e. the map_strided SoA views: expose their runtime stride through a data() member returning a (pointer, stride) pair, or through a stride() / getStride() member next to a plain data();
  • runtime-sized objects, tfel::math matrix / vector: their indexing policy carries its extents as data members, so its default-constructed instance reports a zero extent. They also expose getIndexingPolicy(), from which the dimension is read at run time.

A fixed-size matrix resolves the compile-time TiledLUpp solver, with the dimension deduced from the indexing policy and the residency template booleans of the raw API inferred from the argument types (contiguous object -> internal, strided view -> external), mixed freely. A runtime-sized matrix resolves the runtime TiledLUpp solver, every argument reduced to its (pointer, stride) pair. On that path the extents cannot be checked at compile time: the matrix must be square and every vector extent must match its dimension. These are unchecked preconditions, exactly as in the raw API.

solve, solve_inplace, substitute and substitute_inplace also accept a matrix-like right-hand side holding one right-hand side per column: A X = B, every column solved against the one factorization through the multirhs entry points of the raw API. substitute_canonical accepts a matrix-like x the same way: its columns receive the consecutive canonical columns e_col .. e{col+M-1}. On all five, the template parameter pass_width cuts the substitution into passes (0, the default, means all columns in one pass; the last pass takes the remainder).

Two families are rejected at compile time with an explicit message: row-strided matrix views (sub-matrix views, whose stride between rows is unrelated to the column count) cannot be expressed by the TiledLUpp solvers' single-stride addressing, and gather views holding one pointer per element expose no data() at all.

TFEL stores matrices row-major and the adaptors follow that convention: a configuration selecting the column-major layout is rejected at compile time.

The detection can be overridden for non-TFEL types by specializing tdls::storage_traits.

Every entry point comes in two overloads: a default-configuration form, and an explicit-configuration form taking a constexpr TiledLUppConfig value of the matrix scalar type as its first template argument. Only the TiledLUpp family exists today; a configuration value of another family can select it when one lands.

factorize, solve and solve_inplace also come in counting overloads taking a trailing int& out-parameter: the out-of-tile search counter of the raw API. Without it the diagnostic is compiled out.

Typedef Documentation

◆ matrix_scalar

template<typename MatrixType >
using tdls::detail::matrix_scalar = typename matrix_scalar_of<MatrixType>::type

Scalar type of a dense matrix argument, see matrix_scalar_of.

Template Parameters
MatrixTypedense matrix type

Function Documentation

◆ check_multirhs_pair()

template<typename RhsType , typename SolutionType , typename Scalar , int N>
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr void tdls::detail::check_multirhs_pair ( )
constexpr

Checks a matrix-like right-hand-side block pair (B, X): matching scalar, matching extents where compile-time knowledge allows, one shared layout. On any runtime-sized side the extents are unchecked preconditions, as everywhere in the raw API: B and X must have N rows and the same column count.

Template Parameters
RhsTyperight-hand-side block type
SolutionTypesolution block type
Scalarscalar type of the system
Nsystem dimension (0 on the runtime path)

◆ check_rhs_pair()

template<typename RhsType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr void tdls::detail::check_rhs_pair ( )
constexpr

Checks that the right-hand side and the solution share one residency and one compile-time stride: the raw API carries a single rhs_stride for both. Their extents must match whenever both are fixed-size. With runtime-strided views, both must be mapped on the same batch (equal runtime strides), which is the caller's responsibility.

Template Parameters
RhsTyperight-hand-side type
SolutionTypesolution type

◆ check_vector()

template<typename VectorType , typename Scalar , int N>
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr void tdls::detail::check_vector ( )
constexpr

Checks that a vector-like argument matches the system: arity 1, extent N, same scalar type. The extent is only checkable when both the matrix and the vector are fixed-size; when either side is runtime-sized (N == 0, or a runtime-sized vector), the extent match is an unchecked precondition, as everywhere in the raw API.

Template Parameters
VectorTypedense vector type
Scalarscalar type of the system
Nsystem dimension (0 on the runtime path)

◆ checked_config()

template<typename MatrixType , auto UserConfig>
auto tdls::detail::checked_config ( )
consteval

Validates a user configuration value against the matrix scalar type and returns it with its concrete type.

Template Parameters
MatrixTypedense matrix type
UserConfiguser configuration value
Returns
the configuration value

◆ factorize() [1/4]

template<detail::solver_config auto UserConfig, typename MatrixType , typename PivotType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::factorize ( MatrixType & A,
PivotType & piv )
nodiscardconstexpr

Factor a dense matrix object in place, A := P*L*U.

Template Parameters
UserConfigcompile-time knobs, a constexpr TiledLUppConfig value of the matrix scalar type
Parameters
[in,out]Amatrix-like object (factored in place)
[in,out]pivpivot storage: int pointer/array or dense int object
Returns
false on a singular matrix.

◆ factorize() [2/4]

template<typename MatrixType , typename PivotType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::factorize ( MatrixType & A,
PivotType & piv )
nodiscardconstexpr

Default-configuration overload of factorize.

Parameters
[in,out]Amatrix-like object (factored in place)
[in,out]pivpivot storage: int pointer/array or dense int object
Returns
false on a singular matrix.

◆ factorize() [3/4]

template<detail::solver_config auto UserConfig, typename MatrixType , typename PivotType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::factorize ( MatrixType & A,
PivotType & piv,
int & oot_count )
nodiscardconstexpr

Counting overload of factorize: also reports the number of columns whose best in-tile pivot fell below oot_threshold.

Template Parameters
UserConfigcompile-time knobs, a constexpr TiledLUppConfig value of the matrix scalar type
Parameters
[in,out]Amatrix-like object (factored in place)
[in,out]pivpivot storage: int pointer/array or dense int object
[out]oot_countnumber of columns whose best in-tile pivot fell below oot_threshold
Returns
false on a singular matrix.

◆ factorize() [4/4]

template<typename MatrixType , typename PivotType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::factorize ( MatrixType & A,
PivotType & piv,
int & oot_count )
nodiscardconstexpr

Default-configuration counting overload of factorize.

Parameters
[in,out]Amatrix-like object (factored in place)
[in,out]pivpivot storage: int pointer/array or dense int object
[out]oot_countnumber of columns whose best in-tile pivot fell below oot_threshold
Returns
false on a singular matrix.

◆ factorize_dispatch()

template<auto UserConfig, bool oot_diagnostics, typename MatrixType , typename PivotType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::detail::factorize_dispatch ( MatrixType & A,
PivotType & piv,
int & oot_count )
nodiscardconstexpr

Shared engine of the factorize entry points: reduces the dense objects to raw arguments and forwards to the raw factorize, with or without the out-of-tile counter.

Template Parameters
UserConfigconfiguration value, validated by checked_config
oot_diagnosticscompile the out-of-tile counter in or out
Parameters
[in,out]Amatrix-like object (factored in place)
[in,out]pivpivot storage
[out]oot_countout-of-tile search counter (oot_diagnostics)
Returns
false on a singular matrix.

◆ solve() [1/4]

template<detail::solver_config auto UserConfig, int pass_width = 0, typename MatrixType , typename PivotType , typename RhsType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::solve ( MatrixType & A,
PivotType & piv,
const RhsType & b,
SolutionType & x )
nodiscardconstexpr

Solve A x = b on dense objects: factorize + substitute.

With a matrix-like b (and x), all its columns are solved against the one factorization: A X = B. pass_width then cuts the substitution into passes (0 = all columns in one pass; the last pass takes the remainder). The forward pass is not folded into the factorization on that path (see the raw solve_multirhs).

Template Parameters
UserConfigcompile-time knobs, a constexpr TiledLUppConfig value of the matrix scalar type
pass_widthcolumns per substitution pass for a matrix-like b (0 = all at once; must be 0 for a vector-like b)
Parameters
[in,out]Amatrix-like object (factored in place)
[in,out]pivpivot storage: int pointer/array or dense int object
[in]bright-hand side, in original order: vector-like, or matrix-like holding one right-hand side per column
[out]xsolution, of the same shape as b
Returns
false on a singular matrix.

◆ solve() [2/4]

template<int pass_width = 0, typename MatrixType , typename PivotType , typename RhsType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::solve ( MatrixType & A,
PivotType & piv,
const RhsType & b,
SolutionType & x )
nodiscardconstexpr

Default-configuration overload of solve.

Template Parameters
pass_widthcolumns per substitution pass for a matrix-like b (0 = all at once; must be 0 for a vector-like b)
Parameters
[in,out]Amatrix-like object (factored in place)
[in,out]pivpivot storage: int pointer/array or dense int object
[in]bright-hand side, in original order: vector-like, or matrix-like holding one right-hand side per column
[out]xsolution, of the same shape as b
Returns
false on a singular matrix.

◆ solve() [3/4]

template<detail::solver_config auto UserConfig, int pass_width = 0, typename MatrixType , typename PivotType , typename RhsType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::solve ( MatrixType & A,
PivotType & piv,
const RhsType & b,
SolutionType & x,
int & oot_count )
nodiscardconstexpr

Counting overload of solve: also reports the number of columns whose best in-tile pivot fell below oot_threshold.

Template Parameters
UserConfigcompile-time knobs, a constexpr TiledLUppConfig value of the matrix scalar type
pass_widthcolumns per substitution pass for a matrix-like b (0 = all at once; must be 0 for a vector-like b)
Parameters
[in,out]Amatrix-like object (factored in place)
[in,out]pivpivot storage: int pointer/array or dense int object
[in]bright-hand side, in original order
[out]xsolution, of the same shape as b
[out]oot_countnumber of columns whose best in-tile pivot fell below oot_threshold
Returns
false on a singular matrix.

◆ solve() [4/4]

template<int pass_width = 0, typename MatrixType , typename PivotType , typename RhsType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::solve ( MatrixType & A,
PivotType & piv,
const RhsType & b,
SolutionType & x,
int & oot_count )
nodiscardconstexpr

Default-configuration counting overload of solve.

Template Parameters
pass_widthcolumns per substitution pass for a matrix-like b (0 = all at once; must be 0 for a vector-like b)
Parameters
[in,out]Amatrix-like object (factored in place)
[in,out]pivpivot storage: int pointer/array or dense int object
[in]bright-hand side, in original order
[out]xsolution, of the same shape as b
[out]oot_countnumber of columns whose best in-tile pivot fell below oot_threshold
Returns
false on a singular matrix.

◆ solve_dispatch()

template<auto UserConfig, int pass_width, bool oot_diagnostics, typename MatrixType , typename PivotType , typename RhsType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::detail::solve_dispatch ( MatrixType & A,
PivotType & piv,
const RhsType & b,
SolutionType & x,
int & oot_count )
nodiscardconstexpr

Shared engine of the solve entry points: factorize + substitute on dense objects, with or without the out-of-tile counter.

Template Parameters
UserConfigconfiguration value, validated by checked_config
pass_widthcolumns per substitution pass for a matrix-like b
oot_diagnosticscompile the out-of-tile counter in or out
Parameters
[in,out]Amatrix-like object (factored in place)
[in,out]pivpivot storage
[in]bright-hand side
[out]xsolution
[out]oot_countout-of-tile search counter (oot_diagnostics)
Returns
false on a singular matrix.

◆ solve_inplace() [1/4]

template<detail::solver_config auto UserConfig, int pass_width = 0, typename MatrixType , typename PivotType , typename VectorType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::solve_inplace ( MatrixType & A,
PivotType & piv,
VectorType & y )
nodiscardconstexpr

Solve A y = y on dense objects with the fused factorization (forward substitution folded into factorize, backward pass after).

With a matrix-like y, all its columns are overwritten by the solutions against the one factorization. pass_width then cuts the substitution into passes (0 = all columns in one pass; the last pass takes the remainder). The forward pass is not folded into the factorization on that path (see the raw solve_inplace_multirhs).

Template Parameters
UserConfigcompile-time knobs, a constexpr TiledLUppConfig value of the matrix scalar type
pass_widthcolumns per substitution pass for a matrix-like y (0 = all at once; must be 0 for a vector-like y)
Parameters
[in,out]Amatrix-like object (factored in place)
[in,out]pivpivot storage: int pointer/array or dense int object
[in,out]yright-hand side on entry, solution on exit: vector-like, or matrix-like holding one right-hand side per column
Returns
false on a singular matrix (y left partially updated with a vector-like y, untouched with a matrix-like y).

◆ solve_inplace() [2/4]

template<int pass_width = 0, typename MatrixType , typename PivotType , typename VectorType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::solve_inplace ( MatrixType & A,
PivotType & piv,
VectorType & y )
nodiscardconstexpr

Default-configuration overload of solve_inplace.

Template Parameters
pass_widthcolumns per substitution pass for a matrix-like y (0 = all at once; must be 0 for a vector-like y)
Parameters
[in,out]Amatrix-like object (factored in place)
[in,out]pivpivot storage: int pointer/array or dense int object
[in,out]yright-hand side on entry, solution on exit: vector-like, or matrix-like holding one right-hand side per column
Returns
false on a singular matrix (y left partially updated with a vector-like y, untouched with a matrix-like y).

◆ solve_inplace() [3/4]

template<detail::solver_config auto UserConfig, int pass_width = 0, typename MatrixType , typename PivotType , typename VectorType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::solve_inplace ( MatrixType & A,
PivotType & piv,
VectorType & y,
int & oot_count )
nodiscardconstexpr

Counting overload of solve_inplace: also reports the number of columns whose best in-tile pivot fell below oot_threshold.

Template Parameters
UserConfigcompile-time knobs, a constexpr TiledLUppConfig value of the matrix scalar type
pass_widthcolumns per substitution pass for a matrix-like y (0 = all at once; must be 0 for a vector-like y)
Parameters
[in,out]Amatrix-like object (factored in place)
[in,out]pivpivot storage: int pointer/array or dense int object
[in,out]yright-hand side on entry, solution on exit
[out]oot_countnumber of columns whose best in-tile pivot fell below oot_threshold
Returns
false on a singular matrix (y left partially updated with a vector-like y, untouched with a matrix-like y).

◆ solve_inplace() [4/4]

template<int pass_width = 0, typename MatrixType , typename PivotType , typename VectorType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::solve_inplace ( MatrixType & A,
PivotType & piv,
VectorType & y,
int & oot_count )
nodiscardconstexpr

Default-configuration counting overload of solve_inplace.

Template Parameters
pass_widthcolumns per substitution pass for a matrix-like y (0 = all at once; must be 0 for a vector-like y)
Parameters
[in,out]Amatrix-like object (factored in place)
[in,out]pivpivot storage: int pointer/array or dense int object
[in,out]yright-hand side on entry, solution on exit
[out]oot_countnumber of columns whose best in-tile pivot fell below oot_threshold
Returns
false on a singular matrix (y left partially updated with a vector-like y, untouched with a matrix-like y).

◆ solve_inplace_dispatch()

template<auto UserConfig, int pass_width, bool oot_diagnostics, typename MatrixType , typename PivotType , typename VectorType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr bool tdls::detail::solve_inplace_dispatch ( MatrixType & A,
PivotType & piv,
VectorType & y,
int & oot_count )
nodiscardconstexpr

Shared engine of the solve_inplace entry points: fused factorization on dense objects, with or without the out-of-tile counter.

Template Parameters
UserConfigconfiguration value, validated by checked_config
pass_widthcolumns per substitution pass for a matrix-like y
oot_diagnosticscompile the out-of-tile counter in or out
Parameters
[in,out]Amatrix-like object (factored in place)
[in,out]pivpivot storage
[in,out]yright-hand side on entry, solution on exit
[out]oot_countout-of-tile search counter (oot_diagnostics)
Returns
false on a singular matrix.

◆ substitute() [1/2]

template<detail::solver_config auto UserConfig, int pass_width = 0, typename MatrixType , typename PivotType , typename RhsType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr void tdls::substitute ( const MatrixType & A,
const PivotType & piv,
const RhsType & b,
SolutionType & x )
constexpr

Solve x := U^-1 L^-1 P b on dense objects, from a prior factorize. b and x must not alias.

With a matrix-like b (and x), every column of b is solved into the matching column of x. pass_width then cuts the substitution into passes (0 = all columns in one pass; the last pass takes the remainder).

Template Parameters
UserConfigcompile-time knobs, a constexpr TiledLUppConfig value of the matrix scalar type
pass_widthcolumns per substitution pass for a matrix-like b (0 = all at once; must be 0 for a vector-like b)
Parameters
[in]Afactored matrix-like object
[in]pivpivot storage produced by factorize
[in]bright-hand side, in original order: vector-like, or matrix-like holding one right-hand side per column
[out]xsolution, of the same shape as b

◆ substitute() [2/2]

template<int pass_width = 0, typename MatrixType , typename PivotType , typename RhsType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr void tdls::substitute ( const MatrixType & A,
const PivotType & piv,
const RhsType & b,
SolutionType & x )
constexpr

Default-configuration overload of substitute.

Template Parameters
pass_widthcolumns per substitution pass for a matrix-like b (0 = all at once; must be 0 for a vector-like b)
Parameters
[in]Afactored matrix-like object
[in]pivpivot storage produced by factorize
[in]bright-hand side, in original order: vector-like, or matrix-like holding one right-hand side per column
[out]xsolution, of the same shape as b

◆ substitute_canonical() [1/2]

template<detail::solver_config auto UserConfig, int pass_width = 0, typename MatrixType , typename PivotType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr void tdls::substitute_canonical ( const MatrixType & A,
const PivotType & piv,
const int col,
SolutionType & x )
constexpr

Solve A x = e_col on dense objects, from a prior factorize: the consistent-tangent-operator path.

With a matrix-like x, its columns receive the solutions of the consecutive canonical columns e_col .. e_{col+M-1}, M being the column count of x, every L/U tile loaded once for the block. M is read from x: at compile time on the fixed-size path, at run time for a runtime-sized x, which the runtime-sized matrix path accepts exactly as substitute does for its right-hand-side block. pass_width then cuts the substitution into passes (0 = all columns in one pass; the last pass takes the remainder).

Template Parameters
UserConfigcompile-time knobs, a constexpr TiledLUppConfig value of the matrix scalar type
pass_widthcolumns per substitution pass for a matrix-like x (0 = all at once; must be 0 for a vector-like x)
Parameters
[in]Afactored matrix-like object
[in]pivpivot storage produced by factorize
[in]colindex of the canonical column e_col (the first one with a matrix-like x)
[out]xvector-like solution, or matrix-like holding one solution per canonical column

◆ substitute_canonical() [2/2]

template<int pass_width = 0, typename MatrixType , typename PivotType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr void tdls::substitute_canonical ( const MatrixType & A,
const PivotType & piv,
const int col,
SolutionType & x )
constexpr

Default-configuration overload of substitute_canonical.

Template Parameters
pass_widthcolumns per substitution pass for a matrix-like x (0 = all at once; must be 0 for a vector-like x)
Parameters
[in]Afactored matrix-like object
[in]pivpivot storage produced by factorize
[in]colindex of the canonical column e_col (the first one with a matrix-like x)
[out]xvector-like solution, or matrix-like holding one solution per canonical column

◆ substitute_inplace() [1/2]

template<detail::solver_config auto UserConfig, int pass_width = 0, typename MatrixType , typename PivotType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr void tdls::substitute_inplace ( const MatrixType & A,
const PivotType & piv,
SolutionType & x )
constexpr

Solve in place on dense objects: x holds the unpermuted right-hand side on entry and the solution on exit.

With a matrix-like x, every column is overwritten by its solution. pass_width then cuts the substitution into passes (0 = all columns in one pass; the last pass takes the remainder).

Template Parameters
UserConfigcompile-time knobs, a constexpr TiledLUppConfig value of the matrix scalar type
pass_widthcolumns per substitution pass for a matrix-like x (0 = all at once; must be 0 for a vector-like x)
Parameters
[in]Afactored matrix-like object
[in]pivpivot storage produced by factorize
[in,out]xright-hand side, then solution: vector-like, or matrix-like holding one right-hand side per column

◆ substitute_inplace() [2/2]

template<int pass_width = 0, typename MatrixType , typename PivotType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr void tdls::substitute_inplace ( const MatrixType & A,
const PivotType & piv,
SolutionType & x )
constexpr

Default-configuration overload of substitute_inplace.

Template Parameters
pass_widthcolumns per substitution pass for a matrix-like x (0 = all at once; must be 0 for a vector-like x)
Parameters
[in]Afactored matrix-like object
[in]pivpivot storage produced by factorize
[in,out]xright-hand side, then solution: vector-like, or matrix-like holding one right-hand side per column

◆ substitute_multirhs_dispatch()

template<typename Ctx , int pass_width, bool inplace, typename MatrixType , typename PivotType , typename RhsType , typename SolutionType >
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr void tdls::detail::substitute_multirhs_dispatch ( const MatrixType & A,
const PivotType & piv,
const RhsType & b,
SolutionType & x )
constexpr

Shared translator of the matrix right-hand-side entry points: reduces the dense objects to raw arguments and forwards to the _multirhs entry points, which do the pass cutting themselves. Matrix right-hand sides are always routed through the external addressing of the raw API: the register convention of its internal mode is not the row-major layout of dense matrix objects.

Template Parameters
Ctxadaptor context of the entry point
pass_widthcolumns per substitution pass (0 = all at once)
inplacefalse: read B, write X; true: overwrite X in place (b is then ignored and may alias x)

Variable Documentation

◆ is_dense_v

template<typename T >
bool tdls::detail::is_dense_v
inlineconstexpr
Initial value:
=
(has_data<T>::value || has_pair_data<T>::value) && has_indexing_policy<T>::value

A type is "dense" when it exposes both a data pointer and an indexing policy, the structural core of the TFEL protocol.